private SystemOperationResult InventoryCheck(ProductPageViewModel model) { var data = HccApp.CatalogServices.InventoryCheck(model.LocalProduct, model.Selections); model.StockMessage = data.InventoryMessage; model.IsAvailableForSale = data.IsAvailableForSale; var formQuantity = Request.Form["qty"]; if (model.LocalProduct.IsUserSuppliedPrice) { formQuantity = "1"; } if (!string.IsNullOrEmpty(formQuantity)) { formQuantity = security.InputFilter(formQuantity.Trim(), PortalSecurity.FilterFlag.NoMarkup); } var qty = 0; if (int.TryParse(formQuantity, out qty)) { var li = ConvertProductToLineItem(model); li.Quantity = Convert.ToInt16(formQuantity); return(HccApp.CheckForStockOnItems(li)); } return(new SystemOperationResult(false, Localization.GetString("EnterProperQty"))); }
private bool CheckForStockOnItems(CartViewModel model) { var result = HccApp.CheckForStockOnItems(model.CurrentOrder); if (result.Success) { return(true); } FlashFailure(result.Message); return(false); }
private SystemOperationResult InventoryCheck(ProductPageViewModel model) { var data = HccApp.CatalogServices.InventoryCheck(model.LocalProduct, model.Selections); model.StockMessage = data.InventoryMessage; model.IsAvailableForSale = data.IsAvailableForSale; var formQuantity = Request.Form["qty"]; var qty = 0; if (int.TryParse(formQuantity, out qty)) { var li = ConvertProductToLineItem(model); li.Quantity = Convert.ToInt16(formQuantity); return(HccApp.CheckForStockOnItems(li)); } return(new SystemOperationResult(false, Localization.GetString("EnterProperQty"))); }
protected void btnUpdateQuantities_Click(object sender, EventArgs e) { var gridView = CurrentOrder.IsRecurring ? gvSubscriptions : gvItems; foreach (GridViewRow row in gridView.Rows) { if (row.RowType != DataControlRowType.DataRow) { continue; } var itemId = (long)gridView.DataKeys[row.RowIndex].Value; var txtQty = row.FindControl("txtQty") as TextBox; var li = CurrentOrder.GetLineItem(itemId); var quantity = int.Parse(txtQty.Text.Trim()); var opResult = HccApp.OrderServices.OrdersUpdateItemQuantity(itemId, quantity, CurrentOrder); if (!string.IsNullOrEmpty(opResult.Message)) { ucMessageBox.ShowError(opResult.Message); } } var result = HccApp.CheckForStockOnItems(CurrentOrder); if (!result.Success) { ucMessageBox.ShowWarning(result.Message); } HccApp.CalculateOrderAndSave(CurrentOrder); var handler = OrderEdited; if (handler != null) { handler(this, EventArgs.Empty); } }