Beispiel #1
0
 private void ShowInfo(int OperatorID)
 {
     WebDemo.BLL.WebDemo.Operators   bll   = new WebDemo.BLL.WebDemo.Operators();
     WebDemo.Model.WebDemo.Operators model = bll.GetModel(OperatorID);
     this.lblOperatorID.Text        = model.OperatorID.ToString();
     this.txtOperatorCode.Text      = model.OperatorCode;
     this.txtOperatorName.Text      = model.OperatorName;
     this.txtRoleID.Text            = model.RoleID.ToString();
     this.txtOperPassword.Text      = model.OperPassword;
     this.txtSiteID.Text            = model.SiteID.ToString();
     this.txtFlag.Text              = model.Flag.ToString();
     this.txtCreateDate.Text        = model.CreateDate.ToString();
     this.txtLastLoginDate.Text     = model.LastLoginDate.ToString();
     this.txtPageRowCounts.Text     = model.PageRowCounts.ToString();
     this.txtOperLevel.Text         = model.OperLevel;
     this.txtTemplateID.Text        = model.TemplateID.ToString();
     this.txtPaymentTemplateID.Text = model.PaymentTemplateID.ToString();
     this.txtICTemplateID.Text      = model.ICTemplateID.ToString();
     this.txtPhone.Text             = model.Phone;
     this.txtSelfSetting.Text       = model.SelfSetting;
     this.txtAutoRead.Text          = model.AutoRead.ToString();
     this.txtPhoneSerialNumber.Text = model.PhoneSerialNumber;
     this.txtIsBinding.Text         = model.IsBinding.ToString();
     this.txtRoleLevel.Text         = model.RoleLevel.ToString();
     this.txtExpiryDate.Text        = model.ExpiryDate.ToString();
     this.txtSkin.Text              = model.Skin;
 }
