Пример #1
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;
        }
Пример #2
0
        public bool CreateGradeSection(ref GradeSection gs, ref string message)
        {
            GradeSectionBDO gsb = new GradeSectionBDO();

            TranslateGradeSectionToGradeSectionBDO(gs, gsb);
            return(gsLogic.CreateGradeSection(ref gsb, ref message));
        }
        public ActionResult EditSection(int id)
        {
            if (Session["Username"] == null && Session["Password"] == null)
            {
                return(RedirectToAction("Index", "Admin", new { area = "" }));
            }
            else
            {
                GradesSections gradesection = new Cateloge().SelectGradeSection(id);

                if (gradesection == null)
                {
                    ViewBag.StatusMessage = " No Any Result Founded ! ";
                }
                else
                {
                    GradeSection Formelements = new GradeSection
                    {
                        Name = gradesection.Name,
                    };
                    return(PartialView("_CreateSection", Formelements));
                }

                return(RedirectToAction("Index"));
            }
        }
        public ActionResult CreateSection(GradeSection Add, int id)
        {
            if (Session["Username"] == null && Session["Password"] == null)
            {
                return(RedirectToAction("Index", "Admin", new { area = "" }));
            }
            else
            {
                if (ModelState.IsValid)
                {
                    GradesSections AddGradeSection = new GradesSections();
                    AddGradeSection.Class_Level_id = Convert.ToString(id);
                    AddGradeSection.Name           = Add.Name;
                    AddGradeSection.Date           = DateTime.Today.ToString("dd-MM-yyyy");
                    AddGradeSection.Month          = DateTime.Today.ToString("MMM");
                    AddGradeSection.Year           = DateTime.Today.ToString("yyyy");
                    AddGradeSection.Time           = DateTime.Now.ToString("HH:mm:ss");
                    new Cateloge().AddGradeSection(AddGradeSection);
                    TempData["Msg"] = "New Section Have Added Successfully";
                    return(RedirectToAction("View", new { id = id }));
                }

                return(RedirectToAction("Index"));
            }
        }
        public ActionResult GetSections(int cid, int did)
        {
            List <GradesSections> gradesections = new Cateloge().GradeSections(cid);
            Diaries     diary      = new Cateloge().SelectActiveDiary(did);
            ClassLevels classlevel = new Cateloge().SelectClassLevel(cid);
            WebAllClass Data       = new WebAllClass();

            if (gradesections == null)
            {
                ViewBag.StatusMessage = " No Any Data Found ! ";
                Data.ClassLevel_      = new ClassLevel
                {
                    Name = classlevel.Name
                };
                Data.Diary_ = new Diary()
                {
                    Id         = diary.db_Id,
                    Diary_date = diary.Diary_date
                };
                return(View(Data));
            }
            else
            {
                if (diary == null)
                {
                    ViewBag.StatusMessage = " No Any Data Found ! ";
                }
                else
                {
                    if (classlevel == null)
                    {
                        ViewBag.StatusMessage = " No Any Data Found ! ";
                    }
                    else
                    {
                        Data.ClassLevel_ = new ClassLevel
                        {
                            Name = classlevel.Name
                        };
                    }

                    Data.Diary_ = new Diary()
                    {
                        Id         = diary.db_Id,
                        Diary_date = diary.Diary_date
                    };
                }
                Data.GradeSection_s = new List <GradeSection>();
                foreach (var gdfc in gradesections)
                {
                    GradeSection dbr = new GradeSection();
                    dbr.Id   = gdfc.db_Id;
                    dbr.Name = gdfc.Name;
                    Data.GradeSection_s.Add(dbr);
                }
                Data.GradeSection_s.TrimExcess();
                return(View(Data));
            }
        }
Пример #6
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);
        }
Пример #7
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;
 }
Пример #8
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);
        }
        public ActionResult ViewSection(int cid, int did)
        {
            if (Session["Username"] == null && Session["Password"] == null)
            {
                return(RedirectToAction("Index", "Admin", new { area = "" }));
            }
            else
            {
                List <GradesSections> gradesections = new Cateloge().GradeSections(cid);
                Diaries     diary      = new Cateloge().SelectDiary(did);
                ClassLevels classlevel = new Cateloge().SelectClassLevel(cid);
                AllClasses  Data       = new AllClasses();
                if (gradesections == null)
                {
                    ViewBag.StatusMessage = " No Any Data Found ! ";

                    Data.ClassLevel_ = new ClassLevel()
                    {
                        Name = classlevel.Name
                    };
                    Data.Diary = new Diary()
                    {
                        Id         = diary.db_Id,
                        Diary_date = diary.Diary_date
                    };
                    return(View(Data));
                }
                else
                {
                    Data.ClassLevel_ = new ClassLevel()
                    {
                        Name = classlevel.Name
                    };
                    Data.Diary = new Diary()
                    {
                        Id         = diary.db_Id,
                        Diary_date = diary.Diary_date
                    };
                    Data.GradeSection_s = new List <GradeSection>();
                    foreach (var gdfc in gradesections)
                    {
                        GradeSection dbr = new GradeSection();
                        dbr.Id   = gdfc.db_Id;
                        dbr.Name = gdfc.Name;
                        Data.GradeSection_s.Add(dbr);
                    }
                    Data.GradeSection_s.TrimExcess();
                    return(View(Data));
                }
            }
        }
