示例#1
0
        public Boolean UpdateGradeLevel(ref GradeLevelBDO gBDO, ref string message)
        {
            message = "Grade Level updated successfully.";
            Boolean ret = true;
            using (var DCEnt = new DCFIEntities())
            {
                var gCode = gBDO.GradeLev;
                GradeLevel gInDB = (from g in DCEnt.GradeLevels
                                    where g.GradeLevel1 == gCode
                                    select g).FirstOrDefault();
                if (gInDB == null)
                {
                    throw new Exception("No Grade Level " + gBDO.GradeLev);
                }
                DCEnt.GradeLevels.Remove(gInDB);
                gInDB.GradeLevel1 = gBDO.GradeLev;
                gInDB.Description = gBDO.Description;

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

                if (num != 1)
                {
                    ret = false;
                    message = "No grade level is updated.";
                }
            }
            return ret;
        }
示例#2
0
        public Boolean CreateGradeLevel(ref GradeLevelBDO gBDO, ref string message)
        {
            message = "Grade Level Added Successfully";
            bool ret = true;

            GradeLevel g = new GradeLevel();
            try {
            ConvertGradeLevelBDOToGradeLevel(gBDO, g);
            using (var DCEnt = new DCFIEntities())
            {
                DCEnt.GradeLevels.Attach(g);
                DCEnt.Entry(g).State = System.Data.Entity.EntityState.Added;
                int num = DCEnt.SaveChanges();

                if (num != 1)
                {
                    ret = false;
                    message = "Adding of Grade Level 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;
        }
示例#3
0
 public string GetGradeLevel(string gradeLevel)
 {
     gList = GetAllGradeLevels();
     GradeLevelBDO g = new GradeLevelBDO();
     g = gList.Find(p => p.GradeLev == gradeLevel);
     return g.Description;
 }
示例#4
0
        public List<GradeLevelBDO> GetAllGradeLevels()
        {
            List<GradeLevel> gList = new List<GradeLevel>();
            List<GradeLevelBDO> gBDOList = new List<GradeLevelBDO>();
            try { 
            using (var DCEnt = new DCFIEntities())
            {
                var allGradeLevels = (from gl in DCEnt.GradeLevels
                                      orderby gl.level ascending
                                      select gl);
                gList = allGradeLevels.ToList<GradeLevel>();
            }

          
            foreach (GradeLevel g in gList)
            {
                GradeLevelBDO gBDO = new GradeLevelBDO();
                ConvertGradeLevelToGradeLevelBDO(g, gBDO);
                gBDOList.Add(gBDO);
            }
            }
            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 gBDOList;
        }
 public void TranslateGradeLevelToGradeLevelBDO(GradeLevel gl, GradeLevelBDO g) {
     FeeService fs = new FeeService();
     TraitService ts = new TraitService();
     g.Description = gl.Description;
     g.GradeLev = gl.GradeLev;
     g.StudentFees = fs.ToFeeBDOList(gl.StudentFees);
     g.Traits = ts.ToTraitBDOList(gl.Traits);
 }
示例#6
0
        public GradeLevelBDO NextGradeLevel(String grade) {
            List<GradeLevelBDO> glist = GetAllGradeLevels();
            GradeLevelBDO dbase = new GradeLevelBDO();
                dbase = glist.Find(p => p.GradeLev.Equals(grade));
            GradeLevelBDO gNext = new GradeLevelBDO();
                if (dbase.level == null)
                    dbase.level = -1;

                gNext = glist.Find(p => p.level == (dbase.level + 1));

            return gNext;
        }
示例#7
0
        public List<GradeLevelBDO> GetAllGradeLevels()
        {
            List<GradeLevel> gList = new List<GradeLevel>();
            using (var DCEnt = new DCFIEntities())
            {
                var allGradeLevels = (from gl in DCEnt.GradeLevels
                                      orderby gl.Description ascending
                                      select gl);
                gList = allGradeLevels.ToList<GradeLevel>();
            }

            List<GradeLevelBDO> gBDOList = new List<GradeLevelBDO>();
            foreach (GradeLevel g in gList)
            {
                GradeLevelBDO gBDO = new GradeLevelBDO();
                ConvertGradeLevelToGradeLevelBDO(g, gBDO);
                gBDOList.Add(gBDO);
            }
            return gBDOList;
        }
示例#8
0
        public Boolean CreateGradeLevel(ref GradeLevelBDO gBDO, ref string message)
        {
            message = "Grade Level Added Successfully";
            bool ret = true;

            GradeLevel g = new GradeLevel();
            ConvertGradeLevelBDOToGradeLevel(gBDO, g);
            using (var DCEnt = new DCFIEntities())
            {
                DCEnt.GradeLevels.Attach(g);
                DCEnt.Entry(g).State = System.Data.Entity.EntityState.Added;
                int num = DCEnt.SaveChanges();

                if (num != 1)
                {
                    ret = false;
                    message = "Adding of Grade Level failed";
                }
            }
            return ret;
        }
示例#9
0
 private void TranslateGradeLevelBDOToeGradeLevelDTo(GradeLevelBDO glBDO, GradeLevel gradeLevel)
 {
     gradeLevel.Description = glBDO.Description;
     gradeLevel.GradeLev = glBDO.GradeLev;
     gradeLevel.Category = glBDO.Category;
 }
示例#10
0
 private void ConvertGradeLevelToGradeLevelBDO(GradeLevel g, GradeLevelBDO gbdo)
 {
     gbdo.Description = g.Description;
     gbdo.GradeLev = g.GradeLevel1;
 }
示例#11
0
 private void ConvertGradeLevelBDOToGradeLevel(GradeLevelBDO gbdo, GradeLevel g)
 {
     g.Description = gbdo.Description;
     g.GradeLevel1 = gbdo.GradeLev;
 }
示例#12
0
 public void ConvertGradeLevelToGradeLevelBDO(GradeLevel g, GradeLevelBDO gbdo)
 {
     gbdo.Description = g.Description;
     gbdo.GradeLev = g.GradeLevel1;
     gbdo.Category = g.Category;
 }
示例#13
0
        public Boolean UpdateGradeLevel(ref GradeLevelBDO gBDO, ref string message)
        {
            message = "Grade Level updated successfully.";
            Boolean ret = true;
            try {
            using (var DCEnt = new DCFIEntities())
            {
                var gCode = gBDO.GradeLev;
                GradeLevel gInDB = (from g in DCEnt.GradeLevels
                                    where g.GradeLevel1 == gCode
                                    select g).FirstOrDefault();
                if (gInDB == null)
                {
                    throw new Exception("No Grade Level " + gBDO.GradeLev);
                }
                DCEnt.GradeLevels.Remove(gInDB);
                gInDB.GradeLevel1 = gBDO.GradeLev;
                gInDB.Description = gBDO.Description;

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

                if (num != 1)
                {
                    ret = false;
                    message = "No grade level 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;
        }
示例#14
0
 public void ConvertGradeLevelBDOToGradeLevel(GradeLevelBDO gbdo, GradeLevel g)
 {
     g.Description = gbdo.Description;
     g.GradeLevel1 = gbdo.GradeLev;
     g.Category = gbdo.Category;
 }
示例#15
0
 private void TranslateeGradeLevelBDOToeGradeLevelDTo(GradeLevelBDO glBDO, GradeLevel gradeLevel)
 {
     gradeLevel.Description = glBDO.Description;
     gradeLevel.GradeLev = glBDO.GradeLev;
     //TO DO Fee and Service
 }