public void Setup()
        {
            _existigProducts = new List <Product>();

            for (int i = 0; i < 1000; i++)
            {
                _existigProducts.Add(new Product()
                {
                    Id = i + 1
                });
            }

            _existigProducts[5].Deleted    = true;
            _existigProducts[51].Published = false;
            _existigProducts = _existigProducts.OrderBy(x => x.Id).ToList();

            var productRepo = MockRepository.GenerateStub <IRepository <Product> >();

            productRepo.Stub(x => x.TableNoTracking).Return(_existigProducts.AsQueryable());

            var productCategoryRepo = MockRepository.GenerateStub <IRepository <ProductCategory> >();
            var vendorRepo          = MockRepository.GenerateStub <IRepository <Vendor> >();

            _productApiService = new ProductApiService(productRepo, productCategoryRepo, vendorRepo);
        }
Exemple #2
0
        private async void MainForm_Load(object sender, EventArgs e)
        {
            ///Thread thread = new Thread(() =>
            ///{
            ///    ProductApiService service = new ProductApiService();
            ///    var list = service.GetProducts();
            ///    foreach (var p in list)
            ///    {
            ///        object[] row = { p.Id, p.Name, p.Price };
            ///        dgvProducts.Rows.Add(row);
            ///    }
            ///    lblTredInfo.Text = "Завершено успішно";
            ///});
            ///thread.Start();
            ///
            Debug.WriteLine("-----Main thread----- {0}", Thread.CurrentThread.ManagedThreadId);
            IProductApiService service = new IProductApiService();
            var list = await service.GetProductsAsync();

            Debug.WriteLine("-----Main thread----- {0}", Thread.CurrentThread.ManagedThreadId);
            foreach (var p in list)
            {
                object[] row = { p.Id, p.Name, p.Price };
                dgvProducts.Rows.Add(row);
            }
            lblTredInfo.Text = "Завершено успішно";
        }
Exemple #3
0
 public ProductsController(IProductApiService productApiService,
                           CatalogSettings catalogSettings,
                           IOrderReportService orderReportService,
                           IStoreContext storeContext,
                           IJsonFieldsSerializer jsonFieldsSerializer,
                           IProductService productService,
                           IUrlRecordService urlRecordService,
                           ICustomerActivityService customerActivityService,
                           ILocalizationService localizationService,
                           IFactory <Product> factory,
                           IAclService aclService,
                           IStoreMappingService storeMappingService,
                           IStoreService storeService,
                           ICustomerService customerService,
                           IDiscountService discountService,
                           IPictureService pictureService,
                           IManufacturerService manufacturerService,
                           IProductTagService productTagService,
                           IProductAttributeService productAttributeService,
                           ILogger logger,
                           IDTOHelper dtoHelper) : base(jsonFieldsSerializer, aclService, customerService, storeMappingService, storeService, discountService, customerActivityService, localizationService, pictureService)
 {
     _productApiService       = productApiService;
     _factory                 = factory;
     _catalogSettings         = catalogSettings;
     _storeContext            = storeContext;
     _orderReportService      = orderReportService;
     _manufacturerService     = manufacturerService;
     _productTagService       = productTagService;
     _urlRecordService        = urlRecordService;
     _productService          = productService;
     _productAttributeService = productAttributeService;
     _logger    = logger;
     _dtoHelper = dtoHelper;
 }
 public ProductsController(IProductApiService productApiService,
                           IJsonFieldsSerializer jsonFieldsSerializer,
                           IProductService productService,
                           IUrlRecordService urlRecordService,
                           ICustomerActivityService customerActivityService,
                           ILocalizationService localizationService,
                           IFactory <Product> factory,
                           IAclService aclService,
                           IStoreMappingService storeMappingService,
                           IStoreService storeService,
                           ICustomerService customerService,
                           IDiscountService discountService,
                           IPictureService pictureService,
                           IManufacturerService manufacturerService,
                           IProductTagService productTagService,
                           IProductAttributeService productAttributeService,
                           IDTOHelper dtoHelper) : base(jsonFieldsSerializer, aclService, customerService, storeMappingService, storeService, discountService, customerActivityService, localizationService, pictureService)
 {
     _productApiService       = productApiService;
     _factory                 = factory;
     _manufacturerService     = manufacturerService;
     _productTagService       = productTagService;
     _urlRecordService        = urlRecordService;
     _productService          = productService;
     _productAttributeService = productAttributeService;
     _dtoHelper               = dtoHelper;
 }
