public MainWindow()
 {
     InitializeComponent();
     StudentData.InitTestStudents();
     UserData.ResetTestUserData();
     DisableForm();
 }
Exemple #2
0
        public static Student GetStudentDataByUser(User user)
        {
            long facultyNumber;

            if (!long.TryParse(user.FacultyNumber, out facultyNumber))
            {
                //error invalid faculty number
                return(null);
            }

            Student student = null;

            foreach (User u in UserData.TestUsers)
            {
                long tempFacultyNumber = -1;
                if (long.TryParse(u.FacultyNumber, out tempFacultyNumber) && facultyNumber == tempFacultyNumber)
                {
                    student = StudentData.getStudentByFacutlyNumber(facultyNumber);
                    break;
                }
            }

            //error student not found
            return(student);
        }
Exemple #3
0
        private void getStudent_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            string facNumber = this.studentFacNumber.Text;

            clearListBox();

            if (facNumber == "")
            {
                addAllStudents();
                return;
            }

            Student student = null;

            try
            {
                student = StudentData.GetStudent(facNumber);

                string fullName = student.FirstName + " " + student.SecondName + " " + student.LastName;
                this.studentsList.Items.Add(fullName);
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
            }
        }
Exemple #4
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 Login_Click(object sender, RoutedEventArgs e)
        {
            String username = usernameLogin.Text;
            String password = passLogin.Text;

            User resultU = UserData.isUserPassCorrect(username, password);

            if (resultU == null)
            {
                MessageBox.Show("Потребител с такова потребитслко име или парола не съществува!");
                return;
            }
            else
            {
                currentUserUsername = resultU.Username;
            }

            if (resultU.Role == (int)UserRoles.STUDENT)
            {
                String  fakNum = resultU.FakNum;
                Student s      = StudentData.findStudentByFakNum(long.Parse(fakNum));
                activateFormFields();
                currentStudent = s;
                loadStudent(s);
            }
            else if (resultU.Role == (int)UserRoles.PROFESSOR)
            {
                ProffesorSuccess proffesorSuccessPage = new ProffesorSuccess();
                NavigationService.Navigate(proffesorSuccessPage);

                //enterNotes.IsEnabled = true;
                //fakNumGB.IsEnabled = true;
            }
        }
 public Student getStudentDataByUser(User user)
 {
     if (user.FacNumber == null || StudentData.isUserExistByFacNumber(user.FacNumber))
     {
     }
     return(null);
 }
        private void btnIntern(object sender, RoutedEventArgs e)
        {
            Intern In = new Intern(StudentData.IsThereStudent(((StudentList.SelectedItem) as Student).Fnom));

            // In.CurrentStudent =;// StudentList.SelectedItem);
            In.Show();
        }
Exemple #8
0
 public ListWindow()
 {
     students = new ObservableCollection <Student>();
     InitializeComponent();
     DataContext = this;
     FillList(StudentData.getAllStudents());
 }
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            StudentData cntx = new StudentData();

            cntx.TestStudentsIfEmpty();
            // MessageBox.Show(cntx.ToString());
        }
Exemple #10
0
        private void SearchSt_Click(object sender, RoutedEventArgs e)
        {
            String  fn = fakNumByProf.Text;
            Student s  = StudentData.findStudentByFakNum(long.Parse(fn));

            activateFormFields();
            loadStudent(s);
        }
 public StudentViewModel()
 {
     Student      = new Student();
     FormState    = new State();
     studentData  = new StudentData();
     CheckCommand = new StudentCheckCommand(this);
     ClearCommand = new StudentClearCommand(this);
 }
 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));
 }
        //public event PropertyChangedEventHandler PropertyChanged;

        //public List ProfStListProp
        //{
        //    get { }
        //    set
        //    {
        //    }
        //}

        public void  loadStudentList()
        {
            stDict = StudentData.getAllStudents();
            foreach (Student st in stDict.Values)
            {
                strudentsOC.Add(st);
            }
        }
 public Login()
 {
     InitializeComponent();
     _validation = new StudentValidation(message => MessageBox.Show(message));
     Logger.Logger.plant();
     UserData.ResetTestUserData();
     StudentData.AddStudents();
 }
Exemple #15
0
 public Student GetStudentDataByUser(UserLogin.User user)
 {
     if (!user.FacultyNumber.Equals(string.Empty) ||
         StudentData.IsFacultyNumberValid(user.FacultyNumber))
     {
         return(new Student());
     }
     return(null);
 }
