private void HandleAddToCart() { // extract the input parameters from the form post AddToCartInfo formInput = AddToCartInfo.FromForm(ThisCustomer); if (formInput != AddToCartInfo.INVALID_FORM_COMPOSITION) { string returnUrl = SE.MakeObjectLink("Product", formInput.ProductId, String.Empty); if (!ThisCustomer.IsRegistered && AppLogic.AppConfigBool("DisallowAnonCustomerToCreateWishlist")) { string ErrMsg = string.Empty; ErrorMessage er; if (formInput.CartType == CartTypeEnum.WishCart) { ErrMsg = AppLogic.GetString("signin.aspx.27", 1, ThisCustomer.LocaleSetting); er = new ErrorMessage(ErrMsg); Response.Redirect("signin.aspx?ErrorMsg=" + er.MessageId + "&ReturnUrl=" + Security.UrlEncode(returnUrl)); } if (formInput.CartType == CartTypeEnum.GiftRegistryCart) { ErrMsg = AppLogic.GetString("signin.aspx.28", 1, ThisCustomer.LocaleSetting); er = new ErrorMessage(ErrMsg); Response.Redirect("signin.aspx?ErrorMsg=" + er.MessageId + "&ReturnUrl=" + Security.UrlEncode(returnUrl)); } } bool success = ShoppingCart.AddToCart(ThisCustomer, formInput); AppLogic.eventHandler("AddToCart").CallEvent("&AddToCart=true&VariantID=" + formInput.VariantId.ToString() + "&ProductID=" + formInput.ProductId.ToString() + "&ChosenColor=" + formInput.ChosenColor.ToString() + "&ChosenSize=" + formInput.ChosenSize.ToString()); if (success) { bool stayOnThisPage = AppLogic.AppConfig("AddToCartAction").Equals("STAY", StringComparison.InvariantCultureIgnoreCase); if (stayOnThisPage) { // some tokens like the shoppingcart qty may already be rendered // we therefore need to re-display the page to display the correct qty Response.Redirect(this.Request.Url.ToString()); } else { if (formInput.CartType == CartTypeEnum.WishCart) { Response.Redirect(ResolveClientUrl("~/wishlist.aspx?ReturnUrl=" + Security.UrlEncode(returnUrl))); } if (formInput.CartType == CartTypeEnum.GiftRegistryCart) { Response.Redirect(ResolveClientUrl("~/giftregistry.aspx?ReturnUrl=" + Security.UrlEncode(returnUrl))); } // default Response.Redirect(ResolveClientUrl("~/ShoppingCart.aspx?add=true&ReturnUrl=" + Security.UrlEncode(returnUrl))); } } } return; }
private void HandleAddToCart() { // extract the input parameters from the form post AddToCartInfo formInput = AddToCartInfo.FromForm(ThisCustomer); if (formInput != AddToCartInfo.INVALID_FORM_COMPOSITION) { bool success = ShoppingCart.AddToCart(ThisCustomer, formInput); AppLogic.eventHandler("AddToCart").CallEvent("&AddToCart=true&VariantID=" + formInput.VariantId.ToString() + "&ProductID=" + formInput.ProductId.ToString() + "&ChosenColor=" + formInput.ChosenColor.ToString() + "&ChosenSize=" + formInput.ChosenSize.ToString()); if (success) { bool stayOnThisPage = AppLogic.AppConfig("AddToCartAction").Equals("STAY", StringComparison.InvariantCultureIgnoreCase); if (stayOnThisPage) { // some tokens like the shoppingcart qty may already be rendered // we therefore need to re-display the page to display the correct qty Response.Redirect(this.Request.Url.ToString()); } else { string returnUrl = CommonLogic.GetThisPageName(false) + "?" + CommonLogic.ServerVariables("QUERY_STRING"); if (formInput.CartType == CartTypeEnum.WishCart) { Response.Redirect(ResolveClientUrl("~/wishlist.aspx?ReturnUrl=" + Security.UrlEncode(returnUrl))); } if (formInput.CartType == CartTypeEnum.GiftRegistryCart) { Response.Redirect(ResolveClientUrl("~/giftregistry.aspx?ReturnUrl=" + Security.UrlEncode(returnUrl))); } // default Response.Redirect(ResolveClientUrl("~/ShoppingCart.aspx?add=true&ReturnUrl=" + Security.UrlEncode(returnUrl))); } } } return; }
private void HandleAddToCart() { if (String.IsNullOrEmpty(txtBluBuksUsed.Text) || String.IsNullOrWhiteSpace(txtBluBuksUsed.Text) || txtBluBuksUsed.Text == ".") { txtBluBuksUsed.Text = "0"; } if (String.IsNullOrEmpty(txtproductcategoryfundusedforsalesrep.Text) || String.IsNullOrWhiteSpace(txtproductcategoryfundusedforsalesrep.Text) || (txtproductcategoryfundusedforsalesrep.Text == ".")) { txtproductcategoryfundusedforsalesrep.Text = "0"; } // extract the input parameters from the form post AddToCartInfo formInput = AddToCartInfo.FromForm(ThisCustomer); formInput.BluBucksUsed = Convert.ToDecimal(txtBluBuksUsed.Text); formInput.FundID = Convert.ToInt32(hdnProductFundID.Text); //GLcode holds decision parameter value formInput.GLcode = SOFCodeChoice; if (ThisCustomer.CustomerLevelID == 3 || ThisCustomer.CustomerLevelID == 7) { if (Convert.ToInt16(formInput.GLcode) == (int)SOFUsedType.NF) { formInput.CategoryFundUsed = Convert.ToDecimal("0.00"); } else { formInput.CategoryFundUsed = Convert.ToDecimal(txtproductcategoryfundusedforsalesrep.Text); } formInput.FundID = (int)FundType.SOFFunds; } else { formInput.CategoryFundUsed = Convert.ToDecimal(hdnProductFundAmountUsed.Text); } formInput.BluBucksPercentageUsed = Convert.ToDecimal(hdnBudgetPercentValue.Text); formInput.ProductCategoryID = Convert.ToInt32(hdnProductCategoryID.Text); if (Convert.ToInt16(formInput.GLcode) == (int)SOFUsedType.SOFF) { formInput.SOFCode = txtSOFCode.Text; } else if (Convert.ToInt16(formInput.GLcode) == (int)SOFUsedType.CAPEX) { formInput.SOFCode = txtCAPEX.Text; } else { formInput.SOFCode = "0"; } if (formInput != AddToCartInfo.INVALID_FORM_COMPOSITION) { string returnUrl = SE.MakeObjectLink("Product", formInput.ProductId, String.Empty); if (!ThisCustomer.IsRegistered && AppLogic.AppConfigBool("DisallowAnonCustomerToCreateWishlist")) { string ErrMsg = string.Empty; ErrorMessage er; if (formInput.CartType == CartTypeEnum.WishCart) { ErrMsg = AppLogic.GetString("signin.aspx.27", 1, ThisCustomer.LocaleSetting); er = new ErrorMessage(ErrMsg); Response.Redirect("signin.aspx?ErrorMsg=" + er.MessageId + "&ReturnUrl=" + Security.UrlEncode(returnUrl)); } if (formInput.CartType == CartTypeEnum.GiftRegistryCart) { ErrMsg = AppLogic.GetString("signin.aspx.28", 1, ThisCustomer.LocaleSetting); er = new ErrorMessage(ErrMsg); Response.Redirect("signin.aspx?ErrorMsg=" + er.MessageId + "&ReturnUrl=" + Security.UrlEncode(returnUrl)); } } bool success = ShoppingCart.AddToCart(ThisCustomer, formInput); AppLogic.eventHandler("AddToCart").CallEvent("&AddToCart=true&VariantID=" + formInput.VariantId.ToString() + "&ProductID=" + formInput.ProductId.ToString() + "&ChosenColor=" + formInput.ChosenColor.ToString() + "&ChosenSize=" + formInput.ChosenSize.ToString()); if (success) { bool stayOnThisPage = AppLogic.AppConfig("AddToCartAction").Equals("STAY", StringComparison.InvariantCultureIgnoreCase); if (stayOnThisPage) { // some tokens like the shoppingcart qty may already be rendered // we therefore need to re-display the page to display the correct qty Response.Redirect(this.Request.Url.ToString()); } else { if (formInput.CartType == CartTypeEnum.WishCart) { Response.Redirect(ResolveClientUrl("~/wishlist.aspx?ReturnUrl=" + Security.UrlEncode(returnUrl))); } if (formInput.CartType == CartTypeEnum.GiftRegistryCart) { Response.Redirect(ResolveClientUrl("~/giftregistry.aspx?ReturnUrl=" + Security.UrlEncode(returnUrl))); } // default Response.Redirect(ResolveClientUrl("~/ShoppingCart.aspx?add=true&ReturnUrl=" + Security.UrlEncode(returnUrl))); } } } return; }