Example #1
0
 public GradeSection GetGradeSection(int gradeSectionCode)
 {
     List<GradeSection> glist = new List<GradeSection>();
     glist = GetAllGradeSections();
     GradeSection g = new GradeSection();
     g = glist.Find(p => p.GradeSectionCode == gradeSectionCode);
     return g;
 }
Example #2
0
 private List<GradeSection> ToGradeSectionList(List<GradeSectionBDO> gb)
 {
     List<GradeSection> gsl = new List<GradeSection>();
     foreach (GradeSectionBDO g in gb)
     {
         GradeSection gs = new GradeSection();
         TranslateGradeSectionBDOToGradeSection(g, gs);
         gsl.Add(gs);
     }
     return gsl;
 }
Example #3
0
        public void TranslateGradeSectionToGradeSectionBDO(GradeSection gs, GradeSectionBDO gsb)
        {

            gsb.Deactivated = gs.Deactivated;
            gsb.GradeLevel = gs.GradeLevel;
            gsb.GradeSectionCode = gs.GradeSectionCode;
            gsb.HomeRoomNumber = gs.HomeRoomNumber;
            gsb.HomeRoomTeacherId = gs.HomeRoomTeacherId;
            gsb.SY = gs.SY;
            gsb.Section = gs.Section;
            gsb.Class = gs.Class;
        }
Example #4
0
        private void gvGradeSection_SelectionChanged(object sender, EventArgs e)
        {
            int selectedIndex = gvGradeSection.CurrentRow.Index;


            if (selectedIndex >= 0)
            {
                string gsCode = gvGradeSection.Rows[selectedIndex].Cells["GradeSectionCode"].Value.ToString();
                List<GradeSection> item = new List<GradeSection>();
                item = gradeSectionList.FindAll(x => x.GradeSectionCode.ToString() == gsCode);
                

                gSectionSelected = new GradeSection();
                gSectionSelected = (GradeSection)item[0];
            }
        }
Example #5
0
        private void cmbGradeLevel_SelectedValueChanged(object sender, EventArgs e)
        {
            string msg = string.Empty;
            if (cmbGradeLevel.SelectedIndex != -1)
            {
                sections = new List<GradeSection>(gsService.GetAllSectionsForGrade(cmbGradeLevel.SelectedValue.ToString()));
                cmbSection.DataSource = sections;
                cmbSection.SelectedIndex = 0;

                gradeSection = sections.Find(x => x.GradeSectionCode == int.Parse(cmbSection.SelectedValue.ToString()));

                if (gradeSection != null)
                    teach = gsService.GetTeacherDetail(gradeSection.HomeRoomTeacherId, ref msg);
            }

        }
Example #6
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;
 }
        private void btnSave_Click(object sender, EventArgs e)
        {
            GradeSection gs = new GradeSection();
          
            gs.GradeLevel = cmbGradeLevel.SelectedValue.ToString();
            gs.HomeRoomNumber = Int32.Parse(cmbRoom.SelectedValue.ToString());
            gs.HomeRoomTeacherId = cmbTeacher.SelectedValue.ToString();
            gs.Section = txtSection.Text.ToString();
            gs.SY = cmbSchoolYear.SelectedValue.ToString();
            gs.Class = Int32.Parse(cmbClass.Text.ToString());

            string message=String.Empty;
            bool ret = false;
            IGradeSectionService gservice = new GradeSectionService();
            if (Op == "edit")
            {
                gs.GradeSectionCode = SelectedGradeSection.GradeSectionCode;
                ret = gservice.UpdateGradeSection(ref gs, ref message);
                Log("U", "GradeSections", gs);
                
            }
            else
            {
               ret = gservice.CreateGradeSection(ref gs, ref message);
                Log("C", "GradeSections", gs);
                
            }

            if (ret)
            {
                MessageBox.Show(this, "Saved Successfully");
                this.Close();
            }
            else
                MessageBox.Show(this, "Error in saving");
        }
Example #8
0
 public bool CreateGradeSection(ref GradeSection gs, ref string message)
 {
     GradeSectionBDO gsb = new GradeSectionBDO();
     TranslateGradeSectionToGradeSectionBDO(gs, gsb);
     return gsLogic.CreateGradeSection(ref gsb, ref message);
 }
Example #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();


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

        }