示例#1
0
        /// <summary>
        /// 管理员修改密码
        /// </summary>
        /// <param name="UserNum"></param>
        /// <param name="Password"></param>
        /// <returns></returns>
        public int AdminEditPass(string UserNum, string Password)
        {
            AdminEntity entity = new AdminEntity();

            entity.PassWord = Password;
            entity.Where(item => item.CompanyID == this.CompanyID)
            .And(item => item.UserNum == UserNum);
            entity.IncludePassWord(true);

            int line = this.Admin.Update(entity);

            return(line);
        }
示例#2
0
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="UserNum"></param>
        /// <param name="OldPass"></param>
        /// <param name="NewPass"></param>
        /// <returns></returns>
        public DataResult UpdatePwd(string UserNum, string OldPass, string NewPass)
        {
            AdminEntity entity = new AdminEntity();

            entity.Where(a => a.UserNum == UserNum)
            .And(a => a.PassWord == OldPass)
            .And(a => a.CompanyID == this.CompanyID)
            ;
            int        count      = this.Admin.GetCount(entity);
            DataResult dataResult = new DataResult();

            if (count == 0)
            {
                dataResult.Code    = (int)EResponseCode.Exception;
                dataResult.Message = "旧密码不正确";
                return(dataResult);
            }
            entity          = new AdminEntity();
            entity.PassWord = NewPass;
            entity.IncludePassWord(true);
            entity.Where(a => a.PassWord == OldPass)
            .And(a => a.CompanyID == this.CompanyID)
            ;
            int line = this.Admin.Update(entity);

            if (line > 0)
            {
                dataResult.Code    = (int)EResponseCode.Success;
                dataResult.Message = "密码修改成功";
            }
            else
            {
                dataResult.Code    = (int)EResponseCode.Exception;
                dataResult.Message = "密码修改失败";
            }

            return(dataResult);
        }