Exemplo n.º 1
0
        private void PasswordJokes(string Password)
        {
            DialogResult MsgResult;

            Password = Password.ToLower();
            switch (Password)
            {
            case "beefstew":
                MsgResult = MessageBox.Show("Your password is not stroganoff!", "Password Error", MessageBoxButtons.OK, MessageBoxIcon.Question);
                if (MsgResult == DialogResult.OK)
                {
                    TXT_Password.Clear();
                    TXT_PassReEnter.Clear();
                }
                break;

            case "1forest1":
                MsgResult = MessageBox.Show("You are not forest gump", "Password Error", MessageBoxButtons.OK, MessageBoxIcon.Question);
                if (MsgResult == DialogResult.OK)
                {
                    TXT_Password.Clear();
                    TXT_PassReEnter.Clear();
                }
                break;
            }
        }
Exemplo n.º 2
0
        private void BTN_Register_Click(object sender, EventArgs e)
        {
            DialogResult MsgResult;

            PasswordJokes(TXT_Password.Text);
            bool IsValid = TXT_Password.Text != "" && TXT_FirstName.Text != "";

            if (IsValid || (!CHC_IsTeacher.Checked && IsValid && TXT_Username.Text != ""))
            {
                if (TXT_Password.Text == TXT_PassReEnter.Text)
                {
                    Database.UpdateLoginCredentials(TXT_TeacherID.Text, TXT_TeacherPass.Text);
                    if (Database.ComparisonTeachers())
                    {
                        if (CHC_IsTeacher.Checked)
                        {
                            Database.AddTeacher(TXT_FirstName.Text, TXT_Password.Text);
                            MsgResult = MessageBox.Show("Teacher Added Sucessfully", "Teacher Added", MessageBoxButtons.OK, MessageBoxIcon.Question);
                            Form StudentDetails = new NewStudentDetails(Database, TXT_FirstName.Text, true);
                            StudentDetails.Show();
                            this.Hide();
                        }
                        else
                        {
                            Database.AddStudent(TXT_FirstName.Text, TXT_Username.Text, TXT_Password.Text, TXT_TeacherID.Text);
                            MsgResult = MessageBox.Show("Student Added Sucessfully", "Student Added", MessageBoxButtons.OK, MessageBoxIcon.Question);
                            Database.UpdateLoginCredentials(TXT_Username.Text, TXT_Password.Text);
                            Form StudentDetails = new NewStudentDetails(Database, TXT_FirstName.Text, false);
                            StudentDetails.Show();
                            this.Hide();
                        }
                    }
                    else
                    {
                        MsgResult = MessageBox.Show("You must have your teachers correct details!", "Incorrect Teacher!!!", MessageBoxButtons.OK, MessageBoxIcon.Question);
                    }
                }
                else
                {
                    MsgResult = MessageBox.Show("Your password is not the same!", "Password Error", MessageBoxButtons.OK, MessageBoxIcon.Question);
                    if (MsgResult == DialogResult.OK)
                    {
                        TXT_Password.Clear();
                        TXT_PassReEnter.Clear();
                    }
                }
            }
            else
            {
                MsgResult = MessageBox.Show("There is blank fields!", "Credentials Error", MessageBoxButtons.OK, MessageBoxIcon.Question);
                if (MsgResult == DialogResult.OK)
                {
                    TXT_Password.Clear();
                    TXT_PassReEnter.Clear();
                }
            }
        }