Exemple #5
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         IProductApiService service = new IProductApiService();
         service.Create(new ServiceDLL.Models.ProductAddModel
         {
             Name  = txtName.Text,
             Price = Convert.ToDecimal(txtPrice.Text),
             Image = _base64Image
         });
     }
     catch (WebException wex)
     {
         if (wex.Response != null)
         {
             using (var errorResponse = (HttpWebResponse)wex.Response)
             {
                 using (var reader = new StreamReader(errorResponse.GetResponseStream()))
                 {
                     string error = reader.ReadToEnd();
                     MessageBox.Show(error);
                     //TODO: use JSON.net to parse this string and look at the error message
                 }
             }
         }
         MessageBox.Show("Гюстон у нас проблеми");
     }
 }
Exemple #6
0
 public OrderItemsController(
     IJsonFieldsSerializer jsonFieldsSerializer,
     IAclService aclService,
     ICustomerService customerService,
     IStoreMappingService storeMappingService,
     IStoreService storeService,
     IDiscountService discountService,
     ICustomerActivityService customerActivityService,
     ILocalizationService localizationService,
     IOrderItemApiService orderItemApiService,
     IOrderApiService orderApiService,
     IOrderService orderService,
     IProductApiService productApiService,
     IPriceCalculationService priceCalculationService,
     ITaxService taxService,
     IPictureService pictureService, IDTOHelper dtoHelper)
     : base(jsonFieldsSerializer,
            aclService,
            customerService,
            storeMappingService,
            storeService,
            discountService,
            customerActivityService,
            localizationService,
            pictureService)
 {
     _orderItemApiService     = orderItemApiService;
     _orderApiService         = orderApiService;
     _orderService            = orderService;
     _productApiService       = productApiService;
     _priceCalculationService = priceCalculationService;
     _taxService = taxService;
     _dtoHelper  = dtoHelper;
 }
Exemple #7
0
 public ProductListViewModelTest()
 {
     _container = new TinyIoCContainer();
     //_container.Register<INavigationService, NavigationService>();
     //_container.Register<IProductApiService, ProductApiService>();
     //_container.Register<IDialogService, DialogService>();
     //_container.Register<IGenericRepository, GenericRepository>();
     _productApiService = _container.Resolve <ProductApiService>();
 }
Exemple #8
0
 public WebHookEventConsumer(IStoreService storeService)
 {
     _customerApiService    = EngineContext.Current.Resolve <ICustomerApiService>();
     _categoryApiService    = EngineContext.Current.Resolve <ICategoryApiService>();
     _productApiService     = EngineContext.Current.Resolve <IProductApiService>();
     _dtoHelper             = EngineContext.Current.Resolve <IDTOHelper>();
     _productPictureService = EngineContext.Current.Resolve <IProductPictureService>();
     _productService        = EngineContext.Current.Resolve <IProductService>();
     _categoryService       = EngineContext.Current.Resolve <ICategoryService>();
     _storeMappingService   = EngineContext.Current.Resolve <IStoreMappingService>();
     _cacheManager          = EngineContext.Current.Resolve <IStaticCacheManager>();
 }
        public void Setup()
        {
            _baseDate = new DateTime(2016, 2, 12);

            _existigProducts = new List <Product>()
            {
                new Product()
                {
                    Id = 2, UpdatedOnUtc = _baseDate.AddMonths(2)
                },
                new Product()
                {
                    Id = 3, UpdatedOnUtc = _baseDate.AddMonths(6)
                },
                new Product()
                {
                    Id = 1, UpdatedOnUtc = _baseDate.AddMonths(7)
                },
                new Product()
                {
                    Id = 4, UpdatedOnUtc = _baseDate
                },
                new Product()
                {
                    Id = 5, UpdatedOnUtc = _baseDate.AddMonths(3)
                },
                new Product()
                {
                    Id = 6, Deleted = true, UpdatedOnUtc = _baseDate.AddMonths(10)
                },
                new Product()
                {
                    Id = 7, Published = false, UpdatedOnUtc = _baseDate.AddMonths(4)
                }
            };

            var productRepo = MockRepository.GenerateStub <IRepository <Product> >();

            productRepo.Stub(x => x.TableNoTracking).Return(_existigProducts.AsQueryable());

            var productCategoryRepo = MockRepository.GenerateStub <IRepository <ProductCategory> >();
            var vendorRepo          = MockRepository.GenerateStub <IRepository <Vendor> >();

            var storeMappingService = MockRepository.GenerateStub <IStoreMappingService>();

            storeMappingService.Stub(x => x.Authorize(Arg <Product> .Is.Anything)).Return(true);

            _productApiService = new ProductApiService(productRepo, productCategoryRepo, vendorRepo, storeMappingService);
        }
