示例#1
0
        /// <summary>
        /// 通过用户代码获得User对象
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        private static Users GetUser(string userID)
        {
            AccountDalc dalcAccount = CreateAccountDALC();
            Users       user        = dalcAccount.GetUser(userID);

            //if ((_user == null) || (!_user.Id.Equals(userID)))
            //    _user = GetUser(userID);
            //_permission = AccountPermission.GetUserPermission(_user);


            return(user);
        }
示例#2
0
 /// <summary>
 /// 更改密码
 /// </summary>
 /// <param name="userId">用户代码</param>
 /// <param name="oldPassword">老密码</param>
 /// <param name="newPassword">新密码</param>
 public void ChangePassword(string userId, string oldPassword, string newPassword)
 {
     try
     {
         Users       user        = GetUser(userId);
         AccountDalc dalcAccount = CreateAccountDALC();
         dalcAccount.ChangeUserPassword(user, oldPassword, newPassword);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
示例#3
0
 /// <summary>
 /// 用户登录函数
 /// </summary>
 /// <param name="userId">用户代码</param>
 /// <param name="password">密码</param>
 ///  /// <param name="type">登录方式0:通过登录界面登录,1:医生工作站跳转</param>
 /// <returns>一个包含了用户信息的xml字符串</returns>
 public IUser Login(string userId, string password, int type)
 {
     try
     {
         Users user = new AccountDalc().GetUser(userId);
         if (null == user)
         {
             throw new InvalidUserIdException("用户名不正确");
         }
         if ((_user == null) || (!_user.Id.Equals(userId)))
         {
             _user = GetUser(userId);
         }
         if (type == 0)
         {
             if ((_user as Users).ComparePassword(password))
             {
                 _permission = AccountPermission.GetUserPermission(_user);
                 return(_user);
             }
             else
             {
                 throw new InvalidUserPasswordException("密码不正确");
             }
         }
         else
         {
             _permission = AccountPermission.GetUserPermission(_user);
             return(_user);
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
示例#4
0
        /// <summary>
        /// 更新用户的信息
        /// </summary>
        /// <param name="user">IUser接口对象</param>
        public void UpdateUserInfo(IUser user)
        {
            AccountDalc dalcAccount = CreateAccountDALC();

            dalcAccount.UpdateUserInfo((Users)user);
        }