public bool CreateSchedules(SubjectAssignment subjectAssignment, string message)
 {
     Boolean ret = false; ;
     SubjectAssignmentBDO sabdo = new SubjectAssignmentBDO();
     TranslateScheduleToScheduleBDO(subjectAssignment, sabdo);
     ret = schedLogic.CreateSchedule(ref sabdo, ref message);
     return ret;
 }
 public List<SubjectAssignment> GetAllSchedules(string sy)
 {
     List<SubjectAssignmentBDO> schedules = new List<SubjectAssignmentBDO>();
     schedules = schedLogic.GetAllSchedules(sy);
     List<SubjectAssignment> s = new List<SubjectAssignment>();
     foreach (SubjectAssignmentBDO sched in schedules)
     {
         SubjectAssignment sa = new SubjectAssignment();
         TranslateScheduleBDOToSchedule(sched, sa);
         s.Add(sa);
     }
     return s;
 }
Example #3
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;

        }
Example #4
0
        private void btnAddSchedule_Click(object sender, EventArgs e)
        {
            if (cmbGradeLevel.Text != string.Empty && cmbSection.Text != string.Empty && cmbTimeslot.Text != string.Empty && 
                cmbSubject.Text != string.Empty && cmbTeacher.Text != string.Empty && cmbRoom.Text != string.Empty)
            {
                Timeslot t = new Timeslot();
                t = timeslots.Find(x => x.TimeSlotCode == cmbTimeslot.SelectedValue.ToString());

                GradeSection gs = new GradeSection();
                gs = sections.Find(x => x.GradeSectionCode == sectioncode);

                Subject su = new Subject();
                su = subjects.Find(x => x.SubjectCode == cmbSubject.SelectedValue.ToString());

                Room rm = new Room();
                rm = rooms.Find(x => x.RoomId == Int32.Parse(cmbRoom.SelectedValue.ToString()));

                Teacher tc = new Teacher();
                tc = teachers.Find(x => x.TeacherId == cmbTeacher.SelectedValue.ToString());

                SubjectAssignment sa = new SubjectAssignment();
                sa.GradeLevel = cmbGradeLevel.SelectedValue.ToString() ;
                sa.TeacherName = cmbTeacher.Text;
                sa.SY = currentSY;
                sa.Subject = su;
                sa.SubjectCode = su.SubjectCode;
                sa.SubjectDescription = su.Description;
                sa.TimeslotInfo = t.TimeSlotInfo;
                sa.TimeSlotCode = t.TimeSlotCode;
                sa.Room = rm;
                sa.RoomId = rm.RoomId;
                sa.RoomCode = rm.RoomCode;
                sa.Teacher = tc;
                sa.TeacherId = tc.TeacherId;
                sa.Section = section;
                sa.GradeSection = gs;
                sa.GradeSectionCode = gs.GradeSectionCode;
                sa.Timeslot = t;
                sa.Timestart = t.TimeStart;
                sa.TimeEnd = t.TimeEnd;
                sa.Days = t.Days;
                sa.Deactivated = false;
                createdSchedule.Add(sa);
                schedules.Add(sa);

                
                cmbTimeslot.DataSource = null;
                availTimeSlot.RemoveAll(x => x.TimeSlotCode == t.TimeSlotCode);
                if (availTimeSlot.Count > 0)
                {
                    cmbTimeslot.DataSource = availTimeSlot;
                    cmbTimeslot.SelectedIndex = 0;
                    cmbTimeslot.Refresh();
                }
                else
                    cmbTimeslot.Enabled = false;

                gvSchedule.DataSource = null;
                gvSchedule.DataSource = schedules.FindAll(x => x.GradeSectionCode == sectioncode);
                gvSchedule.Refresh();

                // LoadSchedules();


            }
        }
        public List<SubjectAssignment> GetRightSchedule(int Rank, string gradeLevel)
        {
            List<SubjectAssignment> schList = new List<SubjectAssignment>();
            List<SubjectAssignmentBDO> gradeschedList = new List<SubjectAssignmentBDO>();
            gradeschedList = schedLogic.GetScheduleForGradeLevel(gradeLevel);

            List<SubjectAssignment> sectionSched = new List<SubjectAssignment>();

            foreach (SubjectAssignmentBDO sab in gradeschedList)
            {
                SubjectAssignment sa = new SubjectAssignment();
                TranslateScheduleBDOToSchedule(sab, sa);
                schList.Add(sa);
            }
            int div = Rank / 20;
            div++;
            sectionSched = schList.FindAll(item => item.Class == div);

            return sectionSched;
        }
        public void TranslateScheduleBDOToSchedule(SubjectAssignmentBDO sabdo, SubjectAssignment sched)
        {
            GradeSectionService gs = new GradeSectionService();
            GradeSection g = new GradeSection();
            gs.TranslateGradeSectionBDOToGradeSection(sabdo.GradeSection, g);
            sched.GradeSection = g;
            sched.Section = g.Section;
            sched.GradeLevel = g.GradeLevel;
            sched.Class = (int)g.Class;

            RoomService rs = new RoomService();
            Room r = new Room();
            rs.TranslateRoomBDOtoRoomDTO(sabdo.Room, r);
            sched.Room = r;
            sched.RoomCode = r.RoomCode;

            SubjectService ss = new SubjectService();
            Subject s = new Subject();
            ss.TranslateSubjectBDOToSubject(sabdo.Subject, s);
            sched.Subject = s;

            TeacherService ts = new TeacherService();
            Teacher t = new Teacher();
            ts.TranslateTeacherBDOToTeacherDTO(sabdo.Teacher, t);
            sched.Teacher = t;
            if (t.MiddleName == String.Empty)
                sched.TeacherName = t.LastName + ", " + t.FirstName;
            else
                sched.TeacherName = t.LastName + ", " + t.FirstName + " " + t.MiddleName.Substring(0, 1) + ".";

            TimeslotService times = new TimeslotService();
            Timeslot time = new Timeslot();
            times.TranslateTimeslotBDOToTimeslotDTo(sabdo.Timeslot, time);
            sched.Timeslot = time;
            sched.Timestart = time.TimeStart;
            sched.TimeEnd = time.TimeEnd;
            sched.Days = time.Days;

            sched.Deactivated = sabdo.Deactivated;
            sched.GradeSectionCode = sabdo.GradeSectionCode;
            sched.RoomId = sabdo.RoomId;
            sched.SubjectAssignmentsID = sabdo.SubjectAssignmentsID;
            sched.SubjectCode = sabdo.SubjectCode;

            sched.SY = sabdo.SY;
            sched.TeacherId = sabdo.TeacherId;
            sched.TimeSlotCode = sabdo.TimeSlotCode;

            sched.TimeslotInfo = time.Days + " " + time.TimeStart + "-" + time.TimeEnd;
            sched.SubjectInfo = sabdo.SubjectCode + " " + sched.Section + " " + sched.TimeslotInfo;

            sched.SubjectDescription = s.Description;

        }
        public void TranslateScheduleToScheduleBDO(SubjectAssignment schedule, SubjectAssignmentBDO sabdo)
        {
            sabdo.Deactivated = false;

            sabdo.GradeSectionCode = schedule.GradeSectionCode;
            sabdo.RoomId = schedule.RoomId;
            sabdo.SubjectAssignmentsID = schedule.SubjectAssignmentsID;
            sabdo.SubjectCode = schedule.SubjectCode;
            sabdo.SY = schedule.SY;
            sabdo.TeacherId = schedule.TeacherId;
            sabdo.TimeSlotCode = schedule.TimeSlotCode;

        }
        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;
        }