Esempio n. 1
0
        private void checkInventoryButton_Click(object sender, EventArgs e)
        {
            InventoryServiceSoapClient client = new InventoryServiceSoapClient();

            client.CheckInventoryCompleted += CheckInventoryCompleted;

        	_timer = Stopwatch.StartNew();

            client.CheckInventoryAsync(partNumberBox.Text);
        }
Esempio n. 2
0
        private void checkInventoryButton_Click(object sender, EventArgs e)
        {
            InventoryServiceSoapClient client = new InventoryServiceSoapClient();

            client.CheckInventoryCompleted += CheckInventoryCompleted;

            _timer = Stopwatch.StartNew();

            client.CheckInventoryAsync(partNumberBox.Text);
        }
Esempio n. 3
0
        //28.02.19: KA: Request to SOAP Inventory service
        public APIResultOfArrayOfClassificationConfigurationInformation GetClassifications()
        {
            EndpointAddress            endpoint = new EndpointAddress(client._xSiteMaster.EndpointAddressValueInventory);
            InventoryServiceSoapClient service  = new InventoryServiceSoapClient(new BasicHttpsBinding(), endpoint);

            return(service.GetClassificationConfigurationInformation(new APICredentials()
            {
                DeveloperKey = client._xSiteMaster.DevKey,
                Password = client._xSiteMaster.DevPassword
            }, client._xSiteMaster.AccountId));
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ItemsService"/> class.
        /// </summary>
        /// <param name="credentials">The credentials.</param>
        /// <param name="name">The account user-friendly name.</param>
        /// <param name="accountId">The account id.</param>
        /// <param name="cache">The cache.</param>
        /// <remarks>If <paramref name="cache"/> is <c>null</c> no caching takes place.</remarks>
        public ItemsService(APICredentials credentials, string name, string accountId, ObjectCache cache = null, LogDetailsEnum logDetailsEnum = LogDetailsEnum.Undefined)
        {
            this._credentials   = credentials;
            this.AccountId      = accountId;
            this.LogDetailsEnum = logDetailsEnum;
            this._client        = new InventoryServiceSoapClient();

            this.Name   = name;
            this._cache = cache;
            this.SlidingCacheExpiration = ObjectCache.NoSlidingExpiration;
            this._allItemsCacheKey      = string.Format("caAllItems_ID_{0}", this.AccountId);
        }
    private void DownloadInventoryData()
    {

      try
      {
        this.StatusDescription = string.Format("Creating ChannelAdvisor Client");

        //Create OrderService client and ready it for request
        string devKey = System.Configuration.ConfigurationManager.AppSettings["CaDevK"];
        string devPW = System.Configuration.ConfigurationManager.AppSettings["CaDevPw"];
        //int profileID = 32001327;
        string accountID = System.Configuration.ConfigurationManager.AppSettings["CaAcct"]; ;
        APICredentials cred = new APICredentials();
        cred.DeveloperKey = devKey;
        cred.Password = devPW;
        InventoryServiceSoapClient invClient = new InventoryServiceSoapClient();

        this.StatusDescription = string.Format("Downloading Inventory Item List");

        int invItemDownloadedCount = 0;
        List<InventoryItem> inventory = new List<InventoryItem>();

        InventoryItemCriteria itemCriteria = new InventoryItemCriteria();
        itemCriteria.PageNumber = 1;
        itemCriteria.PageSize = 100;

        InventoryItemDetailLevel detailLevel = new InventoryItemDetailLevel();
        detailLevel.IncludePriceInfo = true;
        detailLevel.IncludeQuantityInfo = true;
        detailLevel.IncludeClassificationInfo = false;

        APIResultOfArrayOfInventoryItemResponse response;

        do
        {
          //invItemDownloadedCount += response.ResultData.Length;
          //this.StatusDescription = string.Format("Downloading Inventory Item List ({0} completed)", invItemDownloadedCount);

          response = invClient.GetFilteredInventoryItemList(cred, accountID, itemCriteria, detailLevel, "", "");
          if (response.ResultData == null)
            break;

          foreach (var responseItem in response.ResultData)
          {
            invItemDownloadedCount++;
            this.StatusDescription = string.Format("Downloading Inventory Item List ({0} completed)", invItemDownloadedCount);
            InventoryItem item = new InventoryItem();
            item.Asin = responseItem.ASIN;
            item.Brand = responseItem.Brand;
            item.Description = responseItem.Description;
            item.Ean = responseItem.EAN;
            item.HarmonizedCode = responseItem.HarmonizedCode;
            item.Height = (decimal)responseItem.Height;
            item.Isbn = responseItem.ISBN;
            item.Length = (decimal)responseItem.Length;
            item.Manufacturer = responseItem.Manufacturer;
            item.Mpn = responseItem.MPN;
            item.Quantity = responseItem.Quantity.Total;
            item.Sku = responseItem.Sku;
            item.SupplierCode = responseItem.SupplierCode;
            item.Title = responseItem.Title;
            item.Upc = responseItem.UPC;
            item.WarehouseLocation = responseItem.WarehouseLocation;
            item.Weight = (decimal)responseItem.Weight;
            item.Width = (decimal)responseItem.Width;


            bool getAttributes = true;
            if (getAttributes)
            {
              var attrResponse = invClient.GetInventoryItemAttributeList(cred, accountID, item.Sku);
              foreach (var attrPair in attrResponse.ResultData)
              {
                item.AttributeList.Add(attrPair.Name, attrPair.Value);
                if (attrPair.Name.Equals("Amazon Category"))
                {
                  item.AmazonCategory = attrPair.Value;
                }
                else if (attrPair.Name.Equals("FBA Notes"))
                {
                  item.FbaNotes = attrPair.Value;
                }
                else if (attrPair.Name.Equals("Is Chocolate"))
                {
                  item.IsMeltable = attrPair.Value;
                }
                else if (attrPair.Name.Equals("Foreign Market Restriction"))
                {
                  item.ForeignMarketRestrictions = attrPair.Value;
                }
                else if (attrPair.Name.Equals("Marketplace Restrictions"))
                {
                  item.MarketplaceRestrictions = attrPair.Value;
                }
                else if (attrPair.Name.Equals("Pricing: Seller Cost Formula"))
                {
                  item.MultiPackQuantity = attrPair.Value;
                }
                else if (attrPair.Name.Equals("Perishable?"))
                {
                  item.Perishable = attrPair.Value;
                }
              }
            }

            inventory.Add(item);
          }

          itemCriteria.PageNumber += 1;
        } while (response.ResultData != null && response.ResultData.Length != 0);

        CommitToDatabase(inventory);
      }
      catch (Exception e)
      {
        throw new Exception(string.Format("ChannelAdvisorInventoryService - {0}", e.Message));
      }

    }
        private void DownloadInventoryData()
        {
            try
            {
                this.StatusDescription = string.Format("Creating ChannelAdvisor Client");

                //Create OrderService client and ready it for request
                string devKey = System.Configuration.ConfigurationManager.AppSettings["CaDevK"];
                string devPW  = System.Configuration.ConfigurationManager.AppSettings["CaDevPw"];
                //int profileID = 32001327;
                string         accountID = System.Configuration.ConfigurationManager.AppSettings["CaAcct"];;
                APICredentials cred      = new APICredentials();
                cred.DeveloperKey = devKey;
                cred.Password     = devPW;
                InventoryServiceSoapClient invClient = new InventoryServiceSoapClient();

                this.StatusDescription = string.Format("Downloading Inventory Item List");

                int invItemDownloadedCount     = 0;
                List <InventoryItem> inventory = new List <InventoryItem>();

                InventoryItemCriteria itemCriteria = new InventoryItemCriteria();
                itemCriteria.PageNumber = 1;
                itemCriteria.PageSize   = 100;

                InventoryItemDetailLevel detailLevel = new InventoryItemDetailLevel();
                detailLevel.IncludePriceInfo          = true;
                detailLevel.IncludeQuantityInfo       = true;
                detailLevel.IncludeClassificationInfo = false;

                APIResultOfArrayOfInventoryItemResponse response;

                do
                {
                    //invItemDownloadedCount += response.ResultData.Length;
                    //this.StatusDescription = string.Format("Downloading Inventory Item List ({0} completed)", invItemDownloadedCount);

                    response = invClient.GetFilteredInventoryItemList(cred, accountID, itemCriteria, detailLevel, "", "");
                    if (response.ResultData == null)
                    {
                        break;
                    }

                    foreach (var responseItem in response.ResultData)
                    {
                        invItemDownloadedCount++;
                        this.StatusDescription = string.Format("Downloading Inventory Item List ({0} completed)", invItemDownloadedCount);
                        InventoryItem item = new InventoryItem();
                        item.Asin              = responseItem.ASIN;
                        item.Brand             = responseItem.Brand;
                        item.Description       = responseItem.Description;
                        item.Ean               = responseItem.EAN;
                        item.HarmonizedCode    = responseItem.HarmonizedCode;
                        item.Height            = (decimal)responseItem.Height;
                        item.Isbn              = responseItem.ISBN;
                        item.Length            = (decimal)responseItem.Length;
                        item.Manufacturer      = responseItem.Manufacturer;
                        item.Mpn               = responseItem.MPN;
                        item.Quantity          = responseItem.Quantity.Total;
                        item.Sku               = responseItem.Sku;
                        item.SupplierCode      = responseItem.SupplierCode;
                        item.Title             = responseItem.Title;
                        item.Upc               = responseItem.UPC;
                        item.WarehouseLocation = responseItem.WarehouseLocation;
                        item.Weight            = (decimal)responseItem.Weight;
                        item.Width             = (decimal)responseItem.Width;


                        bool getAttributes = true;
                        if (getAttributes)
                        {
                            var attrResponse = invClient.GetInventoryItemAttributeList(cred, accountID, item.Sku);
                            foreach (var attrPair in attrResponse.ResultData)
                            {
                                item.AttributeList.Add(attrPair.Name, attrPair.Value);
                                if (attrPair.Name.Equals("Amazon Category"))
                                {
                                    item.AmazonCategory = attrPair.Value;
                                }
                                else if (attrPair.Name.Equals("FBA Notes"))
                                {
                                    item.FbaNotes = attrPair.Value;
                                }
                                else if (attrPair.Name.Equals("Is Chocolate"))
                                {
                                    item.IsMeltable = attrPair.Value;
                                }
                                else if (attrPair.Name.Equals("Foreign Market Restriction"))
                                {
                                    item.ForeignMarketRestrictions = attrPair.Value;
                                }
                                else if (attrPair.Name.Equals("Marketplace Restrictions"))
                                {
                                    item.MarketplaceRestrictions = attrPair.Value;
                                }
                                else if (attrPair.Name.Equals("Pricing: Seller Cost Formula"))
                                {
                                    item.MultiPackQuantity = attrPair.Value;
                                }
                                else if (attrPair.Name.Equals("Perishable?"))
                                {
                                    item.Perishable = attrPair.Value;
                                }
                            }
                        }

                        inventory.Add(item);
                    }

                    itemCriteria.PageNumber += 1;
                } while (response.ResultData != null && response.ResultData.Length != 0);

                CommitToDatabase(inventory);
            }
            catch (Exception e)
            {
                throw new Exception(string.Format("ChannelAdvisorInventoryService - {0}", e.Message));
            }
        }