Ejemplo n.º 1
0
        //edit form closing method to actually edit from each year
        private void EditSubjectFormClosing(object subjectForm, EventArgs e)
        {
            //grabs subject grade from subject form, pull out year
            SubjectGrade subjectGradeRecord = (subjectForm as EditClassForm).ClassGrade;
            int          year = (subjectForm as EditClassForm).Year;

            //if year is changed: move courses from the year combobox, indexed subjects by year
            if (year != yearComboBox.SelectedIndex)
            {
                selectedStudent.Subjects[yearComboBox.SelectedIndex].RemoveAt(classBox1.SelectedIndex);

                //for loop for adding selected students in subject grade, add new collections
                for (int i = selectedStudent.Subjects.Count - 1; i < year; i++)
                {
                    selectedStudent.Subjects.Add(new List <SubjectGrade>());
                }
                //adds to correct year and remove subject editing from the listbox
                selectedStudent.Subjects[year].Add(subjectGradeRecord);
                classBox1.Items.RemoveAt(classBox1.SelectedIndex);
            }

            else
            {
                //if year wasnt changed: just look at subjects collection and index to it, then overwrites it.
                selectedStudent.Subjects[yearComboBox.SelectedIndex][classBox1.SelectedIndex] = subjectGradeRecord;
                classBox1.Items[classBox1.SelectedIndex] = subjectGradeRecord;
            }
        }
Ejemplo n.º 2
0
 public void LoadClassGrade(SubjectGrade classGrade, int year)
 {
     this.classGrade          = classGrade;
     YearBox.SelectedIndex    = year;
     SubjectBox.SelectedIndex = (int)this.classGrade.Subject;
     GradeBox.SelectedIndex   = (int)this.classGrade.Grade;
 }
Ejemplo n.º 3
0
        //adding and categorizing the subject by year
        private void NewSubjectFormClosing(object subjectForm, EventArgs e)
        {
            SubjectGrade subjectGradeRecord = (subjectForm as EditClassForm).ClassGrade;
            int          year = (subjectForm as EditClassForm).Year;

            //for loop to count subjects by the year and organize
            for (int i = selectedStudent.Subjects.Count - 1; i < year; i++)
            {
                selectedStudent.Subjects.Add(new List <SubjectGrade>());
            }
            if (year != yearComboBox.SelectedIndex)
            {
                classBox1.Items.Add(subjectGradeRecord);
            }

            selectedStudent.Subjects[year].Add(subjectGradeRecord);
        }