Пример #1
0
 public User SignUp(string name, string address, string password, string creditCard)
 {
     try
     {
         MarketLog.Log("UserSpot", "User " + currentID + " attempting to sign up to the system...");
         ApproveSignUp(name, address, password, creditCard);
         string encryptedPassword = UserSecurityService.ToEncryptPassword(_guest.SystemID, password);
         MarketLog.Log("UserSpot", "Searching for existing user and storing newly Registered User "
                       + currentID + " data...");
         ValidateUserNotExist(name);
         RegisteredUser newRegistered = _userDB.RegisterUser(_guest.SystemID, name, address, encryptedPassword,
                                                             creditCard, _guest.Cart.GetCartStorage());
         MarketLog.Log("UserSpot", "User " + newRegistered.SystemID + " sign up to the system has been successfull!");
         Answer = new UserAnswer(SignUpStatus.Success, "Sign up has been successfull!");
         _publisher.AddFeedQueue(newRegistered.SystemID);
         return(newRegistered);
     }
     catch (UserException e)
     {
         Answer = new UserAnswer((SignUpStatus)e.Status, e.GetErrorMessage());
         return(_guest);
     }
     catch (DataException e)
     {
         Answer = new UserAnswer((SignUpStatus)e.Status, e.GetErrorMessage());
         return(_guest);
     }
 }