Esempio n. 1
0
        public SubjectBDO GetSubject(string subjectCode)
        {
            SubjectBDO sbdo = new SubjectBDO();
            Subject subj = new Subject();
            try { 
            using (var DCEnt = new DCFIEntities())
            {
                var sub = (from s in DCEnt.Subjects
                           where s.SubjectCode == subjectCode
                           select s).FirstOrDefault();
                subj = sub;


                ConvertSubjectToSubjectBDO(subj, sbdo);
            }
            }
            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 sbdo;
        }
Esempio n. 2
0
        public Boolean UpdateSubject(ref SubjectBDO subjectBDO, ref string message)
        {
            message = "Subject updated successfully.";
            Boolean ret = true;
            using (var DCEnt = new DCFIEntities())
            {
                var subjectCode = subjectBDO.SubjectCode;
                Subject subjectInDB = (from s in DCEnt.Subjects
                                       where s.SubjectCode == subjectCode
                                       select s).FirstOrDefault();
                if (subjectInDB == null)
                {
                    throw new Exception("No Subject with SubjectCode " + subjectBDO.SubjectCode);
                }
                DCEnt.Subjects.Remove(subjectInDB);

                subjectInDB.SubjectID = subjectBDO.SubjectID;
                subjectInDB.Description = subjectBDO.Description;
                subjectInDB.GradeLevel = subjectBDO.GradeLevel;
                subjectInDB.LearningAreaCode = subjectBDO.LearningAreaCode;
                subjectInDB.SubjectCode = subjectBDO.SubjectCode;

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

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

        }
Esempio n. 3
0
 public List<SubjectBDO> GetAllSbjects()
 {
     List<SubjectBDO> subjectBDOList = new List<SubjectBDO>();
     List<Subject> subjectList = new List<Subject>();
     try { 
     using (var DCEnt = new DCFIEntities())
     {
         var allSubjects = (DCEnt.Subjects);
         subjectList = allSubjects.ToList<Subject>();
        foreach (Subject s in subjectList)
         { 
         SubjectBDO subjectBDO = new SubjectBDO();
         ConvertSubjectToSubjectBDO(s, subjectBDO);
         subjectBDOList.Add(subjectBDO);
     }
     }
     }
     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 subjectBDOList;
 }
Esempio n. 4
0
        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;
        }
Esempio n. 5
0
 public void ConvertSubjectBDOToSubject(SubjectBDO sbdo, Subject s)
 {
     s.SubjectID = sbdo.SubjectID;
     s.Description = sbdo.Description;
     s.GradeLevel = sbdo.GradeLevel;
     s.LearningAreaCode = sbdo.LearningAreaCode;
     s.SubjectCode = sbdo.SubjectCode;
 }
Esempio n. 6
0
 public void ConvertSubjectToSubjectBDO(Subject s, SubjectBDO sbdo)
 {
     sbdo.Description = s.Description;
     sbdo.GradeLevel = s.GradeLevel;
     sbdo.LearningAreaCode = s.LearningAreaCode;
     sbdo.SubjectCode = s.SubjectCode;
     sbdo.SubjectID = s.SubjectID;
     sbdo.MPW = s.MPW;
 }
Esempio n. 7
0
 public void TranslateSubjectToSubjectBDO(Subject sub, SubjectBDO sbdo) {
     LearningAreaService las = new LearningAreaService();
     LearningAreaBDO lb = new LearningAreaBDO();
     sbdo.SubjectID = sub.SubjectID;
     sbdo.Description = sub.Description;
     sbdo.GradeLevel = sub.GradeLevel;
     sbdo.LearningAreaCode = sub.LearningAreaCode;
     sbdo.SubjectCode = sub.SubjectCode;
     las.TranslateLearningAreaToLearningAreaBDO(sub.LArea, lb);
     sbdo.LearningArea = lb;
 }
Esempio n. 8
0
 public void ConvertSubjectToSubjectBDO(Subject s, SubjectBDO sbdo)
 {
     LearningAreaDAO ldao = new LearningAreaDAO();
     LearningAreaBDO la = new LearningAreaBDO();
     sbdo.Description = s.Description;
     sbdo.GradeLevel = s.GradeLevel;
     sbdo.LearningAreaCode = s.LearningAreaCode;
     sbdo.SubjectCode = s.SubjectCode;
     sbdo.SubjectID = s.SubjectID;
     //  ldao.ConvertLearningAreaToLearningAreaBDO(s.LearningArea, la);
     sbdo.LearningArea = la;
 }
