private List <Core.Models.SiteCatalog.Pricing.PowerMenu.Product> GetItemPricing(string branchId, string customerNumber, List <ProductLine> products, DateTime effectiveDate) { List <Core.Models.SiteCatalog.Pricing.PowerMenu.Product> retVal = new List <Core.Models.SiteCatalog.Pricing.PowerMenu.Product>(); List <string> itemNumbers = (from ProductLine p in products select p.ProductNumber).ToList(); ICatalogLogic catLogic = _scope.GetService(typeof(ICatalogLogic)) as ICatalogLogic; ProductsReturn items = catLogic.GetProductsByIdsWithPricing(new UserSelectedContext() { BranchId = branchId, CustomerId = customerNumber }, itemNumbers); foreach (Svc.Core.Models.SiteCatalog.Product item in items.Products) { KeithLink.Svc.Core.Models.SiteCatalog.Pricing.PowerMenu.Product currentItem = new KeithLink.Svc.Core.Models.SiteCatalog.Pricing.PowerMenu.Product(); currentItem.ProductNumber = item.ItemNumber; currentItem.IsAuthorized = item.HasPrice; currentItem.IsActive = true; currentItem.AvailableQty = 0; currentItem.IsCatchWeight = item.CatchWeight; ProductLine myProduct = (from ProductLine p in products where p.ProductNumber == currentItem.ProductNumber select p).FirstOrDefault(); if (item.CatchWeight) { currentItem.Price = (decimal)item.CasePriceNumeric; currentItem.PurchaseByUnit = "lb"; } else if (myProduct.Unit.Length == 0 || myProduct.Unit.Equals("case", StringComparison.InvariantCultureIgnoreCase)) { currentItem.Price = (decimal)item.CasePriceNumeric; currentItem.PurchaseByUnit = "cs"; } else if (myProduct.Unit.Equals("each", StringComparison.InvariantCultureIgnoreCase)) { currentItem.Price = (decimal)item.PackagePriceNumeric; currentItem.PurchaseByUnit = "ea"; } else { currentItem.Price = 0; currentItem.PurchaseByUnit = string.Empty; } retVal.Add(currentItem); } return(retVal); }
private List <Core.Models.SiteCatalog.Pricing.PowerMenu.Product> GetItemPricing(string branchId, string customerNumber, ProductLine[] products, DateTime effectiveDate) { List <Core.Models.SiteCatalog.Pricing.PowerMenu.Product> retVal = new List <Core.Models.SiteCatalog.Pricing.PowerMenu.Product>(); List <Core.Models.SiteCatalog.Product> productList = (from ProductLine p in products select new Core.Models.SiteCatalog.Product { ItemNumber = p.ProductNumber }).ToList(); IPriceLogic priceLogic = _scope.GetService(typeof(IPriceLogic)) as IPriceLogic; PriceReturn prices = priceLogic.GetPrices(branchId, customerNumber, effectiveDate, productList); foreach (Price price in prices.Prices) { KeithLink.Svc.Core.Models.SiteCatalog.Pricing.PowerMenu.Product currentItem = new KeithLink.Svc.Core.Models.SiteCatalog.Pricing.PowerMenu.Product(); currentItem.ProductNumber = price.ItemNumber; currentItem.IsAuthorized = (price.CasePrice > 0 || price.PackagePrice > 0); currentItem.IsActive = true; currentItem.AvailableQty = 0; currentItem.IsCatchWeight = false; ProductLine myProduct = (from ProductLine p in products where p.ProductNumber == currentItem.ProductNumber select p).FirstOrDefault(); //if (item.CatchWeight) { // currentItem.Price = decimal.Parse(item.CasePrice); // currentItem.PurchaseByUnit = "Lb"; if (myProduct.Unit.Length == 0 || myProduct.Unit.Equals("case", StringComparison.InvariantCultureIgnoreCase)) { currentItem.Price = (decimal)price.CasePrice; currentItem.PurchaseByUnit = "cs"; } else if (myProduct.Unit.Equals("each", StringComparison.InvariantCultureIgnoreCase)) { currentItem.Price = (decimal)price.PackagePrice; currentItem.PurchaseByUnit = "ea"; } else { currentItem.Price = 0; currentItem.PurchaseByUnit = string.Empty; } retVal.Add(currentItem); } return(retVal); }