Ejemplo n.º 1
0
 public static bool Delete(int entityId)
 {
     if (entityId > 0)
     {
         return(EntityDAL.Delete(entityId));
     }
     else
     {
         throw new BLLException("Delete Failed. Entity Type Id is invalid." + entityId.ToString());
     }
 }
Ejemplo n.º 2
0
        public static EntityBLL GetDetails(int EntityID)
        {
            EntityBLL e  = new EntityBLL();
            DataTable dt = EntityDAL.GetDetails(EntityID).Tables[0];

            if (dt.Rows.Count > 0)
            {
                e = (EntityBLL)dt.Rows[0];
            }
            return(e);
        }
Ejemplo n.º 3
0
 public virtual bool ChangeEntity(EntityBLL New)
 {
     if (uow.Entities.GetOne(o => o.Id == New.Id) != null)
     {
         EntityDAL type = Check(New);
         uow.Entities.Remove(uow.Entities.GetOne(o => o.Id == New.Id));
         uow.Save();
         uow.Entities.Create(type);
         uow.Save();
         return(true);
     }
     else
     {
         throw new EntityNotFoundByIDException(string.Format("Entity with this \"{0}\" ID not Found.", New.Id));
     }
 }
Ejemplo n.º 4
0
        public virtual EntityBLL GetEntityById(int id)
        {
            EntityBLL entity    = new EntityBLL();
            EntityDAL entityDAL = uow.Entities.GetOne(o => o.Id == id);

            if (entityDAL != null)
            {
                Dictionary <string, object> Dict = new Dictionary <string, object>();
                foreach (var g in entityDAL.Attributes)
                {
                    Dict.Add(g.Key, g.Value.Item);
                }

                entity.Id         = entityDAL.Id;
                entity.NameEntity = entityDAL.NameEntity;
                entity.Attributes = Dict;
                return(entity);
            }
            else
            {
                throw new EntityNotFoundByIDException(string.Format("The entity under this (\"{0}\") ID was not found.", id));
            }
        }
Ejemplo n.º 5
0
 public static int Create(int RegionID, string EntityCode, string EntityName)
 {
     return(EntityDAL.Create(RegionID, EntityCode, EntityName));
 }
Ejemplo n.º 6
0
 public static List <EntityBLL> ListEntities()
 {
     return(EntityDAL.ListRegions().Tables[0].AsEnumerable().Select(r => (EntityBLL)r).ToList());
 }
Ejemplo n.º 7
0
 public static EntityCollection GetCollection()
 {
     return(EntityDAL.GetCollection());
 }