public override bool Equals(object obj) { PlanCourse course = obj as PlanCourse; if (course != null) { if (course.ID == ID) { return(true); } return(false); } return(base.Equals(obj)); }
public PlanCourseEdit(PlanCourse pcourse) { ID = pcourse.ID; if(pcourse.courseID != null){ courseID = (int)pcourse.courseID; courseHeader = pcourse.course.courseHeader; }else{ courseID = null; courseHeader = null; } if (pcourse.electiveListID != null) { electiveListName = pcourse.electiveList.electiveListName; } else { electiveListName = null; } notes = pcourse.notes; }
private void ChangeDegreeProgram(Plan plan) { List<PlanCourse> plans = Request<PlanCourse>.GetAll("A", "B").Where(i => i.planID == plan.ID).ToList();//planCourses.Where(i => i.planID == plan.ID).ToList(); foreach (PlanCourse planCourse in plans) { Request<PlanCourse>.Delete(planCourse.ID, "A", "B"); } Dictionary<int, int> semesterOrders = new Dictionary<int, int>(); Dictionary<int, int> semesterMap = new Dictionary<int, int>(); int nowSem = 1; List<Semester> semesterList = Request<Semester>.GetAll("A", "B").Where(i => i.ID >= plan.semesterID).ToList(); foreach (Semester sem in semesterList) { if (sem.standard == true) { semesterMap.Add(nowSem, sem.ID); semesterOrders.Add(nowSem, 0); nowSem++; } } List<RequiredCourse> requirements = plan.degreeProgram.requiredCourses.ToList(); foreach (RequiredCourse req in requirements) { PlanCourse pcourse = new PlanCourse(); pcourse.planID = plan.ID; int order = semesterOrders[req.semester]; pcourse.order = order; semesterOrders[req.semester] = order + 1; pcourse.semesterID = semesterMap[req.semester]; pcourse.courseID = req.courseID; pcourse.credits = req.course.courseHours; Request<PlanCourse>.Add(pcourse, "A", "B"); } List<ElectiveCourse> elects = plan.degreeProgram.electiveCourses.ToList(); foreach (ElectiveCourse elect in elects) { PlanCourse pcourse = new PlanCourse(); pcourse.planID = plan.ID; int order = semesterOrders[elect.semester]; pcourse.order = order; semesterOrders[elect.semester] = order + 1; pcourse.semesterID = semesterMap[elect.semester]; pcourse.electiveListID = elect.electiveListID; pcourse.credits = elect.credits.ToString(); Request<PlanCourse>.Add(pcourse, "A", "B"); } }