Example #1
0
        public CallMessagesResult <bool> UpdateFeed(ILogService log,
                                                    ITime time,
                                                    IDbFactory dbFactory,
                                                    ISystemActionService actionService,
                                                    IItemHistoryService itemHistoryService,
                                                    long companyId)
        {
            var sourceFeed = Path.Combine(UrlHelper.GetImportCatalogFeedPath(), FileName);

            var marketplaceManager = new MarketplaceKeeper(dbFactory, false);

            marketplaceManager.Init();

            IWalmartApi api = (IWalmartApi) new MarketFactory(marketplaceManager.GetAll(), time, log, dbFactory, null)
                              .GetApi(companyId, MarketType.WalmartCA, null);

            var service = new WalmartListingInfoReader(log, time, api, dbFactory, actionService, itemHistoryService, null, null);

            service.UpdateListingInfo(sourceFeed);

            return(new CallMessagesResult <bool>()
            {
                Data = true
            });
        }
Example #2
0
        public void SendTestPromotion(IWalmartApi api)
        {
            var item1 = new ItemDTO()
            {
                StyleId      = 1158,
                SKU          = "21TE062ERDZA-1-3T", // "21TE062ERDZA-1-3T",
                CurrentPrice = 19.89M
            };

            using (var db = _dbFactory.GetRWDb())
            {
                if (item1.StyleId.HasValue)
                {
                    var itemStyle = db.StyleFeatureValues.GetFeatureValueByStyleIdByFeatureId(
                        item1.StyleId.Value,
                        StyleFeatureHelper.ITEMSTYLE);

                    if (!item1.ListPrice.HasValue && itemStyle != null)
                    {
                        item1.ListPrice = PriceHelper.GetDefaultMSRP(itemStyle.Value);
                    }
                }
            }

            //var result = api.GetFeed("20F17E0B509143B89023AD9B8036D158@AQYBAQA");
            //_log.Info(result.ToString());

            //var result = api.SendPrice(item1);
            //_log.Info(result.ToString());

            api.SendPromotion(item1);
        }
Example #3
0
 public WalmartPriceFeedByOne(ILogService log,
                              ITime time,
                              IWalmartApi api,
                              IDbFactory dbFactory,
                              string feedBaseDirectory) : base(log, dbFactory, api, time)
 {
     _feedBaseDirectory = feedBaseDirectory;
 }
Example #4
0
 public ReadReturnWalmartInfoFromMarketThread(IWalmartApi api,
                                              long userId,
                                              ISystemMessageService messageService,
                                              TimeSpan?callbackInterval,
                                              TimeSpan betweenProcessingInverval)
     : base("ReadReturn" + api.Market + "InfoFromMarket", userId, messageService, callbackInterval)
 {
     _api = api;
     _betweenProcessingInverval = betweenProcessingInverval;
 }
Example #5
0
        public void ResetNotExistListingQty(IWalmartApi api, string overrideReportPath)
        {
            var service = new WalmartListingInfoReader(_log, _time, api, _dbFactory,
                                                       _actionService,
                                                       _itemHistoryService,
                                                       AppSettings.WalmartReportBaseDirectory,
                                                       AppSettings.WalmartFeedBaseDirectory);

            service.ResetQtyForNotExistListings(overrideReportPath);
        }
Example #6
0
        public void FindSecondDayFlagDisparity(IWalmartApi api, string overrideFeedpath)
        {
            var service = new WalmartListingInfoReader(_log, _time, api, _dbFactory,
                                                       _actionService,
                                                       _itemHistoryService,
                                                       AppSettings.WalmartReportBaseDirectory,
                                                       AppSettings.WalmartFeedBaseDirectory);

            service.FindSecondDayFlagDisparity(overrideFeedpath);
        }
Example #7
0
        public void RetireNotExistListings(IWalmartApi api)
        {
            var service = new WalmartListingInfoReader(_log, _time, api, _dbFactory,
                                                       _actionService,
                                                       _itemHistoryService,
                                                       AppSettings.WalmartReportBaseDirectory,
                                                       AppSettings.WalmartFeedBaseDirectory);

            service.RetireNotExistListings();
        }
Example #8
0
 public UpdateWalmartOrderDataThread(IWalmartApi api,
                                     long companyId,
                                     ISystemMessageService messageService,
                                     TimeSpan?callbackInterval,
                                     TimeSpan betweenProcessingInverval)
     : base("Update" + api.Market + "OrderData", companyId, messageService, callbackInterval)
 {
     _api = api;
     _betweenProcessingInverval = betweenProcessingInverval;
 }
 public WalmartOrderCancellation(IWalmartApi api,
                                 ISystemActionService actionService,
                                 ILogService log,
                                 ITime time)
 {
     _api           = api;
     _log           = log;
     _time          = time;
     _actionService = actionService;
 }
