Ejemplo n.º 1
0
        public Airing GetBy(string assetId, AiringCollection getFrom = AiringCollection.CurrentOrExpiredCollection)
        {
            var query = Query.EQ("AssetId", assetId);

            Airing airing = null;

            switch (getFrom)
            {
            case AiringCollection.CurrentOrExpiredCollection:
                airing = _currentCollection.FindOne(query) ?? GetFromExpiredCollection(query);
                break;

            case AiringCollection.CurrentCollection:
                airing = _currentCollection.FindOne(query);
                break;

            case AiringCollection.ExpiredCollection:
                airing = GetFromExpiredCollection(query);
                break;

            case AiringCollection.DeletedCollection:
                airing = _deletedCollection.FindOne(query);
                break;
            }

            if (airing == null)
            {
                throw new AiringNotFoundException(string.Format("Airing does not exist in {0} collection.",
                                                                getFrom == AiringCollection.DeletedCollection ? "deleted" : (getFrom == AiringCollection.ExpiredCollection ? "expired" : "current/expired")));
            }

            return(airing);
        }
Ejemplo n.º 2
0
 public void PushIgnoredQueueTo(string airingId, string queueName, AiringCollection getFrom = AiringCollection.CurrentCollection)
 {
     if (getFrom == AiringCollection.CurrentCollection)
     {
         updateAiringQueueDelivery.PushIgnoredQueueTo(airingId, queueName);
     }
     else if (getFrom == AiringCollection.DeletedCollection)
     {
         updateDeletedAiringQueueDelivery.PushIgnoredQueueTo(airingId, queueName);
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Ejemplo n.º 3
0
 public bool IsAiringDistributed(string airingId, string queueName, AiringCollection getFrom = AiringCollection.CurrentCollection)
 {
     if (getFrom == AiringCollection.CurrentCollection)
     {
         return(currentAiringsQuery.IsAiringDistributed(airingId, queueName));
     }
     else if (getFrom == AiringCollection.DeletedCollection)
     {
         return(deletedAiringsQuery.IsAiringDistributed(airingId, queueName));
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Ejemplo n.º 4
0
        public IEnumerable <BLModel.Airing> GetBy(string jsonQuery, int hoursOut, IList <string> queueNames, bool includeEndDate = false, AiringCollection getFrom = AiringCollection.CurrentCollection)
        {
            IEnumerable <DLModel.Airing> airings = new List <DLModel.Airing>();

            if (getFrom == AiringCollection.CurrentCollection)
            {
                airings = currentAiringsQuery.GetBy(jsonQuery, hoursOut, queueNames, includeEndDate);
            }
            else if (getFrom == AiringCollection.DeletedCollection)
            {
                airings = deletedAiringsQuery.GetBy(jsonQuery, hoursOut, queueNames, includeEndDate);
            }
            else
            {
                throw new NotImplementedException();
            }

            return(airings.ToBusinessModel <IEnumerable <DLModel.Airing>, IEnumerable <BLModel.Airing> >());
        }
Ejemplo n.º 5
0
        public IEnumerable <BLModel.Airing> GetDeliverToBy(string queueName, int limit, AiringCollection getFrom = AiringCollection.CurrentCollection)
        {
            IEnumerable <DLModel.Airing> airings = new List <DLModel.Airing>();

            if (getFrom == AiringCollection.CurrentCollection)
            {
                airings = currentAiringsQuery.GetDeliverToBy(queueName, limit);
            }
            else if (getFrom == AiringCollection.DeletedCollection)
            {
                airings = deletedAiringsQuery.GetDeliverToBy(queueName, limit);
            }
            else
            {
                throw new NotImplementedException();
            }

            return(airings.ToBusinessModel <IEnumerable <DLModel.Airing>, IEnumerable <BLModel.Airing> >());
        }
Ejemplo n.º 6
0
 public BLModel.Airing GetBy(string assetId, AiringCollection getFrom = AiringCollection.CurrentOrExpiredCollection)
 {
     return
         (airingQueryHelper.GetBy(assetId, getFrom)
          .ToBusinessModel <DLModel.Airing, BLModel.Airing>());
 }