Exemplo n.º 1
0
        public void OnExecuting(Request request)
        {
            ValidateCartForCheckoutRequest r = (ValidateCartForCheckoutRequest)request;

            // active lines - voided lines, aggregate them over ProductId
            var productQuanityPairs = r.Cart.CartLines.Where(cl => !cl.IsVoided).GroupBy(cl => new { cl.ProductId }).Select(group => new Tuple <long, decimal>(group.Key.ProductId, group.Sum(i => i.Quantity)));

            InventoryRequestHelper.ValidateOnHandQuantities(productQuanityPairs, request.RequestContext);
        }
Exemplo n.º 2
0
        public void OnExecuting(Request request)
        {
            SaveCartVersionedDataRequest r = (SaveCartVersionedDataRequest)request;

            if (r.SalesTransaction != null && r.SalesTransaction.ActiveSalesLines.Count > 0)
            {
                // active lines - voided lines, aggregate them over ProductId
                var productQuanityPairs = r.SalesTransaction.ActiveSalesLines.Where(asl => !asl.IsVoided).GroupBy(cl => new { cl.ProductId }).Select(group => new Tuple <long, decimal>(group.Key.ProductId, group.Sum(i => i.Quantity)));

                InventoryRequestHelper.ValidateOnHandQuantities(productQuanityPairs, request.RequestContext);
            }
        }