public void ConvertAssessToAssessBDO(StudentAssessment a, StudentAssessmentBDO ab) { FeeDAO fd = new FeeDAO(); FeeBDO fb = new FeeBDO(); ScholarshipDAO sd = new ScholarshipDAO(); ScholarshipDiscountBDO sb = new ScholarshipDiscountBDO(); if (a.DiscountId.HasValue) { int d = (int)a.DiscountId; sb = sd.GetScholarship(d); ab.DiscountId = (int)a.DiscountId; } ab.StudentAssessmentId = a.StudentAssessmentId; ab.StudentSY = a.StudentSY; ab.FeeID = a.FeeID; ab.Fee = fd.GetFee((int)ab.FeeID); ab.ScholarshipDiscount = sb; }
public Boolean CreateStudentAssessment(StudentAssessmentBDO student) { string message = "Student Successfully Assessed"; bool ret = true; StudentAssessment sa = new StudentAssessment(); try { ConvertAssessBDOToAssess(student, sa); using (var DCEnt = new DCFIEntities()) { DCEnt.StudentAssessments.Attach(sa); DCEnt.Entry(sa).State = System.Data.Entity.EntityState.Added; int num = DCEnt.SaveChanges(); if (num != 1) { ret = false; message = "Assessment 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 Boolean CreateStudentAssessment(StudentAssessmentBDO student) { string message = "Student Successfully Assessed"; bool ret = true; StudentAssessment sa = new StudentAssessment(); try { ConvertAssessBDOToAssess(student, sa); using (var DCEnt = new DCFIEntities()) { DCEnt.StudentAssessments.Attach(sa); DCEnt.Entry(sa).State = System.Data.Entity.EntityState.Added; int num = DCEnt.SaveChanges(); if (num != 1) { ret = false; message = "Assessment 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 void ConvertAssessBDOToAssess(StudentAssessmentBDO ab, StudentAssessment a) { a.StudentAssessmentId = ab.StudentAssessmentId; a.StudentSY = ab.StudentSY; a.FeeID = ab.FeeID; }