Example #1
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 SubjectAssignmentBDO GetScheduleInfo(int sAi)
        {
            SchoolYearDAO syd = new SchoolYearDAO();

            currentSY = syd.CurrentSY();
            SubjectAssignment    schedInfo = new SubjectAssignment();
            SubjectAssignmentBDO saBDO     = new SubjectAssignmentBDO();

            try {
                using (var DCEnt = new DCFIEntities())
                {
                    schedInfo = (from sched in DCEnt.SubjectAssignments
                                 where sched.Deactivated == false && sched.SY.Equals(currentSY) && sched.SubjectAssignmentsID == sAi
                                 select sched).FirstOrDefault <SubjectAssignment>();

                    ConvertSubjectAssignmentToSubjectAssignmentBDO(schedInfo, saBDO);
                }
            }
            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(saBDO);
        }
Example #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 List <SubjectAssignmentBDO> GetAllSchedulesbySection(int iGradeSection)
        {
            SchoolYearDAO syd = new SchoolYearDAO();

            currentSY = syd.CurrentSY();
            List <SubjectAssignment>    saList    = new List <SubjectAssignment>();
            List <SubjectAssignmentBDO> sabdoList = new List <SubjectAssignmentBDO>();

            try{
                using (var DCEnt = new DCFIEntities())
                {
                    var allSchedule = (from sched in DCEnt.SubjectAssignments
                                       where sched.Deactivated == false && sched.SY.Equals(currentSY) && sched.GradeSectionCode == iGradeSection
                                       select sched).ToList <SubjectAssignment>();
                    saList = allSchedule;



                    foreach (SubjectAssignment sa in saList)
                    {
                        SubjectAssignmentBDO saBDO = new SubjectAssignmentBDO();
                        ConvertSubjectAssignmentToSubjectAssignmentBDO(sa, saBDO);
                        sabdoList.Add(saBDO);
                    }
                }
            }
            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(sabdoList);
        }
Example #5
0
        public List<SubjectAssignmentBDO> GetAllSchedules()
        {
            SchoolYearDAO syd = new SchoolYearDAO();
            currentSY = syd.CurrentSY();
            List<SubjectAssignment> saList = new List<SubjectAssignment>();
            List<SubjectAssignmentBDO> sabdoList = new List<SubjectAssignmentBDO>();
            try { 
            using (var DCEnt = new DCFIEntities())
            {
                var allSchedule = (from sched in DCEnt.SubjectAssignments
                                   where sched.Deactivated == false && sched.SY.Equals(currentSY)
                                   select sched).ToList<SubjectAssignment>();
                saList = allSchedule;



                foreach (SubjectAssignment sa in saList)
                {
                    SubjectAssignmentBDO saBDO = new SubjectAssignmentBDO();
                    ConvertSubjectAssignmentToSubjectAssignmentBDO(sa, saBDO);
                    sabdoList.Add(saBDO);
                }
            }
            }
            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 sabdoList;
        }
Example #6
0
 public SubjectAssignmentBDO GetScheduleInfo(int sAi)
 {
     SchoolYearDAO syd = new SchoolYearDAO();
     currentSY = syd.CurrentSY();
     SubjectAssignment schedInfo = new SubjectAssignment();
     SubjectAssignmentBDO saBDO = new SubjectAssignmentBDO();
     try { 
     using (var DCEnt = new DCFIEntities())
     {
         schedInfo = (from sched in DCEnt.SubjectAssignments
                      where sched.Deactivated == false && sched.SY.Equals(currentSY) && sched.SubjectAssignmentsID == sAi
                      select sched).FirstOrDefault<SubjectAssignment>();
             
         ConvertSubjectAssignmentToSubjectAssignmentBDO(schedInfo, saBDO);
     }
     }
     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 saBDO;
 }