Beispiel #1
0
        public static Student GetStudentDataByUser(User user)
        {
            /*List<Student> students = StudentData.getStudents();
             * return students.Find(s => s.firstName.Equals(user.userName) && s.facNumber.Equals(user.facNumber));*/

            return(StudentData.IsThereStudent(user.facNumber));
        }
        private void btnIntern(object sender, RoutedEventArgs e)
        {
            Intern In = new Intern(StudentData.IsThereStudent(((StudentList.SelectedItem) as Student).Fnom));

            // In.CurrentStudent =;// StudentList.SelectedItem);
            In.Show();
        }
 static public Student GetStudentDataByUser(User user)
 {
     if (user.FacultyNumber.Equals(String.Empty))
     {
         throw new Exception("Faculty number field is empty");
     }
     return(StudentData.IsThereStudent(user.FacultyNumber));
 }
        private void facNumSearchButton_Click(object sender, RoutedEventArgs e)
        {
            Student stud = StudentData.IsThereStudent(facNumSearchTextBox.Text);

            if (stud != null)
            {
                EnableForm();
                FillStudentInfo(stud);
            }
        }
        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");
            }
        }
Beispiel #6
0
        private void BtnLogin_Click(object sender, RoutedEventArgs e)
        {
            User user = UserData.IsUserPassCorrect(txtBoxName.Text, txtBoxPass.Text);

            if (user != null)
            {
                InfoWindow info = new InfoWindow(StudentData.IsThereStudent(user.FakNum));
                this.Visibility = Visibility.Collapsed;
                info.ShowDialog();
                this.Visibility = Visibility.Visible;
                this.Close();
            }
            else
            {
                MessageBox.Show("There is no such User!");
            }
        }
Beispiel #7
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;
            }
        }
        private void LoginUser()
        {
            LoginValidation validator = new LoginValidation(usernameTextBox.Text, passwordBox.Password, DisplayMessage);
            User            user      = null;

            if (validator.ValidateUserInput(ref user))
            {
                DisableLoginForm();
                if (user.role == (int)UserRoles.STUDENT)
                {
                    Student stud = StudentData.IsThereStudent(user.facNumber);
                    EnableForm();
                    FillStudentInfo(stud);
                }
                if (user.role == (int)UserRoles.PROFESSOR)
                {
                    //FacNumSearchGrid.Visibility = Visibility.Visible;
                    ProfessorWindow main = new ProfessorWindow();
                    App.Current.MainWindow = main;
                    this.Close();
                    main.Show();
                }
            }
        }
        private void BtnLogin_Click(object sender, RoutedEventArgs e)
        {
            var students = UserData.Users;
            var user     = students.FirstOrDefault(x => x.UserName == txtInputUserName.Text && x.Password == txtInputPassword.Text);

            if (user == null)
            {
                txtInputPassword.Text = "";
                txtInputUserName.Text = "";
                DisableInputFields();
                MessageBox.Show($"Грешка! Няма такъв потребител.");
                return;
            }

            var studentRepo = new StudentData();
            var student     = studentRepo.IsThereStudent(user.FacultyNumber);

            Student = student;
            EnableInputFields();
            txtInputPassword.Text = "";
            txtInputUserName.Text = "";
            btnLogin.Visibility   = Visibility.Hidden;
            btnLogout.Visibility  = Visibility.Visible;
        }
 public static Student GetStudentDataByFacultyNumber(User user)
 {
     return(StudentData.IsThereStudent(user.FacultyNumber));
 }