Exemple #1
0
        private void Window_Loaded_User(object sender, RoutedEventArgs e)
        {
            //listviewUser.ItemsSource = marks;
            if (Global.Teacher.Type == "PDT")
            {
                listSubject.Add("All");
                List <string> temp = SubjectBUS.loadListNameSubject();
                int           n    = temp.Count;
                for (int i = 0; i < n; i++)
                {
                    listSubject.Add(temp[i]);
                }
                chooseSubject.ItemsSource   = listSubject;
                chooseSubject.SelectedIndex = 1;

                chooseClass.ItemsSource   = AcademicAffairsOfficeBUS.loadListClassToComboBox();
                chooseClass.SelectedIndex = 0;

                if (chooseSemester.SelectedValue.ToString() == "System.Windows.Controls.ComboBoxItem: I")
                {
                    semester = "1";
                }
                else
                {
                    semester = "2";
                }

                if (chooseSubject.SelectedValue.ToString() != "All")
                {
                    listviewUser.ItemsSource = MarkBUS.loadMarkByNameSubject(chooseSubject.SelectedValue.ToString(), chooseClass.SelectedValue.ToString(), Global.schoolYear, semester);
                }
                else
                {
                    listviewUser.ItemsSource = MarkBUS.loadMarkByClass(chooseClass.SelectedValue.ToString(), Global.schoolYear, semester);
                }
            }
            else
            {
                chooseClass.ItemsSource   = TeacherBUS.loadListClassToComboBox(Global.Teacher.Id, Global.schoolYear);
                chooseClass.SelectedIndex = 0;

                chooseSubject.ItemsSource   = TeacherBUS.loadListSubjectToComboBoxInUpdate(Global.Teacher.Id, chooseClass.SelectedValue.ToString(), Global.schoolYear);
                chooseSubject.SelectedIndex = 0;

                if (chooseSemester.SelectedValue.ToString() == "System.Windows.Controls.ComboBoxItem: I")
                {
                    semester = "1";
                }
                else
                {
                    semester = "2";
                }

                listviewUser.ItemsSource = MarkBUS.loadMarkByNameSubject(chooseSubject.SelectedValue.ToString(), chooseClass.SelectedValue.ToString(), Global.schoolYear, semester);
            }
            btnEdit.IsEnabled = false;
        }
        private void Window_Loaded_ReviewScore(object sender, RoutedEventArgs e)
        {
            isLoaded         = true;
            id_title.Content = Global.Student.Id;
            if (Global.Teacher.Type == "PDT")
            {
                listSubject.Add("All");
                List <string> temp = SubjectBUS.loadListNameSubject();
                int           n    = temp.Count;
                for (int i = 0; i < n; i++)
                {
                    listSubject.Add(temp[i]);
                }
                chooseSubject.ItemsSource   = listSubject;
                chooseSubject.SelectedIndex = 0;

                chooseYear.ItemsSource   = AcademicAffairsOfficeBUS.getNameClassWithIDStudent(Global.Student.Id);
                chooseYear.SelectedIndex = 0;
                if (chooseSemester.SelectedValue.ToString() == "System.Windows.Controls.ComboBoxItem: I")
                {
                    semester = "1";
                }
                else
                {
                    semester = "2";
                }


                // MessageBox.Show(chooseSemester.SelectedValue.ToString());
                //MessageBox.Show(chooseSubject.SelectedValue.ToString());
                if (chooseSubject.SelectedValue.ToString() == "All")
                {
                    test.ItemsSource = MarkBUS.loadMark(Global.Student.Id, chooseYear.SelectedValue.ToString(), semester);
                }
                else
                {
                    // test.ItemsSource = MarkBUS.loadMark(Global.Student.Id, Global.Student.NameClass, Global.Student.SchoolYear, semester);
                    test.ItemsSource = MarkBUS.loadMarkByNameWithoutSchoolYear(Global.Student.Id, chooseYear.SelectedValue.ToString(), semester, chooseSubject.SelectedValue.ToString());
                }
            }
            else
            {
                listSubject = TeacherBUS.loadListSubjectToComboBoxInUpdate(Global.Teacher.Id, Global.Student.NameClass, Global.Student.SchoolYear);
                chooseSubject.ItemsSource   = listSubject;
                chooseSubject.SelectedIndex = 0;

                chooseYear.ItemsSource   = AcademicAffairsOfficeBUS.getNameClassWithIDStudent(Global.Student.Id);
                chooseYear.SelectedIndex = 0;


                if (chooseSemester.SelectedValue.ToString() == "System.Windows.Controls.ComboBoxItem: I")
                {
                    semester = "1";
                }
                else
                {
                    semester = "2";
                }


                // MessageBox.Show(chooseSemester.SelectedValue.ToString());
                //MessageBox.Show(chooseSubject.SelectedValue.ToString());
                if (chooseSubject.SelectedValue.ToString() == "All")
                {
                    test.ItemsSource = MarkBUS.loadMark(Global.Student.Id, chooseYear.SelectedValue.ToString(), semester);
                }
                else
                {
                    // test.ItemsSource = MarkBUS.loadMark(Global.Student.Id, Global.Student.NameClass, Global.Student.SchoolYear, semester);
                    test.ItemsSource = MarkBUS.loadMarkByNameWithoutSchoolYear(Global.Student.Id, chooseYear.SelectedValue.ToString(), semester, chooseSubject.SelectedValue.ToString());
                }
            }
        }