Esempio n. 1
0
        public DF_Status CreateStatus(DF_Status status, bool isActiveAiringStatus)
        {
            try
            {
                ODTDatastore _dbODT    = new ODTDatastore(_configuration);
                int          highOrder = _dbODT.GetDatabase().GetCollection <DF_Status>(isActiveAiringStatus ? "DFStatus" : "DFExpiredStatus").FindAll()
                                         .SetSortOrder(SortBy.Descending(new[] { "StatusID" }))
                                         .SetFields(new[] { "StatusID" })
                                         .SetLimit(1)
                                         .FirstOrDefault().StatusID;

                status.StatusID     = ++highOrder;
                status.CreatedDate  = DateTime.Now;
                status.ModifiedDate = status.CreatedDate;
                status.ModifiedBy   = status.CreatedBy;
                MongoCollection <DF_Status> statusCollection = _dbODT.GetDatabase().GetCollection <DF_Status>(isActiveAiringStatus ? "DFStatus" : "DFExpiredStatus");
                statusCollection.Save(status);
            }
            catch (Exception)
            {
                throw;
            }

            return(status);
        }
Esempio n. 2
0
        public IQueryable <Airing> GetAssetsBy(IMongoQuery query)
        {
            var collection = dbConnection.GetDatabase().GetCollection <Airing>("currentassets");

            var disableTrackingQuery = Query.Or(
                Query.NotExists("DisableTracking"),
                Query.EQ("DisableTracking", false));

            var airings = collection.Find(Query.And(query, disableTrackingQuery));

            return(airings.AsQueryable());
        }
Esempio n. 3
0
        private bool DoesStatusExistForAssetReporterAndDestination(DF_Status status, bool isActiveAiringStatus)
        {
            ODTDatastore _dbODT           = new ODTDatastore(_configuration);
            var          statusCollection = _dbODT.GetDatabase().GetCollection <DF_Status>(isActiveAiringStatus ? "DFStatus" : "DFExpiredStatus");
            var          query            = Query.And(Query.EQ("AssetID", status.AssetID),
                                                      Query.EQ("StatusEnum", status.StatusEnum),
                                                      Query.EQ("ReporterEnum", status.ReporterEnum),
                                                      Query.EQ("DestinationID", status.DestinationID));

            return(statusCollection.Find(query).Any());
        }
Esempio n. 4
0
        public IList <DF_Destination> Get()
        {
            ODTDatastore db = new ODTDatastore(appSettings);

            return(db.GetDatabase().GetCollection <DF_Destination>("Destination").FindAll().ToList());
        }