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; }
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; }
public string GetGradeLevel(string gradeLevel) { gList = GetAllGradeLevels(); GradeLevelBDO g = new GradeLevelBDO(); g = gList.Find(p => p.GradeLev == gradeLevel); return g.Description; }
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); }
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; }
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; }
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; }
private void TranslateGradeLevelBDOToeGradeLevelDTo(GradeLevelBDO glBDO, GradeLevel gradeLevel) { gradeLevel.Description = glBDO.Description; gradeLevel.GradeLev = glBDO.GradeLev; gradeLevel.Category = glBDO.Category; }
private void ConvertGradeLevelToGradeLevelBDO(GradeLevel g, GradeLevelBDO gbdo) { gbdo.Description = g.Description; gbdo.GradeLev = g.GradeLevel1; }
private void ConvertGradeLevelBDOToGradeLevel(GradeLevelBDO gbdo, GradeLevel g) { g.Description = gbdo.Description; g.GradeLevel1 = gbdo.GradeLev; }
public void ConvertGradeLevelToGradeLevelBDO(GradeLevel g, GradeLevelBDO gbdo) { gbdo.Description = g.Description; gbdo.GradeLev = g.GradeLevel1; gbdo.Category = g.Category; }
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; }
public void ConvertGradeLevelBDOToGradeLevel(GradeLevelBDO gbdo, GradeLevel g) { g.Description = gbdo.Description; g.GradeLevel1 = gbdo.GradeLev; g.Category = gbdo.Category; }
private void TranslateeGradeLevelBDOToeGradeLevelDTo(GradeLevelBDO glBDO, GradeLevel gradeLevel) { gradeLevel.Description = glBDO.Description; gradeLevel.GradeLev = glBDO.GradeLev; //TO DO Fee and Service }