private void Window_Loaded_Student(object sender, RoutedEventArgs e)
        {
            if (Global.Teacher.Type == "PDT")
            {
                chooseYear.ItemsSource   = AcademicAffairsOfficeBUS.loadListSchoolYearToComboBox();
                chooseYear.SelectedIndex = 0;

                chooseClass.ItemsSource   = AcademicAffairsOfficeBUS.loadListClassToComboBox(chooseYear.SelectedValue.ToString());
                chooseClass.SelectedIndex = 0;

                Global.listStudent          = AcademicAffairsOfficeBUS.loadListStudent(chooseClass.SelectedValue.ToString(), chooseYear.SelectedValue.ToString());
                listviewStudent.ItemsSource = Global.listStudent;
            }
            else
            {
                chooseYear.ItemsSource        = TeacherBUS.loadSchoolYearToComboBox(Global.Teacher.Id);
                chooseYear.SelectedIndex      = 0;
                chooseClass.ItemsSource       = TeacherBUS.loadListClassToComboBox(Global.Teacher.Id, chooseYear.SelectedValue.ToString());
                chooseClass.SelectedIndex     = 0;
                Global.listStudent            = AcademicAffairsOfficeBUS.loadListStudent(chooseClass.SelectedValue.ToString(), chooseYear.SelectedValue.ToString());
                listviewStudent.ItemsSource   = Global.listStudent;
                listviewStudent.SelectedIndex = 0;
            }
            //  Global.listStudent = AcademicAffairsOfficeBUS.loadListStudent(chooseClass.SelectedItem.ToString(), chooseYear.SelectedItem.ToString());

            //   listviewStudent.ItemsSource = Global.listStudent;
        }
Exemple #2
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 ChooseYear_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (chooseClass.SelectedValue != null && chooseYear.SelectedValue != null)
     {
         if (Global.Teacher.Type == "PDT")
         {
             chooseClass.ItemsSource   = AcademicAffairsOfficeBUS.loadListClassToComboBox(chooseYear.SelectedValue.ToString());
             chooseClass.SelectedIndex = 0;
         }
         else
         {
             chooseClass.ItemsSource   = TeacherBUS.loadListClassToComboBox(Global.Teacher.Id, chooseYear.SelectedValue.ToString());
             chooseClass.SelectedIndex = 0;
         }
         Global.listStudent          = AcademicAffairsOfficeBUS.loadListStudent(chooseClass.SelectedItem.ToString(), chooseYear.SelectedItem.ToString());
         listviewStudent.ItemsSource = Global.listStudent;
     }
 }