예제 #1
0
        //Does the same as the above method but for the student user type
        public void LoginStudent()
        {
            ModelRegisterLogin stud = new ModelRegisterLogin();

            List <ModelRegisterLogin> list = cl.GetAllFromStudentLogin(connectionString);

            try
            {
                stud = list.Find((ModelRegisterLogin x) => x.STUD_USERNAME == Int32.Parse(tbUsernameLog.Text));

                if (stud.STUD_USERNAME.ToString().Equals(tbUsernameLog.Text) && stud.STUD_PASSWORD.ToString().Equals(tbPasswordLog.Password))
                {
                    MessageBox.Show("Login Successful !\nWelcome STUDENT " + stud.STUD_USERNAME.ToString());
                    MainMenuStudent ms = new MainMenuStudent(Int32.Parse(tbUsernameLog.Text));
                    ms.Show();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Incorrect username or password\nPlease recheck your credentials and try again", "Error");
                    tbUsernameLog.Text     = "";
                    tbPasswordLog.Password = "";
                }
            }
            catch (System.Exception)
            {
                MessageBox.Show("Incorrect username or password\nPlease recheck your credentials and try again", "Error");
                tbUsernameLog.Text     = "";
                tbPasswordLog.Password = "";
            }
        }
        //returns the user to the student dashboard
        private void BtMainMenu_Click(object sender, RoutedEventArgs e)
        {
            MainMenuStudent mms = new MainMenuStudent(currentUser);

            mms.Show();
            this.Close();
        }