/// <summary> /// insert product entity to nosql documentum collection /// </summary> /// <param name="items"></param> private void InsertProducts(List<CompanyGroup.Domain.MaintainModule.Product> items) { CompanyGroup.Data.NoSql.ISettings settings = new CompanyGroup.Data.NoSql.Settings(CompanyGroup.Helpers.ConfigSettingsParser.GetString("MongoServerHost", "srv1.hrp.hu"), CompanyGroup.Helpers.ConfigSettingsParser.GetInt("MongoServerPort", 27017), CompanyGroup.Helpers.ConfigSettingsParser.GetString("MongoDatabaseName", "CompanyGroup"), CompanyGroup.Helpers.ConfigSettingsParser.GetString("MongoCollectionName", "ProductList")); CompanyGroup.Domain.WebshopModule.IProductRepository productRepository = new CompanyGroup.Data.WebshopModule.ProductRepository(settings); CompanyGroup.Domain.WebshopModule.Pager pager = new CompanyGroup.Domain.WebshopModule.Pager(0, 0, 0); CompanyGroup.Domain.WebshopModule.Products products = new CompanyGroup.Domain.WebshopModule.Products(pager); items.ForEach( x => products.Add( CompanyGroup.Domain.WebshopModule.Factory.CreateProduct(x) ) ); productRepository.InsertList(products); }
public void RemoveProductList() { CompanyGroup.Data.NoSql.ISettings settings = new CompanyGroup.Data.NoSql.Settings(CompanyGroup.Helpers.ConfigSettingsParser.GetString("MongoServerHost", "srv1.hrp.hu"), CompanyGroup.Helpers.ConfigSettingsParser.GetInt("MongoServerPort", 27017), CompanyGroup.Helpers.ConfigSettingsParser.GetString("MongoDatabaseName", "CompanyGroup"), CompanyGroup.Helpers.ConfigSettingsParser.GetString("MongoCollectionName", "ProductList")); CompanyGroup.Domain.WebshopModule.IProductRepository productRepository = new CompanyGroup.Data.WebshopModule.ProductRepository(settings); productRepository.RemoveAllItemsFromCollection(); }