示例#1
0
        private void LoginButton_Click(object sender, System.EventArgs e)
        {
            string username = this.usernameTextBox.Text;
            string password = this.passwordTextBox.Text;

            User user = Database.Login(username, password);

            if (user != null && user.Role == UserRole.User)
            {
                this.Visible = false;
                HomeForm homeForm = new HomeForm();
                homeForm.ShowDialog();
            }
            else
            {
                this.Visible = false;
                AdminHomeForm adminHomeForm = new AdminHomeForm();
                adminHomeForm.ShowDialog();
            }
        }