Пример #10
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];
            }
        }
Пример #11
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];
            }
        }
        public ActionResult View(int id)
        {
            if (Session["Username"] == null && Session["Password"] == null)
            {
                return(RedirectToAction("Index", "Admin", new { area = "" }));
            }
            else
            {
                AllClasses            Data          = new AllClasses();
                ClassLevels           ClassLevel    = new Cateloge().SelectClassLevel(id);
                List <GradesSections> gradesections = new Cateloge().GradeSections(id);

                if (ClassLevel == null)
                {
                    ViewBag.StatusMessage = " No Any Result Founded ! ";
                }
                else
                {
                    Data.ClassLevel_ = new ClassLevel
                    {
                        Id   = ClassLevel.db_Id,
                        Name = ClassLevel.Name
                    };


                    if (gradesections == null)
                    {
                        ViewBag.StatusMessage = " No Any Result Founded ! ";
                    }
                    else
                    {
                        Data.GradeSection_s = new List <GradeSection>();
                        foreach (var gdfc in gradesections)
                        {
                            GradeSection dbr = new GradeSection();
                            dbr.Id             = gdfc.db_Id;
                            dbr.Class_Level_id = gdfc.Class_Level_id;
                            dbr.Name           = gdfc.Name;
                            Data.GradeSection_s.Add(dbr);
                        }
                        Data.GradeSection_s.TrimExcess();
                    }
                }
                return(View(Data));
            }
        }
Пример #13
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);
                }
            }
        }
 public ActionResult EditSection(GradeSection Update, int id)
 {
     if (Session["Username"] == null && Session["Password"] == null)
     {
         return(RedirectToAction("Index", "Admin", new { area = "" }));
     }
     else
     {
         if (ModelState.IsValid)
         {
             GradesSections UpdateGradeSection = new GradesSections();
             UpdateGradeSection.Name = Update.Name;
             new Cateloge().UpdateGradeSection(UpdateGradeSection, id);
             TempData["Msg"] = "Section Have Updated Successfully";
             return(RedirectToAction("Index"));
         }
         return(View(Update));
     }
 }
Пример #15
0
        private void cbSection_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
        {
            if (changed)
            {
                IRegistrationService registrationService = new RegistrationService();
                int          index = cbSection.SelectedIndex;
                GradeSection s     = sections[index];
                registrationService.DeleteExistingSubjects(ControlStudent.StudentId + SY);
                registrationService.UpdateStudentSection(ControlStudent.StudentId + SY, s.GradeSectionCode, s.Section);

                Schedule = registrationService.GetSubjectsOfSection(s.GradeSectionCode, SY);
                subjects.Clear();
                foreach (StudentSchedule sch in Schedule)
                {
                    StudentSubject ss = new StudentSubject()
                    {
                        StudentSY            = controlStudentId + SY,
                        SubjectCode          = sch.SubjectCode,
                        SubjectAssignments   = sch.SubjectAssignments,
                        StudentEnrSubCode    = controlStudentId + SY + sch.SubjectCode,
                        LockFirst            = false,
                        LockSecond           = false,
                        LockThird            = false,
                        LockFourth           = false,
                        FirstPeriodicRating  = 0.00,
                        SecondPeriodicRating = 0.00,
                        ThirdPeriodicRating  = 0.00,
                        FourthPeriodicRating = 0.00
                    };
                    subjects.Add(ss);
                }

                ControlSchedule          = Schedule;
                GlobalClass.gvDatasource = 1;
                gvSchedule.DataSource    = ControlSchedule;
                gvSchedule.ReadOnly      = false;
            }
        }
Пример #16
0
        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");
            }
        }
Пример #17
0
        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;
            GradeSectionServiceClient gservice = new GradeSectionServiceClient();
            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");
        }
Пример #18
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;
        }
Пример #19
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.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);

                LoadSchedules();

            }
        }
Пример #20
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);
            }
        }
Пример #21
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();
            }
        }