Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
0
        /// <summary>
        /// 更新系统菜单 System_Menu对象(即:一条记录
        /// </summary>
        public int Update(System_Menu system_Menu)
        {
            StringBuilder sbParameter = new StringBuilder();
            StringBuilder sb          = new StringBuilder();

            sb.Append(@"UPDATE       System_Menu       SET ");
            if (system_Menu.Menu_Code_IsChanged)
            {
                sbParameter.Append("Menu_Code=@Menu_Code, ");
            }
            if (system_Menu.Menu_Title_IsChanged)
            {
                sbParameter.Append("Menu_Title=@Menu_Title, ");
            }
            if (system_Menu.Menu_Location_IsChanged)
            {
                sbParameter.Append("Menu_Location=@Menu_Location, ");
            }
            if (system_Menu.Menu_PCode_IsChanged)
            {
                sbParameter.Append("Menu_PCode=@Menu_PCode, ");
            }
            if (system_Menu.Menu_Enable_IsChanged)
            {
                sbParameter.Append("Menu_Enable=@Menu_Enable, ");
            }
            if (system_Menu.Menu_Url_IsChanged)
            {
                sbParameter.Append("Menu_Url=@Menu_Url, ");
            }
            if (system_Menu.Menu_Order_IsChanged)
            {
                sbParameter.Append("Menu_Order=@Menu_Order, ");
            }
            if (system_Menu.Menu_Icon_IsChanged)
            {
                sbParameter.Append("Menu_Icon=@Menu_Icon, ");
            }
            if (system_Menu.Stat_IsChanged)
            {
                sbParameter.Append("Stat=@Stat, ");
            }
            if (system_Menu.Shortcut_IsChanged)
            {
                sbParameter.Append("Shortcut=@Shortcut ");
            }
            sb.Append(sbParameter.ToString().Trim().TrimEnd(','));
            sb.Append(" WHERE 1=1 AND ((Stat is null) or (Stat=0))   and Menu_ID=@Menu_ID; ");
            string sql = sb.ToString();

            if (system_Menu.Menu_Code_IsChanged)
            {
                if (string.IsNullOrEmpty(system_Menu.Menu_Code))
                {
                    idb.AddParameter("@Menu_Code", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@Menu_Code", system_Menu.Menu_Code);
                }
            }
            if (system_Menu.Menu_Title_IsChanged)
            {
                if (string.IsNullOrEmpty(system_Menu.Menu_Title))
                {
                    idb.AddParameter("@Menu_Title", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@Menu_Title", system_Menu.Menu_Title);
                }
            }
            if (system_Menu.Menu_Location_IsChanged)
            {
                if (string.IsNullOrEmpty(system_Menu.Menu_Location))
                {
                    idb.AddParameter("@Menu_Location", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@Menu_Location", system_Menu.Menu_Location);
                }
            }
            if (system_Menu.Menu_PCode_IsChanged)
            {
                if (string.IsNullOrEmpty(system_Menu.Menu_PCode))
                {
                    idb.AddParameter("@Menu_PCode", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@Menu_PCode", system_Menu.Menu_PCode);
                }
            }
            if (system_Menu.Menu_Enable_IsChanged)
            {
                if (string.IsNullOrEmpty(system_Menu.Menu_Enable))
                {
                    idb.AddParameter("@Menu_Enable", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@Menu_Enable", system_Menu.Menu_Enable);
                }
            }
            if (system_Menu.Menu_Url_IsChanged)
            {
                if (string.IsNullOrEmpty(system_Menu.Menu_Url))
                {
                    idb.AddParameter("@Menu_Url", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@Menu_Url", system_Menu.Menu_Url);
                }
            }
            if (system_Menu.Menu_Order_IsChanged)
            {
                if (system_Menu.Menu_Order == 0)
                {
                    idb.AddParameter("@Menu_Order", 0);
                }
                else
                {
                    idb.AddParameter("@Menu_Order", system_Menu.Menu_Order);
                }
            }
            if (system_Menu.Menu_Icon_IsChanged)
            {
                if (string.IsNullOrEmpty(system_Menu.Menu_Icon))
                {
                    idb.AddParameter("@Menu_Icon", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@Menu_Icon", system_Menu.Menu_Icon);
                }
            }
            if (system_Menu.Stat_IsChanged)
            {
                if (system_Menu.Stat == 0)
                {
                    idb.AddParameter("@Stat", 0);
                }
                else
                {
                    idb.AddParameter("@Stat", system_Menu.Stat);
                }
            }
            if (system_Menu.Shortcut_IsChanged)
            {
                if (system_Menu.Shortcut == 0)
                {
                    idb.AddParameter("@Shortcut", 0);
                }
                else
                {
                    idb.AddParameter("@Shortcut", system_Menu.Shortcut);
                }
            }

            idb.AddParameter("@Menu_ID", system_Menu.Menu_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);
        }
Esempio n. 3
0
        /// <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);
        }
Esempio n. 4
0
        /// <summary>
        /// 添加系统菜单 System_Menu对象(即:一条记录)
        /// </summary>
        public int Add(System_Menu system_Menu)
        {
            string sql = "INSERT INTO System_Menu (Menu_Code,Menu_Title,Menu_Location,Menu_PCode,Menu_Enable,Menu_Url,Menu_Order,Menu_Icon,Stat,Shortcut) VALUES (@Menu_Code,@Menu_Title,@Menu_Location,@Menu_PCode,@Menu_Enable,@Menu_Url,@Menu_Order,@Menu_Icon,@Stat,@Shortcut)";

            if (string.IsNullOrEmpty(system_Menu.Menu_Code))
            {
                idb.AddParameter("@Menu_Code", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@Menu_Code", system_Menu.Menu_Code);
            }
            if (string.IsNullOrEmpty(system_Menu.Menu_Title))
            {
                idb.AddParameter("@Menu_Title", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@Menu_Title", system_Menu.Menu_Title);
            }
            if (string.IsNullOrEmpty(system_Menu.Menu_Location))
            {
                idb.AddParameter("@Menu_Location", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@Menu_Location", system_Menu.Menu_Location);
            }
            if (string.IsNullOrEmpty(system_Menu.Menu_PCode))
            {
                idb.AddParameter("@Menu_PCode", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@Menu_PCode", system_Menu.Menu_PCode);
            }
            if (string.IsNullOrEmpty(system_Menu.Menu_Enable))
            {
                idb.AddParameter("@Menu_Enable", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@Menu_Enable", system_Menu.Menu_Enable);
            }
            if (string.IsNullOrEmpty(system_Menu.Menu_Url))
            {
                idb.AddParameter("@Menu_Url", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@Menu_Url", system_Menu.Menu_Url);
            }
            if (system_Menu.Menu_Order == 0)
            {
                idb.AddParameter("@Menu_Order", 0);
            }
            else
            {
                idb.AddParameter("@Menu_Order", system_Menu.Menu_Order);
            }
            if (string.IsNullOrEmpty(system_Menu.Menu_Icon))
            {
                idb.AddParameter("@Menu_Icon", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@Menu_Icon", system_Menu.Menu_Icon);
            }
            if (system_Menu.Stat == 0)
            {
                idb.AddParameter("@Stat", 0);
            }
            else
            {
                idb.AddParameter("@Stat", system_Menu.Stat);
            }
            if (system_Menu.Shortcut == 0)
            {
                idb.AddParameter("@Shortcut", 0);
            }
            else
            {
                idb.AddParameter("@Shortcut", system_Menu.Shortcut);
            }


            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);
        }