Esempio n. 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();
            }
        }
Esempio n. 2
0
        private void CreateQuizButton_Click(object sender, EventArgs e)
        {
            string name    = quizNameTextBox.Text;
            int    hours   = int.Parse(hoursTextBox.Text);
            int    minutes = int.Parse(minutesTextBox.Text);
            int    seconds = int.Parse(secondsTextBox.Text);

            if (name != null || name != String.Empty)
            {
                Database.Quizzes.CreateQuiz(new Quiz
                {
                    Name    = name,
                    Hours   = hours,
                    Minutes = minutes,
                    Seconds = seconds
                });

                this.Visible = false;
                AdminHomeForm homeForm = new AdminHomeForm();
                homeForm.ShowDialog();
            }
        }