public StoreOperationCommand(MongoStore ms, StoreJournalEntryCommand storeJournalEntry,
                              ILogger <StoreOperationCommand> logger)
 {
     _ms = ms;
     _storeJournalEntry = storeJournalEntry;
     _logger            = logger;
 }
Beispiel #2
0
        IBiggy <Widget> CreateBiggyList()
        {
            var store = new MongoStore <Widget>(Host, Database, Collection);
            var list  = new QueryableBiggylist <Widget>(store);

            return(list);
        }
 public static void DropCollection <T>(this MongoStore store) where T : DataEntityBase
 {
     store.Connect();
     store.Database.DropCollection(typeof(T).Name);
     store.Logger.Trace($"{nameof(MongoStore)}.{nameof(DropCollection)}",
                        new LogItem("Event", "Drop collection"),
                        new LogItem("Type", typeof(T).ToString));
 }
        public void InsertStore(MongoStore store)
        {
            var foundItems = collection.Find <MongoStore>(x => x.StoreName == store.StoreName).Any();

            if (!foundItems)
            {
                collection.InsertOne(store);
            }
        }
        public string RemoveStore(MongoStore store)
        {
            var    mongoDbStoreRepository = new MongoDbStoreRepository();
            string Result = mongoDbStoreRepository.RemoveStore(store);

            Console.WriteLine(Result);
            Console.WriteLine();
            return(Result);
        }
        public string UpdateStore(MongoStore store)
        {
            var    mongoDbStoreRepository = new MongoDbStoreRepository();
            string result = mongoDbStoreRepository.UpdateStore(store);

            Console.WriteLine(result);
            Console.WriteLine();
            return(result);
        }
Beispiel #7
0
        private async Task Test_Add <TProduct>()
            where TProduct : class, IEntity, ICanBeValidated
        {
            var store   = new MongoStore <TProduct>(_client);
            var product = EntityFactory.Build <TProduct>();

            var result = await store.Add(product);

            var dto = await _client
                      .Collection <TProduct>()
                      .AsQueryable()
                      .SingleAsync(x => x.Id == result.Id);

            Assert.That(dto, Is.EqualTo(result));
        }
Beispiel #8
0
        private async Task Test_Get <TProduct>()
            where TProduct : class, IEntity, ICanBeValidated
        {
            var store   = new MongoStore <TProduct>(_client);
            var product = EntityFactory.Build <TProduct>();

            await _client
            .Collection <TProduct>()
            .InsertOneAsync(product);

            var result = await store.Get(product.Id);

            Assert.That(product, Is.Not.Null);
            Assert.That(result, Is.EqualTo(product));
        }
 public MakeNewPeriodCommand(MongoStore ms,
                             GetCurrentPeriodQuery getCurrentPeriodQuery,
                             GetPeriodTotalsQuery totalsQuery,
                             ClosePeriodCommand close,
                             OpenPeriodCommand open, ILogger <MakeNewPeriodCommand> logger,
                             SetCurrentPeriodCommand setPeriod)
 {
     _ms = ms;
     _getCurrentPeriodQuery = getCurrentPeriodQuery;
     _totalsQuery           = totalsQuery;
     _close     = close;
     _open      = open;
     _logger    = logger;
     _setPeriod = setPeriod;
 }
        public void GetByStoreId(string storeId)
        {
            var        mongoDbStoreRepository = new MongoDbStoreRepository();
            MongoStore store = mongoDbStoreRepository.GetByStoreId(storeId);

            if (store != null)
            {
                Console.WriteLine();
                Console.WriteLine("******Matched record by StoreId*****");

                foreach (var productDetails in store.ProductDetails)
                {
                    Console.WriteLine($"StoreId :{store.Id} StoreName: {store.StoreName} ProductName: {productDetails.Name} Price:{productDetails.Price} ProductInStock:{productDetails.ProductInStock} ManufacturerName:{productDetails.ManufacturerDetails.ManufacturerName} PhoneNumber:{productDetails.ManufacturerDetails.PhoneNumber} Place:{productDetails.ManufacturerDetails.Place}");
                }
            }
            else
            {
                Console.WriteLine("No matched records found for the productID:{0}:" + storeId);
            }
        }
