protected void Page_Load(object sender, EventArgs e) { Sec = (clsSecurity)Session["Sec"]; MyCart = (clsCart)Session["MyCart"]; MyCartList = (clsCartItem)Session["MyCartList"]; txtOrderTotal.Text = Session["Ordertotal"].ToString(); MyCart.Email = Sec.UserEMail; txtEmail.Text = Sec.UserEMail; txtDatePurchased.Text = DateTime.Now.Date.ToString("dd/MM/yyyy"); }
protected void btnAdd_Click(object sender, EventArgs e) { //create a new instance of clsCartItem clsCartItem AnItem = new clsCartItem(); //set the product id AnItem.ProductID = ProductID; //set the quantity AnItem.QTY = Convert.ToInt32(txtQTY.Text); //add the item to the cart's products collection MyCart.Products.Add(AnItem); //go back to shopping Response.Redirect("Default.aspx"); }
protected void btnConfirm_Click(object sender, EventArgs e) { //create a new instance of clsCartItem clsCartItem AnItem = new clsCartItem(); //set the product id AnItem.InventoryId = InventoryId; //set the Item properties AnItem.Name = Convert.ToString(txtName.Text); AnItem.QTY = Convert.ToInt32(txtQuantity.Text); AnItem.Price = Convert.ToDecimal(txtPrice.Text); AnItem.TotalPrice = Convert.ToDecimal((AnItem.QTY) * (AnItem.Price)); if (active == true) { if (chkAge.Checked == true) { //add the item to the cart's products collection MyCart.Products.Add(AnItem); //go back to shopping Response.Redirect("Product.aspx"); } else { lblError.Text = "Please tick the box to give Consent you are 18 or over!"; } } else { //add the item to the cart's products collection MyCart.Products.Add(AnItem); //go back to shopping Response.Redirect("Product.aspx"); } }