public void addProductToCheck(BaseProduct product) { string barcode = productScanner.scanProduct(product); checkPrinter.addProductToCheck(barcode); }
/// <summary> /// Queries the products. /// This method triggures the query that returns amazon products for the specified upc /// </summary> /// <returns>The products.</returns> public List <IProduct> QueryProducts() { //create the list to store the amazon products List <IProduct> products = new List <IProduct>(); try { AmazonAuthentication auth = new AmazonAuthentication(); auth.AccessKey = accessKey; auth.SecretKey = secretKey; AmazonWrapper wrapper = new AmazonWrapper(auth, AmazonEndpoint.US, "wyrecorp-20"); var response = wrapper.Lookup(itemUPC); //if the item array is null then there are no items to retreive and return the prodcuts list blank if (response.Items is null) { return(products); } foreach (var item in response.Items.Item) { String desc = ""; //ioslate any null pointer errors in the description variable try { //parse all of the item features together to create a description for the product foreach (String line in item.ItemAttributes.Feature) { desc = desc + line + Environment.NewLine; } } catch (Exception ex) { Debug.WriteLine("Error reading description from amazon in amazon api. Error Message" + ex.Message); desc = "No description available"; } //create the new product only if the lowest price for this version of the product is not null, because if it null that means that there is no price if (!(item.OfferSummary.LowestNewPrice is null)) { BaseProduct product = new BaseProduct() { Name = item.ItemAttributes.Title ?? "No Title Available", Merchant = "Amazon", Description = desc ?? "No Description Available", UPC = item.ItemAttributes.UPC ?? "No UPC Available", Condition = "New", Price = Double.Parse(item.OfferSummary.LowestNewPrice.FormattedPrice.Substring(1)), FormattedPrice = item.OfferSummary.LowestNewPrice.FormattedPrice ?? "No Formatted Price Available", CurrentCurrency = item.OfferSummary.LowestNewPrice.CurrencyCode ?? "No Currency Code Available", Url = item.DetailPageURL ?? "No Url Available" }; products.Add(product); } if (!(item.OfferSummary.LowestUsedPrice is null)) { BaseProduct productUsed = new BaseProduct() { Name = item.ItemAttributes.Title ?? "No Title Available", Merchant = "Amazon", Description = desc ?? "No Description Available", Condition = "Used", UPC = item.ItemAttributes.UPC ?? "No UPC Available", Price = Double.Parse(item.OfferSummary.LowestUsedPrice.FormattedPrice.Substring(1)), FormattedPrice = item.OfferSummary.LowestUsedPrice.FormattedPrice ?? "No Formatted Price Available", CurrentCurrency = item.OfferSummary.LowestUsedPrice.CurrencyCode, Url = item.DetailPageURL ?? "No Url Available" }; products.Add(productUsed); } if (!(item.OfferSummary.LowestRefurbishedPrice is null)) { BaseProduct productRefurb = new BaseProduct() { Name = item.ItemAttributes.Title ?? "No Title Available", Merchant = "Amazon", Description = desc ?? "No Description Available", UPC = item.ItemAttributes.UPC ?? "No UPC Available", //set the conditions based on the product type Condition = "Refurbished", //set the prices for the products from the lowest offers section Price = Double.Parse(item.OfferSummary.LowestRefurbishedPrice.FormattedPrice.Substring(1)), //set the formatted price for each item FormattedPrice = item.OfferSummary.LowestRefurbishedPrice.FormattedPrice ?? "No Formatted Price Available", //set the currency for each price CurrentCurrency = item.OfferSummary.LowestRefurbishedPrice.CurrencyCode ?? "No Currency Code Available", Url = item.DetailPageURL ?? "No Url Available" }; //add the three products to the list products.Add(productRefurb); } } return(products); }catch (Exception ex) { Debug.WriteLine("Error when getting product information from the Amazon Api, please check api keys and upc and try again later. Error Message:" + ex.Message); return(products); } }
public static string CreateSKU(BaseProduct product) { return($"{SubStringName(product.Name)}{product.Price}"); }
protected void RaiseEvent(BaseProduct product) { OnCorrectProduct?.Invoke(this, new WareHouseEventArgs(product, OnCorrectProduct.Method.Name)); }
public abstract void AddProduct(BaseProduct product);
public virtual void AddProduct(BaseProduct product) { if (product == null || !product.IsNew() && _products.Contains(product)) return; _products.Add(product); }
public virtual void RemoveProduct(BaseProduct product) { _products.Remove(product); }
/// <summary> /// Gets the variants that are published in the <paramref name="websiteSystemId"/>. /// </summary> /// <param name="arg">The argument.</param> /// <param name="websiteSystemId">The website system identifier.</param> /// <param name="channelSystemId">The channel system identifier.</param> /// <returns></returns> public static IEnumerable <Variant> GetPublishedVariants(this BaseProduct arg, Guid websiteSystemId, Guid?channelSystemId = null) { return(_variantService.Value .GetByBaseProduct(arg.SystemId) .Where(x => !string.IsNullOrEmpty(x.GetUrl(channelSystemId: channelSystemId)))); }
/// <summary> /// Gets the main category under which this variant is published. /// </summary> /// <param name="arg">The argument.</param> /// <param name="channelSystemId">The channel identifier.</param> /// <returns></returns> public static Category GetMainCategory(this BaseProduct arg, Guid?channelSystemId) { var linkedCategories = _categoryService.Value.GetByBaseProduct(arg.SystemId); return(linkedCategories.FirstOrDefault(x => x.IsPublished(channelSystemId) && x.ProductLinks.Any(l => l.BaseProductSystemId == arg.SystemId && l.MainCategory))); }
public new void SetStockStatus(BaseProduct product, StockInformation stockInformation) { base.SetStockStatus(product, stockInformation); }
public new void SetPrices(BaseProduct product, IDictionary <string, Price> prices) { base.SetPrices(product, prices); }
private ODataProductModel MapVariant(BaseProduct baseProduct, Variant variant) { var prices = priceListItemService.GetByVariant(variant.SystemId).ToDictionary(p => priceListService.Get(p.PriceListSystemId).Id, r => r.Price); return(new ODataProductModel(baseProduct, variant, prices)); }