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()); } }
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); }
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)); } }
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)); } }
public static int Create(int RegionID, string EntityCode, string EntityName) { return(EntityDAL.Create(RegionID, EntityCode, EntityName)); }
public static List <EntityBLL> ListEntities() { return(EntityDAL.ListRegions().Tables[0].AsEnumerable().Select(r => (EntityBLL)r).ToList()); }
public static EntityCollection GetCollection() { return(EntityDAL.GetCollection()); }