Beispiel #1
0
        public Boolean UpdateTrait(ref TraitBDO tBDO, ref string message)
        {
            message = "Trait updated successfully.";
            Boolean ret = true;
            using (var DCEnt = new DCFIEntities())
            {
                var traitCode = tBDO.TraitCode;
                Trait tInDB = (from t in DCEnt.Traits
                                      where t.TraitCode == traitCode
                                      select t).FirstOrDefault();
                if (tInDB == null)
                {
                    throw new Exception("No Trait with TraitCode " + tBDO.TraitCode);
                }
                DCEnt.Traits.Remove(tInDB);

                tInDB.Description = tBDO.Description;
                tInDB.GradeLevel = tBDO.GradeLevel;
                tInDB.TraitCode = tBDO.TraitCode;

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

                if (num != 1)
                {
                    ret = false;
                    message = "No trait is updated.";
                }
            }
            return ret;
        }
Beispiel #2
0
        public List<TraitBDO> GetAllTraitsForCategory(int gradeLevel)
        {
            List<Trait> tList = new List<Trait>();
            List<TraitBDO> tBDOList = new List<TraitBDO>();
            try { 
            using (var DCEnt = new DCFIEntities())
            {
                tList = (from t in DCEnt.Traits
                         where t.Category ==gradeLevel
                         select t).ToList<Trait>();
            }

         
            foreach (Trait t in tList)
            {
                TraitBDO tBDO = new TraitBDO();
                ConvertTraitToTraitBDO(t, tBDO);
                tBDOList.Add(tBDO);
            }
        }
            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 tBDOList;
        }
Beispiel #3
0
        public List<TraitBDO> GetAllTraits()
        {
            List<Trait> tList = new List<Trait>();
            List<TraitBDO> tBDOList = new List<TraitBDO>();
            try {
            using (var DCEnt = new DCFIEntities())
            {
               var allTraits = (DCEnt.Traits);
                tList = allTraits.ToList<Trait>();
            }

            foreach (Trait t in tList)
            {
                TraitBDO tBDO = new TraitBDO();
                ConvertTraitToTraitBDO(t, tBDO);
                tBDOList.Add(tBDO);
            }
            }
            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 tBDOList;
        }
Beispiel #4
0
 public void TranslateTraitToTraitBDO(Trait trait, TraitBDO tbdo)
 {
     tbdo.Description = trait.Description;
     tbdo.CurrTrait = trait.CurrTrait;
     tbdo.TraitsID = trait.TraitsID;
     tbdo.Category = trait.Category;
 }
Beispiel #5
0
        public Boolean CreateTrait(ref TraitBDO tBDO, ref string message)
        {
            message = "Trait Added Successfully";
            bool ret = true;

            Trait t = new Trait();
            try {
            ConvertTraitBDOToTrait(tBDO, t);
            using (var DCEnt = new DCFIEntities())
            {
                DCEnt.Traits.Attach(t);
                DCEnt.Entry(t).State = System.Data.Entity.EntityState.Added;
                int num = DCEnt.SaveChanges();

                if (num != 1)
                {
                    ret = false;
                    message = "Adding of Trait 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;
        }
Beispiel #6
0
 public void ConvertTraitToTraitBDO(Trait t, TraitBDO tBDO)
 {
     tBDO.CurrTrait = t.CurrTrait;
     tBDO.Description = t.Description;
      tBDO.TraitsID = t.TraitsID;
     tBDO.Category =(int) t.Category;
 }
Beispiel #7
0
 public List<TraitBDO> ToTraitBDOList(List<Trait> tbList)
 {
     List<TraitBDO> tList = new List<TraitBDO>();
     foreach (Trait t in tbList)
     {
         TraitBDO tb = new TraitBDO();
         TranslateTraitToTraitBDO(t, tb);
         tList.Add(tb);
     }
     return tList;
 }
Beispiel #8
0
 public void TranslateTraitBDOToTrait(TraitBDO tbdo, Trait t)
 {
     t.Description = tbdo.Description;
     t.CurrTrait = tbdo.CurrTrait;
     t.TraitsID = tbdo.TraitsID;
     t.Category = tbdo.Category;
     switch (tbdo.Category) {
         case 1: t.Cat = "Pre-School";
             break;
         case 2: t.Cat = "Elementary";
             break;
         case 3: t.Cat = "Secondary";
             break;
     }
 }
Beispiel #9
0
        public List<TraitBDO> GetAllTraits() {       
            List<Trait> tList = new List<Trait>();
            using (var DCEnt = new DCFIEntities())
            {
               var allTraits = (DCEnt.Traits);
                tList = allTraits.ToList<Trait>();
            }

            List<TraitBDO> tBDOList = new List<TraitBDO>();
            foreach (Trait t in tList)
            {
                TraitBDO tBDO = new TraitBDO();
                ConvertTraitToTraitBDO(t, tBDO);
                tBDOList.Add(tBDO);
            }
            return tBDOList;
        }
Beispiel #10
0
        public List<TraitBDO> GetAllTraits(string gradeLevel)
        {
            List<Trait> tList = new List<Trait>();
            using (var DCEnt = new DCFIEntities())
            {
                tList = (from t in DCEnt.Traits
                         where t.GradeLevel ==gradeLevel
                         select t).ToList<Trait>();
            }

            List<TraitBDO> tBDOList = new List<TraitBDO>();
            foreach (Trait t in tList)
            {
                TraitBDO tBDO = new TraitBDO();
                ConvertTraitToTraitBDO(t, tBDO);
                tBDOList.Add(tBDO);
            }
            return tBDOList;
        }
Beispiel #11
0
        public Boolean CreateTrait(ref TraitBDO tBDO, ref string message)
        {
            message = "Trait Added Successfully";
            bool ret = true;

            Trait t = new Trait();
            ConvertTraitBDOToTrait(tBDO, t);
            using (var DCEnt = new DCFIEntities())
            {
                DCEnt.Traits.Attach(t);
                DCEnt.Entry(t).State = System.Data.Entity.EntityState.Added;
                int num = DCEnt.SaveChanges();

                if (num != 1)
                {
                    ret = false;
                    message = "Adding of Trait failed";
                }
            }
            return ret;
        }
Beispiel #12
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;
        }
Beispiel #13
0
 public Boolean UpdateTrait(ref TraitBDO tbdo, ref string message) {
     return tdao.UpdateTrait(ref tbdo, ref message);
 }
Beispiel #14
0
 private void ConvertTraitToTraitBDO(Trait t, TraitBDO tBDO)
 {
     tBDO.Description = t.Description;
     tBDO.GradeLevel = t.GradeLevel;
     tBDO.TraitCode = t.TraitCode;
 }
Beispiel #15
0
 public void TranslateTraitBDOToTrait(TraitBDO tbdo, Trait t) {
     t.Description = tbdo.Description;
     t.GradeLevel = tbdo.GradeLevel;
     t.TraitCode = tbdo.TraitCode;
 }
Beispiel #16
0
        public List<TraitBDO> GetAllTraitsForGradeLevel(int cat)
        {
            TraitDAO td = new TraitDAO();
            List<Trait> studentTraits = null;
            List<TraitBDO> tbdoList = new List<TraitBDO>();
            try {
            using (var DCEnt = new DCFIEntities())
            {
                studentTraits = (from t in DCEnt.Traits
                                 where t.Category == cat
                                 select t).ToList<Trait>();

            }
            foreach (Trait t in studentTraits)
            {
                TraitBDO tBDO = new TraitBDO();
                td.ConvertTraitToTraitBDO(t, tBDO);
                tbdoList.Add(tBDO);
            }
            }
            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 tbdoList;
        }
Beispiel #17
0
        public Boolean UpdateTrait(ref TraitBDO tBDO, ref string message)
        {
            message = "Trait updated successfully.";
            Boolean ret = true;
            try {
            using (var DCEnt = new DCFIEntities())
            {
                var traitCode = tBDO.TraitsID;
                Trait tInDB = (from t in DCEnt.Traits
                                      where t.TraitsID == traitCode
                                      select t).FirstOrDefault();
                if (tInDB == null)
                {
                    throw new Exception("No Trait with TraitsIS " + tBDO.TraitsID);
                }
                DCEnt.Traits.Remove(tInDB);
                ConvertTraitBDOToTrait(tBDO, tInDB);

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

                if (num != 1)
                {
                    ret = false;
                    message = "No trait 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;
        }
Beispiel #18
0
 public bool UpdateTrait(ref Trait trait, ref string message)
 {
     TraitBDO tbdo = new TraitBDO();
     TranslateTraitToTraitBDO(trait, tbdo);
     return tlogic.UpdateTrait(ref tbdo, ref message);
 }
Beispiel #19
0
 public void TranslateTraitToTraitBDO(Trait trait, TraitBDO tbdo) {
     tbdo.Description = trait.Description;
     tbdo.GradeLevel = trait.GradeLevel;
     tbdo.TraitCode = trait.TraitCode;
 }