Exemplo n.º 1
0
        public void ConvertStuSubjectsBDOToStuSubjects(StudentSubjectBDO sbdo, StudentSubject s)
        {
            s.StudentSY = sbdo.StudentSY;
            s.SubjectCode = sbdo.SubjectCode;
            s.StudentSubjectsID = sbdo.StudentSubjectsID;
            s.StudentEnrSubCode = sbdo.StudentEnrSubCode;
            s.Remarks = sbdo.Remarks;

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

            s.SubjectAssignments = sbdo.SubjectAssignments;

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

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

            s.FirstLocked = sbdo.FirstLocked;
            s.SecondLocked = sbdo.SecondLocked;
            s.ThirdLocked = sbdo.ThirdLocked;
            s.FourthLocked = sbdo.FourthLocked;
        }
Exemplo n.º 2
0
        public void ConvertStuSubjectsBDOToStuSubjects(StudentSubjectBDO sbdo, StudentSubject s)
        {
            s.StudentSY         = sbdo.StudentSY;
            s.SubjectCode       = sbdo.SubjectCode;
            s.StudentSubjectsID = sbdo.StudentSubjectsID;
            s.StudentEnrSubCode = sbdo.StudentEnrSubCode;
            s.Remarks           = sbdo.Remarks;

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

            s.SubjectAssignments = sbdo.SubjectAssignments;

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

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

            s.FirstLocked  = sbdo.FirstLocked;
            s.SecondLocked = sbdo.SecondLocked;
            s.ThirdLocked  = sbdo.ThirdLocked;
            s.FourthLocked = sbdo.FourthLocked;
        }
Exemplo n.º 3
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;
        }
Exemplo n.º 4
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;
        }
Exemplo n.º 5
0
        public Boolean CreateStudentSubject(StudentSubjectBDO subBDO, ref string message)
        {
            message = "Student Subject Successfully Saved";
            bool ret = true;

            StudentSubject sa = new StudentSubject();

            ConvertStuSubjectsBDOToStuSubjects(subBDO, sa);
            try{
                using (var DCEnt = new DCFIEntities())
                {
                    DCEnt.StudentSubjects.Attach(sa);
                    DCEnt.Entry(sa).State = System.Data.Entity.EntityState.Added;
                    int num = DCEnt.SaveChanges();

                    if (num != 1)
                    {
                        ret     = false;
                        message = "Saving 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);
        }
Exemplo n.º 6
0
        public Boolean SaveClassGrades(List<StudentSubjectBDO> grades) {
            Boolean ret = true;
            StudentSubject gradeInDB = new StudentSubject();
            try { 
            using (var DCEnt = new DCFIEntities())
            {
                
                foreach (StudentSubjectBDO grade in grades)
                {
                    gradeInDB = (from ss in DCEnt.StudentSubjects
                                 where ss.StudentEnrSubCode == grade.StudentEnrSubCode
                                 select ss).FirstOrDefault();

                    DCEnt.StudentSubjects.Remove(gradeInDB);
                 
                    ConvertStuSubjectsBDOToStuSubjects(grade, gradeInDB);


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

                        if (grade.FourthPeriodicRating != 0 && grade.FirstPeriodicRating != 0 && grade.SecondPeriodicRating != 0 && grade.ThirdPeriodicRating != 0)
                                UpdateStudentGPA(grade.StudentSY);                         
                        
                        else if (grade.FourthPeriodicRating == 0 && grade.ThirdPeriodicRating != 0 && grade.FirstPeriodicRating != 0 && grade.SecondPeriodicRating != 0)
                            UpdateStudentThirdGPA(grade.StudentSY);
                        
                        else if (grade.FourthPeriodicRating == 0 && grade.ThirdPeriodicRating == 0 && grade.SecondPeriodicRating != 0 && grade.FirstPeriodicRating != 0)
                             UpdateStudentSecondGPA(grade.StudentSY);
                        
                        else if (grade.FourthPeriodicRating == 0 && grade.ThirdPeriodicRating == 0 && grade.SecondPeriodicRating == 0 && grade.FirstPeriodicRating != 0)
                           UpdateStudentFirstGPA(grade.StudentSY);
                        
                        if (num != 1)
                        ret = false;
                    
                }

            }
            
        }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;
        }
Exemplo n.º 7
0
        public Boolean CreateStudentSubject(StudentSubjectBDO subBDO,ref string message)
        {
            message = "Student Subject Successfully Saved";
            bool ret = true;

            StudentSubject sa = new StudentSubject();
            ConvertStuSubjectsBDOToStuSubjects(subBDO, sa);
            try{
                using (var DCEnt = new DCFIEntities())
                {
                    DCEnt.StudentSubjects.Attach(sa);
                    DCEnt.Entry(sa).State = System.Data.Entity.EntityState.Added;
                    int num = DCEnt.SaveChanges();

                    if (num != 1)
                    {
                        ret = false;
                        message = "Saving 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;
            
        }
Exemplo n.º 8
0
        public Boolean SaveClassGrades(List <StudentSubjectBDO> grades)
        {
            Boolean        ret       = true;
            StudentSubject gradeInDB = new StudentSubject();

            try {
                using (var DCEnt = new DCFIEntities())
                {
                    foreach (StudentSubjectBDO grade in grades)
                    {
                        gradeInDB = (from ss in DCEnt.StudentSubjects
                                     where ss.StudentEnrSubCode == grade.StudentEnrSubCode
                                     select ss).FirstOrDefault();

                        DCEnt.StudentSubjects.Remove(gradeInDB);

                        ConvertStuSubjectsBDOToStuSubjects(grade, gradeInDB);


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

                        if (grade.FourthPeriodicRating != 0 && grade.FirstPeriodicRating != 0 && grade.SecondPeriodicRating != 0 && grade.ThirdPeriodicRating != 0)
                        {
                            UpdateStudentGPA(grade.StudentSY);
                        }

                        else if (grade.FourthPeriodicRating == 0 && grade.ThirdPeriodicRating != 0 && grade.FirstPeriodicRating != 0 && grade.SecondPeriodicRating != 0)
                        {
                            UpdateStudentThirdGPA(grade.StudentSY);
                        }

                        else if (grade.FourthPeriodicRating == 0 && grade.ThirdPeriodicRating == 0 && grade.SecondPeriodicRating != 0 && grade.FirstPeriodicRating != 0)
                        {
                            UpdateStudentSecondGPA(grade.StudentSY);
                        }

                        else if (grade.FourthPeriodicRating == 0 && grade.ThirdPeriodicRating == 0 && grade.SecondPeriodicRating == 0 && grade.FirstPeriodicRating != 0)
                        {
                            UpdateStudentFirstGPA(grade.StudentSY);
                        }

                        if (num != 1)
                        {
                            ret = false;
                        }
                    }
                }
            }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);
        }