protected void btnCheckout_Clicked(object sender, EventArgs e) { // Order is payed for and is added to users orders if (IsValid) { Order o = new Order(); o.UserEmail = email.Text; o.FirstName = firstName.Text; o.LastName = lastName.Text; o.Phone = phone.Text; o.StreetAddress = streetAddress.Text; o.Suburb = suburb.Text; o.Postcode = postcode.Text; o.PostOption = QueryClass.GetPostageOptionByName(DdlPostage.SelectedItem.Text); o.Products = ((List <Product>)Session["cart"]); o.Date = DateTime.Now.ToString(); if (paypal.Checked) { // o.PaypalID = payPalEmail.Text; } else { //Adding card details to the order to access it on the next page o.CardNumber = card_number.Text; o.CardName = card_name.Text; o.CardCVC = card_cvv.Text; o.CardExpiryDate = card_expiration.Text; } Session.Add("order", o); Response.Redirect("Checkout_Confirmx"); } }
protected void Page_Load(object sender, EventArgs e) { //we needed to unimplement paypal invisi.Visible = false; cart = new List <Product>(); if (!IsPostBack) { foreach (PostageOptions po in QueryClass.GetPostageOptions()) { ListItem li = new ListItem(); li.Text = po.Name; DdlPostage.Items.Add(li); } DdlPostage.SelectedIndex = 0; postPrice.InnerText = "Postage: $" + QueryClass.GetPostageOptionByName(DdlPostage.SelectedItem.Text).Price.ToString("F"); } if (Session["cart"] != null) { cart = (List <Product>)Session["cart"]; } else { Response.Redirect("Main"); } if (Session["user"] != null) { User u = (User)Session["user"]; email.Enabled = false; email.Text = u.Email; postcode.Text = u.Postcode; suburb.Text = u.Suburb; streetAddress.Text = u.Street; phone.Text = u.Phone; lastName.Text = u.LastName; firstName.Text = u.FirstName; } // Make paypal or credit card form visible on page laod if (!paypal.Checked) { paypalForm.Visible = false; cardForm.Visible = true; } else { paypalForm.Visible = true; cardForm.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { postage = Request.QueryString["postage"]; if (postage != null && !IsPostBack) { PostageOptions o = QueryClass.GetPostageOptionByName(postage); pricePostage.Text = o.Price.ToString("F"); namePostage.Text = o.Name; descriptionPostage.Text = o.Description; etaPostage.Text = o.ETA.ToString(); hiddenID.Text = o.ID.ToString(); } }
protected void ddlPostage_Changed(object sender, EventArgs e) { postPrice.InnerText = "Postage: $" + QueryClass.GetPostageOptionByName(DdlPostage.SelectedItem.Text).Price.ToString("F"); }