private void CopyMemberInvoice() { var invoiceId = int.Parse(Request.QueryString["memberInvoiceId"]); var copyOfInvoice = CopyOrderProvider.CopyShoppingCartFromMemberInvoice(DistributorID, Locale, invoiceId); if (copyOfInvoice != null) { SessionInfo.ConfirmedAddress = false; ShoppingCart = copyOfInvoice; if (ShoppingCart.IsFromInvoice && ShoppingCart.CopyInvoiceStatus == CopyInvoiceStatus.AddressValidationFail && ShoppingCart.CopyInvoiceAddress != null) { _checkoutOptions.ValidateInvoiceAddress(); } else { Session["IsCopingFromInvoice"] = null; Response.Redirect(GetRequestURLWithOutPort()); } } else { OnCancelCopyMemberInvoice(); } }
public static MyHLCopyOrderResult CopyOrder(string shoppingCartID, bool ignoreCartNotEmpty) { try { if (IsShoppingCartNotEmpty && !ignoreCartNotEmpty) { return(new MyHLCopyOrderResult(0, false, IsShoppingCartNotEmpty)); } var shoppingCart = CopyOrderProvider.CopyShoppingCart(int.Parse(shoppingCartID), StaticDistributorID, StaticLocale, SkuCollection); return(new MyHLCopyOrderResult(shoppingCart != null ? shoppingCart.ShoppingCartID : 0, shoppingCart != null, IsShoppingCartNotEmpty)); } catch (Exception ex) { LoggerHelper.Error(ex.ToString()); throw ex; } }
/// <summary> /// On continue to the saved cart confirmation. /// </summary> /// <param name="sender">Sender object.</param> /// <param name="e">Event agrs.</param> protected void OnContinue(object sender, EventArgs e) { if (!string.IsNullOrEmpty(hidCartID.Value) && !string.IsNullOrEmpty(hidAction.Value)) { SetDefaultMonth(); switch (hidAction.Value) { case "CheckOut": int shCart = 0; if (int.TryParse(hidCartID.Value, out shCart)) { ShoppingCart = ShoppingCartProvider.GetShoppingCart(DistributorID, Locale, shCart); if (this.ShoppingCart.IsSavedCart) { HLRulesManager.Manager.ProcessSavedCartManagementRules(this.ShoppingCart, ShoppingCartRuleReason.CartRetrieved); } if (DisplayNonResidentMessage(hidCartID.Value)) { ShowNonResidentPopup(hidCartID.Value); return; } } ClearShoppingCartModuleCache(); Response.Redirect(string.Format("~/Ordering/ShoppingCart.aspx?CartID={0}", hidCartID.Value)); break; case "New": OnNewOrderIgnoringCartNotNull(this, null); break; case "Copy": var shoppingCart = CopyOrderProvider.CopyShoppingCart(int.Parse(hidCartID.Value), DistributorID, Locale, ProductInfoCatalog.AllSKUs); if (shoppingCart.ShoppingCartID > 0) { ShoppingCart = shoppingCart; if (this.ShoppingCart.IsFromCopy) { HLRulesManager.Manager.ProcessSavedCartManagementRules(this.ShoppingCart, ShoppingCartRuleReason.CartRetrieved); } } if (DisplayNonResidentMessage(shoppingCart.ShoppingCartID.ToString())) { ShowNonResidentPopup(shoppingCart.ShoppingCartID.ToString()); return; } ClearShoppingCartModuleCache(); Response.Redirect(string.Format("~/Ordering/ShoppingCart.aspx?CartID={0}", shoppingCart.ShoppingCartID)); break; } } else if (!string.IsNullOrEmpty(hidAction.Value)) { switch (hidAction.Value) { case "New": OnNewOrderIgnoringCartNotNull(this, null); break; } } }