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_ickxj model = Eva.Library.Format.FormatEntityTool.FormatJsonToModel <sara.dd.ldsw.model.tbl_ld_ickxj>(json); if (model.f_ickxjbh == "") { model.f_ickxjbh = sara.dd.ldsw.commonclass.commonclass.getBusinessNum("xj", ""); model.f_ickxjbh = sara.dd.ldsw.commonclass.commonclass.getBusinessNum("xj", ""); } resultDic["result"] = "true"; resultDic["message"] = _idal_tbl_ld_ickxj.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 Update(string json, string columns, string type, string clientInf) { Dictionary <string, string> resultDic = new Dictionary <string, string>(); resultDic["result"] = ""; resultDic["message"] = ""; try { _iAccessDataTrans = sara.dd.ldsw.commonclass.commonclass.CreateIAccessDataTrans(); _iAccessDataTrans.getTrans().begin(); sara.dd.ldsw.model.tbl_ld_ickxj model = Eva.Library.Format.FormatEntityTool.FormatJsonToModel <sara.dd.ldsw.model.tbl_ld_ickxj>(json); columns = FormatColumns(columns).Replace("^", ","); switch (type) { case "xk": { resultDic["result"] = "true"; resultDic["message"] = _idal_tbl_ld_ickxj.Update(model, columns, _iAccessDataTrans); IList <sara.dd.ldsw.model.tbl_ld_khb> model_khb_list = _idal_tbl_ld_khb.GetList(" sys_id='" + model.f_khbhid.ToString() + "'", "", "*", "", "", _iAccessDataTrans); if (model_khb_list.Count > 0) { sara.dd.ldsw.model.tbl_ld_khb model_khb = model_khb_list[0]; //判断操作类型属于新建还是补卡 if (model.f_czlxid == "08150001") { //新建,客户表的IC卡累积购量清0 List <IDictionary <string, string> > array = new List <IDictionary <string, string> >(); IDictionary <string, string> temp = new Dictionary <string, string>(); temp.Add("key", "f_ickljgl"); temp.Add("oldvalue", model_khb.f_ickljgl); temp.Add("newvalue", "0"); temp.Add("name", "IC卡累积购量"); array.Add(temp); sara.dd.ldsw.commonclass.commonclass.addUpdateLog("tbl_ld_khb", model.f_khbhid.ToString(), "tbl_ld_ickxj_detail", "IC卡新建补卡", array, clientInf, _iAccessDataTrans); model_khb.f_ickljgl = "0"; model_khb.f_value9 = "1"; } else { //补卡,不需要清0IC卡累积购量 model_khb.f_value9 = "2"; } //更新客户表 _idal_tbl_ld_khb.Update(model_khb, "f_ickljgl,f_value9", _iAccessDataTrans); _iAccessDataTrans.getTrans().commit(); } else { string errormessage = ""; if (model_khb_list.Count <= 0) { errormessage += "没有查询到客户信息;"; } resultDic["result"] = "false"; resultDic["message"] = errormessage; _iAccessDataTrans.getTrans().rollback(); } } break; case "pt": default: { resultDic["result"] = "true"; resultDic["message"] = _idal_tbl_ld_ickxj.Update(model, columns, null); _iAccessDataTrans.getTrans().commit(); } break; } 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)); }