//This method is only called when Adding a Class.
 //DataSetConnector should already exist; if not, it is created and
 //the DataTables are loaded.
 public bool AddCourseRecord(CourseRecord cr)
 {
     if (XMLDataSetConnector.Instance.AddNewCourseRecordAndSTS(
         cr.GetStudent().GetID(), cr.GetSection().GetID(), Grade.None))
     {
         courseRecords.Add(cr);
         return true;
     }
     return false;
 }
 //University should always exist before CourseRecords are accessed
 public List<CourseRecord> GetCourseRecordsByStudent(Student st)
 {
     List<CourseRecord> crs = new List<CourseRecord>();
     DataRow[] rows = _studentRecords.CRsAndSsToSs.Select("StudentID = '" + st.GetID() + "'");
     foreach (DataRow row in rows)
     {
         StudentRecordsDataSet.CRsAndSsToSsRow r = (StudentRecordsDataSet.CRsAndSsToSsRow) row;
         Section s = University.Instance.GetSectionByID(r.SectionID);
         CourseRecord rec = new CourseRecord(r.Grade, s, st);
         crs.Add(rec);
     }
     return crs;
 }
        public bool ModifyCR(CourseRecord cr, String g)
        {
            String expression = "StudentID = '" + cr.GetStudent().GetID() + "' AND ";
            expression += "SectionID = '" + cr.GetSection().GetID() + "'";

            DataRow[] rows = _studentRecords.CRsAndSsToSs.Select(expression);
            if (rows.Length == 0) return false;

            StudentRecordsDataSet.CRsAndSsToSsRow r = (StudentRecordsDataSet.CRsAndSsToSsRow)rows[0];
            if (r.Grade.Equals(g)) return false;

            r.Grade = g;

            UpdateXml();
            return true;
        }
 public void AddCourseRecord(CourseRecord cr)
 {
     records.Add(cr);
 }
 public void RemoveCourseRecord(CourseRecord cr)
 {
     records.Remove(cr);
 }
 //This method is only called when Dropping a Class.
 //DataSetConnector should already exist; if not, it is created and
 //the DataTables are loaded.
 public bool RemoveCourseRecord(CourseRecord cr)
 {
     if (XMLDataSetConnector.Instance.RemoveCourseRecordAndSTS(
          cr.GetStudent().GetID(), cr.GetSection().GetID()))
     {
         courseRecords.Remove(cr);
         return true;
     }
     return false;
 }
        private void Sections_listBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            Students_listBox.Items.Clear();
            Grades_listBox.Items.Clear();
            this.errMsg_textBox.Text = "Select Student and Grade";
            Grade_comboBox.SelectedItem = Grade_comboBox.Items[0];
            cr = null;

            section = sections[Sections_listBox.SelectedIndex];
            students = section.GetStudents();

            LoadStudentsAndGrades();
        }
        private void Students_listBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.errMsg_textBox.Text = "Select Student and Grade";
            Grade_comboBox.Text = "";

            Student student = students[Students_listBox.SelectedIndex];
            cr = student.GetTranscript().GetCourseRecordBySectionID(section.GetID());

            Grade_comboBox.Text = cr.GetGrade().ToString();
        }
        private void Semesters_listBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            Sections_listBox.Items.Clear();
            Students_listBox.Items.Clear();
            Grades_listBox.Items.Clear();
            this.errMsg_textBox.Text = "Select Student and Grade";
            Grade_comboBox.SelectedItem = Grade_comboBox.Items[0];
            students = null; section = null; cr = null;

            Semester sem = semesters[Semesters_listBox.SelectedIndex];
            sections = University.Instance.GetSectionsByEmployeeUserIDAndSemester(employee.GetID(), sem);
            foreach (Section s in sections)
            {
                String sectionString = s.GetCourse().GetDepartment() + " ";
                sectionString += s.GetCourse().GetNumber() + " - ";
                sectionString += s.GetNumber().ToString().PadLeft(3, '0');
                Sections_listBox.Items.Add(sectionString);
            }
        }