//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; }
//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; }
public void AddCourseRecord(CourseRecord cr) { records.Add(cr); }
public void RemoveCourseRecord(CourseRecord cr) { records.Remove(cr); }