Beispiel #1
0
 public CResult<bool> IsUserCorrect(string userName, string password)
 {
     var result = new UserInfoDAL().IsUserCorrect(userName, password);
     if (result) {
         return new CResult<bool>(true);
     } else {
         return new CResult<bool>(false, ErrorCode.UserInfoError);
     }
 }
Beispiel #2
0
        public CResult<WebUserInfo> GetUserInfoByName(string userName)
        {
            if (string.IsNullOrEmpty(userName)) {
                return new CResult<WebUserInfo>(null, ErrorCode.ParameterError);
            }

            var userInfo = new UserInfoDAL().GetUserInfoByName(userName);
            if (userInfo == null) {
                return new CResult<WebUserInfo>(null, ErrorCode.UserNotExist);
            }

            var webUserInfo = new WebUserInfo() {
                UserName = userInfo.UserName,
                UserID = userInfo.UserID
            };

            return new CResult<WebUserInfo>(webUserInfo);
        }
Beispiel #3
0
        public CResult<WebUserInfo> GetUserInfoByID(int userID)
        {
            if (userID <= 0) {
                return new CResult<WebUserInfo>(null, ErrorCode.ParameterError);
            }

            var userInfo = new UserInfoDAL().GetUserInfoByID(userID);
            if (userInfo == null) {
                return new CResult<WebUserInfo>(null, ErrorCode.UserNotExist);
            }

            var webUserInfo = new WebUserInfo() {
                UserName = userInfo.UserName,
                UserID = userInfo.UserID,
                OldPassword = userInfo.Password,
            };

            return new CResult<WebUserInfo>(webUserInfo);
        }