Beispiel #1
0
        public Boolean CreateGradeSection(ref GradeSectionBDO gsBDO, ref string message)
        {
            message = "Grade Section Added Successfully";
            bool ret = true;

            GradeSection gs = new GradeSection();
            try{
            ConvertGradeSectionBDOToGradeSection(gsBDO, gs);
            using (var DCEnt = new DCFIEntities())
            {
                DCEnt.GradeSections.Attach(gs);
                DCEnt.Entry(gs).State = System.Data.Entity.EntityState.Added;
                int num = DCEnt.SaveChanges();

                if (num != 1)
                {
                    ret = false;
                    message = "Adding of Grade Section failed";
                }
            }
            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        Trace.TraceInformation("Property: {0} Error: {1}",
                                                validationError.PropertyName,
                                                validationError.ErrorMessage);
                    }
                }
            }
            return ret;
        }
Beispiel #2
0
        public GradeSectionBDO GetGradeSectionBDO(int gradesectioncode)
        {
            GradeSection gsec = new GradeSection();
            GradeSectionBDO gsBDO = new GradeSectionBDO();
            try { 
            using (var DCEnt = new DCFIEntities())
            {
                gsec = (from gs in DCEnt.GradeSections
                                        where gs.GradeSectionCode == gradesectioncode
                                        select gs).FirstOrDefault<GradeSection>();

                 ConvertGradeSectionToGradeSectionBDO(gsec, gsBDO);
             }
            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        Trace.TraceInformation("Property: {0} Error: {1}",
                                                validationError.PropertyName,
                                                validationError.ErrorMessage);
                    }
                }
            }
            return gsBDO;
        }
Beispiel #3
0
        public void ConvertGradeSectionToGradeSectionBDO(GradeSection gs, GradeSectionBDO gsBDO)
        {
            RoomDAO r = new RoomDAO();
            RoomBDO room = new RoomBDO();
            TeacherDAO t = new TeacherDAO();
            TeacherBDO teach = new TeacherBDO();
            SchoolYearDAO s = new SchoolYearDAO();
            SchoolYearBDO sy = new SchoolYearBDO();

            s.ConvertSYToSYBDO(gs.SchoolYear, sy);
            t.ConvertTeacherToTeacherBDO(gs.Teacher, teach);
            r.ConvertRoomToRoomBDO(gs.Room, room);

            gsBDO.Deactivated = gs.Deactivated;
            gsBDO.GradeLevel = gs.GradeLevel;
            gsBDO.GradeSectionCode = gs.GradeSectionCode;
            gsBDO.HomeRoomNumber = (int)gs.HomeRoomNumber;
            gsBDO.HomeRoomTeacherId = gs.HomeRoomTeacherId;
            gsBDO.Section = gs.Section;
            gsBDO.SY = gs.SY;
            gsBDO.Class = gs.Class;

            gsBDO.HomeRoom = room;
            gsBDO.HomeRoomTeacher = teach;
            gsBDO.SchoolYear = sy;
        }
        public void ConvertSubjectAssignmentToSubjectAssignmentBDO(SubjectAssignment sa, SubjectAssignmentBDO sabdo)
        {
            sabdo.Deactivated = (bool)sa.Deactivated;
            GradeSectionDAO gd = new GradeSectionDAO();
            GradeSectionBDO g = new GradeSectionBDO();
            g = gd.GetGradeSectionBDO((int)sa.GradeSectionCode);
            sabdo.GradeSection = g;
            sabdo.GradeSectionCode = g.GradeSectionCode;
            RoomBDO r = new RoomBDO();
            RoomDAO rd = new RoomDAO();
            rd.ConvertRoomToRoomBDO(sa.Room, r);
            sabdo.Room = r;
            sabdo.RoomId = r.RoomId;
            SubjectDAO sd = new SubjectDAO();
            SubjectBDO sb = new SubjectBDO();
            sd.ConvertSubjectToSubjectBDO(sa.Subject, sb);
            sabdo.Subject = sb;
            sabdo.SubjectAssignmentsID = sa.SubjectAssignmentsID;
            sabdo.SubjectCode = sa.SubjectCode;
            sabdo.SY = sa.SY;
            TeacherDAO td = new TeacherDAO();
            TeacherBDO tb = new TeacherBDO();
            td.ConvertTeacherToTeacherBDO(sa.Teacher, tb);
            sabdo.Teacher = tb;
            sabdo.TeacherId = tb.TeacherId;
            TimeslotDAO tid = new TimeslotDAO();
            TimeslotBDO tib = new TimeslotBDO();
            tid.ConvertTimeslotToTimeslotBDO(sa.Timeslot, tib);
            sabdo.Timeslot = tib;
            sabdo.TimeSlotCode = tib.TimeSlotCode;

            sabdo.GradeLevel = g.GradeLevel;
        }