Beispiel #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WebDemo.Model.WebDemo.Operators GetModel(int OperatorID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 OperatorID,OperatorCode,OperatorName,RoleID,OperPassword,SiteID,Flag,CreateDate,LastLoginDate,PageRowCounts,OperLevel,TemplateID,PaymentTemplateID,ICTemplateID,Phone,SelfSetting,AutoRead,PhoneSerialNumber,IsBinding,RoleLevel,ExpiryDate,Skin from Operators ");
            strSql.Append(" where OperatorID=@OperatorID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OperatorID", SqlDbType.Int, 4)
            };
            parameters[0].Value = OperatorID;

            WebDemo.Model.WebDemo.Operators model = new WebDemo.Model.WebDemo.Operators();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(WebDemo.Model.WebDemo.Operators model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Operators(");
            strSql.Append("OperatorID,OperatorCode,OperatorName,RoleID,OperPassword,SiteID,Flag,CreateDate,LastLoginDate,PageRowCounts,OperLevel,TemplateID,PaymentTemplateID,ICTemplateID,Phone,SelfSetting,AutoRead,PhoneSerialNumber,IsBinding,RoleLevel,ExpiryDate,Skin)");
            strSql.Append(" values (");
            strSql.Append("@OperatorID,@OperatorCode,@OperatorName,@RoleID,@OperPassword,@SiteID,@Flag,@CreateDate,@LastLoginDate,@PageRowCounts,@OperLevel,@TemplateID,@PaymentTemplateID,@ICTemplateID,@Phone,@SelfSetting,@AutoRead,@PhoneSerialNumber,@IsBinding,@RoleLevel,@ExpiryDate,@Skin)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OperatorID",        SqlDbType.Int,         4),
                new SqlParameter("@OperatorCode",      SqlDbType.VarChar,    50),
                new SqlParameter("@OperatorName",      SqlDbType.VarChar,    50),
                new SqlParameter("@RoleID",            SqlDbType.Int,         4),
                new SqlParameter("@OperPassword",      SqlDbType.VarChar,    50),
                new SqlParameter("@SiteID",            SqlDbType.Int,         4),
                new SqlParameter("@Flag",              SqlDbType.Int,         4),
                new SqlParameter("@CreateDate",        SqlDbType.DateTime),
                new SqlParameter("@LastLoginDate",     SqlDbType.DateTime),
                new SqlParameter("@PageRowCounts",     SqlDbType.Int,         4),
                new SqlParameter("@OperLevel",         SqlDbType.VarChar,    50),
                new SqlParameter("@TemplateID",        SqlDbType.Int,         4),
                new SqlParameter("@PaymentTemplateID", SqlDbType.Int,         4),
                new SqlParameter("@ICTemplateID",      SqlDbType.Int,         4),
                new SqlParameter("@Phone",             SqlDbType.VarChar,    50),
                new SqlParameter("@SelfSetting",       SqlDbType.VarChar,   500),
                new SqlParameter("@AutoRead",          SqlDbType.Int,         4),
                new SqlParameter("@PhoneSerialNumber", SqlDbType.VarChar,    50),
                new SqlParameter("@IsBinding",         SqlDbType.Int,         4),
                new SqlParameter("@RoleLevel",         SqlDbType.Int,         4),
                new SqlParameter("@ExpiryDate",        SqlDbType.DateTime),
                new SqlParameter("@Skin",              SqlDbType.VarChar, 50)
            };
            parameters[0].Value  = model.OperatorID;
            parameters[1].Value  = model.OperatorCode;
            parameters[2].Value  = model.OperatorName;
            parameters[3].Value  = model.RoleID;
            parameters[4].Value  = model.OperPassword;
            parameters[5].Value  = model.SiteID;
            parameters[6].Value  = model.Flag;
            parameters[7].Value  = model.CreateDate;
            parameters[8].Value  = model.LastLoginDate;
            parameters[9].Value  = model.PageRowCounts;
            parameters[10].Value = model.OperLevel;
            parameters[11].Value = model.TemplateID;
            parameters[12].Value = model.PaymentTemplateID;
            parameters[13].Value = model.ICTemplateID;
            parameters[14].Value = model.Phone;
            parameters[15].Value = model.SelfSetting;
            parameters[16].Value = model.AutoRead;
            parameters[17].Value = model.PhoneSerialNumber;
            parameters[18].Value = model.IsBinding;
            parameters[19].Value = model.RoleLevel;
            parameters[20].Value = model.ExpiryDate;
            parameters[21].Value = model.Skin;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WebDemo.Model.WebDemo.Operators DataRowToModel(DataRow row)
 {
     WebDemo.Model.WebDemo.Operators model = new WebDemo.Model.WebDemo.Operators();
     if (row != null)
     {
         if (row["OperatorID"] != null && row["OperatorID"].ToString() != "")
         {
             model.OperatorID = int.Parse(row["OperatorID"].ToString());
         }
         if (row["OperatorCode"] != null)
         {
             model.OperatorCode = row["OperatorCode"].ToString();
         }
         if (row["OperatorName"] != null)
         {
             model.OperatorName = row["OperatorName"].ToString();
         }
         if (row["RoleID"] != null && row["RoleID"].ToString() != "")
         {
             model.RoleID = int.Parse(row["RoleID"].ToString());
         }
         if (row["OperPassword"] != null)
         {
             model.OperPassword = row["OperPassword"].ToString();
         }
         if (row["SiteID"] != null && row["SiteID"].ToString() != "")
         {
             model.SiteID = int.Parse(row["SiteID"].ToString());
         }
         if (row["Flag"] != null && row["Flag"].ToString() != "")
         {
             model.Flag = int.Parse(row["Flag"].ToString());
         }
         if (row["CreateDate"] != null && row["CreateDate"].ToString() != "")
         {
             model.CreateDate = DateTime.Parse(row["CreateDate"].ToString());
         }
         if (row["LastLoginDate"] != null && row["LastLoginDate"].ToString() != "")
         {
             model.LastLoginDate = DateTime.Parse(row["LastLoginDate"].ToString());
         }
         if (row["PageRowCounts"] != null && row["PageRowCounts"].ToString() != "")
         {
             model.PageRowCounts = int.Parse(row["PageRowCounts"].ToString());
         }
         if (row["OperLevel"] != null)
         {
             model.OperLevel = row["OperLevel"].ToString();
         }
         if (row["TemplateID"] != null && row["TemplateID"].ToString() != "")
         {
             model.TemplateID = int.Parse(row["TemplateID"].ToString());
         }
         if (row["PaymentTemplateID"] != null && row["PaymentTemplateID"].ToString() != "")
         {
             model.PaymentTemplateID = int.Parse(row["PaymentTemplateID"].ToString());
         }
         if (row["ICTemplateID"] != null && row["ICTemplateID"].ToString() != "")
         {
             model.ICTemplateID = int.Parse(row["ICTemplateID"].ToString());
         }
         if (row["Phone"] != null)
         {
             model.Phone = row["Phone"].ToString();
         }
         if (row["SelfSetting"] != null)
         {
             model.SelfSetting = row["SelfSetting"].ToString();
         }
         if (row["AutoRead"] != null && row["AutoRead"].ToString() != "")
         {
             model.AutoRead = int.Parse(row["AutoRead"].ToString());
         }
         if (row["PhoneSerialNumber"] != null)
         {
             model.PhoneSerialNumber = row["PhoneSerialNumber"].ToString();
         }
         if (row["IsBinding"] != null && row["IsBinding"].ToString() != "")
         {
             model.IsBinding = int.Parse(row["IsBinding"].ToString());
         }
         if (row["RoleLevel"] != null && row["RoleLevel"].ToString() != "")
         {
             model.RoleLevel = int.Parse(row["RoleLevel"].ToString());
         }
         if (row["ExpiryDate"] != null && row["ExpiryDate"].ToString() != "")
         {
             model.ExpiryDate = DateTime.Parse(row["ExpiryDate"].ToString());
         }
         if (row["Skin"] != null)
         {
             model.Skin = row["Skin"].ToString();
         }
     }
     return(model);
 }
Beispiel #5
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(WebDemo.Model.WebDemo.Operators model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Operators set ");
            strSql.Append("OperatorCode=@OperatorCode,");
            strSql.Append("OperatorName=@OperatorName,");
            strSql.Append("RoleID=@RoleID,");
            strSql.Append("OperPassword=@OperPassword,");
            strSql.Append("SiteID=@SiteID,");
            strSql.Append("Flag=@Flag,");
            strSql.Append("CreateDate=@CreateDate,");
            strSql.Append("LastLoginDate=@LastLoginDate,");
            strSql.Append("PageRowCounts=@PageRowCounts,");
            strSql.Append("OperLevel=@OperLevel,");
            strSql.Append("TemplateID=@TemplateID,");
            strSql.Append("PaymentTemplateID=@PaymentTemplateID,");
            strSql.Append("ICTemplateID=@ICTemplateID,");
            strSql.Append("Phone=@Phone,");
            strSql.Append("SelfSetting=@SelfSetting,");
            strSql.Append("AutoRead=@AutoRead,");
            strSql.Append("PhoneSerialNumber=@PhoneSerialNumber,");
            strSql.Append("IsBinding=@IsBinding,");
            strSql.Append("RoleLevel=@RoleLevel,");
            strSql.Append("ExpiryDate=@ExpiryDate,");
            strSql.Append("Skin=@Skin");
            strSql.Append(" where OperatorID=@OperatorID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OperatorCode",      SqlDbType.VarChar,    50),
                new SqlParameter("@OperatorName",      SqlDbType.VarChar,    50),
                new SqlParameter("@RoleID",            SqlDbType.Int,         4),
                new SqlParameter("@OperPassword",      SqlDbType.VarChar,    50),
                new SqlParameter("@SiteID",            SqlDbType.Int,         4),
                new SqlParameter("@Flag",              SqlDbType.Int,         4),
                new SqlParameter("@CreateDate",        SqlDbType.DateTime),
                new SqlParameter("@LastLoginDate",     SqlDbType.DateTime),
                new SqlParameter("@PageRowCounts",     SqlDbType.Int,         4),
                new SqlParameter("@OperLevel",         SqlDbType.VarChar,    50),
                new SqlParameter("@TemplateID",        SqlDbType.Int,         4),
                new SqlParameter("@PaymentTemplateID", SqlDbType.Int,         4),
                new SqlParameter("@ICTemplateID",      SqlDbType.Int,         4),
                new SqlParameter("@Phone",             SqlDbType.VarChar,    50),
                new SqlParameter("@SelfSetting",       SqlDbType.VarChar,   500),
                new SqlParameter("@AutoRead",          SqlDbType.Int,         4),
                new SqlParameter("@PhoneSerialNumber", SqlDbType.VarChar,    50),
                new SqlParameter("@IsBinding",         SqlDbType.Int,         4),
                new SqlParameter("@RoleLevel",         SqlDbType.Int,         4),
                new SqlParameter("@ExpiryDate",        SqlDbType.DateTime),
                new SqlParameter("@Skin",              SqlDbType.VarChar,    50),
                new SqlParameter("@OperatorID",        SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.OperatorCode;
            parameters[1].Value  = model.OperatorName;
            parameters[2].Value  = model.RoleID;
            parameters[3].Value  = model.OperPassword;
            parameters[4].Value  = model.SiteID;
            parameters[5].Value  = model.Flag;
            parameters[6].Value  = model.CreateDate;
            parameters[7].Value  = model.LastLoginDate;
            parameters[8].Value  = model.PageRowCounts;
            parameters[9].Value  = model.OperLevel;
            parameters[10].Value = model.TemplateID;
            parameters[11].Value = model.PaymentTemplateID;
            parameters[12].Value = model.ICTemplateID;
            parameters[13].Value = model.Phone;
            parameters[14].Value = model.SelfSetting;
            parameters[15].Value = model.AutoRead;
            parameters[16].Value = model.PhoneSerialNumber;
            parameters[17].Value = model.IsBinding;
            parameters[18].Value = model.RoleLevel;
            parameters[19].Value = model.ExpiryDate;
            parameters[20].Value = model.Skin;
            parameters[21].Value = model.OperatorID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #6
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtOperatorCode.Text.Trim().Length == 0)
            {
                strErr += "OperatorCode不能为空!\\n";
            }
            if (this.txtOperatorName.Text.Trim().Length == 0)
            {
                strErr += "OperatorName不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtRoleID.Text))
            {
                strErr += "RoleID格式错误!\\n";
            }
            if (this.txtOperPassword.Text.Trim().Length == 0)
            {
                strErr += "OperPassword不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtSiteID.Text))
            {
                strErr += "SiteID格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtFlag.Text))
            {
                strErr += "1-正常 2锁定格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtCreateDate.Text))
            {
                strErr += "CreateDate格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtLastLoginDate.Text))
            {
                strErr += "LastLoginDate格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtPageRowCounts.Text))
            {
                strErr += "每页显示行数格式错误!\\n";
            }
            if (this.txtOperLevel.Text.Trim().Length == 0)
            {
                strErr += "OperLevel不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtTemplateID.Text))
            {
                strErr += "TemplateID格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtPaymentTemplateID.Text))
            {
                strErr += "PaymentTemplateID格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtICTemplateID.Text))
            {
                strErr += "ICTemplateID格式错误!\\n";
            }
            if (this.txtPhone.Text.Trim().Length == 0)
            {
                strErr += "Phone不能为空!\\n";
            }
            if (this.txtSelfSetting.Text.Trim().Length == 0)
            {
                strErr += "SelfSetting不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtAutoRead.Text))
            {
                strErr += "AutoRead格式错误!\\n";
            }
            if (this.txtPhoneSerialNumber.Text.Trim().Length == 0)
            {
                strErr += "PhoneSerialNumber不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtIsBinding.Text))
            {
                strErr += "IsBinding格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtRoleLevel.Text))
            {
                strErr += "RoleLevel格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtExpiryDate.Text))
            {
                strErr += "ExpiryDate格式错误!\\n";
            }
            if (this.txtSkin.Text.Trim().Length == 0)
            {
                strErr += "Skin不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      OperatorID        = int.Parse(this.lblOperatorID.Text);
            string   OperatorCode      = this.txtOperatorCode.Text;
            string   OperatorName      = this.txtOperatorName.Text;
            int      RoleID            = int.Parse(this.txtRoleID.Text);
            string   OperPassword      = this.txtOperPassword.Text;
            int      SiteID            = int.Parse(this.txtSiteID.Text);
            int      Flag              = int.Parse(this.txtFlag.Text);
            DateTime CreateDate        = DateTime.Parse(this.txtCreateDate.Text);
            DateTime LastLoginDate     = DateTime.Parse(this.txtLastLoginDate.Text);
            int      PageRowCounts     = int.Parse(this.txtPageRowCounts.Text);
            string   OperLevel         = this.txtOperLevel.Text;
            int      TemplateID        = int.Parse(this.txtTemplateID.Text);
            int      PaymentTemplateID = int.Parse(this.txtPaymentTemplateID.Text);
            int      ICTemplateID      = int.Parse(this.txtICTemplateID.Text);
            string   Phone             = this.txtPhone.Text;
            string   SelfSetting       = this.txtSelfSetting.Text;
            int      AutoRead          = int.Parse(this.txtAutoRead.Text);
            string   PhoneSerialNumber = this.txtPhoneSerialNumber.Text;
            int      IsBinding         = int.Parse(this.txtIsBinding.Text);
            int      RoleLevel         = int.Parse(this.txtRoleLevel.Text);
            DateTime ExpiryDate        = DateTime.Parse(this.txtExpiryDate.Text);
            string   Skin              = this.txtSkin.Text;


            WebDemo.Model.WebDemo.Operators model = new WebDemo.Model.WebDemo.Operators();
            model.OperatorID        = OperatorID;
            model.OperatorCode      = OperatorCode;
            model.OperatorName      = OperatorName;
            model.RoleID            = RoleID;
            model.OperPassword      = OperPassword;
            model.SiteID            = SiteID;
            model.Flag              = Flag;
            model.CreateDate        = CreateDate;
            model.LastLoginDate     = LastLoginDate;
            model.PageRowCounts     = PageRowCounts;
            model.OperLevel         = OperLevel;
            model.TemplateID        = TemplateID;
            model.PaymentTemplateID = PaymentTemplateID;
            model.ICTemplateID      = ICTemplateID;
            model.Phone             = Phone;
            model.SelfSetting       = SelfSetting;
            model.AutoRead          = AutoRead;
            model.PhoneSerialNumber = PhoneSerialNumber;
            model.IsBinding         = IsBinding;
            model.RoleLevel         = RoleLevel;
            model.ExpiryDate        = ExpiryDate;
            model.Skin              = Skin;

            WebDemo.BLL.WebDemo.Operators bll = new WebDemo.BLL.WebDemo.Operators();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }