Exemplo n.º 1
0
        public List<StudentTraitBDO> GetAllStudentTraits()
        {
            List<StudentTraitBDO> traitBDOList = new List<StudentTraitBDO>();
            List<StudentTrait> traitList = new List<StudentTrait>();
            try {
                using (var DCEnt = new DCFIEntities())
                {
                    var allStudentTraits = (DCEnt.StudentTraits);
                    traitList = allStudentTraits.ToList<StudentTrait>();



                    foreach (StudentTrait t in traitList)
                    {
                        StudentTraitBDO traitBDO = new StudentTraitBDO();
                        ConvertStuTraitsToStuTraitsBDO(t, traitBDO);
                        traitBDOList.Add(traitBDO);
                    }
                }
                }
            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 traitBDOList;
        }
Exemplo n.º 2
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
         };
         string message = string.Empty;
         StudentTraitBDO stb = new StudentTraitBDO();
         TranslateStuTraitsToStuTraitsBDO(st, stb);
         ret = stl.AddStudentCharacters(stb, ref message);
     }
 }
Exemplo n.º 3
0
        public List<StudentTraitBDO> GetStudentTraits(int studID, string sy)
        {
            List<StudentTraitBDO> traitsList = new List<StudentTraitBDO>();
            try
            {
                string id = String.Empty;

                id = studID.ToString() + sy;
                List<StudentTrait> st = new List<StudentTrait>();
                StudentTraitBDO traitBDO = new StudentTraitBDO();


                using (var DCEnt = new DCFIEntities())
                {
                    st = (from trait in DCEnt.StudentTraits
                          where trait.StudentSY == id
                          select trait).ToList<StudentTrait>();


                    foreach (StudentTrait stl in st)
                    {
                        ConvertStuTraitsToStuTraitsBDO(stl, traitBDO);
                        traitsList.Add(traitBDO);
                    }
                }
            }
            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 traitsList;
        }
Exemplo n.º 4
0
 public void ConvertStuTraitsBDOToStuTraits(StudentTraitBDO stbdo, StudentTrait st)
 {
     st.StudentSY = stbdo.StudentSY;
     st.TraitsID = stbdo.TraitsID;
     st.FirstPeriodicRating = stbdo.FirstPeriodicRating;
     st.SecondPeriodicRating = stbdo.SecondPeriodicRating;
     st.ThirdPeriodicRating = stbdo.ThirdPeriodicRating;
     st.FourthPeriodicRating = stbdo.FourthPeriodicRating;
     st.StudentEnrTraitCode = stbdo.StudentEnrTraitCode;
     st.FirstEntered = stbdo.FirstEntered;
     st.FirstLocked = stbdo.FirstLocked;
     st.FourthEntered = stbdo.FourthEntered;
     st.FourthLocked = stbdo.FourthLocked;
     st.LockCFourth = stbdo.LockCFourth;
     st.LockFirst = stbdo.LockFirst;
     st.LockSecond = stbdo.LockSecond;
     st.LockThird = stbdo.LockThird;
     st.SecondEntered = stbdo.SecondEntered;
     st.SecondLocked = stbdo.SecondLocked;
     st.ThirdEntered = stbdo.ThirdEntered;
     st.ThirdLocked = stbdo.ThirdLocked;
     st.GradeSectionCode = stbdo.GradeSectionCode;
 }
Exemplo n.º 5
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;
        }
