/// <summary> /// 判断交付揭示是否已经打印 /// </summary> /// <param name="Data"></param> /// <returns></returns> public JsonModelJsPrintCheck JsPrintCheck(string Data) { JsonModelJsPrintCheck model = new JsonModelJsPrintCheck(); ParamModel param = Newtonsoft.Json.JsonConvert.DeserializeObject <ParamModel>(Data); DBDeliverJSPrint dbDeliverJSPrint = new DBDeliverJSPrint(); MDSelfServiceMachine.MDDeliverJSPrint modelPlan = new MDSelfServiceMachine.MDDeliverJSPrint(); try { int bPrint = dbDeliverJSPrint.IsJsPrintable(param.strPlanGUID, param.strTrainmanGUID, param.dtBeginWorkTime); modelPlan.StrPlanGUID = param.strPlanGUID; modelPlan.StrSiteGUID = param.cid; modelPlan.StrTrainmanGUID = param.strTrainmanGUID; model.result = "0"; model.returnStr = "返回成功"; model.bPrint = bPrint.ToString(); } catch (Exception ex) { TF.CommonUtility.LogClass.logex(ex, ""); model.result = "1"; model.returnStr = "提交失败" + ex.Message; } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public MDSelfServiceMachine.MDDeliverJSPrint DataRowToModel(DataRow row) { MDSelfServiceMachine.MDDeliverJSPrint model = new MDSelfServiceMachine.MDDeliverJSPrint(); if (row != null) { if (row["nID"] != null && row["nID"].ToString() != "") { model.nID = int.Parse(row["nID"].ToString()); } if (row["StrTrainmanGUID"] != null) { model.StrTrainmanGUID = row["StrTrainmanGUID"].ToString(); } if (row["StrPlanGUID"] != null) { model.StrPlanGUID = row["StrPlanGUID"].ToString(); } if (row["StrSiteGUID"] != null) { model.StrSiteGUID = row["StrSiteGUID"].ToString(); } if (row["dtPrintTime"] != null && row["dtPrintTime"].ToString() != "") { model.dtPrintTime = DateTime.Parse(row["dtPrintTime"].ToString()); } } return(model); }
/// 保存打印记录 /// </summary> /// <param name="print"></param> public JsonModel SavePrintData(string Data) { DBDeliverJSPrint dbs = new DBDeliverJSPrint(); printData print = Newtonsoft.Json.JsonConvert.DeserializeObject <printData>(Data); JsonModel model = new JsonModel(); MDSelfServiceMachine.MDDeliverJSPrint modelPlan = new MDSelfServiceMachine.MDDeliverJSPrint(); try { modelPlan.StrPlanGUID = print.data.strPlanGUID; modelPlan.StrSiteGUID = print.data.cid; modelPlan.StrTrainmanGUID = print.data.strTrainmanGUID; string strPrintTime = print.data.dtPrintTime; DateTime dtPrint; if (DateTime.TryParse(strPrintTime, out dtPrint)) { modelPlan.dtPrintTime = dtPrint; } dbs.AddDeliverJSPrint(modelPlan); } catch (Exception ex) { TF.CommonUtility.LogClass.logex(ex, ""); model.result = "1"; model.returnStr = "提交失败:" + ex.Message; } return(model); }
/// <summary> /// 增加一条数据 /// </summary> public int AddDeliverJSPrint(MDSelfServiceMachine.MDDeliverJSPrint model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Tab_DeliverJSPrint("); strSql.Append("StrTrainmanGUID,StrPlanGUID,StrSiteGUID,dtPrintTime)"); strSql.Append(" values ("); strSql.Append("@StrTrainmanGUID,@StrPlanGUID,@StrSiteGUID,@dtPrintTime)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@StrTrainmanGUID", SqlDbType.VarChar, 50), new SqlParameter("@StrPlanGUID", SqlDbType.VarChar, 50), new SqlParameter("@StrSiteGUID", SqlDbType.VarChar, 50), new SqlParameter("@dtPrintTime", SqlDbType.DateTime) }; parameters[0].Value = model.StrTrainmanGUID; parameters[1].Value = model.StrPlanGUID; parameters[2].Value = model.StrSiteGUID; parameters[3].Value = model.dtPrintTime; object obj = SqlHelper.ExecuteScalar(SqlHelper.ConnString, CommandType.Text, strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }