//Clears the Session 'cart' and creates a new list private void ClearCart() { listOfSales = new SalesList(); Session["cart"] = listOfSales; }
protected void Page_Load(object sender, EventArgs e) { if (Session["ClientID"] == null) { Response.Redirect("Home.aspx"); } if (Session["SecurityLevel"] != null && Session["SecurityLevel"].ToString() == "1") { pnlCheckOut.Visible = false; btnFinalCheckOut.Visible = false; pnlSuccess.Visible = false; txtEmail.Text = GetEmailAddress(); if (!IsPostBack || Session["cart"] == null) { DAL_Project.DAL d = new DAL_Project.DAL(@"Data Source=localhost;Initial Catalog=dbDeidreFinalAssign;Integrated Security=SSPI"); Session["cart"] = new SalesList(); ListViewItem.DataSource = d.ExecuteProcedure("spGetItem"); ListViewItem.DataBind(); } listOfSales = (SalesList)Session["cart"]; RefreshCart(); } else { Response.Redirect("Home.aspx"); } }