Пример #1
0
 public void TranslateRoomBDOtoRoomDTO(RoomBDO room, Room r)
 {
     r.RoomId = room.RoomId;
     r.BuildingCode = room.BuildingCode;
     r.Capacity = room.Capacity;
     r.Deactivated = room.Deactivated;
     r.Description = room.Description;
     r.RoomCode = room.RoomCode;
     r.RoomNumber = room.RoomNumber;
 }
Пример #2
0
        public Room GetRoom(int roomcode)
        {
            List<Room> roomList = new List<Room>();
            roomList = GetAllRooms();
            Room r = new Room();
            r = roomList.Find(rm => rm.RoomId == roomcode);


            return r;
        }
Пример #3
0
 public List<Room> GetAllRooms(string buildingCode)
 {
     List<Room> rlist = new List<Room>();
     foreach (RoomBDO rbdo in blogic.GetAllRooms(buildingCode))
     {
         Room r = new Room();
         TranslateRoomBDOtoRoomDTO(rbdo, r);
         rlist.Add(r);
     }
     return rlist;
 }
Пример #4
0
 public List<Room> GetAllRooms()
 {
     List<Room> roomList = new List<Room>();
     foreach (RoomBDO rbdo in rLogic.GetAllRooms())
     {
         Room r = new Room();
         TranslateRoomBDOtoRoomDTO(rbdo, r);
         roomList.Add(r);
     }
     return roomList;
 }
Пример #5
0
 public void TranslateGradeSectionBDOToGradeSection(GradeSectionBDO gs, GradeSection gsb)
 {
     RoomService rService = new RoomService();
     Room room = new Room();
     TeacherService tService = new TeacherService();
     Teacher teacher = new Teacher();
     string message = string.Empty;
     room = rService.GetRoom(gs.HomeRoomNumber);
     teacher = tService.GetTeacher(gs.HomeRoomTeacherId, ref message);
     gsb.Deactivated = gs.Deactivated;
     gsb.GradeLevel = gs.GradeLevel;
     gsb.GradeSectionCode = gs.GradeSectionCode;
     gsb.HomeRoom = room;
     gsb.HomeRoomNumber = gs.HomeRoomNumber;
     gsb.HomeRoomTeacherId = gs.HomeRoomTeacherId;
     gsb.HomeRoomTeacher = teacher;
     if (teacher.MiddleName == String.Empty)
         gsb.TeacherName = teacher.LastName + ", " + teacher.FirstName;
     else
         gsb.TeacherName = teacher.LastName + ", " + teacher.FirstName + " " + teacher.MiddleName.Substring(0, 1);
     gsb.Class = gs.Class;
     gsb.SY = gs.SY;
     gsb.Section = gs.Section;
 }
Пример #6
0
 public Boolean UpdateRoom(ref Room room, ref string message)
 {
     RoomBDO roomBDO = new RoomBDO();
     TranslateRoomDTOtoRoomBDO(room, roomBDO);
     return rLogic.UpdateRoom(ref roomBDO, ref message);
 }
Пример #7
0
 public List<Room> ToRoomDTO(List<RoomBDO> tc)
 {
     List<Room> tcbdoList = new List<Room>();
     foreach (RoomBDO t in tc)
     {
         Room tbdo = new Room();
         TranslateRoomBDOtoRoomDTO(t, tbdo);
         tcbdoList.Add(tbdo);
     }
     return tcbdoList;
 }
Пример #8
0
 public List<Room> ToRoomList(List<RoomBDO> rbdo)
 {
     List<Room> rooms = new List<Room>();
     foreach (RoomBDO rb in rbdo)
     {
         Room r = new Room();
         TranslateRoomBDOtoRoomDTO(rb, r);
         rooms.Add(r);
     }
     return rooms;
 }
Пример #9
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();


            }
        }
Пример #10
0
        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;

        }