Пример #1
0
        public StudentEnrollmentBDO GetStudentEnrolment(string studID, string sy)
        {
            string id = String.Empty;

            id = studID + sy;
            StudentEnrollment    sa       = null;
            StudentEnrollmentBDO enrolBDO = new StudentEnrollmentBDO();

            try {
                using (var DCEnt = new DCFIEntities())
                {
                    sa = (from enrol in DCEnt.StudentEnrollments
                          where enrol.StudentSY == id
                          select enrol).FirstOrDefault();
                }

                ConvertEnrolToEnrolBDO(sa, enrolBDO);
            }
            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(enrolBDO);
        }
Пример #2
0
        public Boolean EnrolStudent(StudentEnrollment studentEnr)
        {
            GradeSectionLogic    gsl        = new GradeSectionLogic();
            StudentService       ss         = new StudentService();
            StudentEnrollmentBDO studentBDO = new StudentEnrollmentBDO();

            string message = string.Empty;

            List <GradeSectionBDO> sections = new List <GradeSectionBDO>();
            string grade = studentEnr.GradeLevel;

            sections = (gsl.GetAllSectionsofGrade(grade));

            int div = studentEnr.Rank / 20;

            div++;
            int index = sections.FindIndex(item => item.Class == div);

            studentEnr.GradeSectionCode = (int?)sections[index].GradeSectionCode;
            TranslatEnrolToEnrolBDO(studentEnr, studentBDO);
            if (sel.RegisterStudent(studentBDO, ref message))
            {
                string section = String.Empty;
                studentBDO.GradeSectionCode = studentEnr.GradeSectionCode;
                index   = sections.FindIndex(item => item.GradeSectionCode == studentEnr.GradeSectionCode);
                section = sections[index].Section;
                ss.UpdateStudent(studentEnr.StudentId, studentEnr.GradeLevel, studentEnr.Rank, section);
                ControlStudentCharacters(studentBDO);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #3
0
        public List <StudentEnrollmentBDO> GetAllEnrollments()
        {
            List <StudentEnrollmentBDO> enrolBDOList = new List <StudentEnrollmentBDO>();
            List <StudentEnrollment>    enrolList    = new List <StudentEnrollment>();

            try {
                using (var DCEnt = new DCFIEntities())
                {
                    var allEnrols = (DCEnt.StudentEnrollments);
                    enrolList = allEnrols.ToList <StudentEnrollment>();
                }


                foreach (StudentEnrollment a in enrolList)
                {
                    StudentEnrollmentBDO enrolBDO = new StudentEnrollmentBDO();
                    ConvertEnrolToEnrolBDO(a, enrolBDO);
                    enrolBDOList.Add(enrolBDO);
                }
            }
            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(enrolBDOList);
        }
Пример #4
0
        public void ControlStudentCharacters(StudentEnrollmentBDO student)
        {
            int          cat       = GetCategory(student.GradeLevel);
            Boolean      ret       = false;
            TraitService trait     = new TraitService();
            List <Trait> traitlist = new List <Trait>();

            traitlist = trait.GetAllTraitsOfCategory(cat);
            foreach (Trait t in traitlist)
            {
                StudentTrait st = new StudentTrait
                {
                    StudentSY           = student.StudentSY,
                    TraitsID            = t.TraitsID,
                    StudentEnrTraitCode = student.StudentSY + t.TraitsID,
                    LockFirst           = false,
                    LockSecond          = false,
                    LockFourth          = false,
                    LockThird           = false
                };
                if (student.GradeSectionCode != null)
                {
                    st.GradeSectionCode = (int)student.GradeSectionCode;
                }

                string          message = string.Empty;
                StudentTraitBDO stb     = new StudentTraitBDO();
                TranslateStuTraitsToStuTraitsBDO(st, stb);
                ret = stl.AddStudentCharacters(stb, ref message);
            }
        }
Пример #5
0
 public void ConvertEnrolBDOToEnrol(StudentEnrollmentBDO seb, StudentEnrollment se)
 {
     se.StudentSY            = seb.StudentSY;
     se.StudentId            = seb.StudentId;
     se.SY                   = seb.SY;
     se.GradeLevel           = seb.GradeLevel;
     se.GradeSectionCode     = seb.GradeSectionCode;
     se.Dismissed            = seb.Dismissed;
     se.Stat                 = seb.Stat;
     se.DiscountId           = seb.DiscountId;
     se.StudentEnrollmentsID = seb.StudentEnrollmentsID;
 }
Пример #6
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;
        }
Пример #7
0
        public void TranslatEnrolToEnrolBDO(StudentEnrollment se, StudentEnrollmentBDO seb)
        {
            seb.StudentSY        = se.StudentSY;
            seb.StudentId        = se.StudentId;
            seb.SY               = se.SY;
            seb.GradeLevel       = se.GradeLevel;
            seb.GradeSectionCode = se.GradeSectionCode;
            seb.Dismissed        = se.Dismissed;
            seb.Stat             = se.Stat;
            seb.DiscountId       = se.DiscountId;
            seb.Rank             = se.Rank;

            // seb.StudentEnrollmentsID = se.StudentEnrollmentsID
        }
Пример #8
0
        public void ConvertEnrolToEnrolBDO(StudentEnrollment se, StudentEnrollmentBDO seb)
        {
            StudentDAO sd  = new StudentDAO();
            StudentBDO stu = new StudentBDO();

            stu                      = sd.GetStudentBDO(se.StudentId);
            seb.StudentSY            = se.StudentSY;
            seb.StudentId            = se.StudentId;
            seb.SY                   = se.SY;
            seb.GradeLevel           = se.GradeLevel;
            seb.GradeSectionCode     = se.GradeSectionCode;
            seb.Dismissed            = se.Dismissed;
            seb.Stat                 = se.Stat;
            seb.DiscountId           = se.DiscountId;
            seb.Student              = stu;
            seb.StudentEnrollmentsID = se.StudentEnrollmentsID;
        }
Пример #9
0
        public void TranslatEnrolBDOToEnrol(StudentEnrollmentBDO seb, StudentEnrollment se)
        {
            StudentService ss  = new StudentService();
            Student        stu = new Student();

            ss.TranslateStudentBDOToStudentDTO(seb.Student, stu);
            se.StudentSY            = seb.StudentSY;
            se.StudentId            = seb.StudentId;
            se.SY                   = seb.SY;
            se.GradeLevel           = seb.GradeLevel;
            se.GradeSectionCode     = seb.GradeSectionCode;
            se.Dismissed            = seb.Dismissed;
            se.Stat                 = seb.Stat;
            se.DiscountId           = (int)seb.DiscountId;
            se.StudentName          = stu.LastName + ", " + stu.FirstName + " " + stu.MiddleName;
            se.StudentEnrollmentsID = seb.StudentEnrollmentsID;
            se.student              = stu;
        }
Пример #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;
        }
