private void loginButton_Click(object sender, EventArgs e)
 {
     if (usernameTextBox.Text == "" || passwordTextBox.Text == "")
     {
         MessageBox.Show("Username or password can not be empty");
     }
     else
     {
         UserService userService = new UserService();
         bool        result      = userService.LoginValidation(usernameTextBox.Text, passwordTextBox.Text);
         if (result)
         {
             userService = new UserService();
             if (userService.GetUserType(usernameTextBox.Text) == "Admin")
             {
                 HomeForAdmin homeForAdmin = new HomeForAdmin(usernameTextBox.Text);
                 homeForAdmin.Show();
                 this.Hide();
             }
             else
             {
                 HomeForUser homeForUser = new HomeForUser(usernameTextBox.Text);
                 homeForUser.Show();
                 this.Hide();
             }
         }
         else
         {
             MessageBox.Show("Invalid Username or password ");
         }
     }
 }
Exemple #2
0
        private void backToHomeBuktton1_Click(object sender, EventArgs e)
        {
            HomeForUser homeForUser = new HomeForUser(username);

            homeForUser.Show();
            this.Hide();
        }
Exemple #3
0
        private void backToHomeBuktton1_Click(object sender, EventArgs e)
        {
            UserService userService = new UserService();

            if (userService.GetUserType(username) == "Admin")
            {
                HomeForAdmin homeForAdmin = new HomeForAdmin(username);
                homeForAdmin.Show();
                this.Hide();
            }
            else
            {
                HomeForUser homeForUser = new HomeForUser(username);
                homeForUser.Show();
                this.Hide();
            }
        }