Esempio n. 1
0
        /// <summary>
        /// 重置员工密码
        /// </summary>
        /// <param name="staffId"></param>
        /// <param name="roleType"></param>
        public void PawReset(string staffId, string roleType)
        {
            TSAgentUser    tsAgentUser    = new TSAgentUser();
            string         strSQL         = "select * from tsAgentUser where userId=" + staffId + " and roleId!=001";
            TSAgentUserDAO tsAgentUserDao = new TSAgentUserDAO();
            Param          param          = new Param();

            tsAgentUser = tsAgentUserDao.GetList(strSQL, param)[0];
            try
            {
                string userPwd = Encrypt.ConvertPwd(tsAgentUser.userId, tsAgentUser.userCode);
                tsAgentUserDao.ChangePwd(tsAgentUser.userId, userPwd, roleType);
                Message.success(context, "员工密码重置成功");
                loginSession.Log(staffId + "员工密码重置成功");
            }
            catch (Exception e)
            {
                Message.error(context, "员工密码重置失败 ");
                loginSession.Log(e.Message);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 修改当前用户密码
        /// </summary>
        /// <param name="oldPwd">旧密码</param>
        /// <param name="newPwd">新密码</param>
        public void ChangePwd(string oldPwd, string newPwd, string roleId, string roleType)
        {
            TSAgentUserDAO tsAgentUserDao = new TSAgentUserDAO();
            TSAgentUser    user           = tsAgentUserDao.Get(loginAgentUser.UserId, roleId);

            if (user.userPwd.Equals(Encrypt.ConvertPwd(user.userId, oldPwd)) == false)
            {
                Message.error(context, "旧密码输入错误");
                return;
            }

            user.userPwd = Encrypt.ConvertPwd(user.userId, newPwd);
            try
            {
                tsAgentUserDao.ChangePwd(user.userId, user.userPwd, roleType);
                Message.success(context, "密码修改成功");
                loginAgentUser.Log("密码修改成功");
            }
            catch (Exception e)
            {
                Message.error(context, "密码修改失败");
                loginAgentUser.Log("密码修改失败,错误:" + e.Message);
            }
        }