Ejemplo n.º 1
0
 public void ConvertTraitToTraitBDO(Trait t, TraitBDO tBDO)
 {
     tBDO.CurrTrait = t.CurrTrait;
     tBDO.Description = t.Description;
      tBDO.TraitsID = t.TraitsID;
     tBDO.Category =(int) t.Category;
 }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
 private void ConvertTraitToTraitBDO(Trait t, TraitBDO tBDO)
 {
     tBDO.Description = t.Description;
     tBDO.GradeLevel = t.GradeLevel;
     tBDO.TraitCode = t.TraitCode;
 }
Ejemplo n.º 5
0
 private void ConvertTraitBDOToTrait(TraitBDO t, Trait tBDO)
 {
     tBDO.Description = t.Description;
     tBDO.GradeLevel  = t.GradeLevel;
     tBDO.TraitCode   = t.TraitCode;
 }