Beispiel #5
0
 public List<GradeSectionBDO> GetAllGradeSections(string currentSY)
 {
     List<GradeSection> gsList = new List<GradeSection>();
     List<GradeSectionBDO> gsBDOList = new List<GradeSectionBDO>();
     try { 
     using (var DCEnt = new DCFIEntities())
     {
         var allGradeSections = (from gs in DCEnt.GradeSections
                                 where gs.SY == currentSY
                                 orderby gs.GradeLevel, gs.Class
                                 select gs);
         gsList = allGradeSections.ToList<GradeSection>();
             
     foreach (GradeSection gs in gsList)
     {
         GradeSectionBDO gsBDO = new GradeSectionBDO();
         ConvertGradeSectionToGradeSectionBDO(gs, gsBDO);
         gsBDOList.Add(gsBDO);
     }
     }
     }
     catch (DbEntityValidationException dbEx)
     {
         foreach (var validationErrors in dbEx.EntityValidationErrors)
         {
             foreach (var validationError in validationErrors.ValidationErrors)
             {
                 Trace.TraceInformation("Property: {0} Error: {1}",
                                         validationError.PropertyName,
                                         validationError.ErrorMessage);
             }
         }
     }
     return gsBDOList;
 }
Beispiel #6
0
 public void ConvertGradeSectionBDOToGradeSection(GradeSectionBDO gsBDO, GradeSection gs)
 {
     gs.Deactivated = gsBDO.Deactivated;
     gs.GradeLevel = gsBDO.GradeLevel;
     gs.GradeSectionCode = gsBDO.GradeSectionCode;
     gs.HomeRoomNumber = gsBDO.HomeRoomNumber;
     gs.HomeRoomTeacherId = gsBDO.HomeRoomTeacherId;
     gs.Section = gsBDO.Section;
     gs.SY = gsBDO.SY;
     gs.Class = gsBDO.Class;
 }
Beispiel #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;
        }
Beispiel #8
0
        public List<GradeSectionBDO> GetAllGradeSections()
        {
            List<GradeSection> gsList = new List<GradeSection>();
            using (var DCEnt = new DCFIEntities())
            {
                var allGradeSections = (DCEnt.GradeSections);
                gsList = allGradeSections.ToList<GradeSection>();
            }

            List<GradeSectionBDO> gsBDOList = new List<GradeSectionBDO>();
            foreach (GradeSection gs in gsList)
            {
                GradeSectionBDO gsBDO = new GradeSectionBDO();
                ConvertGradeSectionToGradeSectionBDO(gs, gsBDO);
                gsBDOList.Add(gsBDO);
            }
            return gsBDOList;
        }
Beispiel #9
0
        public Boolean CreateGradeSection(ref GradeSectionBDO gsBDO, ref string message)
        {
            message = "Grade Section Added Successfully";
            bool ret = true;

            GradeSection gs = new GradeSection();
            ConvertGradeSectionBDOToGradeSection(gsBDO, gs);
            using (var DCEnt = new DCFIEntities())
            {
                DCEnt.GradeSections.Attach(gs);
                DCEnt.Entry(gs).State = System.Data.Entity.EntityState.Added;
                int num = DCEnt.SaveChanges();

                if (num != 1)
                {
                    ret = false;
                    message = "Adding of Grade Section failed";
                }
            }
            return ret;
        }
