public Boolean ChangePassword(string userid, string currentpassword, string newpassword)
        {
            WCFUser u = new WCFUser();

            u.UserID   = userid;
            u.PassWord = currentpassword;

            try
            {
                if (ValidateUser(u) != null)
                {
                    throw new NotImplementedException();
                }
                else
                {
                    // invalid user
                    return(false);
                }
            }
            catch (Exception e)
            {
                // error
                return(false);
            }
        }
        public WCFUser ValidateUser(WCFUser User)
        {
            //return BusinessLogic.validateUser(userid, password);

            try
            {
                User user = userService.FindByUserID(User.UserID);
                if (user != null)
                {
                    if (User.PassWord == Encrypt.DecryptMethod(user.password))
                    {
                        return(WCFModelConvertUtility.ConvertToWCFUser(user));
                    }
                    else
                    {
                        return(null);
                    }
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                // non existing userID
                return(null);
            }
        }
Exemplo n.º 3
0
        public WCFUser GetUser(string userID)
        {
            StationeryModel entity  = new StationeryModel();
            User            user    = entity.Users.Where(x => x.userID == userID).First();
            WCFUser         wcfUser = WCFModelConvertUtility.ConvertToWCFUser(user);

            return(wcfUser);
        }
Exemplo n.º 4
0
        public static WCFUser ConvertToWCFUser(User user)
        {
            WCFUser wUser = new WCFUser();

            wUser.UserID         = user.userID;
            wUser.DepartmentCode = user.departmentCode;
            wUser.Role           = user.role;
            wUser.Name           = user.name;

            return(wUser);
        }
 public WCFUser GetUser(string userID, string password)
 {
     try
     {
         User user = userService.FindByUserID(userID);
         if (Encrypt.DecryptMethod(user.password) == password)
         {
             WCFUser wcfUser = WCFModelConvertUtility.ConvertToWCFUser(user);
             return(wcfUser);
         }
         else
         {
             WCFUser invalid = new WCFUser();
             return(invalid);
         }
     }
     catch (Exception e)
     {
         WCFUser invalid = new WCFUser();
         return(invalid);
     }
 }