public string Update(string json, string columns, string clientInf) { Dictionary <string, string> resultDic = new Dictionary <string, string>(); resultDic["result"] = ""; resultDic["message"] = ""; try { sara.dd.ldsw.model.tbl_ld_ghsb model = Eva.Library.Format.FormatEntityTool.FormatJsonToModel <sara.dd.ldsw.model.tbl_ld_ghsb>(json); columns = FormatColumns(columns).Replace("^", ","); resultDic["result"] = "true"; resultDic["message"] = _idal_tbl_ld_ghsb.Update(model, columns, null); NewLog("数据更新成功,更新的数据为:json:" + json + ",columns:" + columns, "sql_update", clientInf); } catch (Exception ex) { resultDic["result"] = "false"; resultDic["message"] = Eva.Library.Format.FormatTextTool.ErrorMessageFormat(ex.Message + ex.StackTrace); NewLog("数据更新失败,更新的数据为:json:" + json + ",columns:" + columns + ",异常信息:" + Eva.Library.Format.FormatTextTool.ErrorMessageFormat(ex.Message + ex.StackTrace), "sql_update", clientInf); } return(Eva.Library.Format.FormatEntityTool.FormatDicToJson(resultDic)); }
public string Add(string json, string clientInf) { Dictionary <string, string> resultDic = new Dictionary <string, string>(); resultDic["result"] = ""; resultDic["message"] = ""; try { sara.dd.ldsw.model.tbl_ld_ghsb model = Eva.Library.Format.FormatEntityTool.FormatJsonToModel <sara.dd.ldsw.model.tbl_ld_ghsb>(json); resultDic["result"] = "true"; resultDic["message"] = _idal_tbl_ld_ghsb.Add(model, null); NewLog("数据创建成功,创建的数据为:" + json, "sql_insert", clientInf); } catch (Exception ex) { resultDic["result"] = "false"; resultDic["message"] = Eva.Library.Format.FormatTextTool.ErrorMessageFormat(ex.Message + ex.StackTrace); NewLog("数据创建失败,创建的数据为:" + json + ",异常信息:" + Eva.Library.Format.FormatTextTool.ErrorMessageFormat(ex.Message + ex.StackTrace), "sql_insert", clientInf); } return(Eva.Library.Format.FormatEntityTool.FormatDicToJson(resultDic)); }
public string GetKhJsonAndUpdate(string json, string khidString, string clearKhbhString, string czlxString, string czidString, string clientInf) { Dictionary <string, string> resultDic = new Dictionary <string, string>(); resultDic["result"] = ""; resultDic["message"] = ""; try { IDictionary <string, string> clientInfoDic = Eva.Library.Format.FormatEntityTool.FormatJsonToDic(clientInf); Dictionary <string, string> khxxJsonDic = new Dictionary <string, string>(); DataTable dt = new DataTable(); _iAccessDataTrans = sara.dd.ldsw.commonclass.commonclass.CreateIAccessDataTrans(); _iAccessDataTrans.getTrans().begin(); sara.dd.ldsw.idal.Itbl_ld_ghsb idal_tbl_ld_ghsb = new sara.dd.ldsw.dal.tbl_ld_ghsb(); sara.dd.ldsw.model.tbl_ld_ghsb model = Eva.Library.Format.FormatEntityTool.FormatJsonToModel <sara.dd.ldsw.model.tbl_ld_ghsb>(json); //调用commonclass的方法 拿到客户json List <DataTable> lt = new List <DataTable>(); lt = sara.dd.ldsw.commonclass.commonclass.GetKhxxJsonAndSetCzlx(khidString, czlxString, czidString, _iAccessDataTrans); DataTable khxx = lt[0]; DataTable yhxx = lt[1]; DataTable sbxx = lt[2]; if (khxx.Rows.Count > 0) { } DataRow dr = khxx.Rows[0];//这是拿到第一行数据 string khbh = dr["f_khbh"].ToString(); string khbhid = dr["sys_id"].ToString(); string yhm = dr["f_yhm"].ToString(); string dz = dr["f_dz"].ToString(); string dh = dr["f_dh"].ToString(); string khxx_yhm_dz = yhm + "," + dz + "," + dh; khxxJsonDic["khxx"] = Eva.Library.Format.FormatEntityTool.FormatDataTableToJson(khxx);; khxxJsonDic["yhxx"] = Eva.Library.Format.FormatEntityTool.FormatDataTableToJson(yhxx); khxxJsonDic["sbxx"] = Eva.Library.Format.FormatEntityTool.FormatDataTableToJson(sbxx); string khxxJson = Eva.Library.Format.FormatEntityTool.FormatDicToJson(khxxJsonDic); //2.取出用户民、地址 逗号分隔,放到数据库f_khxx //3.更新f_khbh,f_khbhid model.f_khbh = khbh; model.f_khbhid = khbhid; model.f_khxx = khxx_yhm_dz; model.f_khjson = khxxJson; //4.clearCzlxKhbh不等于json中的客户编号 那么清空上一个客户编号的f_value1和f_value2 #region clearCzlx if (clearKhbhString != khbh) { string sql = "update tbl_ld_khb set f_value1='" + "" + "',f_value2 = '" + "" + "' where f_khbh = '" + clearKhbhString + "'"; _iAccessDataTrans.ExecuteSql(sql); } #endregion idal_tbl_ld_ghsb.Update(model, "f_khjson,f_khxx,f_khbh,f_khbhid", _iAccessDataTrans); _iAccessDataTrans.getTrans().commit(); resultDic["result"] = "true"; resultDic["message"] = khxxJson; } catch (Exception ex) { if (_iAccessDataTrans != null) { _iAccessDataTrans.getTrans().rollback(); _iAccessDataTrans = null; } resultDic["result"] = "false"; resultDic["message"] = Eva.Library.Format.FormatTextTool.ErrorMessageFormat(ex.Message + ex.StackTrace); } return(Eva.Library.Format.FormatEntityTool.FormatDicToJson(resultDic)); }
/// <summary> /// //projclass = 3时进行的归档操作,执行落数程序 /// </summary> /// <param name="sys_ids"></param> /// <param name="str_facterid"></param> /// <param name="ds_facter"></param> /// <param name="str_txt_bak_message"></param> /// <param name="clientInf"></param> /// <returns></returns> public string set_complete(string sys_ids, string str_facterid, DataSet ds_facter, string str_txt_bak_message, string clientInf) { /* * all_result返回参数的整理: * 1、"{\"result\":\"true\",\"message\":\"\"}"----》第二次点击落地按钮,(理论上不应该出现这个情况,有可能是第一次操作时整个操作流程没有完成,所以造成用户可以点击这个按钮,所以此处的操作仅实现状态修改,返回值为true) * 2、"{\"result\":\"submit\",\"message\":\"" + messageString + "\"}";----》此时message是一个字符串,shpid|path * 3、"{\"result\":\"false\",\"message\":\"" + messageString + "\"}";----》此时message是一个字符串,异常信息。 * 4、"{\"result\":\"submitqueue\",\"message\":\"\"}"----》成功加入队列 * */ IDictionary <string, string> clientInfoDic = Eva.Library.Format.FormatEntityTool.FormatJsonToDic(clientInf); string userid = clientInfoDic["userid"]; string username = clientInfoDic["username"]; string all_result = ""; string[] sys_idss = sys_ids.Split(','); for (int i = 0; i < sys_idss.Length; i++) { try { _model_tbl_maintable = _idal_itbl_maintable.GetList(" sys_id='" + sys_idss[i].ToString() + "'", "", "*", "", "", null)[0]; if (all_result == "") { string result = ""; _t = commonclass.CreateIAccessDataTrans(); _t.getTrans().begin(); #region businesscode //businesscode //在此处添加针对projclassid = 3的业务代码 //更新旧水表的状态为停用 //更新客户表冗余水表信息的字段,判断停用水表编号是否有值,有用“^”分割保存。把f_value1,f_value2置为空 //更新更换水表表的状态为归档 model_tbl_ld_ghsb = idal_tbl_ld_ghsb.GetList(" fk_tbl_maintable_sys_id = '" + sys_idss[i].ToString() + "' ", "", "*", "", "", null)[0]; model_tbl_ld_khb = idal_tbl_ld_khb.GetList(" sys_id = '" + model_tbl_ld_ghsb.f_khbhid + "' ", "", "*", "", "", null)[0]; _model_tbl_ld_sbb = idal_tbl_ld_sbb.GetList(" sys_id = '" + model_tbl_ld_khb.f_sbbhid + "' ", "", "*", "", "", null)[0]; #region 在水表表中新增一条数据 sara.dd.ldsw.model.tbl_ld_sbb model_tbl_ld_sbb = new sara.dd.ldsw.model.tbl_ld_sbb(); model_tbl_ld_sbb.sys_id = 0; model_tbl_ld_sbb.sys_orderid = ""; model_tbl_ld_sbb.sys_creatuserid = userid; model_tbl_ld_sbb.sys_creatusername = username; model_tbl_ld_sbb.sys_creatdate = DateTime.Now; model_tbl_ld_sbb.sys_lastedituserid = userid; model_tbl_ld_sbb.sys_lasteditusername = username; model_tbl_ld_sbb.sys_lasteditdate = DateTime.Now; model_tbl_ld_sbb.sys_deluserid = ""; model_tbl_ld_sbb.sys_delusername = ""; model_tbl_ld_sbb.sys_deldate = DateTime.Parse("1900-1-1"); model_tbl_ld_sbb.sys_delflag = "0"; model_tbl_ld_sbb.f_value1 = ""; model_tbl_ld_sbb.f_value2 = ""; model_tbl_ld_sbb.f_value3 = ""; model_tbl_ld_sbb.f_value4 = ""; model_tbl_ld_sbb.f_value5 = ""; model_tbl_ld_sbb.f_value6 = ""; model_tbl_ld_sbb.f_value7 = ""; model_tbl_ld_sbb.f_value8 = ""; model_tbl_ld_sbb.f_value9 = ""; model_tbl_ld_sbb.f_value10 = ""; model_tbl_ld_sbb.f_sbbh = sara.dd.ldsw.commonclass.commonclass.getBusinessNum("sb", model_tbl_ld_ghsb.f_newsblxid, null); model_tbl_ld_sbb.f_ztsbh = ""; model_tbl_ld_sbb.f_lxth = ""; model_tbl_ld_sbb.f_sbfz = model_tbl_ld_ghsb.f_newsbfz; model_tbl_ld_sbb.f_sbfzid = model_tbl_ld_ghsb.f_newsbfzid; model_tbl_ld_sbb.f_sbpp = model_tbl_ld_ghsb.f_newsbpp; model_tbl_ld_sbb.f_mph = model_tbl_ld_ghsb.f_newmph; model_tbl_ld_sbb.f_sbdz = model_tbl_ld_ghsb.f_newsbdz; model_tbl_ld_sbb.f_khbh = model_tbl_ld_ghsb.f_khbh; model_tbl_ld_sbb.f_rs = model_tbl_ld_ghsb.f_newrs; model_tbl_ld_sbb.f_sbkj = model_tbl_ld_ghsb.f_newsbkj; model_tbl_ld_sbb.f_sbkjid = model_tbl_ld_ghsb.f_newsbkjid; model_tbl_ld_sbb.f_sblx = model_tbl_ld_ghsb.f_newsblx; model_tbl_ld_sbb.f_sblxid = model_tbl_ld_ghsb.f_newsblxid; model_tbl_ld_sbb.f_jllx = model_tbl_ld_ghsb.f_newjllx; model_tbl_ld_sbb.f_jllxid = model_tbl_ld_ghsb.f_newjllxid; model_tbl_ld_sbb.f_cszm = model_tbl_ld_ghsb.f_newcszm; model_tbl_ld_sbb.f_bqzm = model_tbl_ld_ghsb.f_newbqzm; model_tbl_ld_sbb.f_sqzm = model_tbl_ld_ghsb.f_newsqzm; model_tbl_ld_sbb.f_sqsl = model_tbl_ld_ghsb.f_newsqsl; model_tbl_ld_sbb.f_ljgl = model_tbl_ld_ghsb.f_newljgl; model_tbl_ld_sbb.f_qsqpjsl = model_tbl_ld_ghsb.f_newqsqpjsl; model_tbl_ld_sbb.f_qlqpjsl = model_tbl_ld_ghsb.f_newqlqpjsl; model_tbl_ld_sbb.f_zt = model_tbl_ld_ghsb.f_newzt; model_tbl_ld_sbb.f_ztid = model_tbl_ld_ghsb.f_newztid; model_tbl_ld_sbb.f_bz = model_tbl_ld_ghsb.f_bz; model_tbl_ld_sbb.f_bqsl = model_tbl_ld_ghsb.f_newdysl; model_tbl_ld_sbb.f_nljgl = model_tbl_ld_ghsb.f_newnysl; model_tbl_ld_sbb.f_azrq = model_tbl_ld_ghsb.f_newazrq; model_tbl_ld_sbb.f_qfzt = model_tbl_ld_ghsb.f_newqfzt; model_tbl_ld_sbb.f_fj = model_tbl_ld_ghsb.f_xsbfj; model_tbl_ld_sbb.f_synx = model_tbl_ld_ghsb.f_newsynx; string sbbhid = idal_tbl_ld_sbb.Add(model_tbl_ld_sbb, null); #endregion #region 更新客户表冗余水表信息的字段,判断停用水表编号是否有值,有用“^”分割保存。把f_value1,f_value2置为空 model_tbl_ld_khb.f_sbbh = model_tbl_ld_sbb.f_sbbh; model_tbl_ld_khb.f_sbbhid = sbbhid; model_tbl_ld_khb.f_bqzm = model_tbl_ld_sbb.f_bqzm; model_tbl_ld_khb.f_sqzm = model_tbl_ld_sbb.f_sqzm; model_tbl_ld_khb.f_bqsl = model_tbl_ld_sbb.f_bqsl; model_tbl_ld_khb.f_sqsl = model_tbl_ld_sbb.f_sqsl; model_tbl_ld_khb.f_qsqpjsl = model_tbl_ld_sbb.f_qsqpjsl; model_tbl_ld_khb.f_qlqpjsl = model_tbl_ld_sbb.f_qlqpjsl; //model_tbl_ld_khb.f_ljgl = model_tbl_ld_sbb.f_ljgl; model_tbl_ld_khb.f_lxth = model_tbl_ld_sbb.f_lxth; model_tbl_ld_khb.f_sblx = model_tbl_ld_sbb.f_sblx; model_tbl_ld_khb.f_sblxid = model_tbl_ld_sbb.f_sblxid; model_tbl_ld_khb.f_jllx = model_tbl_ld_sbb.f_jllx; model_tbl_ld_khb.f_jllxid = model_tbl_ld_sbb.f_jllxid; if (model_tbl_ld_khb.f_tssbbh != "") { model_tbl_ld_khb.f_tssbbh = model_tbl_ld_khb.f_tssbbh + "^" + _model_tbl_ld_sbb.f_sbbh; model_tbl_ld_khb.f_tssbbhid = model_tbl_ld_khb.f_tssbbhid + "^" + _model_tbl_ld_sbb.sys_id; } else { model_tbl_ld_khb.f_tssbbh = _model_tbl_ld_sbb.f_sbbh; model_tbl_ld_khb.f_tssbbhid = _model_tbl_ld_sbb.sys_id.ToString(); } model_tbl_ld_khb.f_ztsbh = model_tbl_ld_sbb.f_ztsbh; model_tbl_ld_khb.f_rs = model_tbl_ld_sbb.f_rs; model_tbl_ld_khb.f_sbkj = model_tbl_ld_sbb.f_sbkj; model_tbl_ld_khb.f_sbkjid = model_tbl_ld_sbb.f_sbkjid; model_tbl_ld_khb.f_sbfz = model_tbl_ld_sbb.f_sbfz; model_tbl_ld_khb.f_sbfzid = model_tbl_ld_sbb.f_sbfzid; //model_tbl_ld_khb.f_nljgl = model_tbl_ld_sbb.f_nljgl; model_tbl_ld_khb.f_value1 = ""; model_tbl_ld_khb.f_value2 = ""; idal_tbl_ld_khb.Update(model_tbl_ld_khb, "f_sbbh,f_sbbhid,f_bqzm,f_sqzm,f_bqsl,f_sqsl,f_qsqpjsl,f_qlqpjsl,f_ljgl,f_lxth,f_sblx,f_sblxid,f_jllx,f_jllxid,f_tssbbh,f_tssbbhid,f_ztsbh,f_rs ,f_sbkj,f_sbkjid,f_sbfz,f_sbfzid,f_nljg,f_value1,f_value2", null); #endregion #region 更新旧水表的状态为停用 _model_tbl_ld_sbb.f_zt = "停用"; _model_tbl_ld_sbb.f_ztid = "9"; idal_tbl_ld_sbb.Update(_model_tbl_ld_sbb, "f_zt,f_ztid", null); #endregion #region 更新更换水表表的状态为归档,操作人,操作时间 model_tbl_ld_ghsb.f_zt = "归档"; model_tbl_ld_ghsb.f_ztid = "2"; model_tbl_ld_ghsb.f_czr = username; model_tbl_ld_ghsb.f_czrid = userid; model_tbl_ld_ghsb.f_czsj = DateTime.Now; model_tbl_ld_ghsb.f_newsbbh = model_tbl_ld_sbb.f_sbbh; idal_tbl_ld_ghsb.Update(model_tbl_ld_ghsb, "f_zt,f_ztid,f_czr,f_czrid,f_czsj,f_newsbbh", null); #endregion #endregion //调整数据状态 NameValueCollection nvc_maintableparameters = new NameValueCollection(); nvc_maintableparameters.Add("sys_processnextuser", "^nextuser"); nvc_maintableparameters.Add("fk_tbl_maintable_sys_id", "^null"); nvc_maintableparameters.Add("fk_workflow_sys_id", "^null"); result = _hic.NextStateItemNew(sys_idss[i].ToString(), nvc_maintableparameters, str_facterid, ds_facter, str_txt_bak_message, "", "", clientInf, _t); if (result == "") { _t.getTrans().commit(); } else { _t.getTrans().rollback(); all_result = "{\"result\":\"false\",\"message\":\"" + result + "\"}"; } } } catch (Exception ex) { all_result = "{\"result\":\"false\",\"message\":\"" + ex.Message + "\"}"; } } if (all_result == "") { // all_result = "{\"result\":\"true\",\"message\":\"\"}"; } return(all_result); }