//[RequireHttps] public ActionResult AddBillingAddress() { try { // Create Customer Customer customer = new Customer(); customer.GetFromStorage(); if (!customer.LoggedIn()) { return RedirectToAction("Index", "Authenticate", new { referrer = "https://" + Request.Url.Host + "/Cart/Checkout" }); } if (customer.Cart.payment_id == 0) { Address billing = new Address(); // Build out our Billing object billing = new Address { first = Request.Form["bfirst"], last = Request.Form["blast"], street1 = Request.Form["bstreet1"], street2 = Request.Form["bstreet2"], city = Request.Form["bcity"], postal_code = Request.Form["bzip"], residential = (Request.Form["bresidential"] == null) ? false : true, active = true }; try { billing.state = Convert.ToInt32(Request.Form["bstate"]); } catch (Exception) { throw new Exception("You must select a billing state/province."); } billing.Save(customer.ID); if (customer.billingID == 0) { customer.SetBillingDefaultAddress(billing.ID); } if (customer.shippingID == 0) { customer.SetShippingDefaultAddress(billing.ID); } // Retrieve Customer from Sessions/Cookie customer.Cart.SetBilling(billing.ID); if (customer.Cart.ship_to == 0) { customer.Cart.SetShipping(billing.ID); } } else { UDF.ExpireCart(customer.ID); return RedirectToAction("index"); } } catch { } return RedirectToAction("shipping"); }
//[RequireHttps] public ActionResult AddBillingAddress() { try { // Create Customer Customer customer = new Customer(); HttpContext ctx = System.Web.HttpContext.Current; customer.GetFromStorage(ctx); if (customer.Cart.payment_id == 0) { Address billing = new Address(); // Build out our Billing object billing = new Address { first = Request.Form["bfirst"], last = Request.Form["blast"], street1 = Request.Form["bstreet1"], street2 = Request.Form["bstreet2"], city = Request.Form["bcity"], postal_code = Request.Form["bzip"], residential = (Request.Form["bresidential"] == null) ? false : true, active = true }; try { billing.state = Convert.ToInt32(Request.Form["bstate"]); } catch (Exception) { throw new Exception("You must select a billing state/province."); } billing.Save(customer.ID); if (customer.billingID == 0) { customer.SetBillingDefaultAddress(billing.ID); } if (customer.shippingID == 0 && !billing.isPOBox()) { customer.SetShippingDefaultAddress(billing.ID); } // Retrieve Customer from Sessions/Cookie customer.Cart.SetBilling(billing.ID); if (customer.Cart.ship_to == 0 && !billing.isPOBox()) { customer.Cart.SetShipping(billing.ID); } } else { UDF.ExpireCart(ctx, customer.ID); return RedirectToAction("index"); } } catch { } return RedirectToAction("shipping"); }
//[RequireHttps] public ActionResult ChooseBilling(int id = 0) { // Create Customer Customer customer = new Customer(); HttpContext ctx = System.Web.HttpContext.Current; // Retrieve Customer from Sessions/Cookie customer.GetFromStorage(ctx); if (customer.Cart.payment_id == 0) { if (customer.billingID == 0) { customer.SetBillingDefaultAddress(id); } customer.Cart.SetBilling(id); return RedirectToAction("billing"); } else { UDF.ExpireCart(ctx, customer.ID); return RedirectToAction("index"); } }
public ActionResult SetBillingDefault(int id = 0) { HttpContext ctx = System.Web.HttpContext.Current; Customer cust = new Customer(); cust.GetFromStorage(ctx); if (!cust.LoggedIn(ctx)) { return RedirectToAction("Index", "Authenticate"); } Address a = new Address().Get(id); if (a.cust_id == cust.ID) { cust.SetBillingDefaultAddress(id); cust.BindAddresses(); } return RedirectToAction("Addresses"); }
//[RequireHttps] public ActionResult ChooseBilling(int id = 0) { // Create Customer Customer customer = new Customer(); // Retrieve Customer from Sessions/Cookie customer.GetFromStorage(); if (!customer.LoggedIn()) { return RedirectToAction("Index", "Authenticate", new { referrer = "https://" + Request.Url.Host + "/Cart/Checkout" }); } if (customer.Cart.payment_id == 0) { if (customer.billingID == 0) { customer.SetBillingDefaultAddress(id); } customer.Cart.SetBilling(id); return RedirectToAction("billing"); } else { UDF.ExpireCart(customer.ID); return RedirectToAction("index"); } }
public ActionResult SetBillingDefault(int id = 0) { Customer cust = new Customer(); cust.GetFromStorage(); Address a = new Address().Get(id); if (a.cust_id == cust.ID) { cust.SetBillingDefaultAddress(id); cust.BindAddresses(); } return RedirectToAction("Addresses"); }