Esempio n. 9
0
 public void TranslateSubjectBDOToSubject(SubjectBDO sub, Subject sbdo)
 {
     //LearningAreaService las = new LearningAreaService();
     //LearningArea lb = new LearningArea();
     sbdo.SubjectID = sub.SubjectID;
     sbdo.Description = sub.Description;
     sbdo.GradeLevel = sub.GradeLevel;
     sbdo.LearningAreaCode = sub.LearningAreaCode;
     sbdo.SubjectCode = sub.SubjectCode;
     sbdo.Academic = sub.Academic;
     sbdo.MPW = sub.MPW;
       //  las.TranslateLearningAreaBDOToLearningArea(sub.LearningArea, lb);
        // sbdo.LArea = lb;
 }
Esempio n. 10
0
        public void ConvertSubjectBDOToSubject(SubjectBDO sbdo, Subject s)
        {
            //LearningAreaDAO ldao = new LearningAreaDAO();
            //LearningArea l = new LearningArea();//s.LearningArea = sbdo.LearningArea;
            s.SubjectID = sbdo.SubjectID;
            s.Description = sbdo.Description;
            s.GradeLevel = sbdo.GradeLevel;
            s.LearningAreaCode = sbdo.LearningAreaCode;
            s.SubjectCode = sbdo.SubjectCode;
            s.MPW = sbdo.MPW;

              //  ldao.ConvertLearningAreaBDOToLearningArea(sbdo.LearningArea, l);
               // s.LearningArea = l;
        }
Esempio n. 11
0
 public List<SubjectBDO> ToSubjectBDOList(List<Subject> sList)
 {
     List<SubjectBDO> slist = new List<SubjectBDO>();
     foreach (Subject s in sList)
     {
         SubjectBDO sbdo = new SubjectBDO();
         sbdo.LearningAreaCode = s.LearningAreaCode;
         sbdo.Description = s.Description;
         sbdo.GradeLevel = s.GradeLevel;
         sbdo.SubjectCode = s.SubjectCode;
         slist.Add(sbdo);
     }
     return slist;
 }
Esempio n. 12
0
        public SubjectBDO GetSubject(string subjectCode)
        {
            SubjectBDO sbdo = new SubjectBDO();
            Subject subj = new Subject();
            using (var DCEnt = new DCFIEntities())
            {
                var sub = (from s in DCEnt.Subjects
                           where s.SubjectCode == subjectCode
                           select s).FirstOrDefault();
                subj = sub;
            }

            ConvertSubjectToSubjectBDO(subj, sbdo);
            return sbdo;
        }
Esempio n. 13
0
        public void ConvertStuSubjectsToStuSubjectsBDO(StudentSubject s, StudentSubjectBDO sbdo)
        {
            StudentEnrolmentDAO sed = new StudentEnrolmentDAO();
            StudentEnrollmentBDO sedb = new StudentEnrollmentBDO();
            sed.ConvertEnrolToEnrolBDO(s.StudentEnrollment, sedb);
            sbdo.StudentEnrollment = sedb;

            StudentDAO sd = new StudentDAO();
            StudentBDO sb = new StudentBDO();
            sd.ConvertStudentToStudentBDO(s.StudentEnrollment.Student, sb);
            sbdo.StudentEnrollment.Student = sb;

            SubjectDAO subd = new SubjectDAO();
            SubjectBDO sbo = new SubjectBDO();
            subd.ConvertSubjectToSubjectBDO(s.Subject, sbo);
            sbdo.Subject = sbo;

            sbdo.StudentSY = s.StudentSY;
            sbdo.SubjectCode = s.SubjectCode;
            sbdo.StudentSubjectsID = s.StudentSubjectsID;
            sbdo.StudentEnrSubCode = s.StudentEnrSubCode;
            sbdo.Remarks = s.Remarks;

            sbdo.FirstPeriodicRating = s.FirstPeriodicRating;
            sbdo.SecondPeriodicRating = s.SecondPeriodicRating;
            sbdo.ThirdPeriodicRating = s.ThirdPeriodicRating;
            sbdo.FourthPeriodicRating = s.FourthPeriodicRating;

            sbdo.StudentEnrSubCode = s.StudentEnrSubCode;

            sbdo.SubjectAssignments = s.SubjectAssignments;

            sbdo.FirstEntered = s.FirstEntered;
            sbdo.SecondEntered = s.SecondEntered;
            sbdo.FourthEntered = s.FourthEntered;
            sbdo.ThirdEntered = s.ThirdEntered;

            sbdo.LockFirst = s.LockFirst;
            sbdo.LockSecond = s.LockSecond;
            sbdo.LockThird = s.LockThird;
            sbdo.LockFourth = s.LockFourth;

            sbdo.FirstLocked = s.FirstLocked;
            sbdo.SecondLocked = s.SecondLocked;
            sbdo.ThirdLocked = s.ThirdLocked;
            sbdo.FourthLocked = s.FourthLocked;
        }
