Esempio n. 1
0
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            Student s = null;

            s = StudentData.IsThereStudent(txtFNom.Text);
            if (s != null)
            {
                MainWindow Win1 = new MainWindow();
                Win1.DisplayInfo(s);
                Win1.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("No Student found");
            }
        }
Esempio n. 2
0
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            LoginValidation vali = new LoginValidation(txtUsername.Text, txtPassword.Text, ConsoleShowErr);

            if (vali.ValidateUserInput(ref MainWindow.user))
            {
                MainWindow Win1 = new MainWindow();
                Win1.Show();
                if (MainWindow.user.role == UserRole.STUDENT)
                {
                    Student st = StudentData.IsThereStudent(MainWindow.user.facultyNumber);
                    if (st != null)
                    {
                        Win1.DisplayInfo(st);
                    }
                    Win1.btnPermisions.IsEnabled = false;
                    Win1.btnSearch.IsEnabled     = false;
                }
                if (MainWindow.user.role == UserRole.PROFESSOR)
                {
                    TeacherControlWindow Teach = new TeacherControlWindow();
                    Teach.Show();
                    Win1.Close();
                    this.Close();

                    //Win1.btnPermisions.IsEnabled = false;
                }
                if (MainWindow.user.role == UserRole.ADMIN)
                {
                    AdminControlWindow Adm = new AdminControlWindow();
                    Adm.Show();
                    Win1.Close();
                    this.Close();

                    //Win1.btnPermisions.IsEnabled = false;
                }
                this.Close();
            }
            else
            {
                txtPassword.Text = "";
                Login.ConsoleShowErr("wrong info");
                vali = null;
            }
        }