Ejemplo n.º 1
0
        public ILineItem LineItemByCode(string code)
        {
            var lineItem = LineItems.FirstOrDefault(x =>
                                                    x.Code.Equals(code, StringComparison.OrdinalIgnoreCase));

            return(lineItem);
        }
Ejemplo n.º 2
0
        protected virtual async Task <CartAggregate> InnerAddLineItemAsync(LineItem lineItem, CartProduct product = null, IList <DynamicPropertyValue> dynamicProperties = null)
        {
            var existingLineItem = LineItems.FirstOrDefault(li => li.ProductId == lineItem.ProductId);

            if (existingLineItem != null)
            {
                await InnerChangeItemQuantityAsync(existingLineItem, existingLineItem.Quantity + Math.Max(1, lineItem.Quantity), product);

                existingLineItem.FulfillmentCenterId   = lineItem.FulfillmentCenterId;
                existingLineItem.FulfillmentCenterName = lineItem.FulfillmentCenterName;

                lineItem = existingLineItem;
            }
            else
            {
                lineItem.Id = null;
                Cart.Items.Add(lineItem);
            }

            if (dynamicProperties != null)
            {
                await UpdateCartItemDynamicProperties(lineItem, dynamicProperties);
            }

            return(this);
        }
Ejemplo n.º 3
0
        public void RemoveProduct(int productId)
        {
            var item = LineItems.FirstOrDefault(x => x.ProductId == productId);

            if (item != null)
            {
                LineItems.Remove(item);
            }
        }
Ejemplo n.º 4
0
        public void Remove(string lineItemId)
        {
            var lineItem = LineItems.FirstOrDefault(li => li.Id == lineItemId);

            if (lineItem != null)
            {
                LineItems.Remove(lineItem);
            }
        }
Ejemplo n.º 5
0
        public void Add(LineItem lineItem)
        {
            var existingLineItem = LineItems.FirstOrDefault(li => li.ProductId == lineItem.ProductId);

            if (existingLineItem != null)
            {
                existingLineItem.Quantity += lineItem.Quantity;
            }
            else
            {
                LineItems.Add(lineItem);
            }
        }
Ejemplo n.º 6
0
        public LineItem GetLockInSaleItem(LineItem lockInAdjustment)
        {
            var lockInLineItem = LineItems.FirstOrDefault(
                lineItem => lineItem.TradeMoney.Currency == lockInAdjustment.TradeMoney.Currency &&
                lineItem.LineItemType != ItemType.LockInSaleAdjustment);

            if (lockInLineItem == null)
            {
                throw new ArgumentException(string.Format(
                                                "Unable to retrieve lock-in sale item for lock-in adjustment LineItemId: {0}", lockInAdjustment.Id));
            }

            return(lockInLineItem);
        }
Ejemplo n.º 7
0
        public void AddProduct(int productId, int qty, double price)
        {
            var item = LineItems.FirstOrDefault(x => x.ProductId == productId);

            if (item != null)
            {
                item.Quantity += qty;
            }
            else
            {
                LineItems.Add(new OrderLineItem {
                    ProductId = productId, Quantity = qty, Price = price, OrderId = OrderId
                });
            }
        }
Ejemplo n.º 8
0
        public void RemoveProduct(int productId)
        {
            var item = LineItems.FirstOrDefault(x => x.ProductId == productId);

            if (item != null)
            {
                LineItems.Remove(item);
            }

            /* veya */

            /*foreach (var item in LineItems)
             * {
             *  if (item.ProductId == productId)
             *  {
             *      LineItems.Remove(item);
             *      break;
             *  }
             * }*/
        }
Ejemplo n.º 9
0
 public FinAnalyzerLineItem LineItem(string inventoryID)
 {
     return(LineItems.FirstOrDefault(x => x.InventoryID == inventoryID));
 }