Esempio n. 14
0
 public void ConvertLearningAreaToLearningAreaBDO(LearningArea la, LearningAreaBDO labdo)
 {
     // labdo.Subjects = GetSubjectsforLearningArea(la.LearningAreaCode);
     labdo.Academic = la.Academic;
     labdo.Description = la.Description;
     labdo.LearningAreaCode = la.LearningAreaCode;
     labdo.Units = la.Units;
     labdo.RatePerUnit = la.RatePerUnit;
     labdo.RatePerSubject = la.RatePerSubject;
     foreach (Subject s in la.Subjects)
     {
         SubjectBDO sb = new SubjectBDO();
        ConvertSubjectToSubjectBDO(s, sb);
         sb.Academic =(bool) la.Academic;
         labdo.Subjects.Add(sb);
     }
 }
Esempio n. 15
0
        public List<SubjectBDO> GetAllSbjects()
        {
            List<Subject> subjectList = new List<Subject>();
            using (var DCEnt = new DCFIEntities())
            {
                var allSubjects = (DCEnt.Subjects);
                subjectList = allSubjects.ToList<Subject>();
            }

            List<SubjectBDO> subjectBDOList = new List<SubjectBDO>();
            foreach (Subject s in subjectList)
            {
                SubjectBDO subjectBDO = new SubjectBDO();
                ConvertSubjectToSubjectBDO(s, subjectBDO);
                subjectBDOList.Add(subjectBDO);
            }
            return subjectBDOList;
        }
Esempio n. 16
0
        private List<CurriculumSubjectBDO> ToCurriculumSubjectBDOList(List<CurriculumSubject> csList)
        {
            List<CurriculumSubjectBDO> csbdoList = new List<CurriculumSubjectBDO>();
            foreach (CurriculumSubject cs in csList)
            {
                SubjectDAO sDAO = new SubjectDAO();
                SubjectBDO sbdo = new SubjectBDO();
                CurriculumSubjectBDO csbdo = new CurriculumSubjectBDO();
                csbdo.CurriculumCode = cs.CurriculumCode;
                csbdo.CurrSubCode = cs.CurrSubCode;
                csbdo.Deactivated = cs.Deactivated;
                csbdo.SubjectCode = cs.SubjectCode;
                sbdo = sDAO.GetSubject(cs.SubjectCode);

                csbdo.Sub = sbdo;
                csbdoList.Add(csbdo);
            }
            return csbdoList;
        }
Esempio n. 17
0
        public Boolean CreateSubject(ref SubjectBDO subjectBDO, ref string message)
        {
            message = "Subject Added Successfully";
            bool ret = true;

            Subject s = new Subject();
            ConvertSubjectBDOToSubject(subjectBDO, s);

            using (var DCEnt = new DCFIEntities())
            {
                DCEnt.Subjects.Attach(s);
                DCEnt.Entry(s).State = System.Data.Entity.EntityState.Added;
                int num = DCEnt.SaveChanges();

                if (num != 1)
                {
                    ret = false;
                    message = "Adding of Subject failed";
                }
            }
            return ret;
        }