Exemple #10
0
        static void Main(string[] args)
        {
            Console.InputEncoding  = Encoding.Unicode;
            Console.OutputEncoding = Encoding.Unicode;
            Console.WriteLine(DateTime.Now);
            Console.WriteLine("Дані із сервера");
            IProductApiService sp = new IProductApiService();

            foreach (var item in sp.GetProducts())
            {
                Console.WriteLine("Id: {0}\tName: {1}\tPrice:{2}",
                                  item.Id, item.Name, item.Price);
            }
            Console.WriteLine(DateTime.Now);
        }
        public AngularController(IProductApiService productServ)
        {
            this._productService = productServ;

            products = new ProductAPI[]
                {
              new ProductAPI() { Name ="Pierwszy Produkt", Price=10 , Description="ble", SoldOut = true, Specyfications ="ble ble", Image = "../Images/1.jpg", Reviews = new List<ReviewsAPI>(){ new ReviewsAPI() { Starts = 3, Review = "okokokok"}}},
                new ProductAPI() { Name ="Drugi Produkt", Price=20 , Description="bleble", SoldOut = true, Specyfications ="ble ble", Image = "../Images/2.jpg", Reviews = new List<ReviewsAPI>(){ new ReviewsAPI() { Starts = 3, Review = "okokokok"}}},
                new ProductAPI() { Name ="Trzeci Produkt", Price=25 , Description="blebleble", SoldOut = true, Specyfications ="ble ble", Image = "../Images/3.jpg", Reviews = new List<ReviewsAPI>(){ new ReviewsAPI() { Starts = 5, Review = "okokokok"}}},
                new ProductAPI() { Name ="Czwarty Produkt", Price=30 , Description="blebleble", SoldOut = false, Specyfications ="ble ble", Image = "../Images/4.jpg", Reviews = new List<ReviewsAPI>(){ new ReviewsAPI() { Starts = 5, Review = "okokokok"}}},
                new ProductAPI() { Name ="Piąty Produkt", Price=30 , Description="blebleble", SoldOut = false, Specyfications ="ble ble", Image = "../Images/5.jpg", Reviews = new List<ReviewsAPI>(){ new ReviewsAPI() { Starts = 5, Review = "okokokok"}}},
                new ProductAPI() { Name ="Szósty Produkt", Price=30 , Description="blebleble", SoldOut = true, Specyfications ="ble ble", Image = "../Images/1.jpg", Reviews = new List<ReviewsAPI>(){ new ReviewsAPI() { Starts = 5, Review = "okokokok"}}},
                new ProductAPI() { Name ="Siódmy Produkt", Price=30 , Description="blebleble", SoldOut = false, Specyfications ="ble ble", Image = "../Images/2.jpg", Reviews = new List<ReviewsAPI>(){ new ReviewsAPI() { Starts = 5, Review = "okokokok"}}}
                    };
        }
