Exemple #1
0
        public CallEBayProcessing(ILogService log,
                                  ITime time,
                                  ICacheService cacheService,
                                  IDbFactory dbFactory,
                                  IStyleManager styleManager,
                                  eBayApi eBayApi,
                                  IEmailService emailService,
                                  CompanyDTO company)
        {
            _log                                 = log;
            _time                                = time;
            _dbFactory                           = dbFactory;
            _cacheService                        = cacheService;
            _styleManager                        = styleManager;
            _descriptionTemplatePath             = Path.Combine(AppSettings.TemplateDirectory, TemplateHelper.EBayDescriptionTemplateName);
            _descriptionMultiListingTemplatePath = Path.Combine(AppSettings.TemplateDirectory, TemplateHelper.EBayDescriptionMultiListingTemplateName);

            _eBayApi      = eBayApi;
            _company      = company;
            _emailService = emailService;

            _actionService = new SystemActionService(_log, _time);
            _htmlScraper   = new HtmlScraperService(log, time, dbFactory);

            var itemHistoryService = new ItemHistoryService(_log, _time, _dbFactory);

            _barcodeService           = new BarcodeService(log, time, dbFactory);
            _autoCreateListingService = new AutoCreateEBayListingService(_log, _time, dbFactory, cacheService, _barcodeService, _emailService, itemHistoryService, AppSettings.IsDebug);
        }
 public EBayRepublishThread(eBayApi api,
                            long companyId,
                            ISystemMessageService messageService,
                            IList <TimeSpan> callTimeStamps,
                            ITime time)
     : base(api.Market + api.MarketplaceId + "Republish", companyId, messageService, callTimeStamps, time)
 {
     _api = api;
 }
Exemple #3
0
        public SetupController(eBayApi api)
        {
            context = api.GetContext();

            getNotificationPreferences = new GetNotificationPreferencesCall(context);
            getNotificationPreferences.PreferenceLevel = eBay.Service.Core.Soap.NotificationRoleCodeType.User;

            asyncRequest = new Task(getNotificationPreferences.Execute);
            asyncRequest.Start();
        }
 public UpdateEBayOrderDataThread(eBayApi api,
                                  long companyId,
                                  ISystemMessageService messageService,
                                  TimeSpan?callbackInterval,
                                  TimeSpan betweenProcessingInverval)
     : base("UpdateEBay" + api.MarketplaceId + "OrderData", companyId, messageService, callbackInterval)
 {
     _api = api;
     _betweenProcessingInverval = betweenProcessingInverval;
 }
Exemple #5
0
 public ReadListingEBayInfoFromMarketThread(eBayApi api,
                                            long companyId,
                                            ISystemMessageService messageService,
                                            TimeSpan?callbackInterval,
                                            TimeSpan betweenProcessingInverval)
     : base("ReadListing" + api.Market + api.MarketplaceId + "InfoFromMarket", companyId, messageService, callbackInterval)
 {
     _api = api;
     _betweenProcessingInverval = betweenProcessingInverval;
 }
Exemple #6
0
        public void SubmitPrice(eBayApi api)
        {
            var sync = new eBayItemsSync(_log,
                                         _time,
                                         api,
                                         _dbFactory,
                                         _styleManager,
                                         AppSettings.eBayImageDirectory,
                                         AppSettings.eBayImageBaseUrl,
                                         AppSettings.LabelDirectory);

            sync.SendPriceUpdates();
        }
Exemple #7
0
        public void SyncItemsInfo(eBayApi api, IList <string> itemIds)
        {
            var sync = new eBayItemsSync(_log,
                                         _time,
                                         api,
                                         _dbFactory,
                                         _styleManager,
                                         AppSettings.eBayImageDirectory,
                                         AppSettings.eBayImageBaseUrl,
                                         AppSettings.LabelDirectory);

            sync.SyncItemsInfo(itemIds);
        }
Exemple #8
0
        public void SubmitItemsFromFile(eBayApi api, string filename)
        {
            var sourceSkus = ExcelReader.LoadSKUs(filename, 0).Select(i => i.SKU).ToList();
            var skus       = new List <string>();

            using (var db = _dbFactory.GetRWDb())
            {
                var eBaySkus = db.Listings.GetAll().Where(l => l.Market == (int)MarketType.eBay)
                               .Where(l => !String.IsNullOrEmpty(l.SKU))
                               .Select(l => l.SKU)
                               .ToList();
                skus = eBaySkus.Where(s => sourceSkus.Any(so => s.StartsWith(so))).ToList();
            }
            _log.Info("Count: " + skus.Count());
            SubmitItems(api, skus);
        }