Exemple #16
0
        private void buttonSearchStudent_Click(object sender, RoutedEventArgs e)
        {
            Student s = StudentData.GetStudent((int.Parse(tb_fNumberProfessor.Text)));

            if (s != null)
            {
                fillStudentControls(s);
            }
        }
        private void facNumSearchButton_Click(object sender, RoutedEventArgs e)
        {
            Student stud = StudentData.IsThereStudent(facNumSearchTextBox.Text);

            if (stud != null)
            {
                EnableForm();
                FillStudentInfo(stud);
            }
        }
        public void CopyTestUsers()
        {
            UserContext context     = new UserContext();
            StudentData studentdata = new StudentData();

            foreach (User user in UserData.TestUsers)
            {
                context.Users.Add(user);
            }
            context.SaveChanges();
        }
 private void studentButton_Click(object sender, RoutedEventArgs e)
 {
     if (StudentData.GetStudent(facNumberTB.Text) != null)
     {
         SetStudentData(StudentData.GetStudent(facNumberTB.Text));
     }
     else
     {
         ClearTextBoxes();
         createStudentButton.Visibility = Visibility.Visible;
     }
 }
 private void loadFunctionalitiesAccordingRole()
 {
     if (user.role == 2)
     {
         facNumberTB.IsEnabled    = true;
         studentButton.Visibility = Visibility.Visible;
         this.NavigationService.Navigate(new InspectorPage());
     }
     else if (user.role == 4)
     {
         SetStudentData(StudentData.GetStudent(user.number));
     }
 }
Exemple #21
0
        public void addAllStudents()
        {
            clearListBox();
            StudentData.AddSomeStudents();
            List <Student> students = StudentData.DefaultStudents;

            foreach (Student student in students)
            {
                string fullName = student.FirstName + " " + student.SecondName + " " + student.LastName;

                this.studentsList.Items.Add(fullName);
            }
        }
Exemple #22
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (groupField.Text == "")
     {
         FillList(StudentData.getAllStudents());
     }
     else
     {
         int group;
         Int32.TryParse(groupField.Text, out group);
         FillList(StudentData.getStudentsFromGroup(group));
     }
 }
        public MainWindow()
        {
            InitializeComponent();
            FillStudStatusChoices();

            if (GradesData.TestGradesEmpty() == true)
            {
                GradesData.CopyTestGrades();
            }


            if (StudentData.TestStudentsIfEmpty() == true)
            {
                StudentData.CopyTestStudents();
            }
        }
        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");
            }
        }
Exemple #25
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!");
            }
        }
Exemple #26
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 BtnFillData_Click(object sender, RoutedEventArgs e)
        {
            // TODO: Find better way of doing this. Also add input box to get the current student
            var repository = new StudentData();
            var student    = repository.Students[0];

            txtCourse.Text        = student.Course.ToString();
            txtDegree.Text        = student.Degree;
            txtFaculty.Text       = student.Faculty;
            txtFacultyNumber.Text = student.FacultyNumber;
            txtFirstName.Text     = student.FirstName;
            txtGroup.Text         = student.Group.ToString();
            txtLastName.Text      = student.LastName;
            txtSpecialty.Text     = student.Specialty;
            txtStatus.Text        = student.Status;
            txtStream.Text        = student.Stream.ToString();
            txtSurName.Text       = student.SurName;
        }
        public MainWindow()
        {
            StudentData.addTestStudents();

            if (user == null)
            {
                Login Log1 = new Login();
                this.Close();
                Log1.Show();
            }
            else
            {
                addFaculties();
                addDegree();
                FillStudStatusChoices();
                InitializeComponent();
                currentUser.Content = "Current user: "******"  as:  " + user.role.ToString();
            }
        }
        public void SaveChanges()
        {
            Student student = StudentData.GetStudentByFacultyNumber(Student.FacultyNumber);

            UserLogin.User user = UserLogin.UserData.GetUserByFacultyNumber(Student.FacultyNumber);
            if (student != null)
            {
                if (user != null)
                {
                    student.LastEnter = user.LastEnter.ToString();
                }
                Student.SetStudent(student);
            }
            else
            {
                Student.Clear();
                FormState.IsEnabled = false;
            }
        }
        public void PopulateData(object sender, RoutedEventArgs e)
        {
            String studentName = txtName.Text;

            foreach (Student student in StudentData.getStudents())
            {
                if (studentName.Equals(student.firstName))
                {
                    txtName.Text       = student.firstName;
                    txtMiddlename.Text = student.middleName;
                    txtLastname.Text   = student.lastName;
                    txtFaculty.Text    = student.faculty;
                    txtSpeciality.Text = student.speciality;
                    txtOKS.Text        = student.degree;
                    txtStatus.Text     = student.status;
                    txtFacNumber.Text  = student.facultyNumber.ToString();
                    txtCourse.Text     = student.course.ToString();
                    txtStream.Text     = student.stream.ToString();
                    txtGroup.Text      = student.group.ToString();
                }
            }
        }