public void ConvertTraitToTraitBDO(Trait t, TraitBDO tBDO) { tBDO.CurrTrait = t.CurrTrait; tBDO.Description = t.Description; tBDO.TraitsID = t.TraitsID; tBDO.Category =(int) t.Category; }
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; }
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; }
private void ConvertTraitToTraitBDO(Trait t, TraitBDO tBDO) { tBDO.Description = t.Description; tBDO.GradeLevel = t.GradeLevel; tBDO.TraitCode = t.TraitCode; }
private void ConvertTraitBDOToTrait(TraitBDO t, Trait tBDO) { tBDO.Description = t.Description; tBDO.GradeLevel = t.GradeLevel; tBDO.TraitCode = t.TraitCode; }