public static int InsertLog(mg_sys_log model) { string sql2 = "INSERT INTO View_mg_sys_log (AngleResult,TorqueResult,scanCode,MenderName,ReviseTime,op_id,op_name,fl_id,fl_name,st_id,st_no,PartOrderID,or_no,part_no,step_order,step_startTime,step_endTime,step_duringtime,scanResult,sys_desc,ScrewCount) VALUES ('" + model.AngleResult + "', '" + model.TorqueResult + "', '" + model.scanCode + "', '" + model.MenderName + "', '" + model.ReviseTime + "', '" + model.op_id + "', '" + model.op_name + "', '" + model.fl_id + "', '" + model.fl_name + "', '" + model.st_id + "', '" + model.st_no + "', '" + model.PartOrderID + "', '" + model.or_no + "', '" + model.part_no + "', '" + model.step_order + "', '" + model.step_startTime + "', '" + model.step_endTime + "', '" + model.step_duringtime + "', '" + model.scanResult + "', '" + model.sys_desc + "', '" + model.ScrewCount + "')"; int a = SqlHelper.ExecuteNonQuery(SqlHelper.SqlConnString, CommandType.Text, sql2, null); return(a); }
public static string getList(int PageSize, int StartIndex, int EndIndex, string SortFlag, string sortOrder, string wherestr) { if (string.IsNullOrEmpty(SortFlag)) { SortFlag = " st_no,step_startTime"; } if (string.IsNullOrEmpty(sortOrder)) { sortOrder = "asc"; } List <mg_sys_log> list = new List <mg_sys_log>(); int total = 0; string query_sql = " select * from(select row_number() over(order by " + SortFlag + " " + sortOrder + " ) as rowid,report.* from View_mg_sys_log report where 1 = 1 " + wherestr + ") as Results where rowid >=" + StartIndex + " and rowid <=" + EndIndex + " "; string count_sql = "select count(*) as total from View_mg_sys_log where 1 = 1 " + wherestr; DataSet ds = SqlHelper.GetDataSetTableMapping(SqlHelper.SqlConnString, System.Data.CommandType.Text, count_sql + query_sql, new string[] { "count", "data" }, null); if (DataHelper.HasData(ds)) { DataTable dt1 = ds.Tables["count"]; total = NumericParse.StringToInt(DataHelper.GetCellDataToStr(dt1.Rows[0], "total")); DataTable dt2 = ds.Tables["data"]; foreach (DataRow row in dt2.Rows) { mg_sys_log model = new mg_sys_log(); model.sys_id = DataHelper.GetCellDataToStr(row, "sys_id"); model.op_id = DataHelper.GetCellDataToStr(row, "op_id"); model.op_name = DataHelper.GetCellDataToStr(row, "op_name"); model.fl_id = DataHelper.GetCellDataToStr(row, "fl_id"); model.fl_name = DataHelper.GetCellDataToStr(row, "fl_name"); model.st_id = DataHelper.GetCellDataToStr(row, "st_id"); model.st_no = DataHelper.GetCellDataToStr(row, "st_no"); model.PartOrderID = DataHelper.GetCellDataToStr(row, "PartOrderID"); model.or_no = DataHelper.GetCellDataToStr(row, "or_no"); model.part_no = DataHelper.GetCellDataToStr(row, "part_no"); model.step_order = NumericParse.StringToInt(DataHelper.GetCellDataToStr(row, "step_order")); model.step_startTime = DataHelper.GetCellDataToStr(row, "step_startTime"); model.step_endTime = DataHelper.GetCellDataToStr(row, "step_endTime"); model.step_duringtime = DataHelper.GetCellDataToStr(row, "step_duringtime"); model.AngleResult = DataHelper.GetCellDataToStr(row, "AngleResult"); model.TorqueResult = DataHelper.GetCellDataToStr(row, "TorqueResult"); model.scanCode = DataHelper.GetCellDataToStr(row, "scanCode"); model.scanResult = DataHelper.GetCellDataToStr(row, "scanResult"); model.sys_desc = DataHelper.GetCellDataToStr(row, "sys_desc"); model.ScrewCount = DataHelper.GetCellDataToStr(row, "ScrewCount"); model.MenderName = DataHelper.GetCellDataToStr(row, "MenderName"); model.ReviseTime = DataHelper.GetCellDataToStr(row, "ReviseTime"); list.Add(model); } } DataListModel <mg_sys_log> allmodel = new DataListModel <mg_sys_log>(); allmodel.total = total.ToString(); allmodel.rows = list; string jsonStr = JSONTools.ScriptSerialize <DataListModel <mg_sys_log> >(allmodel); return(jsonStr); }
public void ProcessRequest(HttpContext context) { JavaScriptSerializer s = new JavaScriptSerializer(); HttpRequest request = HttpContext.Current.Request; string sys_id = request["step_id"]; string AngleResult = request["AngleResult"]; string TorqueResult = request["TorqueResult"]; string scanCode = request["scanCode"]; string name = request["edit_name"].Trim(); DateTime dt = DateTime.Now; string t = dt.ToString("yyyy-MM-dd hh:mm:ss"); DataTable ResTable = mg_sys_logBll.GetTableByID(sys_id); //根据sys_id拿到选中的该记录 ; //根据sys_id拿到选中的该记录 string op_id = ResTable.Rows[0][1].ToString(); //拿到该记录的op_id的值 [op_name],[fl_id],[fl_name],[st_id],[st_no],[PartOrderID],[or_no],[part_no],[step_order],[step_startTime],[step_endTime],[step_duringtime],[sys_desc],[ScrewCount] string op_name = ResTable.Rows[0][2].ToString(); string fl_id = ResTable.Rows[0][3].ToString(); string fl_name = ResTable.Rows[0][4].ToString(); string st_id = ResTable.Rows[0][5].ToString(); string st_no = ResTable.Rows[0][6].ToString(); decimal PartOrderID = default(decimal); if (!string.IsNullOrEmpty(ResTable.Rows[0][7].ToString())) { PartOrderID = decimal.Parse(ResTable.Rows[0][7].ToString()); } string or_no = ResTable.Rows[0][8].ToString(); string part_no = ResTable.Rows[0][9].ToString(); string step_order = ResTable.Rows[0][10].ToString(); string step_startTime = ResTable.Rows[0][11].ToString(); string step_endTime = ResTable.Rows[0][12].ToString(); string step_duringtime = ResTable.Rows[0][13].ToString(); string scanResult = ResTable.Rows[0][17].ToString(); string sys_desc = ResTable.Rows[0][18].ToString(); int ScrewCount = default(int); if (!string.IsNullOrEmpty(ResTable.Rows[0][19].ToString())) { ScrewCount = int.Parse(ResTable.Rows[0][19].ToString()); } mg_sys_log model = new mg_sys_log(); model.sys_id = sys_id; model.op_id = op_id; model.op_name = op_name; model.fl_id = fl_id; model.fl_name = fl_name; model.st_id = st_id; model.st_no = st_no; model.PartOrderID = PartOrderID.ToString(); model.or_no = or_no; model.part_no = part_no; model.step_order = NumericParse.StringToInt(step_order); model.step_startTime = step_startTime; model.step_endTime = step_endTime; model.step_duringtime = step_duringtime; model.AngleResult = AngleResult; model.TorqueResult = TorqueResult; model.scanCode = scanCode; model.scanResult = scanResult; model.sys_desc = sys_desc; model.ScrewCount = ScrewCount.ToString(); model.MenderName = name; model.ReviseTime = t; int a = mg_sys_logBll.InsertLog(model); string ss; if (a > 0) { ss = "true"; } else { ss = "false"; } string josn = "{\"Result\":\"" + ss + "\"}"; context.Response.ContentType = "json"; context.Response.Write(josn); }
public static int InsertLog(mg_sys_log model) { return(mg_sys_LogDal.InsertLog(model)); }