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_sbbj model = Eva.Library.Format.FormatEntityTool.FormatJsonToModel <sara.dd.ldsw.model.tbl_ld_sbbj>(json); columns = FormatColumns(columns).Replace("^", ","); resultDic["result"] = "true"; resultDic["message"] = _idal_tbl_ld_sbbj.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_sbbj model = Eva.Library.Format.FormatEntityTool.FormatJsonToModel <sara.dd.ldsw.model.tbl_ld_sbbj>(json); resultDic["result"] = "true"; resultDic["message"] = _idal_tbl_ld_sbbj.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)); }
/// <summary> /// 重写更新updatepaper /// </summary> /// <param name="json"></param> /// <param name="columns"></param> /// <param name="clientInf"></param> /// <returns></returns> public string Update(sara.dd.ldsw.model.tbl_ld_sbbj model, string columns, Eva.Library.Data.AccessDataTrans.IAccessDataTrans t) { String[] columnsArray = columns.Split(','); List <string> columsList = new List <string>(columnsArray); List <OracleParameter> parameterList = new List <OracleParameter>(); OracleParameter parameter = null; #region sqlString StringBuilder strSql = new StringBuilder(); StringBuilder strSql_use = new StringBuilder(); strSql.Append("update tbl_ld_sbbj set "); strSql_use.Append("update tbl_ld_sbbj set "); if (Eva.Library.Configuration.ConfigurationManager.AppSettings["SqlEditMode"].ToString() == "parameter") { } else //如果是sql形式的话,则进行textReturn { model = Eva.Library.Format.FormatTextTool.ModelFormat(model); } if (model.sys_orderid != null && columsList.Contains("sys_orderid")) { strSql.Append("sys_orderid='" + (model.sys_orderid) + "',"); strSql_use.Append("sys_orderid=:sys_orderid,"); parameter = new OracleParameter(":sys_orderid", OracleType.VarChar); parameter.Value = model.sys_orderid; parameterList.Add(parameter); } if (model.sys_creatuserid != null && columsList.Contains("sys_creatuserid")) { strSql.Append("sys_creatuserid='" + (model.sys_creatuserid) + "',"); strSql_use.Append("sys_creatuserid=:sys_creatuserid,"); parameter = new OracleParameter(":sys_creatuserid", OracleType.VarChar); parameter.Value = model.sys_creatuserid; parameterList.Add(parameter); } if (model.sys_creatusername != null && columsList.Contains("sys_creatusername")) { strSql.Append("sys_creatusername='******',"); strSql_use.Append("sys_creatusername=:sys_creatusername,"); parameter = new OracleParameter(":sys_creatusername", OracleType.VarChar); parameter.Value = model.sys_creatusername; parameterList.Add(parameter); } if (model.sys_creatdate != null && columsList.Contains("sys_creatdate")) { strSql.Append("sys_creatdate=to_date('" + model.sys_creatdate.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-MM-dd hh24:mi:ss'),"); strSql_use.Append("sys_creatdate=:sys_creatdate,"); parameter = new OracleParameter(":sys_creatdate", OracleType.DateTime); parameter.Value = model.sys_creatdate; parameterList.Add(parameter); } if (model.sys_lastedituserid != null && columsList.Contains("sys_lastedituserid")) { strSql.Append("sys_lastedituserid='" + (model.sys_lastedituserid) + "',"); strSql_use.Append("sys_lastedituserid=:sys_lastedituserid,"); parameter = new OracleParameter(":sys_lastedituserid", OracleType.VarChar); parameter.Value = model.sys_lastedituserid; parameterList.Add(parameter); } if (model.sys_lasteditusername != null && columsList.Contains("sys_lasteditusername")) { strSql.Append("sys_lasteditusername='******',"); strSql_use.Append("sys_lasteditusername=:sys_lasteditusername,"); parameter = new OracleParameter(":sys_lasteditusername", OracleType.VarChar); parameter.Value = model.sys_lasteditusername; parameterList.Add(parameter); } if (model.sys_lasteditdate != null && columsList.Contains("sys_lasteditdate")) { strSql.Append("sys_lasteditdate=to_date('" + model.sys_lasteditdate.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-MM-dd hh24:mi:ss'),"); strSql_use.Append("sys_lasteditdate=:sys_lasteditdate,"); parameter = new OracleParameter(":sys_lasteditdate", OracleType.DateTime); parameter.Value = model.sys_lasteditdate; parameterList.Add(parameter); } if (model.sys_deluserid != null && columsList.Contains("sys_deluserid")) { strSql.Append("sys_deluserid='" + (model.sys_deluserid) + "',"); strSql_use.Append("sys_deluserid=:sys_deluserid,"); parameter = new OracleParameter(":sys_deluserid", OracleType.VarChar); parameter.Value = model.sys_deluserid; parameterList.Add(parameter); } if (model.sys_delusername != null && columsList.Contains("sys_delusername")) { strSql.Append("sys_delusername='******',"); strSql_use.Append("sys_delusername=:sys_delusername,"); parameter = new OracleParameter(":sys_delusername", OracleType.VarChar); parameter.Value = model.sys_delusername; parameterList.Add(parameter); } if (model.sys_deldate != null && columsList.Contains("sys_deldate")) { strSql.Append("sys_deldate=to_date('" + model.sys_deldate.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-MM-dd hh24:mi:ss'),"); strSql_use.Append("sys_deldate=:sys_deldate,"); parameter = new OracleParameter(":sys_deldate", OracleType.DateTime); parameter.Value = model.sys_deldate; parameterList.Add(parameter); } if (model.sys_delflag != null && columsList.Contains("sys_delflag")) { strSql.Append("sys_delflag='" + (model.sys_delflag) + "',"); strSql_use.Append("sys_delflag=:sys_delflag,"); parameter = new OracleParameter(":sys_delflag", OracleType.VarChar); parameter.Value = model.sys_delflag; parameterList.Add(parameter); } if (model.f_value1 != null && columsList.Contains("f_value1")) { strSql.Append("f_value1='" + (model.f_value1) + "',"); strSql_use.Append("f_value1=:f_value1,"); parameter = new OracleParameter(":f_value1", OracleType.VarChar); parameter.Value = model.f_value1; parameterList.Add(parameter); } if (model.f_value2 != null && columsList.Contains("f_value2")) { strSql.Append("f_value2='" + (model.f_value2) + "',"); strSql_use.Append("f_value2=:f_value2,"); parameter = new OracleParameter(":f_value2", OracleType.VarChar); parameter.Value = model.f_value2; parameterList.Add(parameter); } if (model.f_value3 != null && columsList.Contains("f_value3")) { strSql.Append("f_value3='" + (model.f_value3) + "',"); strSql_use.Append("f_value3=:f_value3,"); parameter = new OracleParameter(":f_value3", OracleType.VarChar); parameter.Value = model.f_value3; parameterList.Add(parameter); } if (model.f_value4 != null && columsList.Contains("f_value4")) { strSql.Append("f_value4='" + (model.f_value4) + "',"); strSql_use.Append("f_value4=:f_value4,"); parameter = new OracleParameter(":f_value4", OracleType.VarChar); parameter.Value = model.f_value4; parameterList.Add(parameter); } if (model.f_value5 != null && columsList.Contains("f_value5")) { strSql.Append("f_value5='" + (model.f_value5) + "',"); strSql_use.Append("f_value5=:f_value5,"); parameter = new OracleParameter(":f_value5", OracleType.VarChar); parameter.Value = model.f_value5; parameterList.Add(parameter); } if (model.f_value6 != null && columsList.Contains("f_value6")) { strSql.Append("f_value6='" + (model.f_value6) + "',"); strSql_use.Append("f_value6=:f_value6,"); parameter = new OracleParameter(":f_value6", OracleType.VarChar); parameter.Value = model.f_value6; parameterList.Add(parameter); } if (model.f_value7 != null && columsList.Contains("f_value7")) { strSql.Append("f_value7='" + (model.f_value7) + "',"); strSql_use.Append("f_value7=:f_value7,"); parameter = new OracleParameter(":f_value7", OracleType.VarChar); parameter.Value = model.f_value7; parameterList.Add(parameter); } if (model.f_value8 != null && columsList.Contains("f_value8")) { strSql.Append("f_value8='" + (model.f_value8) + "',"); strSql_use.Append("f_value8=:f_value8,"); parameter = new OracleParameter(":f_value8", OracleType.VarChar); parameter.Value = model.f_value8; parameterList.Add(parameter); } if (model.f_value9 != null && columsList.Contains("f_value9")) { strSql.Append("f_value9='" + (model.f_value9) + "',"); strSql_use.Append("f_value9=:f_value9,"); parameter = new OracleParameter(":f_value9", OracleType.VarChar); parameter.Value = model.f_value9; parameterList.Add(parameter); } if (model.f_value10 != null && columsList.Contains("f_value10")) { strSql.Append("f_value10='" + (model.f_value10) + "',"); strSql_use.Append("f_value10=:f_value10,"); parameter = new OracleParameter(":f_value10", OracleType.VarChar); parameter.Value = model.f_value10; parameterList.Add(parameter); } if (model.f_sbid != null && columsList.Contains("f_sbid")) { strSql.Append("f_sbid='" + (model.f_sbid) + "',"); strSql_use.Append("f_sbid=:f_sbid,"); parameter = new OracleParameter(":f_sbid", OracleType.VarChar); parameter.Value = model.f_sbid; parameterList.Add(parameter); } if (model.f_sbbh != null && columsList.Contains("f_sbbh")) { strSql.Append("f_sbbh='" + (model.f_sbbh) + "',"); strSql_use.Append("f_sbbh=:f_sbbh,"); parameter = new OracleParameter(":f_sbbh", OracleType.VarChar); parameter.Value = model.f_sbbh; parameterList.Add(parameter); } if (model.f_bjsj != null && columsList.Contains("f_bjsj")) { strSql.Append("f_bjsj=to_date('" + model.f_bjsj.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-MM-dd hh24:mi:ss'),"); strSql_use.Append("f_bjsj=:f_bjsj,"); parameter = new OracleParameter(":f_bjsj", OracleType.DateTime); parameter.Value = model.f_bjsj; parameterList.Add(parameter); } if (model.f_bjzt != null && columsList.Contains("f_bjzt")) { strSql.Append("f_bjzt='" + (model.f_bjzt) + "',"); strSql_use.Append("f_bjzt=:f_bjzt,"); parameter = new OracleParameter(":f_bjzt", OracleType.VarChar); parameter.Value = model.f_bjzt; parameterList.Add(parameter); } if (model.f_bjztid != null && columsList.Contains("f_bjztid")) { strSql.Append("f_bjztid='" + (model.f_bjztid) + "',"); strSql_use.Append("f_bjztid=:f_bjztid,"); parameter = new OracleParameter(":f_bjztid", OracleType.VarChar); parameter.Value = model.f_bjztid; parameterList.Add(parameter); } if (model.f_bjnr != null && columsList.Contains("f_bjnr")) { strSql.Append("f_bjnr='" + (model.f_bjnr) + "',"); strSql_use.Append("f_bjnr=:f_bjnr,"); parameter = new OracleParameter(":f_bjnr", OracleType.VarChar); parameter.Value = model.f_bjnr; parameterList.Add(parameter); } int n = strSql.ToString().LastIndexOf(","); strSql.Remove(n, 1); strSql.Append(" where sys_id='" + model.sys_id + "'"); n = strSql_use.ToString().LastIndexOf(","); strSql_use.Remove(n, 1); strSql_use.Append(" where sys_id='" + model.sys_id + "'"); #endregion int columscount = 0; if (Eva.Library.Configuration.ConfigurationManager.AppSettings["SqlEditMode"].ToString() == "parameter") { #region parameter if (parameterList.Count > 0) { if (t == null) { columscount = _iAccessData.ExecuteSql(strSql_use.ToString(), parameterList.ToArray()); } else { columscount = t.ExecuteSql(strSql_use.ToString(), parameterList.ToArray()); } } #endregion } else { #region sql if (t == null) { columscount = _iAccessData.ExecuteSql(strSql.ToString()); } else { columscount = t.ExecuteSql(strSql.ToString()); } #endregion } return(columscount.ToString()); }
/// <summary> /// 重写添加addlayerconfig /// </summary> /// <param name="json"></param> /// <param name="clientInf"></param> /// <returns></returns> public string Add(sara.dd.ldsw.model.tbl_ld_sbbj model, Eva.Library.Data.AccessDataTrans.IAccessDataTrans t) { StringBuilder strSql = new StringBuilder(); StringBuilder strSql_use = new StringBuilder(); StringBuilder strSql1 = new StringBuilder(); StringBuilder strSql2 = new StringBuilder(); StringBuilder strSql3 = new StringBuilder(); if (Eva.Library.Configuration.ConfigurationManager.AppSettings["SqlEditMode"].ToString() == "parameter") { } else //如果是sql形式的话,则进行textFormat { model = Eva.Library.Format.FormatTextTool.ModelFormat(model); } List <OracleParameter> parameterList = new List <OracleParameter>(); OracleParameter parameter = null; string sid = ""; if (model.sys_id <= 0) { if (t == null) { sid = GetMaxId(null).ToString(); } else { sid = GetMaxId(t).ToString(); } model.sys_id = int.Parse(sid); } else { sid = model.sys_id.ToString(); } #region sqlString strSql1.Append("sys_id,"); strSql2.Append("'" + sid + "',"); strSql3.Append(":sys_id,"); parameter = new OracleParameter(":sys_id", OracleType.Number); parameter.Value = sid; parameterList.Add(parameter); if (model.sys_orderid != null) { strSql1.Append("sys_orderid,"); strSql2.Append("'" + (model.sys_orderid) + "',"); strSql3.Append(":sys_orderid,"); parameter = new OracleParameter(":sys_orderid", OracleType.VarChar); parameter.Value = model.sys_orderid; parameterList.Add(parameter); } if (model.sys_creatuserid != null) { strSql1.Append("sys_creatuserid,"); strSql2.Append("'" + (model.sys_creatuserid) + "',"); strSql3.Append(":sys_creatuserid,"); parameter = new OracleParameter(":sys_creatuserid", OracleType.VarChar); parameter.Value = model.sys_creatuserid; parameterList.Add(parameter); } if (model.sys_creatusername != null) { strSql1.Append("sys_creatusername,"); strSql2.Append("'" + (model.sys_creatusername) + "',"); strSql3.Append(":sys_creatusername,"); parameter = new OracleParameter(":sys_creatusername", OracleType.VarChar); parameter.Value = model.sys_creatusername; parameterList.Add(parameter); } if (model.sys_creatdate != null) { strSql1.Append("sys_creatdate,"); strSql2.Append("to_date('" + model.sys_creatdate.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-MM-dd hh24:mi:ss'),"); strSql3.Append(":sys_creatdate,"); parameter = new OracleParameter(":sys_creatdate", OracleType.DateTime); parameter.Value = model.sys_creatdate; parameterList.Add(parameter); } if (model.sys_lastedituserid != null) { strSql1.Append("sys_lastedituserid,"); strSql2.Append("'" + (model.sys_lastedituserid) + "',"); strSql3.Append(":sys_lastedituserid,"); parameter = new OracleParameter(":sys_lastedituserid", OracleType.VarChar); parameter.Value = model.sys_lastedituserid; parameterList.Add(parameter); } if (model.sys_lasteditusername != null) { strSql1.Append("sys_lasteditusername,"); strSql2.Append("'" + (model.sys_lasteditusername) + "',"); strSql3.Append(":sys_lasteditusername,"); parameter = new OracleParameter(":sys_lasteditusername", OracleType.VarChar); parameter.Value = model.sys_lasteditusername; parameterList.Add(parameter); } if (model.sys_lasteditdate != null) { strSql1.Append("sys_lasteditdate,"); strSql2.Append("to_date('" + model.sys_lasteditdate.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-MM-dd hh24:mi:ss'),"); strSql3.Append(":sys_lasteditdate,"); parameter = new OracleParameter(":sys_lasteditdate", OracleType.DateTime); parameter.Value = model.sys_lasteditdate; parameterList.Add(parameter); } if (model.sys_deluserid != null) { strSql1.Append("sys_deluserid,"); strSql2.Append("'" + (model.sys_deluserid) + "',"); strSql3.Append(":sys_deluserid,"); parameter = new OracleParameter(":sys_deluserid", OracleType.VarChar); parameter.Value = model.sys_deluserid; parameterList.Add(parameter); } if (model.sys_delusername != null) { strSql1.Append("sys_delusername,"); strSql2.Append("'" + (model.sys_delusername) + "',"); strSql3.Append(":sys_delusername,"); parameter = new OracleParameter(":sys_delusername", OracleType.VarChar); parameter.Value = model.sys_delusername; parameterList.Add(parameter); } if (model.sys_deldate != null) { strSql1.Append("sys_deldate,"); strSql2.Append("to_date('" + model.sys_deldate.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-MM-dd hh24:mi:ss'),"); strSql3.Append(":sys_deldate,"); parameter = new OracleParameter(":sys_deldate", OracleType.DateTime); parameter.Value = model.sys_deldate; parameterList.Add(parameter); } if (model.sys_delflag != null) { strSql1.Append("sys_delflag,"); strSql2.Append("'" + (model.sys_delflag) + "',"); strSql3.Append(":sys_delflag,"); parameter = new OracleParameter(":sys_delflag", OracleType.VarChar); parameter.Value = model.sys_delflag; parameterList.Add(parameter); } if (model.f_value1 != null) { strSql1.Append("f_value1,"); strSql2.Append("'" + (model.f_value1) + "',"); strSql3.Append(":f_value1,"); parameter = new OracleParameter(":f_value1", OracleType.VarChar); parameter.Value = model.f_value1; parameterList.Add(parameter); } if (model.f_value2 != null) { strSql1.Append("f_value2,"); strSql2.Append("'" + (model.f_value2) + "',"); strSql3.Append(":f_value2,"); parameter = new OracleParameter(":f_value2", OracleType.VarChar); parameter.Value = model.f_value2; parameterList.Add(parameter); } if (model.f_value3 != null) { strSql1.Append("f_value3,"); strSql2.Append("'" + (model.f_value3) + "',"); strSql3.Append(":f_value3,"); parameter = new OracleParameter(":f_value3", OracleType.VarChar); parameter.Value = model.f_value3; parameterList.Add(parameter); } if (model.f_value4 != null) { strSql1.Append("f_value4,"); strSql2.Append("'" + (model.f_value4) + "',"); strSql3.Append(":f_value4,"); parameter = new OracleParameter(":f_value4", OracleType.VarChar); parameter.Value = model.f_value4; parameterList.Add(parameter); } if (model.f_value5 != null) { strSql1.Append("f_value5,"); strSql2.Append("'" + (model.f_value5) + "',"); strSql3.Append(":f_value5,"); parameter = new OracleParameter(":f_value5", OracleType.VarChar); parameter.Value = model.f_value5; parameterList.Add(parameter); } if (model.f_value6 != null) { strSql1.Append("f_value6,"); strSql2.Append("'" + (model.f_value6) + "',"); strSql3.Append(":f_value6,"); parameter = new OracleParameter(":f_value6", OracleType.VarChar); parameter.Value = model.f_value6; parameterList.Add(parameter); } if (model.f_value7 != null) { strSql1.Append("f_value7,"); strSql2.Append("'" + (model.f_value7) + "',"); strSql3.Append(":f_value7,"); parameter = new OracleParameter(":f_value7", OracleType.VarChar); parameter.Value = model.f_value7; parameterList.Add(parameter); } if (model.f_value8 != null) { strSql1.Append("f_value8,"); strSql2.Append("'" + (model.f_value8) + "',"); strSql3.Append(":f_value8,"); parameter = new OracleParameter(":f_value8", OracleType.VarChar); parameter.Value = model.f_value8; parameterList.Add(parameter); } if (model.f_value9 != null) { strSql1.Append("f_value9,"); strSql2.Append("'" + (model.f_value9) + "',"); strSql3.Append(":f_value9,"); parameter = new OracleParameter(":f_value9", OracleType.VarChar); parameter.Value = model.f_value9; parameterList.Add(parameter); } if (model.f_value10 != null) { strSql1.Append("f_value10,"); strSql2.Append("'" + (model.f_value10) + "',"); strSql3.Append(":f_value10,"); parameter = new OracleParameter(":f_value10", OracleType.VarChar); parameter.Value = model.f_value10; parameterList.Add(parameter); } if (model.f_sbid != null) { strSql1.Append("f_sbid,"); strSql2.Append("'" + (model.f_sbid) + "',"); strSql3.Append(":f_sbid,"); parameter = new OracleParameter(":f_sbid", OracleType.VarChar); parameter.Value = model.f_sbid; parameterList.Add(parameter); } if (model.f_sbbh != null) { strSql1.Append("f_sbbh,"); strSql2.Append("'" + (model.f_sbbh) + "',"); strSql3.Append(":f_sbbh,"); parameter = new OracleParameter(":f_sbbh", OracleType.VarChar); parameter.Value = model.f_sbbh; parameterList.Add(parameter); } if (model.f_bjsj != null) { strSql1.Append("f_bjsj,"); strSql2.Append("to_date('" + model.f_bjsj.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-MM-dd hh24:mi:ss'),"); strSql3.Append(":f_bjsj,"); parameter = new OracleParameter(":f_bjsj", OracleType.DateTime); parameter.Value = model.f_bjsj; parameterList.Add(parameter); } if (model.f_bjzt != null) { strSql1.Append("f_bjzt,"); strSql2.Append("'" + (model.f_bjzt) + "',"); strSql3.Append(":f_bjzt,"); parameter = new OracleParameter(":f_bjzt", OracleType.VarChar); parameter.Value = model.f_bjzt; parameterList.Add(parameter); } if (model.f_bjztid != null) { strSql1.Append("f_bjztid,"); strSql2.Append("'" + (model.f_bjztid) + "',"); strSql3.Append(":f_bjztid,"); parameter = new OracleParameter(":f_bjztid", OracleType.VarChar); parameter.Value = model.f_bjztid; parameterList.Add(parameter); } if (model.f_bjnr != null) { strSql1.Append("f_bjnr,"); strSql2.Append("'" + (model.f_bjnr) + "',"); strSql3.Append(":f_bjnr,"); parameter = new OracleParameter(":f_bjnr", OracleType.VarChar); parameter.Value = model.f_bjnr; parameterList.Add(parameter); } strSql.Append("insert into tbl_ld_sbbj("); strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1)); strSql.Append(")"); strSql.Append(" values ("); strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1)); strSql.Append(")"); strSql_use.Append("insert into tbl_ld_sbbj("); strSql_use.Append(strSql1.ToString().Remove(strSql1.Length - 1)); strSql_use.Append(")"); strSql_use.Append(" values ("); strSql_use.Append(strSql3.ToString().Remove(strSql3.Length - 1)); strSql_use.Append(")"); #endregion if (Eva.Library.Configuration.ConfigurationManager.AppSettings["SqlEditMode"].ToString() == "parameter") { #region parameter if (parameterList.Count > 0) { if (t == null) { _iAccessData.ExecuteSql(strSql_use.ToString(), parameterList.ToArray()); } else { t.ExecuteSql(strSql_use.ToString(), parameterList.ToArray()); } } #endregion } else { #region sql if (t == null) { _iAccessData.ExecuteSql(strSql.ToString()); } else { t.ExecuteSql(strSql.ToString()); } List <string> paraStrList = new List <string>(); List <OracleParameter> pList = new List <OracleParameter>(); OracleParameter p = null; if (paraStrList.Count > 0) { string updateSqlString = " update tbl_ld_sbbj set " + string.Join(" , ", paraStrList.ToArray()) + " where sys_id = '" + sid + "' "; if (pList.Count > 0) { if (t == null) { _iAccessData.ExecuteSql(updateSqlString, pList.ToArray()); } else { t.ExecuteSql(updateSqlString, pList.ToArray()); } } } #endregion } return(sid); }
public string meterAlert(string jsontable) { Eva.Library.Data.AccessDataTrans.IAccessDataTrans t = commonclass.commonclass.CreateIAccessDataTrans(); //jsontable = jsontable.Replace("\n", "").Replace(" ", "").Replace("\t", "").Replace("\r", "").Replace("\\\\\\\\\\\\\\\\", "\\\\\\\\").Replace("\\\"","\"").Replace("\"[","[").Replace("]\"","]"); DataTable dt = Eva.Library.Format.FormatEntityTool.FormatJsonToDataTable(jsontable); try { t.getTrans().begin(); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt.Rows[i]; #region 增加一条报警记录 if (dr["f_sbbh"].ToString() != null && dr["f_sbbh"].ToString() != "") { DateTime bjsj = Convert.ToDateTime(dr["f_bjsj"].ToString()); DateTime currentTime = System.DateTime.Now; List <sara.dd.ldsw.model.tbl_ld_sbb> sbmodellist = _idal_tbl_ld_sbb.GetList("f_sbbh='" + dr["f_sbbh"].ToString() + "'", "", "*", "", "", t); if (sbmodellist.Count == 1) { sara.dd.ldsw.model.tbl_ld_sbbj model = new sara.dd.ldsw.model.tbl_ld_sbbj(); sara.dd.ldsw.model.tbl_ld_sbb sbmodel = sbmodellist[0]; model.sys_creatuserid = "74"; model.sys_creatusername = "******"; model.sys_creatdate = currentTime; model.sys_lastedituserid = "74"; model.sys_lasteditusername = "******"; model.sys_lasteditdate = currentTime; model.sys_deldate = DateTime.Parse("1900-01-01"); model.sys_delflag = "0"; model.f_sbid = sbmodel.sys_id.ToString(); model.f_sbbh = dr["f_sbbh"].ToString(); model.f_bjsj = bjsj; if (dr["f_bjxx"].ToString() == "在线") { model.f_bjzt = "正常"; model.f_bjztid = "1"; model.f_bjnr = dr["f_bjxx"].ToString(); sbmodel.f_bjzt = "正常"; sbmodel.f_bjztid = "1"; sbmodel.f_bjnr = dr["f_bjxx"].ToString(); _idal_tbl_ld_sbb.Update(sbmodel, "f_bjzt,f_bjztid,f_bjnr", t); } else { model.f_bjzt = "报警"; model.f_bjztid = "2"; model.f_bjnr = dr["f_bjxx"].ToString(); sbmodel.f_bjzt = "报警"; sbmodel.f_bjztid = "2"; sbmodel.f_bjnr = dr["f_bjxx"].ToString(); _idal_tbl_ld_sbb.Update(sbmodel, "f_bjzt,f_bjztid,f_bjnr", t); } _idal_tbl_ld_sbbj.Add(model, t); } #endregion } } #region 增加通送信息 //获取报警水表数 string count = _idal_tbl_ld_sbb.GetCount("f_bjztid='2'", t); if (int.Parse(count) > 0) { sara.dd.ldsw.model.tbl_notice noticemodel = new sara.dd.ldsw.model.tbl_notice(); DateTime currentTime = System.DateTime.Now; noticemodel.sys_creatuserid = "74"; noticemodel.sys_creatusername = "******"; noticemodel.sys_creatdate = currentTime; noticemodel.sys_lastedituserid = "74"; noticemodel.sys_lasteditusername = "******"; noticemodel.sys_lasteditdate = currentTime; noticemodel.sys_deldate = DateTime.Parse("1900-01-01"); noticemodel.sys_delflag = "0"; noticemodel.f_title = "水表报警"; noticemodel.f_content = "<a href=\"http://127.0.0.1/sara.dd.ldsw/ui/tbl_ld_sbbj/tbl_ld_sbbj_list.html?listtype=1&uid=1519\">水表报警(" + count + ")</a>"; noticemodel.f_startdate = currentTime; noticemodel.f_edndate = currentTime; noticemodel.f_group = "张建东"; noticemodel.f_groupid = "1519"; _idal_tbl_notice.Add(noticemodel, t); } #endregion t.getTrans().commit(); } catch (Exception ex) { t.getTrans().rollback(); return("程序异常" + ex.Message); } return("true"); }