using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLToolkit.Data;
using Newtonsoft.Json;
namespace Android
{
public partial class FrmProductionEntry : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string Operation = Request.QueryString["Operation"].ToString();
string Code = Request.QueryString["Code"].ToString();
string Name = Request.QueryString["Name"].ToString();
string CutSlip = Request.QueryString["CutSlip"].ToString();
string Style = Request.QueryString["Style"].ToString();
int Pairs = Convert.ToInt32(Request.QueryString["Pairs"]);
int OT = Convert.ToInt32(Request.QueryString["OT"]);
string Hours = Request.QueryString["Hours"].ToString();
string TableCode = Request.QueryString["TableCode"].ToString();
using (DbManager Db = new DbManager())
{
string Result = "";
Result = Db.SetSpCommand("Arind.Dbo.SpProductionEntry",
Db.InputOutputParameter("@Message", Result),
Db.InputParameter("@CutSlip", CutSlip),
Db.InputParameter("@Operation", Operation),
Db.InputParameter("[USER=93151]@code[/USER]", Code),
Db.InputParameter("[USER=50922]@name[/USER]", Name),
Db.InputParameter("@Style", Style),
Db.InputParameter("@Pairs", Pairs),
Db.InputParameter("@OverTime", OT),
Db.InputParameter("@Hours", Hours),
Db.InputParameter("[USER=115178]@table[/USER]", TableCode)).ExecuteScalar<string>(ScalarSourceType.OutputParameter);
DataTable dt = new DataTable();
DataColumn dc = new DataColumn("Message", typeof(String));
dt.Columns.Add(dc);
DataRow dr = dt.NewRow();
dr[0] = Result;
dt.Rows.Add(dr);
Response.Write(DataTableToJSONWithJSONNet(dt));
Db.Close();
Db.Dispose();
//return Result;
}
}
public string DataTableToJSONWithJSONNet(DataTable table)
{
string JSONString = string.Empty;
JSONString = JsonConvert.SerializeObject(table);
return JSONString;
}
}
}