/// <summary> /// 更新数据字典 Bse_Dict对象(即:一条记录 /// </summary> public int Update(Bse_Dict bse_Dict) { StringBuilder sbParameter = new StringBuilder(); StringBuilder sb = new StringBuilder(); sb.Append(@"UPDATE Bse_Dict SET "); if (bse_Dict.Dict_Key_IsChanged) { sbParameter.Append("Dict_Key=@Dict_Key, "); } if (bse_Dict.Dict_Code_IsChanged) { sbParameter.Append("Dict_Code=@Dict_Code, "); } if (bse_Dict.Dict_Name_IsChanged) { sbParameter.Append("Dict_Name=@Dict_Name, "); } if (bse_Dict.Dict_Order_IsChanged) { sbParameter.Append("Dict_Order=@Dict_Order, "); } if (bse_Dict.Dict_PCode_IsChanged) { sbParameter.Append("Dict_PCode=@Dict_PCode, "); } if (bse_Dict.Dict_PName_IsChanged) { sbParameter.Append("Dict_PName=@Dict_PName, "); } if (bse_Dict.Dict_Desp_IsChanged) { sbParameter.Append("Dict_Desp=@Dict_Desp, "); } if (bse_Dict.Dict_SCode_IsChanged) { sbParameter.Append("Dict_SCode=@Dict_SCode, "); } if (bse_Dict.Dict_Bak_IsChanged) { sbParameter.Append("Dict_Bak=@Dict_Bak, "); } if (bse_Dict.Dict_UDef1_IsChanged) { sbParameter.Append("Dict_UDef1=@Dict_UDef1, "); } if (bse_Dict.Dict_UDef2_IsChanged) { sbParameter.Append("Dict_UDef2=@Dict_UDef2, "); } if (bse_Dict.Dict_UDef3_IsChanged) { sbParameter.Append("Dict_UDef3=@Dict_UDef3, "); } if (bse_Dict.Dict_UDef4_IsChanged) { sbParameter.Append("Dict_UDef4=@Dict_UDef4, "); } if (bse_Dict.Dict_UDef5_IsChanged) { sbParameter.Append("Dict_UDef5=@Dict_UDef5, "); } if (bse_Dict.Dict_Level_IsChanged) { sbParameter.Append("Dict_Level=@Dict_Level, "); } if (bse_Dict.Dict_IsEditable_IsChanged) { sbParameter.Append("Dict_IsEditable=@Dict_IsEditable, "); } if (bse_Dict.Stat_IsChanged) { sbParameter.Append("Stat=@Stat "); } sb.Append(sbParameter.ToString().Trim().TrimEnd(',')); sb.Append(" WHERE 1=1 AND ((Stat is null) or (Stat=0)) and Dict_ID=@Dict_ID; "); string sql = sb.ToString(); if (bse_Dict.Dict_Key_IsChanged) { if (string.IsNullOrEmpty(bse_Dict.Dict_Key)) { idb.AddParameter("@Dict_Key", DBNull.Value); } else { idb.AddParameter("@Dict_Key", bse_Dict.Dict_Key); } } if (bse_Dict.Dict_Code_IsChanged) { if (string.IsNullOrEmpty(bse_Dict.Dict_Code)) { idb.AddParameter("@Dict_Code", DBNull.Value); } else { idb.AddParameter("@Dict_Code", bse_Dict.Dict_Code); } } if (bse_Dict.Dict_Name_IsChanged) { if (string.IsNullOrEmpty(bse_Dict.Dict_Name)) { idb.AddParameter("@Dict_Name", DBNull.Value); } else { idb.AddParameter("@Dict_Name", bse_Dict.Dict_Name); } } if (bse_Dict.Dict_Order_IsChanged) { if (bse_Dict.Dict_Order == 0) { idb.AddParameter("@Dict_Order", 0); } else { idb.AddParameter("@Dict_Order", bse_Dict.Dict_Order); } } if (bse_Dict.Dict_PCode_IsChanged) { if (string.IsNullOrEmpty(bse_Dict.Dict_PCode)) { idb.AddParameter("@Dict_PCode", DBNull.Value); } else { idb.AddParameter("@Dict_PCode", bse_Dict.Dict_PCode); } } if (bse_Dict.Dict_PName_IsChanged) { if (string.IsNullOrEmpty(bse_Dict.Dict_PName)) { idb.AddParameter("@Dict_PName", DBNull.Value); } else { idb.AddParameter("@Dict_PName", bse_Dict.Dict_PName); } } if (bse_Dict.Dict_Desp_IsChanged) { if (string.IsNullOrEmpty(bse_Dict.Dict_Desp)) { idb.AddParameter("@Dict_Desp", DBNull.Value); } else { idb.AddParameter("@Dict_Desp", bse_Dict.Dict_Desp); } } if (bse_Dict.Dict_SCode_IsChanged) { if (string.IsNullOrEmpty(bse_Dict.Dict_SCode)) { idb.AddParameter("@Dict_SCode", DBNull.Value); } else { idb.AddParameter("@Dict_SCode", bse_Dict.Dict_SCode); } } if (bse_Dict.Dict_Bak_IsChanged) { if (string.IsNullOrEmpty(bse_Dict.Dict_Bak)) { idb.AddParameter("@Dict_Bak", DBNull.Value); } else { idb.AddParameter("@Dict_Bak", bse_Dict.Dict_Bak); } } if (bse_Dict.Dict_UDef1_IsChanged) { if (string.IsNullOrEmpty(bse_Dict.Dict_UDef1)) { idb.AddParameter("@Dict_UDef1", DBNull.Value); } else { idb.AddParameter("@Dict_UDef1", bse_Dict.Dict_UDef1); } } if (bse_Dict.Dict_UDef2_IsChanged) { if (string.IsNullOrEmpty(bse_Dict.Dict_UDef2)) { idb.AddParameter("@Dict_UDef2", DBNull.Value); } else { idb.AddParameter("@Dict_UDef2", bse_Dict.Dict_UDef2); } } if (bse_Dict.Dict_UDef3_IsChanged) { if (string.IsNullOrEmpty(bse_Dict.Dict_UDef3)) { idb.AddParameter("@Dict_UDef3", DBNull.Value); } else { idb.AddParameter("@Dict_UDef3", bse_Dict.Dict_UDef3); } } if (bse_Dict.Dict_UDef4_IsChanged) { if (string.IsNullOrEmpty(bse_Dict.Dict_UDef4)) { idb.AddParameter("@Dict_UDef4", DBNull.Value); } else { idb.AddParameter("@Dict_UDef4", bse_Dict.Dict_UDef4); } } if (bse_Dict.Dict_UDef5_IsChanged) { if (string.IsNullOrEmpty(bse_Dict.Dict_UDef5)) { idb.AddParameter("@Dict_UDef5", DBNull.Value); } else { idb.AddParameter("@Dict_UDef5", bse_Dict.Dict_UDef5); } } if (bse_Dict.Dict_Level_IsChanged) { if (bse_Dict.Dict_Level == 0) { idb.AddParameter("@Dict_Level", 0); } else { idb.AddParameter("@Dict_Level", bse_Dict.Dict_Level); } } if (bse_Dict.Dict_IsEditable_IsChanged) { if (bse_Dict.Dict_IsEditable == 0) { idb.AddParameter("@Dict_IsEditable", 0); } else { idb.AddParameter("@Dict_IsEditable", bse_Dict.Dict_IsEditable); } } if (bse_Dict.Stat_IsChanged) { if (bse_Dict.Stat == 0) { idb.AddParameter("@Stat", 0); } else { idb.AddParameter("@Stat", bse_Dict.Stat); } } idb.AddParameter("@Dict_ID", bse_Dict.Dict_ID); int Re = 0; //SQL日志记录 var RunMethod = System.Reflection.MethodBase.GetCurrentMethod(); System.Collections.Hashtable param = new System.Collections.Hashtable(); string Ex = "0"; foreach (System.Collections.DictionaryEntry item in idb.GetParameters()) { param.Add(item.Key, item.Value); } try { Re = idb.ExeCmd(sql); Ex = Re.ToString(); } catch (Exception ex) { Ex = ex.Message; } SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType + "." + RunMethod.Name, Ex); return(Re); }
/// <summary> /// 更新Sys_LoginLog Sys_LoginLog对象(即:一条记录 /// </summary> public int Update(Sys_LoginLog sys_LoginLog) { StringBuilder sbParameter = new StringBuilder(); StringBuilder sb = new StringBuilder(); sb.Append(@"UPDATE Sys_LoginLog SET "); if (sys_LoginLog.EL_Date_IsChanged) { sbParameter.Append("EL_Date=@EL_Date, "); } if (sys_LoginLog.EL_IP_IsChanged) { sbParameter.Append("EL_IP=@EL_IP, "); } if (sys_LoginLog.EL_Mac_IsChanged) { sbParameter.Append("EL_Mac=@EL_Mac, "); } if (sys_LoginLog.EL_Success_IsChanged) { sbParameter.Append("EL_Success=@EL_Success, "); } if (sys_LoginLog.EL_UserCode_IsChanged) { sbParameter.Append("EL_UserCode=@EL_UserCode, "); } if (sys_LoginLog.EL_UserName_IsChanged) { sbParameter.Append("EL_UserName=@EL_UserName, "); } if (sys_LoginLog.EL_Dept_IsChanged) { sbParameter.Append("EL_Dept=@EL_Dept, "); } if (sys_LoginLog.EL_Company_IsChanged) { sbParameter.Append("EL_Company=@EL_Company, "); } if (sys_LoginLog.EL_CancleDate_IsChanged) { sbParameter.Append("EL_CancleDate=@EL_CancleDate, "); } if (sys_LoginLog.Stat_IsChanged) { sbParameter.Append("Stat=@Stat "); } sb.Append(sbParameter.ToString().Trim().TrimEnd(',')); sb.Append(" WHERE 1=1 AND ((Stat is null) or (Stat=0)) and EL_ID=@EL_ID; "); string sql = sb.ToString(); if (sys_LoginLog.EL_Date_IsChanged) { if (sys_LoginLog.EL_Date == DateTime.MinValue) { idb.AddParameter("@EL_Date", DBNull.Value); } else { idb.AddParameter("@EL_Date", sys_LoginLog.EL_Date); } } if (sys_LoginLog.EL_IP_IsChanged) { if (string.IsNullOrEmpty(sys_LoginLog.EL_IP)) { idb.AddParameter("@EL_IP", DBNull.Value); } else { idb.AddParameter("@EL_IP", sys_LoginLog.EL_IP); } } if (sys_LoginLog.EL_Mac_IsChanged) { if (string.IsNullOrEmpty(sys_LoginLog.EL_Mac)) { idb.AddParameter("@EL_Mac", DBNull.Value); } else { idb.AddParameter("@EL_Mac", sys_LoginLog.EL_Mac); } } if (sys_LoginLog.EL_Success_IsChanged) { if (string.IsNullOrEmpty(sys_LoginLog.EL_Success)) { idb.AddParameter("@EL_Success", DBNull.Value); } else { idb.AddParameter("@EL_Success", sys_LoginLog.EL_Success); } } if (sys_LoginLog.EL_UserCode_IsChanged) { if (string.IsNullOrEmpty(sys_LoginLog.EL_UserCode)) { idb.AddParameter("@EL_UserCode", DBNull.Value); } else { idb.AddParameter("@EL_UserCode", sys_LoginLog.EL_UserCode); } } if (sys_LoginLog.EL_UserName_IsChanged) { if (string.IsNullOrEmpty(sys_LoginLog.EL_UserName)) { idb.AddParameter("@EL_UserName", DBNull.Value); } else { idb.AddParameter("@EL_UserName", sys_LoginLog.EL_UserName); } } if (sys_LoginLog.EL_Dept_IsChanged) { if (string.IsNullOrEmpty(sys_LoginLog.EL_Dept)) { idb.AddParameter("@EL_Dept", DBNull.Value); } else { idb.AddParameter("@EL_Dept", sys_LoginLog.EL_Dept); } } if (sys_LoginLog.EL_Company_IsChanged) { if (string.IsNullOrEmpty(sys_LoginLog.EL_Company)) { idb.AddParameter("@EL_Company", DBNull.Value); } else { idb.AddParameter("@EL_Company", sys_LoginLog.EL_Company); } } if (sys_LoginLog.EL_CancleDate_IsChanged) { if (sys_LoginLog.EL_CancleDate == DateTime.MinValue) { idb.AddParameter("@EL_CancleDate", DBNull.Value); } else { idb.AddParameter("@EL_CancleDate", sys_LoginLog.EL_CancleDate); } } if (sys_LoginLog.Stat_IsChanged) { if (sys_LoginLog.Stat == 0) { idb.AddParameter("@Stat", 0); } else { idb.AddParameter("@Stat", sys_LoginLog.Stat); } } idb.AddParameter("@EL_ID", sys_LoginLog.EL_ID); int Re = 0; //SQL日志记录 var RunMethod = System.Reflection.MethodBase.GetCurrentMethod(); System.Collections.Hashtable param = new System.Collections.Hashtable(); string Ex = "0"; foreach (System.Collections.DictionaryEntry item in idb.GetParameters()) { param.Add(item.Key, item.Value); } try { Re = idb.ExeCmd(sql); Ex = Re.ToString(); } catch (Exception ex) { Ex = ex.Message; } SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType + "." + RunMethod.Name, Ex); return(Re); }
/// <summary> /// 添加数据字典 Bse_Dict对象(即:一条记录) /// </summary> public int Add(Bse_Dict bse_Dict) { string sql = "INSERT INTO Bse_Dict (Dict_Key,Dict_Code,Dict_Name,Dict_Order,Dict_PCode,Dict_PName,Dict_Desp,Dict_SCode,Dict_Bak,Dict_UDef1,Dict_UDef2,Dict_UDef3,Dict_UDef4,Dict_UDef5,Dict_Level,Dict_IsEditable,Stat) VALUES (@Dict_Key,@Dict_Code,@Dict_Name,@Dict_Order,@Dict_PCode,@Dict_PName,@Dict_Desp,@Dict_SCode,@Dict_Bak,@Dict_UDef1,@Dict_UDef2,@Dict_UDef3,@Dict_UDef4,@Dict_UDef5,@Dict_Level,@Dict_IsEditable,@Stat)"; if (string.IsNullOrEmpty(bse_Dict.Dict_Key)) { idb.AddParameter("@Dict_Key", DBNull.Value); } else { idb.AddParameter("@Dict_Key", bse_Dict.Dict_Key); } if (string.IsNullOrEmpty(bse_Dict.Dict_Code)) { idb.AddParameter("@Dict_Code", DBNull.Value); } else { idb.AddParameter("@Dict_Code", bse_Dict.Dict_Code); } if (string.IsNullOrEmpty(bse_Dict.Dict_Name)) { idb.AddParameter("@Dict_Name", DBNull.Value); } else { idb.AddParameter("@Dict_Name", bse_Dict.Dict_Name); } if (bse_Dict.Dict_Order == 0) { idb.AddParameter("@Dict_Order", 0); } else { idb.AddParameter("@Dict_Order", bse_Dict.Dict_Order); } if (string.IsNullOrEmpty(bse_Dict.Dict_PCode)) { idb.AddParameter("@Dict_PCode", DBNull.Value); } else { idb.AddParameter("@Dict_PCode", bse_Dict.Dict_PCode); } if (string.IsNullOrEmpty(bse_Dict.Dict_PName)) { idb.AddParameter("@Dict_PName", DBNull.Value); } else { idb.AddParameter("@Dict_PName", bse_Dict.Dict_PName); } if (string.IsNullOrEmpty(bse_Dict.Dict_Desp)) { idb.AddParameter("@Dict_Desp", DBNull.Value); } else { idb.AddParameter("@Dict_Desp", bse_Dict.Dict_Desp); } if (string.IsNullOrEmpty(bse_Dict.Dict_SCode)) { idb.AddParameter("@Dict_SCode", DBNull.Value); } else { idb.AddParameter("@Dict_SCode", bse_Dict.Dict_SCode); } if (string.IsNullOrEmpty(bse_Dict.Dict_Bak)) { idb.AddParameter("@Dict_Bak", DBNull.Value); } else { idb.AddParameter("@Dict_Bak", bse_Dict.Dict_Bak); } if (string.IsNullOrEmpty(bse_Dict.Dict_UDef1)) { idb.AddParameter("@Dict_UDef1", DBNull.Value); } else { idb.AddParameter("@Dict_UDef1", bse_Dict.Dict_UDef1); } if (string.IsNullOrEmpty(bse_Dict.Dict_UDef2)) { idb.AddParameter("@Dict_UDef2", DBNull.Value); } else { idb.AddParameter("@Dict_UDef2", bse_Dict.Dict_UDef2); } if (string.IsNullOrEmpty(bse_Dict.Dict_UDef3)) { idb.AddParameter("@Dict_UDef3", DBNull.Value); } else { idb.AddParameter("@Dict_UDef3", bse_Dict.Dict_UDef3); } if (string.IsNullOrEmpty(bse_Dict.Dict_UDef4)) { idb.AddParameter("@Dict_UDef4", DBNull.Value); } else { idb.AddParameter("@Dict_UDef4", bse_Dict.Dict_UDef4); } if (string.IsNullOrEmpty(bse_Dict.Dict_UDef5)) { idb.AddParameter("@Dict_UDef5", DBNull.Value); } else { idb.AddParameter("@Dict_UDef5", bse_Dict.Dict_UDef5); } if (bse_Dict.Dict_Level == 0) { idb.AddParameter("@Dict_Level", 0); } else { idb.AddParameter("@Dict_Level", bse_Dict.Dict_Level); } if (bse_Dict.Dict_IsEditable == 0) { idb.AddParameter("@Dict_IsEditable", 0); } else { idb.AddParameter("@Dict_IsEditable", bse_Dict.Dict_IsEditable); } if (bse_Dict.Stat == 0) { idb.AddParameter("@Stat", 0); } else { idb.AddParameter("@Stat", bse_Dict.Stat); } int Re = 0; //SQL日志记录 var RunMethod = System.Reflection.MethodBase.GetCurrentMethod(); System.Collections.Hashtable param = new System.Collections.Hashtable(); string Ex = "0"; foreach (System.Collections.DictionaryEntry item in idb.GetParameters()) { param.Add(item.Key, item.Value); } try { Re = idb.ExeCmd(sql); Ex = Re.ToString(); } catch (Exception ex) { Ex = ex.Message; } SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType + "." + RunMethod.Name, Ex); return(Re); }
/// <summary> /// 添加Sys_LoginLog Sys_LoginLog对象(即:一条记录) /// </summary> public int Add(Sys_LoginLog sys_LoginLog) { string sql = "INSERT INTO Sys_LoginLog (EL_Date,EL_IP,EL_Mac,EL_Success,EL_UserCode,EL_UserName,EL_Dept,EL_Company,EL_CancleDate,Stat) VALUES (@EL_Date,@EL_IP,@EL_Mac,@EL_Success,@EL_UserCode,@EL_UserName,@EL_Dept,@EL_Company,@EL_CancleDate,@Stat)"; if (sys_LoginLog.EL_Date == DateTime.MinValue) { idb.AddParameter("@EL_Date", DBNull.Value); } else { idb.AddParameter("@EL_Date", sys_LoginLog.EL_Date); } if (string.IsNullOrEmpty(sys_LoginLog.EL_IP)) { idb.AddParameter("@EL_IP", DBNull.Value); } else { idb.AddParameter("@EL_IP", sys_LoginLog.EL_IP); } if (string.IsNullOrEmpty(sys_LoginLog.EL_Mac)) { idb.AddParameter("@EL_Mac", DBNull.Value); } else { idb.AddParameter("@EL_Mac", sys_LoginLog.EL_Mac); } if (string.IsNullOrEmpty(sys_LoginLog.EL_Success)) { idb.AddParameter("@EL_Success", DBNull.Value); } else { idb.AddParameter("@EL_Success", sys_LoginLog.EL_Success); } if (string.IsNullOrEmpty(sys_LoginLog.EL_UserCode)) { idb.AddParameter("@EL_UserCode", DBNull.Value); } else { idb.AddParameter("@EL_UserCode", sys_LoginLog.EL_UserCode); } if (string.IsNullOrEmpty(sys_LoginLog.EL_UserName)) { idb.AddParameter("@EL_UserName", DBNull.Value); } else { idb.AddParameter("@EL_UserName", sys_LoginLog.EL_UserName); } if (string.IsNullOrEmpty(sys_LoginLog.EL_Dept)) { idb.AddParameter("@EL_Dept", DBNull.Value); } else { idb.AddParameter("@EL_Dept", sys_LoginLog.EL_Dept); } if (string.IsNullOrEmpty(sys_LoginLog.EL_Company)) { idb.AddParameter("@EL_Company", DBNull.Value); } else { idb.AddParameter("@EL_Company", sys_LoginLog.EL_Company); } if (sys_LoginLog.EL_CancleDate == DateTime.MinValue) { idb.AddParameter("@EL_CancleDate", DBNull.Value); } else { idb.AddParameter("@EL_CancleDate", sys_LoginLog.EL_CancleDate); } if (sys_LoginLog.Stat == 0) { idb.AddParameter("@Stat", 0); } else { idb.AddParameter("@Stat", sys_LoginLog.Stat); } int Re = 0; //SQL日志记录 var RunMethod = System.Reflection.MethodBase.GetCurrentMethod(); System.Collections.Hashtable param = new System.Collections.Hashtable(); string Ex = "0"; foreach (System.Collections.DictionaryEntry item in idb.GetParameters()) { param.Add(item.Key, item.Value); } try { Re = idb.ExeCmd(sql); Ex = Re.ToString(); } catch (Exception ex) { Ex = ex.Message; } SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType + "." + RunMethod.Name, Ex); return(Re); }