Пример #1
0
        public List<TeacherLoad> GetAllTeachersLoad(string sy)
        {
            SubjectAssignmentService sas = new SubjectAssignmentService();
            List<TeacherLoad> load = new List<TeacherLoad>();
            List<SubjectAssignment> loadBdoList = new List<SubjectAssignment>();
            loadBdoList = sas.GetTeacherSchedule(sy);

            foreach (SubjectAssignment sab in loadBdoList)
            {
                int index = -1;
                int gsc = sab.GradeSectionCode;
                index = load.FindIndex(item => item.GradeSectionCode == gsc && item.SubjectCode==sab.SubjectCode);
                if (index == -1)
                {
                    TeacherLoad sa = new TeacherLoad();
                    TranslateScheduleToLoad(sab, sa);
                    sa.SubjectAssignments = sab.SubjectAssignmentsID.ToString();
                    sa.TimeslotInfo = sab.TimeslotInfo;
                    load.Add(sa);
                }
                else
                {
                    string asses = String.Empty;
                    asses = load[index].SubjectAssignments;
                    string tlinfo = String.Empty;
                    tlinfo = load[index].TimeslotInfo;
                    load[index].SubjectAssignments = asses + " " + sab.SubjectAssignmentsID.ToString();
                    load[index].TimeslotInfo = tlinfo + "/" + sab.TimeslotInfo;
                }
            }
            return load;
        }
Пример #2
0
        public void TranslateScheduleToLoad(SubjectAssignment sa, TeacherLoad tl)
        {
            tl.GradeSection = sa.GradeSection;
            tl.Section = sa.Section;
            tl.GradeLevel = sa.GradeLevel;
            tl.Class = sa.Class;

            tl.Room = sa.Room;
            tl.RoomCode = sa.RoomCode;

            tl.Subject = sa.Subject;
            tl.Teacher = sa.Teacher;
            tl.TeacherName = sa.TeacherName;

            tl.Timeslot = sa.Timeslot;
            tl.Timestart = sa.Timestart;
            tl.TimeEnd = sa.TimeEnd;
            tl.Days = sa.Days;

            tl.Deactivated = sa.Deactivated;
            tl.GradeSectionCode = sa.GradeSectionCode;
            tl.RoomId = sa.RoomId;
            tl.SubjectCode = sa.SubjectCode;

            tl.SY = sa.SY;
            tl.TeacherId = sa.TeacherId;
            tl.TimeSlotCode = sa.TimeSlotCode;

            tl.SubjectInfo = sa.SubjectInfo;

            tl.SubjectDescription = sa.SubjectDescription;
        }