Beispiel #10
0
        public void ConvertStuTraitsToStuTraitsBDO(StudentTrait st, StudentTraitBDO stbdo)
        {
            stbdo.StudentSY = st.StudentSY;
            stbdo.TraitsID = st.TraitsID;
            stbdo.GradeSectionCode = st.GradeSectionCode;
            stbdo.FirstPeriodicRating = st.FirstPeriodicRating;
            stbdo.SecondPeriodicRating = st.SecondPeriodicRating;
            stbdo.ThirdPeriodicRating = st.ThirdPeriodicRating;
            stbdo.FourthPeriodicRating = st.FourthPeriodicRating;
            stbdo.StudentEnrTraitCode = st.StudentEnrTraitCode;
            stbdo.FirstEntered = st.FirstEntered;
            stbdo.FirstLocked = st.FirstLocked;
            stbdo.FourthEntered = st.FourthEntered;
            stbdo.FourthLocked = st.FourthLocked;
            stbdo.LockCFourth = st.LockCFourth;
            stbdo.LockFirst = st.LockFirst;
            stbdo.LockSecond = st.LockSecond;
            stbdo.LockThird = st.LockThird;
            stbdo.SecondEntered = st.SecondEntered;
            stbdo.SecondLocked = st.SecondLocked;
            stbdo.ThirdEntered = st.ThirdEntered;
            stbdo.ThirdLocked = st.ThirdLocked;
            TraitDAO td = new TraitDAO();
            TraitBDO tb = new TraitBDO();
            td.ConvertTraitToTraitBDO(st.Trait, tb);
            stbdo.Trait = tb;

            StudentEnrolmentDAO sed = new StudentEnrolmentDAO();
            StudentEnrollmentBDO seb = new StudentEnrollmentBDO();
            sed.ConvertEnrolToEnrolBDO(st.StudentEnrollment, seb);
            stbdo.StudentEnrollment = seb;

            GradeSectionDAO gsd = new GradeSectionDAO();
            GradeSectionBDO gs = new GradeSectionBDO();
            gsd.ConvertGradeSectionToGradeSectionBDO(st.GradeSection, gs);
            stbdo.GradeSection = gs;
        }
        public Boolean UpdateGradeSection(ref GradeSectionBDO gsBDO, ref string message)
        {
            message = "Grade Section updated successfully.";
            Boolean ret = true;
            using (var DCEnt = new DCFIEntities())
            {
                var gsCode = gsBDO.GradeSectionCode;
                   GradeSection gsInDB = (from gs in DCEnt.GradeSections
                                      where gs.GradeSectionCode== gsCode
                                      select gs).FirstOrDefault();
                if (gsInDB == null)
                {
                    throw new Exception("No Grade Section with Grade Section Code " + gsBDO.GradeSectionCode);
                }
                DCEnt.GradeSections.Remove(gsInDB);

                gsInDB.Deactivated = gsBDO.Deactivated;
                gsInDB.GradeLevel = gsBDO.GradeLevel;
                gsInDB.GradeSectionCode = gsBDO.GradeSectionCode;
                gsInDB.HomeRoomNumber = gsBDO.HomeRoomNumber;
                gsInDB.HomeRoomTeacherId = gsBDO.HomeRoomTeacherId;
                gsInDB.Section = gsBDO.Section;
                gsInDB.SY = gsBDO.SY;

                DCEnt.GradeSections.Attach(gsInDB);
                DCEnt.Entry(gsInDB).State = System.Data.Entity.EntityState.Modified;
                int num = DCEnt.SaveChanges();

                if (num != 1)
                {
                    ret = false;
                    message = "No grade section is updated.";
                }
            }
            return ret;

        }
Beispiel #12
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;
 }
Beispiel #13
0
        public Boolean UpdateGradeSection(ref GradeSectionBDO gsBDO, ref string message)
        {
            message = "Grade Section updated successfully.";
            Boolean ret = true;
            try {
            using (var DCEnt = new DCFIEntities())
            {
                var gsCode = gsBDO.GradeSectionCode;
                   GradeSection gsInDB = (from gs in DCEnt.GradeSections
                                      where gs.GradeSectionCode== gsCode
                                      select gs).FirstOrDefault();
                if (gsInDB == null)
                {
                    throw new Exception("No Grade Section with Grade Section Code " + gsBDO.GradeSectionCode);
                }
                DCEnt.GradeSections.Remove(gsInDB);

                gsInDB.Deactivated = gsBDO.Deactivated;
                gsInDB.GradeLevel = gsBDO.GradeLevel;
                gsInDB.GradeSectionCode = gsBDO.GradeSectionCode;
                gsInDB.HomeRoomNumber = gsBDO.HomeRoomNumber;
                gsInDB.HomeRoomTeacherId = gsBDO.HomeRoomTeacherId;
                gsInDB.Section = gsBDO.Section;
                gsInDB.SY = gsBDO.SY;
                gsInDB.Class = gsBDO.Class;
                DCEnt.GradeSections.Attach(gsInDB);
                DCEnt.Entry(gsInDB).State = System.Data.Entity.EntityState.Modified;
                int num = DCEnt.SaveChanges();

                if (num != 1)
                {
                    ret = false;
                    message = "No grade section is updated.";
                }
            }
            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        Trace.TraceInformation("Property: {0} Error: {1}",
                                                validationError.PropertyName,
                                                validationError.ErrorMessage);
                    }
                }
            }
            return ret;
        }
Beispiel #14
0
 private void ConvertGradeSectionToGradeSectionBDO(GradeSection gs, GradeSectionBDO gsBDO)
 {
     gsBDO.Deactivated = gs.Deactivated;
     gsBDO.GradeLevel = gs.GradeLevel;
     gsBDO.GradeSectionCode = gs.GradeSectionCode;
     gsBDO.HomeRoomNumber = gs.HomeRoomNumber;
     gsBDO.HomeRoomTeacherId = gs.HomeRoomTeacherId;
     gsBDO.Section = gs.Section;
     gsBDO.SY = gs.SY;
 }
Beispiel #15
0
 public bool CreateGradeSection(ref GradeSection gs, ref string message)
 {
     GradeSectionBDO gsb = new GradeSectionBDO();
     TranslateGradeSectionToGradeSectionBDO(gs, gsb);
     return gsLogic.CreateGradeSection(ref gsb, ref message);
 }
Beispiel #16
0
 public Boolean UpdateGradeSection(ref GradeSectionBDO gsbdo, ref string message) {
     return gsDao.UpdateGradeSection(ref gsbdo, ref message);
 }