Exemple #12
0
        public void Setup()
        {
            _existigProducts = new List <Product>()
            {
                new Product()
                {
                    Id = 2, Published = true
                },
                new Product()
                {
                    Id = 3, Published = true
                },
                new Product()
                {
                    Id = 1, Published = false
                },
                new Product()
                {
                    Id = 4, Published = true
                },
                new Product()
                {
                    Id = 5, Published = true
                },
                new Product()
                {
                    Id = 6, Deleted = true, Published = true
                },
                new Product()
                {
                    Id = 7, Published = false
                }
            };

            var productRepo = MockRepository.GenerateStub <IRepository <Product> >();

            productRepo.Stub(x => x.TableNoTracking).Return(_existigProducts.AsQueryable());

            var productCategoryRepo = MockRepository.GenerateStub <IRepository <ProductCategory> >();
            var vendorRepo          = MockRepository.GenerateStub <IRepository <Vendor> >();

            var storeMappingService = MockRepository.GenerateStub <IStoreMappingService>();

            storeMappingService.Stub(x => x.Authorize(Arg <Product> .Is.Anything)).Return(true);

            _productApiService = new ProductApiService(productRepo, productCategoryRepo, vendorRepo, storeMappingService);
        }
        public WebHookEventConsumer(IStoreService storeService)
        {
            IWebHookService webHookService = EngineContext.Current.ContainerManager.Resolve <IWebHookService>();

            _customerApiService = EngineContext.Current.ContainerManager.Resolve <ICustomerApiService>();
            _categoryApiService = EngineContext.Current.ContainerManager.Resolve <ICategoryApiService>();
            _productApiService  = EngineContext.Current.ContainerManager.Resolve <IProductApiService>();
            _dtoHelper          = EngineContext.Current.ContainerManager.Resolve <IDTOHelper>();
            _storeService       = EngineContext.Current.ContainerManager.Resolve <IStoreService>();

            _productService      = EngineContext.Current.ContainerManager.Resolve <IProductService>();
            _categoryService     = EngineContext.Current.ContainerManager.Resolve <ICategoryService>();
            _storeMappingService = EngineContext.Current.ContainerManager.Resolve <IStoreMappingService>();
            _storeContext        = EngineContext.Current.ContainerManager.Resolve <IStoreContext>();

            _webHookManager = webHookService.GetHookManager();
        }
Exemple #14
0
        public void Setup()
        {
            _baseDate = new DateTime(2016, 2, 23);

            _existigProducts = new List <Product>()
            {
                new Product()
                {
                    Id = 2, CreatedOnUtc = _baseDate.AddMonths(2)
                },
                new Product()
                {
                    Id = 3, CreatedOnUtc = _baseDate.AddMonths(10)
                },
                new Product()
                {
                    Id = 1, CreatedOnUtc = _baseDate.AddMonths(7)
                },
                new Product()
                {
                    Id = 4, CreatedOnUtc = _baseDate
                },
                new Product()
                {
                    Id = 5, CreatedOnUtc = _baseDate.AddMonths(3)
                },
                new Product()
                {
                    Id = 6, Deleted = true, CreatedOnUtc = _baseDate.AddMonths(10)
                },
                new Product()
                {
                    Id = 7, Published = false, CreatedOnUtc = _baseDate.AddMonths(4)
                }
            };

            var productRepo = MockRepository.GenerateStub <IRepository <Product> >();

            productRepo.Stub(x => x.TableNoTracking).Return(_existigProducts.AsQueryable());

            var productCategoryRepo = MockRepository.GenerateStub <IRepository <ProductCategory> >();
            var vendorRepo          = MockRepository.GenerateStub <IRepository <Vendor> >();

            _productApiService = new ProductApiService(productRepo, productCategoryRepo, vendorRepo);
        }
Exemple #15
0
        public void Setup()
        {
            _existigProducts = new List <Product>()
            {
                new Product()
                {
                    Id = 2
                },
                new Product()
                {
                    Id = 3
                },
                new Product()
                {
                    Id = 1
                },
                new Product()
                {
                    Id = 4
                },
                new Product()
                {
                    Id = 5
                },
                new Product()
                {
                    Id = 6, Deleted = true
                },
                new Product()
                {
                    Id = 7
                }
            };

            var productRepo = MockRepository.GenerateStub <IRepository <Product> >();

            productRepo.Stub(x => x.TableNoTracking).Return(_existigProducts.AsQueryable());

            var productCategoryRepo = MockRepository.GenerateStub <IRepository <ProductCategory> >();
            var vendorRepo          = MockRepository.GenerateStub <IRepository <Vendor> >();

            var storeMappingService = MockRepository.GenerateStub <IStoreMappingService>();

            _productApiService = new ProductApiService(productRepo, productCategoryRepo, vendorRepo, storeMappingService);
        }
