Esempio n. 1
0
        protected override void Process()
        {
            using (var unit = GetUnitOfWork())
            {
                foreach (Vendor vendor in Vendors.Where(x => ((VendorType)x.VendorType).Has(VendorType.JdeRetailStock) && x.IsActive))
                {
                    if (vendor.VendorSettings.GetValueByKey <int>("AssortmentImportID", 0) < 1)
                    {
                        continue;
                    }

                    log.DebugFormat("Start import BAS stock import, vendor {0} en vendorID {1}", vendor.Name, vendor.VendorID);


                    _retailStock    = vendor.VendorSettings.GetValueByKey <bool>("RetailStock", false);
                    _auctionStock   = vendor.VendorSettings.GetValueByKey <bool>("AuctionStock", false);
                    _shopAssortment = vendor.VendorSettings.GetValueByKey <bool>("ShopAssortment", false);

                    using (var content = GetContent(vendor))
                    {
                        if (_retailStock)
                        {
                            var rs = new ProcessRetailStock();
                            rs.Process(content, vendor, log);
                        }
                    }

                    log.DebugFormat("Finish import BAS stock import, vendor {0} en vendorID {1}", vendor.Name, vendor.VendorID);
                }
            }
        }
Esempio n. 2
0
        protected override void Process()
        {
            foreach (Vendor vendor in Vendors.Where(x => ((VendorType)x.VendorType).Has(VendorType.Stock) && x.IsActive))
            {
#if DEBUG
                if (vendor.VendorID != 31)
                {
                    continue;
                }
#endif

                if (vendor.VendorSettings.GetValueByKey <int>("AssortmentImportID", 0) < 1)
                {
                    continue;
                }

                log.DebugFormat("Start import BAS stock import, vendor {0} en vendorID {1}", vendor.Name, vendor.VendorID);


                _retailStock    = false;// vendor.VendorSettings.GetValueByKey<bool>("RetailStock", false);
                _auctionStock   = vendor.VendorSettings.GetValueByKey <bool>("AuctionStock", false);
                _shopAssortment = vendor.VendorSettings.GetValueByKey <bool>("ShopAssortment", false);

                using (var content = GetContent(vendor))
                {
                    int totalProducts = content.Tables[0].AsEnumerable().Count();
                    log.DebugFormat("Start Stock processing for {0}, {1} Products", vendor.Name, totalProducts);

                    //if (totalProducts > 0)
                    //  BulkImport(vendor.VendorID, content, vendor.ParentVendorID);
                    //else
                    //  log.Debug("Stop processing with empty dataset");

                    if (totalProducts > 0)
                    {
                        if (_auctionStock)
                        {
                            var bscStock = new ProcessBSCStockAssortment();
                            bscStock.Process(content, vendor, log, true);
                        }
                        else if (_retailStock)
                        {
                            var rs = new ProcessRetailStock();
                            rs.Process(content, vendor, log);
                        }
                        else
                        {
                            var ass = new ProcessStock();
                            ass.Process(content, vendor, log);
                        }
                    }
                    else
                    {
                        log.Debug("Stop processing with empty dataset");
                    }
                }

                log.DebugFormat("Finish import BAS stock import, vendor {0} en vendorID {1}", vendor.Name, vendor.VendorID);
            }
        }