Пример #11
0
        public Boolean EnrolStudent(StudentEnrollmentBDO studentBDO, ref string message)
        {
            message = "Successful registering student";
            Boolean           ret     = true;
            StudentEnrollment student = new StudentEnrollment();

            ConvertEnrolBDOToEnrol(studentBDO, student);
            string sid = studentBDO.StudentId;

            try{
                using (var DCEnt = new DCFIEntities())
                {
                    DCEnt.StudentEnrollments.Attach(student);
                    DCEnt.Entry(student).State = System.Data.Entity.EntityState.Added;

                    Student inDB = (from s in DCEnt.Students
                                    where s.StudentId.Equals(sid)
                                    select s).FirstOrDefault();

                    inDB.ScholarshipDiscountId = studentBDO.DiscountId;

                    DCEnt.SaveChanges();
                }
            }
            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);
        }
Пример #12
0
        public bool EnrolIrregStudent(StudentEnrollment studentEnr)
        {
            GradeSectionLogic    gsl        = new GradeSectionLogic();
            StudentService       ss         = new StudentService();
            StudentEnrollmentBDO studentBDO = new StudentEnrollmentBDO();

            TranslatEnrolToEnrolBDO(studentEnr, studentBDO);
            string message = string.Empty;

            if (sel.RegisterStudent(studentBDO, ref message))
            {
                string section = String.Empty;
                int    gsc     = (int)studentEnr.GradeSectionCode;
                section = gsl.GetSection(gsc);
                ss.UpdateStudent(studentEnr.StudentId, studentEnr.GradeLevel, studentEnr.Rank, section);
                ControlStudentCharacters(studentBDO);
                return(true);
            }

            else
            {
                return(false);
            }
        }
Пример #13
0
 public Boolean RegisterStudent(StudentEnrollmentBDO student, ref string message)
 {
     return(enrolDAO.EnrolStudent(student, ref message));
 }