Example #1
0
        /// <summary>
        /// 初始化带教老师用户信息 Add By wwj 2011-06-07
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public Users InitMaster(string userID)
        {
            //在临时账户登录时由于进此方法使得_permission变为null所以无菜单
            //重新判断获得edit by ywk
            if ((_user == null) || (!_user.Id.Equals(userID)))
            {
                _user = GetUser(userID);

                _permission = AccountPermission.GetUserPermission(_user);
            }

            if (!string.IsNullOrEmpty(userID))
            {
                return(GetUser(userID));
            }
            return(null);
        }
Example #2
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);
     }
 }