protected void CheckoutButton_Clicked(object sender, EventArgs e) { if (Session[Constants.SessionKeys.SUMMARY_EDIT] != null && (bool)Session[Constants.SessionKeys.SUMMARY_EDIT] == true) { Session.Remove(Constants.SessionKeys.SUMMARY_EDIT); CartDB db = new CartDB(); db.CartUpdateDirty(CurrentCart.CartId, true); CurrentCart.MoveToStep(Constants.CheckoutStep.Summary); Response.Redirect(Constants.Pages.CHECKOUT); return; } CurrentCart.MoveToStep(0); Response.Redirect(Constants.Pages.CHECKOUT); }
protected void ContinueButton_Clicked(object sender, EventArgs e) { bool success = false; if(Page.IsValid){ int login_Uid = CartUsers.GetLoginID(); CartLocation BillLocation = null; BillLocation = CartLocation.GetBillingLocationByUserID(login_Uid); CartDB db = new CartDB(); db.CartDeleteAllLocations(CurrentCart.CartId); string BillingBusinessName = BillingBusinessNameTextbox.Text; string BillingFullName = BillingFullnameTextbox.Text; string BillingAddress1 = BillingAddressLine1Textbox.Text; string BillingAddress2 = BillingAddressLine2Textbox.Text; string BillingCity = BillingCityTextbox.Text; string BillingStateCode = BillingStateDropdown.SelectedValue; string BillingPostalCode = BillingPostalCodeTextbox.Text; string BillingPhone = BillingPhoneTextbox.Text; string BillingEmail = BillingEmailTextbox.Text; string BillingEmailConfirmation = BillingEmailConfirmationTextbox.Text; string ShippingBusinessName = ShippingBusinessNameTextbox.Text; string ShippingFullName = ShippingFullnameTextbox.Text; string ShippingAddress1 = ShippingAddressLine1Textbox.Text; string ShippingAddress2 = ShippingAddressLine2Textbox.Text; string ShippingCity = ShippingCityTextbox.Text; string ShippingStateCode = ShippingStateDropdown.SelectedValue; string ShippingPostalCode = ShippingPostalCodeTextbox.Text; string ShippingPhone = ShippingPhoneTextbox.Text; int address_book_id; if (Helper.StringExists(ShippingAddressBookLocationID.Value) && Int32.TryParse(ShippingAddressBookLocationID.Value, out address_book_id)) { LoginAddress address = LoginAddress.GetAddressFromLoginAddressID(address_book_id); if (address != null && address.LoginID == CartUsers.GetLoginID()) { db.LoginUpdAddress(address.LoginAddressID, address.LoginID, ShippingBusinessName, ShippingFullName, ShippingAddress1, ShippingAddress2, ShippingCity, ShippingStateCode, "", ShippingPostalCode, CountryCode,ShippingPhone, 0); } } try { Session["UTitle"] = BillLocation.UTitle; Session["AreaCode"] = BillLocation.AreaCode; Session["PhoneExt"] = BillLocation.PhoneExt; Session["Fax"] = BillLocation.Fax; } catch (Exception erro) { Session["UTitle"] = ""; Session["AreaCode"] = ""; Session["PhoneExt"] = ""; Session["Fax"] = ""; } try { success = db.CartAddLocation(CurrentCart.CartId, CartDB.LocationType.Billing, BillingBusinessName, BillingFullName, BillingAddress1, BillingAddress2, BillingCity, BillingStateCode, BillingPostalCode, CountryCode, BillingPhone, BillingEmail, BillLocation.UTitle, BillLocation.AreaCode, BillLocation.PhoneExt, BillLocation.Fax); success = db.CartAddLocation(CurrentCart.CartId, CartDB.LocationType.Shipping, ShippingBusinessName, ShippingFullName, ShippingAddress1, ShippingAddress2, ShippingCity, ShippingStateCode, ShippingPostalCode, CountryCode, ShippingPhone, "", BillLocation.UTitle, BillLocation.AreaCode, BillLocation.PhoneExt, BillLocation.Fax); } catch (Exception cartErr) { success = db.CartAddLocation(CurrentCart.CartId, CartDB.LocationType.Billing, BillingBusinessName, BillingFullName, BillingAddress1, BillingAddress2, BillingCity, BillingStateCode, BillingPostalCode, CountryCode, BillingPhone, BillingEmail,"","", "", ""); success = db.CartAddLocation(CurrentCart.CartId, CartDB.LocationType.Shipping, ShippingBusinessName, ShippingFullName, ShippingAddress1, ShippingAddress2, ShippingCity, ShippingStateCode, ShippingPostalCode, CountryCode, ShippingPhone, "", "", "", "", ""); } if (success) { if (Session[Constants.SessionKeys.SUMMARY_EDIT] != null && (bool)Session[Constants.SessionKeys.SUMMARY_EDIT] == true) { Session.Remove(Constants.SessionKeys.SUMMARY_EDIT); db.CartUpdateDirty(CurrentCart.CartId, true); CurrentCart.MoveToStep(Constants.CheckoutStep.Summary); Response.Redirect(Constants.Pages.CHECKOUT); return; } CurrentCart.MoveNextStep(); Response.Redirect(Constants.Pages.CHECKOUT); } } }