Exemple #16
0
 public ProductCategoryMappingsController(IProductCategoryMappingsApiService productCategoryMappingsService,
                                          ICategoryService categoryService,
                                          IJsonFieldsSerializer jsonFieldsSerializer,
                                          IAclService aclService,
                                          ICustomerService customerService,
                                          IStoreMappingService storeMappingService,
                                          IStoreService storeService,
                                          IDiscountService discountService,
                                          ICustomerActivityService customerActivityService,
                                          ILocalizationService localizationService,
                                          ICategoryApiService categoryApiService,
                                          IProductApiService productApiService)
     : base(jsonFieldsSerializer, aclService, customerService, storeMappingService, storeService, discountService, customerActivityService, localizationService)
 {
     _productCategoryMappingsService = productCategoryMappingsService;
     _categoryService    = categoryService;
     _categoryApiService = categoryApiService;
     _productApiService  = productApiService;
 }
Exemple #17
0
 public ProductsController(IJsonFieldsSerializer jsonFieldsSerializer,
                           ISettingService settingService,
                           IStoreContext storeContext,
                           IProductApiService productApiService,
                           ICustomerActivityService customerActivityService,
                           ILocalizationService localizationService,
                           IAclService aclService,
                           IStoreMappingService storeMappingService,
                           IStoreService storeService,
                           ICustomerService customerService,
                           IDiscountService discountService,
                           IPictureService pictureService,
                           IDTOHelper dtoHelper) : base(jsonFieldsSerializer, aclService, customerService, storeMappingService, storeService, discountService, customerActivityService, localizationService, pictureService)
 {
     _settingService    = settingService;
     _storeContext      = storeContext;
     _productApiService = productApiService;
     _dtoHelper         = dtoHelper;
 }
 public ProductManufacturerMappingsController(IProductManufacturerMappingsApiService productManufacturerMappingsService,
                                              IManufacturerService manufacturerService,
                                              IJsonFieldsSerializer jsonFieldsSerializer,
                                              IAclService aclService,
                                              ICustomerService customerService,
                                              IStoreMappingService storeMappingService,
                                              IStoreService storeService,
                                              IDiscountService discountService,
                                              ICustomerActivityService customerActivityService,
                                              ILocalizationService localizationService,
                                              IManufacturerApiService manufacturerApiService,
                                              IProductApiService productApiService,
                                              IPictureService pictureService)
     : base(jsonFieldsSerializer, aclService, customerService, storeMappingService, storeService, discountService, customerActivityService, localizationService, pictureService)
 {
     _productManufacturerMappingsService = productManufacturerMappingsService;
     _manufacturerService    = manufacturerService;
     _manufacturerApiService = manufacturerApiService;
     _productApiService      = productApiService;
 }
Exemple #19
0
 public ProductPricesController(
     IJsonFieldsSerializer jsonFieldsSerializer,
     IAclService aclService,
     ICustomerService customerService,
     IStoreMappingService storeMappingService,
     IStoreService storeService,
     IDiscountService discountService,
     ICustomerActivityService customerActivityService,
     ILocalizationService localizationService,
     IPictureService pictureService,
     IProductApiService productApiService,
     IProductService productService,
     IDTOHelper dtoHelper,
     IHostEnvironment hostEnvironment)
     : base(jsonFieldsSerializer, aclService, customerService, storeMappingService, storeService, discountService, customerActivityService, localizationService, pictureService)
 {
     this._productApiService = productApiService;
     _productService         = productService;
     _dtoHelper       = dtoHelper;
     _hostEnvironment = hostEnvironment;
 }
