示例#1
0
        /// <summary>
        /// 更新管理员账号信息,密码为空时不修改密码
        /// </summary>
        /// <param name="webmasterInfo">EyouSoft.Model.SysStructure.MWebmasterInfo</param>
        /// <returns></returns>
        public bool UpdateWebmasterInfo(EyouSoft.Model.SysStructure.MWebmasterInfo webmasterInfo)
        {
            DbCommand     cmd     = this._db.GetSqlStringCommand("SELECT 1");
            StringBuilder cmdText = new StringBuilder();

            cmdText.Append(" UPDATE [tbl_Webmaster] SET ");
            cmdText.Append(" [Username]=@Username ");
            this._db.AddInParameter(cmd, "Username", DbType.String, webmasterInfo.Username);

            if (webmasterInfo.Password != null && !string.IsNullOrEmpty(webmasterInfo.Password.NoEncryptPassword))
            {
                cmdText.Append(" ,[Password]=@Password ");
                cmdText.Append(" ,[MD5Password]=@MD5Password ");

                this._db.AddInParameter(cmd, "Password", DbType.String, webmasterInfo.Password.NoEncryptPassword);
                this._db.AddInParameter(cmd, "MD5Password", DbType.String, webmasterInfo.Password.MD5Password);
            }

            cmdText.Append(" WHERE [Id]=@UserId ");
            this._db.AddInParameter(cmd, "UserId", DbType.String, webmasterInfo.UserId);

            cmd.CommandText = cmdText.ToString();

            return(DbHelper.ExecuteSql(cmd, this._db) == 1 ? true : false);
        }
示例#2
0
文件: self.aspx.cs 项目: windygu/bbl
        /// <summary>
        /// btnUpdate_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            EyouSoft.Model.SysStructure.MWebmasterInfo  webmasterInfo = new EyouSoft.Model.SysStructure.MWebmasterInfo();
            EyouSoft.SSOComponent.Entity.MasterUserInfo loginUserInfo = Utils.GetWebmaster();
            if (loginUserInfo != null)
            {
                webmasterInfo.UserId   = loginUserInfo.UserId;
                webmasterInfo.Username = EyouSoft.Common.Utils.InputText(this.txtUsername.Value);
                webmasterInfo.Password = new EyouSoft.Model.CompanyStructure.PassWord();
                webmasterInfo.Password.NoEncryptPassword = this.txtPassword.Value;

                if (string.IsNullOrEmpty(webmasterInfo.Username))
                {
                    this.RegisterAlertAndRedirectScript("登录账号不能为空", "");
                    return;
                }

                EyouSoft.BLL.SysStructure.BSys bll = new EyouSoft.BLL.SysStructure.BSys();
                if (bll.UpdateWebmasterInfo(webmasterInfo))
                {
                    this.RegisterAlertAndRedirectScript("账号信息更新成功", "");
                }
                else
                {
                    this.RegisterAlertAndRedirectScript("账号信息更新失败", "");
                }
            }
        }
示例#3
0
        /// <summary>
        /// 更新管理员账号信息,密码为空时不修改密码
        /// </summary>
        /// <param name="webmasterInfo">EyouSoft.Model.SysStructure.MWebmasterInfo</param>
        /// <returns></returns>
        public bool UpdateWebmasterInfo(EyouSoft.Model.SysStructure.MWebmasterInfo webmasterInfo)
        {
            if (webmasterInfo == null)
            {
                return(false);
            }
            if (webmasterInfo.UserId < 1)
            {
                return(false);
            }
            if (string.IsNullOrEmpty(webmasterInfo.Username))
            {
                return(false);
            }

            return(dal.UpdateWebmasterInfo(webmasterInfo));
        }