Exemplo n.º 6
0
        public Boolean CreateStudentTrait(ref StudentTraitBDO sabdo, ref string message)
        {
            message = "Student Trait Successfully Saved";
            bool ret = true;

            StudentTrait sa = new StudentTrait();
            try {
            ConvertStuTraitsBDOToStuTraits(sabdo, sa);
                using (var DCEnt = new DCFIEntities())
                {
                    DCEnt.StudentTraits.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.º 7
0
        public List<StudentTraitBDO> GetAdvisees(int GradeSectionCode, string gender)
        {
            List<StudentTrait> studlist = new List<StudentTrait>();
            List<StudentTraitBDO> classList = new List<StudentTraitBDO>();
            try
            {
                using (var DCEnt = new DCFIEntities())
                {

                    var ss = (from sub in DCEnt.StudentTraits
                              where sub.GradeSectionCode==GradeSectionCode & sub.StudentEnrollment.Student.Gender == gender
                              orderby sub.StudentEnrollment.Student.LastName
                              select sub).ToList<StudentTrait>();

                    studlist = ss;

                    foreach (StudentTrait st in studlist)
                    {
                        StudentTraitBDO ssbdo = new StudentTraitBDO();
                        ConvertStuTraitsToStuTraitsBDO(st, ssbdo);
                        classList.Add(ssbdo);
                    }
                }
            }
            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 classList;
        }
Exemplo n.º 8
0
        public void TranslateStudentTraitToStudentTraitBDO(StudentTrait ss, StudentTraitBDO ssbdo)
        {
            ssbdo.FirstEntered = ss.FirstEntered;
            ssbdo.FirstLocked = ss.FirstLocked;
            ssbdo.FirstPeriodicRating = ss.FirstPeriodicRating;
            ssbdo.FourthEntered = ss.FourthEntered;
            ssbdo.FourthLocked = ss.FourthLocked;
            ssbdo.FourthPeriodicRating = ss.FourthPeriodicRating;
            ssbdo.LockFirst = ss.LockFirst;
            ssbdo.LockCFourth = ss.LockFourth;
            ssbdo.LockSecond = ss.LockSecond;
            ssbdo.LockThird = ss.LockThird;
            ssbdo.SecondEntered = ss.SecondEntered;
            ssbdo.SecondLocked = ss.SecondLocked;
            ssbdo.SecondPeriodicRating = ss.SecondPeriodicRating;
            ssbdo.ThirdEntered = ss.ThirdEntered;
            ssbdo.ThirdLocked = ss.ThirdLocked;
            ssbdo.ThirdPeriodicRating = ss.ThirdPeriodicRating;
            ssbdo.StudentEnrTraitCode = ss.StudentEnrTraitCode;

            ssbdo.TraitsID = ss.TraitsID;
            ssbdo.StudentSY = ss.StudentSY;
            ssbdo.GradeSectionCode = ss.GradeSectionCode;

        }
Exemplo n.º 9
0
 public bool SaveTraitsGrade(List<StudentTrait> grades)
 {
     GradingLogic gl = new GradingLogic();
     List<StudentTraitBDO> ssbdo = new List<StudentTraitBDO>();
     foreach (StudentTrait stutra in grades)
     {
         StudentTraitBDO stutraBdo = new StudentTraitBDO();
         TranslateStudentTraitToStudentTraitBDO(stutra, stutraBdo);
         ssbdo.Add(stutraBdo);
     }
     gl.SaveTraitsGrades(ssbdo);
     return true;
 }
Exemplo n.º 10
0
        public void TranslateStudentTraitBDOToStudentTrait(StudentTraitBDO stb, StudentTrait st)
        {
            st.Description = stb.Trait.Description;
            st.FirstEntered = stb.FirstEntered;
            st.FirstLocked = stb.FirstLocked;
            st.FirstPeriodicRating = stb.FirstPeriodicRating;
            st.FourthEntered = stb.FourthEntered;
            st.FourthLocked = stb.FourthLocked;
            st.FourthPeriodicRating = stb.FourthPeriodicRating;
            st.GradeLevel = stb.GradeSection.GradeLevel;
            st.GradeSectionCode = (int)stb.GradeSectionCode;
            st.LockFirst = stb.LockFirst;
            st.LockFourth = stb.LockCFourth;
            st.LockSecond = stb.LockSecond;
            st.LockThird = stb.LockThird;
            st.SecondEntered = stb.SecondEntered;
            st.SecondLocked = stb.SecondLocked;
            st.SecondPeriodicRating = stb.SecondPeriodicRating;
            st.Section = stb.GradeSection.Section;

            RegistrationService r = new RegistrationService();
            StudentEnrollment se = new StudentEnrollment();
            r.TranslatEnrolBDOToEnrol(stb.StudentEnrollment, se);
            st.StudentEnr = se;

            st.StudentEnrTraitCode = stb.StudentEnrTraitCode;
            st.StudentId = se.StudentId;
            st.StudentName = se.StudentName;
            st.StudentSY = stb.StudentSY;
            st.TeacherId = stb.GradeSection.HomeRoomTeacherId;

            st.TeacherName = stb.GradeSection.HomeRoomTeacher.LastName + "," + stb.GradeSection.HomeRoomTeacher.FirstName;
            st.ThirdEntered = stb.ThirdEntered;
            st.ThirdLocked = stb.ThirdLocked;
            st.ThirdPeriodicRating = stb.ThirdPeriodicRating;
            st.TraitsID = stb.TraitsID;

        }
Exemplo n.º 11
0
 public Boolean AddStudentCharacters(StudentTraitBDO stbdo, ref string message) {
    return std.CreateStudentTrait(ref stbdo, ref message);
 }
Exemplo n.º 12
0
 public void NewTraitsTranslateStuTraitsToStuTraitsBDO(StudentTrait st, StudentTraitBDO stbdo)
 {
     stbdo.StudentSY = st.StudentSY;
     stbdo.TraitsID = st.TraitsID;
     stbdo.FirstPeriodicRating = st.FirstPeriodicRating;
     stbdo.SecondPeriodicRating = st.SecondPeriodicRating;
     stbdo.ThirdPeriodicRating = st.ThirdPeriodicRating;
     stbdo.FourthPeriodicRating = st.FourthPeriodicRating;
     stbdo.StudentEnrTraitCode = st.StudentEnrTraitCode;
     stbdo.GradeSectionCode = st.GradeSectionCode;
 }
Exemplo n.º 13
0
        public Boolean UpdateStudentCharacters(Trait tbdo)
        {
            SchoolYear sy = new SchoolYear();
            sy = GetCurrentSY();

            IGradeLevelService gradeLevelService = new GradeLevelService();
            List<GradeLevel> gradeLevelList = new List<GradeLevel>(gradeLevelService.GetAllGradeLevels());
            List<GradeLevel> gradeLevelCategory = new List<GradeLevel>();
            gradeLevelCategory = gradeLevelList.FindAll(x => x.Category == tbdo.Category);

            Boolean ret = false;

            List<string> studentIDs = new List<string>();
            foreach (GradeLevel gl in gradeLevelCategory)
            {
                studentIDs.AddRange(GetEnrolledStudentsforNewTraits(gl.GradeLev, sy.SY));
            }

            foreach (string studentID in studentIDs)
            {
                StudentEnrollment se = new StudentEnrollment();
                se = GetEnrolledStudent(studentID, sy.SY);
                StudentTrait st = new StudentTrait
                {
                    StudentSY = se.StudentSY,
                    TraitsID = tbdo.TraitsID,
                    StudentEnrTraitCode = se.StudentSY + tbdo.TraitsID,
                    GradeSectionCode = (int)se.GradeSectionCode,
                    LockFirst = false,
                    LockSecond = false,
                    LockFourth = false,
                    LockThird = false
                };
                string message = string.Empty;
                StudentTraitBDO stb = new StudentTraitBDO();
                NewTraitsTranslateStuTraitsToStuTraitsBDO(st, stb);
                ret = stl.AddStudentCharacters(stb, ref message);
            }
            return ret;

        }