public void AddPerson()
        {
            PersonModel   person   = new PersonModel(UserLogin, UserEmail);
            PasswordModel password = new PasswordModel(UserPassword);

            if (Validator.Validate(person, new PersonValidator(), "Login") == true &&
                Validator.Validate(password, new PasswordValidator()) == true)
            {
                password.Hash();
                GlobalConfig.Connection.CreatePerson(person, password);

                MessageBox.Show("Operation successful");
                shellViewModel.ShowIssues();
            }
        }
Esempio n. 2
0
        public void Login()
        {
            PersonModel   person   = new PersonModel(UserLogin);
            PasswordModel password = new PasswordModel(UserPassword);

            if (Validator.Validate(person, new PersonValidator(), "Login") &&
                Validator.Validate(password, new PasswordValidator()) == true)
            {
                password.Hash();
                if (GlobalConfig.Connection.Authenticate(person.Login, password.Password))
                {
                    person = GlobalConfig.Connection.GetPersonByLogin(person);
                    shellViewModel.LoggedUser = person;
                    shellViewModel.ShowIssues();
                }
                else
                {
                    MessageBox.Show("Wrong username or password");
                }
            }
        }