public ItemsFilter(InventoryItemCriteria criteria, InventoryItemDetailLevel detailLevel, string sortField, string sortDirection) { this.Criteria = criteria; this.DetailLevel = detailLevel; this.SortField = sortField; this.SortDirection = sortDirection; }
public ItemsFilter( InventoryItemCriteria criteria, InventoryItemDetailLevel detailLevel, string sortField, string sortDirection ) { this.Criteria = criteria; this.DetailLevel = detailLevel; this.SortField = sortField; this.SortDirection = sortDirection; }
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)); } }
public ItemsFilter(InventoryItemCriteria criteria, InventoryItemDetailLevel detailLevel) { this.Criteria = criteria; this.DetailLevel = detailLevel; }
public ItemsFilter( InventoryItemCriteria criteria, InventoryItemDetailLevel detailLevel ) { this.Criteria = criteria; this.DetailLevel = detailLevel; }