Esempio n. 1
0
        public void AddUser(string FirstName,string SecondName,string MonthBirthDay,string DayBirthDay,string YearBirthDay,string EmailAddress,string ConfirmEmailAddress,string FirstPartCellPhone,
            string SecondPartCellPhone,string ThirdPartCellPhone,string ZipCode,string Password,string ConfirmPassword)
        {
            messageToBeShown = "";
            User user = new User(FirstName, SecondName, new UserDateOfBirth(MonthBirthDay, YearBirthDay, DayBirthDay), EmailAddress,
                                new UserCellPhone(FirstPartCellPhone, SecondPartCellPhone, ThirdPartCellPhone), ZipCode, Password);
            if (!confirmationEmailMatch(user,ConfirmEmailAddress))
            {
                messageToBeShown = "Email and confirmation eamail do not match";
                return;
            }
            if (!confirmationPasswordMatch(user,ConfirmPassword))
            {
                messageToBeShown = "Password and confirmationPassword do not match";
                return;
            }

            if (alreadyExistsUser(user))
            {
                messageToBeShown = "A user with specified email already exists";
                return;
            }

            try
            {
                userDM.Add(user);
                messageToBeShown = "User succesfuly added";
            }
            catch (InvalidUserException invalidUserException)
            {
                messageToBeShown = invalidUserException.Message;
            }
        }
Esempio n. 2
0
       //[HttpPost]
        public ActionResult LogIn(User model)
        {

            var userEmail = model.email;
            var userPassword = model.password;
       //    ViewBag.message("Numele: " + userPassword + "Parola: " + userEmail);

            return View(model);
        }
Esempio n. 3
0
 private bool alreadyExistsUser(User user)
 {
     List<User> usersList = userDM.GetAllUsers();
     for (int index = 0; index < usersList.Count; index++)
     {
         if (usersList[index].EmailAddress.Equals(user.EmailAddress))
         {
             return true;
         }
     }
     return false;
 }
Esempio n. 4
0
 public void Add(User User)
 {
     try
     {
         UserValidator userValidator = new UserValidator();
         userValidator.Validate(User);
         usersList.Add(User);
     }
     catch (InvalidUserException invalidUserException)
     {
         throw invalidUserException;
     }
 }
Esempio n. 5
0
 public ActionResult LogIn2(User user)
 {
     UserDM userMap = new UserDM();
     if (ModelState.IsValid)
     {
         if (userMap.checkUserLogin(user))
         {
             return RedirectToAction("Index", "Home");
         }
         ModelState.AddModelError("", "Login data is incorrect!");
     }
     return View(user);
 }
Esempio n. 6
0
        private void Init()
        {
            var newUser = new User();

            newUser.Id = 1;
            newUser.firstName = "User1FN";
            newUser.secondName = "User1SN";
            newUser.email = "*****@*****.**";
            newUser.password = "******";
            newUser.zipCode = 12345;
            newUser.cellPhone = "0755555555";

            _usersList.Add(newUser);

            newUser = new User();

            newUser.Id = 2;
            newUser.firstName = "User2FN";
            newUser.secondName = "User2SN";
            newUser.email = "*****@*****.**";
            newUser.password = "******";
            newUser.zipCode = 12345;
            newUser.cellPhone = "0755555555";

            _usersList.Add(newUser);

            newUser = new User();

            newUser.Id = 3;
            newUser.firstName = "User3FN";
            newUser.secondName = "User3SN";
            newUser.email = "*****@*****.**";
            newUser.password = "******";
            newUser.zipCode = 12345;
            newUser.cellPhone = "0755555555";

            _usersList.Add(newUser);

        }
Esempio n. 7
0
 private bool confirmationEmailMatch(User user, string confirmationEmail)
 {
     return user.EmailAddress.Equals(confirmationEmail);
 }
Esempio n. 8
0
 private bool confirmationPasswordMatch(User user, string confirmationPassword)
 {
     return user.Password.Equals(confirmationPassword);
 }
Esempio n. 9
0
        public void RemoveUser(User user)
        {
            _usersList.Remove(user);
>>>>>>> 88e733912c7fd449e56c94f6fe867a5f49ca79fa
        }
Esempio n. 10
0
 public void AddUser(User user)
 {
     _usersList.Add(user);
 }