Esempio n. 18
0
        public Boolean CreateSubject(ref SubjectBDO subjectBDO, ref string message)
        {
            message = "Subject Added Successfully";
            bool ret = true;

            Subject s = new Subject();
            try { 
            ConvertSubjectBDOToSubject(subjectBDO, s);

            using (var DCEnt = new DCFIEntities())
            {
                DCEnt.Subjects.Attach(s);
                DCEnt.Entry(s).State = System.Data.Entity.EntityState.Added;
                int num = DCEnt.SaveChanges();

                if (num != 1)
                {
                    ret = false;
                    message = "Adding of Subject 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;
        }
Esempio n. 19
0
        public List<SubjectBDO> GetSubjectsforGradeLevel(string gradeLevel)
        {
            List<Subject> subjects = null;
            List<SubjectBDO> sbdoList = new List<SubjectBDO>();
            using (var DCEnt = new DCFIEntities())
            {
                subjects = (from s in DCEnt.Subjects
                            where s.GradeLevel == gradeLevel
                            select s).ToList<Subject>();

            }
            foreach (Subject s in subjects)
            {
                SubjectBDO subjBDO = new SubjectBDO();
                ConvertSubjectToSubjectBDO(s, subjBDO);
                sbdoList.Add(subjBDO);
            }
            return sbdoList;
        }
Esempio n. 20
0
        public Boolean UpdateSubject(ref SubjectBDO subjectBDO, ref string message)
        {
            message = "Subject updated successfully.";
            Boolean ret = true;
            try { 
            using (var DCEnt = new DCFIEntities())
            {
                var subjectCode = subjectBDO.SubjectCode;
                Subject subjectInDB = (from s in DCEnt.Subjects
                                       where s.SubjectCode == subjectCode
                                       select s).FirstOrDefault();
                if (subjectInDB == null)
                {
                    throw new Exception("No Subject with SubjectCode " + subjectBDO.SubjectCode);
                }
                DCEnt.Subjects.Remove(subjectInDB);

                subjectInDB.SubjectID = subjectBDO.SubjectID;
                subjectInDB.Description = subjectBDO.Description;
                subjectInDB.GradeLevel = subjectBDO.GradeLevel;
                subjectInDB.LearningAreaCode = subjectBDO.LearningAreaCode;
                subjectInDB.SubjectCode = subjectBDO.SubjectCode;
                    subjectInDB.MPW = subjectBDO.MPW;

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

                if (num != 1)
                {
                    ret = false;
                    message = "No subject 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;

        }
Esempio n. 21
0
        public List<SubjectBDO> GetSubjectsforLearningArea(string learningAreaCode)
        {
            List<Subject> subjects = null;
            List<SubjectBDO> sbdoList = new List<SubjectBDO>();
            using (var DCEnt = new DCFIEntities())
            {
                subjects = (from s in DCEnt.Subjects
                            where s.LearningAreaCode == learningAreaCode
                            select s).ToList<Subject>();

            }
            foreach (Subject s in subjects)
            {
                SubjectBDO subjBDO = new SubjectBDO();
                ConvertSubjectToSubjectBDO(s, subjBDO);
                sbdoList.Add(subjBDO);
            }
            return sbdoList;
        }
Esempio n. 22
0
        public List<SubjectBDO> GetSubjectsforGradeLevel(string gradeLevel)
        {
            List<Subject> subjects = null;
            List<SubjectBDO> sbdoList = new List<SubjectBDO>();
            try { 
            using (var DCEnt = new DCFIEntities())
            {
                subjects = (from s in DCEnt.Subjects
                            where s.GradeLevel == gradeLevel
                            select s).ToList<Subject>();

          
            foreach (Subject s in subjects)
            {
                SubjectBDO subjBDO = new SubjectBDO();
                ConvertSubjectToSubjectBDO(s, subjBDO);
                sbdoList.Add(subjBDO);
            }
            }
            }
            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 sbdoList;
        }
Esempio n. 23
0
 public List<SubjectBDO> ToSubjectBDOList(ICollection<Subject> slist)
 {
     List<SubjectBDO> sbdoList = new List<SubjectBDO>();
     foreach (Subject s in slist)
     {
         SubjectBDO sbdo = new SubjectBDO();
         ConvertSubjectToSubjectBDO(s, sbdo);
         sbdoList.Add(sbdo);
     }
     return sbdoList;
 }