コード例 #1
0
        private void BackButton_Click(object sender, RoutedEventArgs e)
        {
            LectureMenu lectureMenu = new LectureMenu(lectureID);

            lectureMenu.Show();
            this.Hide();
        }
        private void BackButton_Click(object sender, RoutedEventArgs e)
        {
            //goes back to the Lectures menu
            LectureMenu lecturerMenu = new LectureMenu(LectureID);

            lecturerMenu.Show();
            this.Hide();
        }
        private void SubmitButton_Click(object sender, RoutedEventArgs e)
        {
            //once lecturer is finished creating a test and adding Questions this button takes them to their menu
            LectureMenu lecturerMenu = new LectureMenu(lecturerID);

            lecturerMenu.Show();
            this.Hide();
        }
        private void LogInButton_Click_1(object sender, RoutedEventArgs e)
        {
            //method that loads the databases into lists and compares the users input to that from the database
            bool isCorrect = false;

            QueryDatabaseStudents();
            QueryDatabaseLecturers();
            try
            {
                //loop running through all lectures
                for (int i = 0; i < lecturesList.Count; i++)
                {
                    if (usernameTextBox.Text == lecturesList[i].LectureID && EncryptionDll.EncryptData(passwordTextBox.Text, "ffhhgfgh") == lecturesList[i].Password)
                    {
                        LectureID = lecturesList[i].LectureID;
                        LectureMenu lecturerMenu = new LectureMenu(LectureID);
                        this.Hide();
                        lecturerMenu.Show();
                        isCorrect = true;
                        break;
                    }
                }
                //loop running through all students
                for (int i = 0; i < studentsList.Count; i++)
                {
                    if (usernameTextBox.Text == studentsList[i].StudentID && EncryptionDll.EncryptData(passwordTextBox.Text, "ffhhgfgh") == studentsList[i].Password)
                    {
                        StudentMenu studentMenu = new StudentMenu(studentsList[i].StudentID);
                        studentMenu.Show();
                        this.Hide();
                        isCorrect = true;
                        break;
                    }
                }
            }
            catch (Exception)
            {
            }
            if (isCorrect == false)
            {
                MessageBox.Show("invalid username or password. Try again!", "LogIn Error", MessageBoxButton.OK);
            }
        }