Ejemplo n.º 1
0
        public IentityBase clone()
        {
            var newMulEnt = new multyEntity();

            newMulEnt.entityID    = entityID;
            newMulEnt.entityValue = entityValue;
            newMulEnt.entityType  = entityType;
            newMulEnt.parts       = parts;
            newMulEnt.singleValue = singleValue;
            return(newMulEnt);
        }
        public void addUpdateEntity(multyEntity newEnt)
        {
            try
            {
                var old = DB.multyEntity.Where(e => e.entityValue == newEnt.entityValue);
                if (old.Any())
                {
                    old.Single().parts       = newEnt.parts;
                    old.Single().singleValue = newEnt.parts;
                    old.Single().entityType  = newEnt.parts;
                }
                else
                {
                    DB.multyEntity.Add(newEnt);
                }

                DB.SaveChanges();
            }
            catch (Exception e)
            {
                //   Logger.log(this.GetType().Name, MethodBase.GetCurrentMethod().Name, e.ToString());
                throw new DBException();
            }
        }