Beispiel #11
0
        private async Task Test_Replace <TProduct>()
            where TProduct : class, IEntity, ICanBeValidated
        {
            var store   = new MongoStore <TProduct>(_client);
            var product = EntityFactory.Build <TProduct>();

            await _client
            .Collection <TProduct>()
            .InsertOneAsync(product);

            var updatedProduct = EntityFactory.Build <TProduct>(product.Id);

            await store.Replace(updatedProduct);

            var result = await _client
                         .Collection <TProduct>()
                         .AsQueryable()
                         .SingleAsync(x => x.Id == product.Id);

            Assert.That(result, Is.EqualTo(updatedProduct));
        }
Beispiel #12
0
        private async Task Test_Remove <TProduct>()
            where TProduct : class, IEntity, ICanBeValidated
        {
            var store   = new MongoStore <TProduct>(_client);
            var product = EntityFactory.Build <TProduct>();

            await _client
            .Collection <TProduct>()
            .InsertOneAsync(product);

            var deletedItems = await store.Remove(product.Id);

            Assert.That(deletedItems, Is.EqualTo(1));

            var foundAny = await _client
                           .Collection <TProduct>()
                           .AsQueryable()
                           .AnyAsync(x => true);

            Assert.That(foundAny, Is.False);
        }
Beispiel #13
0
 public AddToteOptionCommand(MongoStore ms, GetToteByIdQuery get)
 {
     _ms  = ms;
     _get = get;
 }
Beispiel #14
0
 public StoreJournalEntryCommand(MongoStore ms, ILogger <StoreJournalEntryCommand> logger)
 {
     _ms     = ms;
     _logger = logger;
 }
Beispiel #15
0
 public GetToteByIdQuery(MongoStore ms)
 {
     _ms = ms;
 }
Beispiel #16
0
 public PromoCodeFindQuery(MongoStore ms)
 {
     _ms = ms;
 }
 public ProjectMetaSaveCommand(MongoStore ms)
 {
     _ms = ms;
 }
Beispiel #18
0
 public GetToteReportsQuery(MongoStore ms)
 {
     _ms = ms;
 }
 public GetPeriodTotalsQuery(MongoStore ms)
 {
     _ms = ms;
 }
 /// <summary>
 /// Typically used with unit testing
 /// </summary>
 public static void ClearCache <T>(this MongoStore store)
 {
     MongoStore.CollectionCache.Remove(typeof(T));
 }
Beispiel #21
0
 IBiggy<Widget> CreateBiggyList()
 {
     var store = new MongoStore<Widget>(Host, Database, Collection);
       var list = new QueryableBiggylist<Widget>(store);
       return list;
 }
        public MongoStore GetByStoreId(string storeId)
        {
            MongoStore record = collection.Find(Builders <MongoStore> .Filter.Eq(x => x.Id, storeId)).FirstOrDefault();

            return(record);
        }
 public string RemoveStore(MongoStore store)
 {
     collection.DeleteOne(s => s.StoreName == store.StoreName);
     return("Store is removed successfully :" + store.StoreName);
 }
Beispiel #24
0
 public AddBetToToteCommand(MongoStore ms, GetToteByIdQuery get)
 {
     _ms  = ms;
     _get = get;
 }
Beispiel #25
0
 public StartToteCommand(MongoStore ms)
 {
     _ms = ms;
 }
Beispiel #26
0
 public CloseToteCommand(MongoStore ms)
 {
     _ms = ms;
 }
Beispiel #27
0
 public FinishToteCommand(MongoStore ms)
 {
     _ms = ms;
 }
Beispiel #28
0
 public AppStateSaveCommand(IOptions <AppConfig> cfg, MongoStore ms)
 {
     _cfg = cfg;
     _ms  = ms;
 }
        public string UpdateStore(MongoStore store)
        {
            collection.ReplaceOne(p => p.StoreName == store.StoreName, store);

            return("Store Address and Store PinCode details are updated successfully");
        }
Beispiel #30
0
 public PromoAddCommand(MongoStore ms)
 {
     _ms = ms;
 }
Beispiel #31
0
 public GetAppStateQuery(MongoStore ms)
 {
     _ms = ms;
 }