Exemplo n.º 1
0
        private void BTN_Delete_Click(object sender, EventArgs e)
        {
            DialogResult MsgResult;

            Database.UpdateLoginCredentials(TXT_TeacherID.Text, TXT_TeacherPass.Text);
            if (Database.ComparisonTeachers())
            {
                Database.UpdateLoginCredentials(TXT_Username.Text, TXT_Password.Text);
                if (Database.ComparisonStudents())
                {
                    MsgResult = MessageBox.Show("Would you like to delete this student?", "Deleting Student", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (MsgResult == DialogResult.Yes)
                    {
                        Database.DeleteStudent();
                        MessageBox.Show("Student Deleted!");
                        Form Loadup = new LoginScreen(Database);
                        Loadup.Show();
                        this.Dispose();
                    }
                }
                else
                {
                    Database.SearchTeacher(TXT_FirstName.Text);
                    MsgResult = MessageBox.Show("Would you like to delete this teacher?", "Deleting Teacher", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (MsgResult == DialogResult.Yes)
                    {
                        Database.DeleteTeacher();
                        MessageBox.Show("Teacher Deleted!");
                        Form Loadup = new LoginScreen(Database);
                        Loadup.Show();
                        this.Dispose();
                    }
                }
            }
            else
            {
                MsgResult = MessageBox.Show("Invalid Teacher Credentials", "Invalid Details", MessageBoxButtons.OK, MessageBoxIcon.Question);
                if (MsgResult == DialogResult.Yes)
                {
                    TXT_TeacherID.Clear();
                    TXT_TeacherPass.Clear();
                }
            }
        }
Exemplo n.º 2
0
        private void BTN_Login_Click(object sender, EventArgs e)
        {
            DialogResult MsgResult;
            string       Output  = "Username or Password is incorrect, please try again";
            string       ExitMsg = "Loadup Error";

            Database.UpdateLoginCredentials(TXT_Username.Text, TXT_Password.Text);
            Database.FillStudentsTbl();
            if (Database.ComparisonStudents())
            {
                Form Menu = new SongMenu(Database);
                Menu.Show();
                this.Dispose();
            }
            else
            {
                MsgResult = MessageBox.Show(Output, ExitMsg, MessageBoxButtons.OK, MessageBoxIcon.Question);
                if (MsgResult == DialogResult.OK)
                {
                    TXT_Password.Clear();
                    TXT_Username.Clear();
                }
            }
        }