コード例 #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            User currentUser = CreateLoginUser();
            IUserService loginService = new UserService();

            bool validUser = loginService.ValidateUser(currentUser);

            if (validUser)
            {
                ResetLoginAttempts();
                this.Hide();
                Home home = new Home();
                home.Show();
            }
            else
            {
                AddLoginAttempts(ReadLoginAttempts());
                this.loginValidation.Items.Clear();
                this.loginValidation.Items.Add("Email or password is incorrect");
                Console.WriteLine("Logging error : Email or password is incorrect");
            }
        }
コード例 #2
0
 private void btnSignUp_Click(object sender, EventArgs e)
 {
     User currentUser = CreateSignUpUser();
     if (Validate(currentUser))
     {
         IUserService signUpService = new UserService() ;
         signUpService.AddNewUser(currentUser);
         this.Hide();
         Home home = new Home();
         home.Show();
     }
 }