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_log model = Eva.Library.Format.FormatEntityTool.FormatJsonToModel <sara.dd.ldsw.model.tbl_ld_log>(json); model.sys_creatdate = DateTime.Now; model.sys_lasteditdate = DateTime.Now; resultDic["result"] = "true"; resultDic["message"] = _idal_tbl_ld_log.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 clientInf) { Dictionary <string, string> resultDic = new Dictionary <string, string>(); resultDic["result"] = ""; resultDic["message"] = ""; try { sara.dd.ldsw.model.tbl_ld_log model = Eva.Library.Format.FormatEntityTool.FormatJsonToModel <sara.dd.ldsw.model.tbl_ld_log>(json); model.sys_lasteditdate = DateTime.Now; columns = FormatColumns(columns).Replace("^", ","); resultDic["result"] = "true"; resultDic["message"] = _idal_tbl_ld_log.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)); }