public List<StudentSchedule> GetStudentExistingSchedule(List<StudentSubject> studSubs, string sy) { List<StudentSchedule> schedList = new List<StudentSchedule>(); schedList = GetSchedules(sy); List<StudentSchedule> existing = new List<StudentSchedule>(); StudentSchedule stud = new StudentSchedule(); foreach (StudentSubject ss in studSubs) { int index = schedList.FindIndex(item => item.SubjectAssignments == ss.SubjectAssignments); stud = schedList[index]; stud.Selected = false; existing.Add(stud); } return existing; }
public void TranslateSAToLoadStudentSchedule(SubjectAssignment sab, StudentSchedule sa) { sa.GradeSection = sab.GradeSection; sa.Section = sab.Section; sa.GradeLevel = sab.GradeLevel; sa.Class = sab.Class; sa.Room = sab.Room; sa.RoomCode = sab.RoomCode; sa.Subject = sab.Subject; sa.Teacher = sab.Teacher; sa.TeacherName = sab.TeacherName; sa.Timeslot = sab.Timeslot; sa.Timestart = sab.Timestart; sa.TimeEnd = sab.TimeEnd; sa.Days = sab.Days; sa.Deactivated = sab.Deactivated; sa.GradeSectionCode = sab.GradeSectionCode; sa.RoomId = sab.RoomId; sa.SubjectCode = sab.SubjectCode; sa.SY = sab.SY; sa.TeacherId = sab.TeacherId; sa.TimeSlotCode = sab.TimeSlotCode; sa.SubjectInfo = sa.SubjectInfo; sa.SubjectDescription = sa.SubjectDescription; }
public List<StudentSchedule> GetSchedules(string sy) { List<SubjectAssignment> schedList = new List<SubjectAssignment>(); schedList = GetAllSchedules(sy); List<StudentSchedule> studSched = new List<StudentSchedule>(); foreach (SubjectAssignment sab in schedList) { int index = -1; index = studSched.FindIndex(item=>item.SubjectCode==sab.SubjectCode && item.GradeSectionCode==sab.GradeSectionCode ) ; if (index == -1) { StudentSchedule sa = new StudentSchedule(); TranslateSAToLoadStudentSchedule(sab, sa); sa.SubjectAssignments = sab.SubjectAssignmentsID.ToString(); sa.TimeslotInfo = sab.TimeslotInfo; studSched.Add(sa); } else { studSched[index].SubjectAssignments+=" "+sab.SubjectAssignmentsID.ToString(); studSched[index].TimeslotInfo +=" "+sab.TimeslotInfo; } } return studSched; }