public void saveCartChecks(ItemModel obj) { // add new item to the cart if (Singleton.getCart().CartItemList.Where(x => x.Item.ID == obj.Item.ID).Count() == 0) { var cart_itemModel = new Cart_itemModel(); obj.IsItemSelected = true; cart_itemModel.Item = obj.Item; cart_itemModel.TxtQuantity = 1.ToString(); Singleton.getCart().AddItem(cart_itemModel); } // delete item from the cart else { // unselect item var itemFound = ItemModelList.Where(x => x.Item.ID == obj.Item.ID).FirstOrDefault(); if (itemFound != null) { itemFound.IsItemSelected = false; } foreach (var cart_itemModel in Singleton.getCart().CartItemList.Where(x => x.Item.ID == obj.Item.ID && x.TxtRef == obj.TxtRef).ToList()) { Singleton.getCart().RemoveItem(cart_itemModel); } } GoToQuoteCommand.raiseCanExecuteActionChanged(); }
public async Task <bool> checkIfStockAvailable(Cart_itemModel cart_itemModel) { bool isStockAvailable = false; var itemFound = (await Bl.BlItem.searchItemAsync(new Item { Ref = cart_itemModel.TxtRef }, ESearchOption.AND)).FirstOrDefault(); if (itemFound != null && itemFound.Stock >= Utility.intTryParse(cart_itemModel.TxtQuantity) - Utility.intTryParse(cart_itemModel.TxtOldQuantity)) { isStockAvailable = true; } return(isStockAvailable); }
private void deleteItemFromCart(Cart_itemModel obj) { saveCartChecks(new ItemModel { Item = obj.Item }); }
private bool canDeleteItemFromCart(Cart_itemModel arg) { return(true); }
public void RemoveItem(Cart_itemModel cart_itemModel) { CartItemList.Remove(cart_itemModel); }
public void AddItem(Cart_itemModel cart_itemModel) { cart_itemModel.PropertyChanged += onTotalPurchaseOrSellingPriceChange; CartItemList.Add(cart_itemModel); onPropertyChange("CartItemList"); }