Exemple #9
0
        public void SubmitInventory(eBayApi api, IList <string> skuList)
        {
            List <long> itemIds = null;

            if (skuList != null)
            {
                using (var db = _dbFactory.GetRWDb())
                {
                    //itemIds =
                    //    db.Items.GetAll().Where(i => i.ItemPublishedStatus == (int)PublishedStatuses.Published
                    //                                 && i.Market == (int)MarketType.eBay)
                    //        .Select(i => i.Id)
                    //        .ToList()
                    //        .Select(l => (long)l)
                    //    .ToList();

                    itemIds = db.Listings.GetAll().Where(l => skuList.Contains(l.SKU) &&
                                                         l.Market == (int)api.Market &&
                                                         l.MarketplaceId == api.MarketplaceId)
                              .Select(l => l.ItemId)
                              .ToList()
                              .Select(l => (long)l)
                              .ToList();
                }
            }

            var sync = new eBayItemsSync(_log,
                                         _time,
                                         api,
                                         _dbFactory,
                                         _styleManager,
                                         AppSettings.eBayImageDirectory,
                                         AppSettings.eBayImageBaseUrl,
                                         AppSettings.LabelDirectory);

            sync.SendInventoryUpdates(itemIds);
        }
Exemple #10
0
        public void Republish(eBayApi api)
        {
            var service = new ItemRepublishService(_log, _time, _dbFactory);

            service.PublishUnpublishedListings(MarketType.eBay, null);
        }
Exemple #11
0
 public NotificationController(eBayApi api)
 {
     context = api.GetContext();
 }
        public void Setup()
        {
            Database.SetInitializer <AmazonContext>(null);
            XmlConfigurator.Configure(new FileInfo(AppSettings.log4net_Config));

            _dbFactory = new DbFactory();
            _time      = new TimeService(_dbFactory);
            _settings  = new SettingsService(_dbFactory);

            _styleHistoryService = new StyleHistoryService(_log, _time, _dbFactory);
            _styleManager        = new StyleManager(_log, _time, _styleHistoryService);
            _actionService       = new SystemActionService(_log, _time);
            _quantityManager     = new QuantityManager(_log, _time);
            _priceManager        = new PriceManager(_log, _time, _dbFactory, _actionService, _settings);
            _cacheService        = new CacheService(_log, _time, _actionService, _quantityManager);
            _barcodeService      = new BarcodeService(_log, _time, _dbFactory);
            _weightService       = new WeightService();

            IEmailSmtpSettings smtpSettings = new EmailSmtpSettings();

            using (var db = new UnitOfWork())
            {
                _company = db.Companies.GetFirstWithSettingsAsDto();

                if (AppSettings.IsDebug)
                {
                    smtpSettings = SettingsBuilder.GetSmtpSettingsFromAppSettings();
                }
                else
                {
                    smtpSettings = SettingsBuilder.GetSmtpSettingsFromCompany(_company);
                }

                _addressService = AddressService.Default;
                _emailService   = new EmailService(_log, smtpSettings, _addressService);

                //todo check itemHist
                _autoCreateNonameListingService = new AutoCreateNonameListingService(_log,
                                                                                     _time,
                                                                                     _dbFactory,
                                                                                     _cacheService,
                                                                                     _barcodeService,
                                                                                     _emailService, null,
                                                                                     AppSettings.IsDebug);

                var marketplaces = new MarketplaceKeeper(_dbFactory, true);
                marketplaces.Init();

                var shipmentPrividers = db.ShipmentProviders.GetByCompanyId(_company.Id);

                var apiFactory = new MarketFactory(marketplaces.GetAll(), _time, _log, _dbFactory, AppSettings.JavaPath);

                var weightService = new WeightService();

                var serviceFactory = new ServiceFactory();
                var rateProviders  = serviceFactory.GetShipmentProviders(_log,
                                                                         _time,
                                                                         _dbFactory,
                                                                         weightService,
                                                                         shipmentPrividers,
                                                                         null,
                                                                         null,
                                                                         null,
                                                                         null);

                _magentoApi    = (Magento20MarketApi)apiFactory.GetApi(_company.Id, MarketType.Magento, MarketplaceKeeper.ShopifyDWS);
                _shopifyDWSApi = (ShopifyApi)apiFactory.GetApi(_company.Id, MarketType.Shopify, MarketplaceKeeper.ShopifyDWS);
                _eBayApi       = (eBayApi)apiFactory.GetApi(_company.Id, MarketType.eBay, "");
                _amazonApi     = (AmazonApi)apiFactory.GetApi(_company.Id, MarketType.Amazon, MarketplaceKeeper.AmazonComMarketplaceId);
                _walmartApi    = (WalmartApi)apiFactory.GetApi(_company.Id, MarketType.Walmart, "");
            }
        }
Exemple #13
0
 public HomeController(ITransactionRepository t, eBayApi context)
 {
     transactions = t;
     ebayContext  = context.GetContext();
 }
Exemple #14
0
 public eBayOrderUpdater(eBayApi api, ILogService log, ITime time)
 {
     _api  = api;
     _log  = log;
     _time = time;
 }