Exemple #20
0
 public ShippingsController(IJsonFieldsSerializer jsonFieldsSerializer,
                            ISettingService settingService,
                            IStoreContext storeContext,
                            IProductApiService productApiService,
                            ICustomerActivityService customerActivityService,
                            ILocalizationService localizationService,
                            IAclService aclService,
                            IStoreMappingService storeMappingService,
                            IStoreService storeService,
                            ICustomerService customerService,
                            IDiscountService discountService,
                            IPictureService pictureService,
                            IShippingService shippingService,
                            ICountryService countryService,
                            IStateProvinceService stateProvinceService,
                            IWorkContext workContext,
                            IOrderTotalCalculationService orderTotalCalculationService,
                            ITaxService taxService,
                            ICurrencyService currencyService,
                            IPriceFormatter priceFormatter,
                            ShippingSettings shippingSettings,
                            IDTOHelper dtoHelper) : base(jsonFieldsSerializer, aclService, customerService, storeMappingService, storeService, discountService, customerActivityService, localizationService, pictureService)
 {
     _settingService               = settingService;
     _storeContext                 = storeContext;
     _productApiService            = productApiService;
     _shippingService              = shippingService;
     _countryService               = countryService;
     _stateProvinceService         = stateProvinceService;
     _workContext                  = workContext;
     _orderTotalCalculationService = orderTotalCalculationService;
     _taxService          = taxService;
     _currencyService     = currencyService;
     _localizationService = localizationService;
     _shippingSettings    = shippingSettings;
 }
        private async void BtnGetData_Click(object sender, RoutedEventArgs e)
        {
            Thread thread = new Thread(() =>
            {
                IProductApiService service = new IProductApiService();
                var list = service.GetProducts();
                foreach (var p in list)
                {
                    Product prod = new Product
                    {
                        Id    = p.Id,
                        Name  = p.Name,
                        Price = p.Price
                    };
                    products.Add(prod);
                }
            });

            thread.Start();


            ///Debug.WriteLine("-----Main thread----- {0}", Thread.CurrentThread.ManagedThreadId);
            ///ProductApiService service = new ProductApiService();
            ///var list = await service.GetProductsAsync();
            ///Debug.WriteLine("-----Main thread----- {0}", Thread.CurrentThread.ManagedThreadId);
            ///foreach (var p in list)
            ///{
            ///    Product prod = new Product
            ///    {
            ///        Id = p.Id,
            ///        Name = p.Name,
            ///        Price=p.Price
            ///    };
            ///    products.Add(prod);
            ///}
        }
 public ProductController(IProductApiService service)
 {
     _service = service;
 }
Exemple #23
0
 public ProductApiController(IProductApiService productApiService)
 {
     _productApiService = productApiService;
 }
Exemple #24
0
        public void Setup()
        {
            _existigProducts = new List <Product>()
            {
                new Product()
                {
                    Id = 2, VendorId = 1
                },
                new Product()
                {
                    Id = 3, VendorId = 2
                },
                new Product()
                {
                    Id = 1, VendorId = 1
                },
                new Product()
                {
                    Id = 4
                },
                new Product()
                {
                    Id = 5
                },
                new Product()
                {
                    Id = 6, Deleted = true, VendorId = 1
                },
                new Product()
                {
                    Id = 7, VendorId = 2
                },
                new Product()
                {
                    Id = 8, VendorId = 3
                },
                new Product()
                {
                    Id = 9, VendorId = 4
                }
            };

            var productRepo = MockRepository.GenerateStub <IRepository <Product> >();

            productRepo.Stub(x => x.TableNoTracking).Return(_existigProducts.AsQueryable());

            var productCategoryRepo = MockRepository.GenerateStub <IRepository <ProductCategory> >();

            _existingVendors = new List <Vendor>()
            {
                new Vendor()
                {
                    Id = 1, Name = "vendor 1", Active = true
                },
                new Vendor()
                {
                    Id = 2, Name = "vendor 2", Active = true
                },
                new Vendor()
                {
                    Id = 3, Name = "vendor 3", Deleted = true
                },
                new Vendor()
                {
                    Id = 4, Name = "vendor 4", Active = false
                },
                new Vendor()
                {
                    Id = 5, Name = "vendor 5", Active = true
                }
            };

            var vendorRepo = MockRepository.GenerateStub <IRepository <Vendor> >();

            vendorRepo.Stub(x => x.TableNoTracking).Return(_existingVendors.AsQueryable());

            _productApiService = new ProductApiService(productRepo, productCategoryRepo, vendorRepo);
        }
Exemple #25
0
 public ProductController(IProductApiService productApiService, IPermissionService permissionService)
 {
     _productApiService = productApiService;
     _permissionService = permissionService;
 }
Exemple #26
0
 public ProductListViewModel(IConnectionService connectionService,
                             INavigationService navigationService, IDialogService dialogService,
                             IProductApiService productApiService) : base(connectionService, navigationService, dialogService)
 {
     _productApiService = productApiService;
 }
 public HomeController(IProductApiService apiService)
 {
     _apiService = apiService;
 }
Exemple #28
0
 public ProductService(IProductApiService apiService)
 {
 }