Example #10
0
 public BaseWalmartFeed(ILogService log,
                        IDbFactory dbFactory,
                        IWalmartApi api,
                        ITime time)
 {
     _log       = log;
     _time      = time;
     _api       = api;
     _dbFactory = dbFactory;
 }
        public WalmartItemsFeed(ILogService log,
                                ITime time,
                                IWalmartApi api,
                                IDbFactory dbFactory,
                                string feedBaseDirectory,
                                string swatchImageDirectory,
                                string swatchImageBaseUrl,
                                string walmartImageDirectory,
                                string walmartImageBaseUrl) : base(log, dbFactory, api, time)
        {
            _feedBaseDirectory = feedBaseDirectory;

            _swatchImageDirectory = swatchImageDirectory;
            _swatchImageBaseUrl   = swatchImageBaseUrl;

            _walmartImageDirectory = walmartImageDirectory;
            _walmartImageBaseUrl   = walmartImageBaseUrl;
        }
 public WalmartListingInfoReader(ILogService log,
                                 ITime time,
                                 IWalmartApi api,
                                 IDbFactory dbFactory,
                                 ISystemActionService actionService,
                                 IItemHistoryService itemHistoryService,
                                 string reportBaseDirectory,
                                 string feedBaseDirectory)
 {
     _api                 = api;
     _log                 = log;
     _time                = time;
     _dbFactory           = dbFactory;
     _actionService       = actionService;
     _itemHistoryService  = itemHistoryService;
     _reportBaseDirectory = reportBaseDirectory;
     _feedBaseDirectory   = feedBaseDirectory;
 }
 public WalmartOrderUpdater(IWalmartApi api, ILogService log, ITime time)
 {
     _api  = api;
     _log  = log;
     _time = time;
 }
Example #14
0
 public WalmartOrderAcknowledgement(IWalmartApi api, ILogService log, ITime time)
 {
     _api  = api;
     _log  = log;
     _time = time;
 }
Example #15
0
        public void GetOrder(IWalmartApi api, string orderId)
        {
            var orders = api.GetOrder(_log, orderId);

            _log.Info(orders.ToString());
        }
Example #16
0
        public void GetWalmartSizes(IWalmartApi walmartApi)
        {
            using (var db = _dbFactory.GetRWDb())
            {
                var items = db.Items.GetAll()
                            .Where(i => i.Market == (int)MarketType.Walmart)
                            .Select(i => new ItemDTO()
                {
                    Id              = i.Id,
                    Barcode         = i.Barcode,
                    ASIN            = i.ASIN,
                    SourceMarketId  = i.SourceMarketId,
                    PublishedStatus = i.ItemPublishedStatus,
                    Color           = i.Color,
                    Size            = i.Size,
                })
                            .ToList();

                var existAllAttributes = db.ItemAdditions.GetAll().Where(i => i.Field == "MarketSize" || i.Field == "MarketColor").ToList();

                _log.Info("Total items: " + items.Count);
                var index    = 0;
                var pageSize = 100;

                while (index < items.Count)
                {
                    _log.Info("index: " + index);
                    var pageItems = items.Skip(index).Take(pageSize).ToList();

                    foreach (var item in pageItems)
                    {
                        var result = _openApi.LookupProductByJSON(item.SourceMarketId);
                        if (result.Data != null && result.Data.Any())
                        {
                            var sizeAttr = existAllAttributes.Where(i => i.ItemId == item.Id &&
                                                                    i.Field == "MarketSize").FirstOrDefault();
                            if (sizeAttr == null)
                            {
                                sizeAttr = new Core.Entities.Listings.ItemAddition()
                                {
                                    Field      = "MarketSize",
                                    ItemId     = item.Id,
                                    CreateDate = _time.GetAppNowTime()
                                };
                                db.ItemAdditions.Add(sizeAttr);
                            }
                            sizeAttr.Value = result.Data[0].Size;

                            var colorAttr = existAllAttributes.Where(i => i.ItemId == item.Id &&
                                                                     i.Field == "MarketColor").FirstOrDefault();
                            if (colorAttr == null)
                            {
                                colorAttr = new Core.Entities.Listings.ItemAddition()
                                {
                                    Field      = "MarketColor",
                                    ItemId     = item.Id,
                                    CreateDate = _time.GetAppNowTime()
                                };
                                db.ItemAdditions.Add(colorAttr);
                            }
                            colorAttr.Value = result.Data[0].Color;

                            db.Commit();
                        }
                    }
                    index += pageSize;
                }
            }
        }
 public WalmartProductController(IWalmartApi api)
 {
     _api = api;
     _walmartApiComponent = new WalmartApiService();
 }