public Boolean CreateSibling(List <SiblingBDO> sbdo, string studentId) { Boolean ret = true; try { foreach (SiblingBDO s in sbdo) { Sibling sib = new Sibling(); ConvertSiblingBDOToSibling(s, sib, studentId); using (var DCEnt = new DCFIEntities()) { DCEnt.Siblings.Attach(sib); int num = DCEnt.SaveChanges(); if (num != 1) { ret = false; } } } } 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); }
private List <Sibling> ToSiblingList(List <SiblingBDO> siblings) { List <Sibling> sibList = new List <Sibling>(); foreach (SiblingBDO s in siblings) { Sibling sbdo = new Sibling(); ConvertSiblingBDOToSibling(s, sbdo, s.StudentId); sibList.Add(sbdo); } return(sibList); }
public Boolean CreateSibling(List<SiblingBDO> sbdo, string studentId) { Boolean ret = true; foreach (SiblingBDO s in sbdo) { Sibling sib = new Sibling(); ConvertSiblingBDOToSibling(s, sib, studentId); using (var DCEnt = new DCFIEntities()) { DCEnt.Siblings.Attach(sib); int num = DCEnt.SaveChanges(); if (num != 1) ret = false; } } return ret; }
public Boolean CreateSibling(List <SiblingBDO> sbdo, string studentId) { Boolean ret = true; foreach (SiblingBDO s in sbdo) { Sibling sib = new Sibling(); ConvertSiblingBDOToSibling(s, sib, studentId); using (var DCEnt = new DCFIEntities()) { DCEnt.Siblings.Attach(sib); int num = DCEnt.SaveChanges(); if (num != 1) { ret = false; } } } return(ret); }
private void ConvertSiblingToSiblingBDO(Sibling s, SiblingBDO sib) { sib.SiblingId = s.SiblingId; sib.StudentId = s.StudentId; sib.SiblingStudentId = s.SiblingStudentId; }
private void ConvertSiblingBDOToSibling(SiblingBDO s, Sibling sib, string studentId) { sib.StudentId = studentId; sib.SiblingStudentId = s.SiblingStudentId; }
private List<Sibling> ToSiblingList(List<SiblingBDO> siblings) { List<Sibling> sibList = new List<Sibling>(); foreach (SiblingBDO s in siblings) { Sibling sbdo = new Sibling(); ConvertSiblingBDOToSibling(s, sbdo,s.StudentId); sibList.Add(sbdo); } return sibList; }
private void ConvertSiblingBDOToSibling(SiblingBDO s, Sibling sib,string studentId) { sib.StudentId = studentId; sib.SiblingStudentId = s.SiblingStudentId; }
public Boolean CreateSibling(List<SiblingBDO> sbdo, string studentId) { Boolean ret = true; try { foreach (SiblingBDO s in sbdo) { Sibling sib = new Sibling(); ConvertSiblingBDOToSibling(s, sib, studentId); using (var DCEnt = new DCFIEntities()) { DCEnt.Siblings.Attach(sib); int num = DCEnt.SaveChanges(); if (num != 1) ret = false; } } } 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; }