Esempio n. 1
0
        public void LoadTimeslots()
        {
            ITimeslotService tService = new TimeslotService();
            string message = String.Empty;
            try
            {
                var timeslot = tService.GetAllTimeslots();
                timeslotList = new List<Timeslot>(timeslot);
                gvTimeSlot.DataSource = timeslotList;
                gvTimeSlot.Refresh();

                if (gvTimeSlot.RowCount != 0)
                    gvTimeSlot.Rows[0].IsSelected = true;
            }
            catch (Exception ex)
            {
                message = "Error Loading List of Timeslots";
                MessageBox.Show(ex.ToString());
            }

        }
Esempio n. 2
0
        public List <Timeslot> GetTimeslots()
        {
            TimeslotService tservice = new TimeslotService();

            return(tservice.GetAllTimeslots());
        }
Esempio n. 3
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;
        }
Esempio n. 4
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (timeslotSelected != null)
            {
                ITimeslotService tService = new TimeslotService();
                string message = String.Empty;

                if (!tService.DeleteTimeslot(timeslotSelected.TimeSlotCode, ref message))
                {
                   
                    MessageBox.Show("Deletion of Timeslot Failed");
                }
                else
                {
                    Log("D", "Timeslots", timeslotSelected);
                    MessageBox.Show("Deleted succesfully!");
                }
            }
        }
Esempio n. 5
0
 public List<Timeslot> GetTimeslots()
 {
     TimeslotService tservice = new TimeslotService();
     return tservice.GetAllTimeslots();
 }
Esempio n. 6
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;

        }
Esempio n. 7
0
        private void SaveUser()
        {
            try
            {
                Boolean ret = false;
                string message = String.Empty;

                List<String> list = new List<String>();
                if (chkSunday.Checked == true) list.Add("Sun");
                if (chkMonday.Checked == true) list.Add("Mon");
                if (chkTuesday.Checked == true) list.Add("Tue");
                if (chkWednesday.Checked == true) list.Add("Wed");
                if (chkThursday.Checked == true) list.Add("Thu");
                if (chkFriday.Checked == true) list.Add("Fri");
                if (chkSaturday.Checked == true) list.Add("Sat");

                string szDays = string.Empty;
                szDays = string.Join(",", list.ToArray());

                DateTime? dtTimeStart = DateTime.Now;
                DateTime? dtTimeEnd = DateTime.Now;

                dtTimeStart = tPStart.Value;
                dtTimeEnd = tpEnd.Value;

                ITimeslotService tService = new TimeslotService();
                Timeslot timeslot = new Timeslot()
                {
                    TimeSlotCode = txtTimeslotCode.Text,
                    TimeStart = dtTimeStart.Value.ToString("hh:mm tt"),
                    TimeEnd = dtTimeEnd.Value.ToString("hh:mm tt"),
                    Days = szDays
                };

                if (Op.Equals("edit"))
                {
                    timeslot.TimeSlotCode = SelectedTimeslot.TimeSlotCode;
                    ret = tService.UpdateTimeslot(ref timeslot, ref message);
                    Log("U", "Timeslots", timeslot);
                }
                else
                {
                    ret = tService.CreateTimeslot(ref timeslot, ref message);
                    Log("C", "Timeslots", timeslot);
                }

                MessageBox.Show("Saved Successfully!");

                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.ToString());
            }
        }