protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            cFunctions ocFunctions = new cFunctions();
            Hashtable  oHashtable  = new Hashtable();

            oHashtable.Add("@ShoppingCartID", this.GridView1.SelectedValue.ToString().Trim());
            ocFunctions.RunSprocBool("RemoveFromCart", oHashtable);
            Response.Redirect("ShoppingCart.aspx?m=n");
        }
        protected void btnRemoveAll_Click(object sender, EventArgs e)
        {
            cFunctions ocFunctions = new cFunctions();
            Hashtable  oHashtable  = new Hashtable();

            oHashtable.Add("@UserName", Membership.GetUser().ToString().Trim());
            ocFunctions.RunSprocBool("RemoveAllFromCart", oHashtable);
            Response.Redirect("ShoppingCart.aspx?m=n");
        }
        private void DeleteAll()
        {
            cFunctions ocFunctions = new cFunctions();
            Hashtable  oHashtable  = new Hashtable();

            // Add User Name to Hash table
            oHashtable.Add("@UserName", Session["UserName"].ToString().Trim());
            ocFunctions.RunSprocBool("RemoveAllFromCart", oHashtable);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            cFunctions oFunctions = new cFunctions();
            int        count      = 0;

            try
            {
                if (Membership.GetUser().ToString().Trim() == string.Empty)
                {
                    Response.Redirect("Login.aspx");
                }
            }
            catch
            {
                Response.Redirect("Login.aspx");
            }

            Session["UserName"] = Membership.GetUser().ToString().Trim();

            try
            {
                if (Request.QueryString["m"].ToString().Trim() == "y")
                {
                    DeleteAll();
                }
            }
            catch
            {
                Response.Redirect("Index.aspx");
            }

            count = oFunctions.GetCount("SELECT count(*) from dbo.ShoppingCart WHERE (UserName = '******') AND (Active = 1)");
            if (count == 0)
            {
                this.lblEmptyCart.Visible = true;
                this.btnCheckout.Enabled  = false;
                this.btnRemoveAll.Enabled = false;
            }
            else
            {
                this.lblEmptyCart.Visible = false;
                this.btnCheckout.Enabled  = true;
                this.btnRemoveAll.Enabled = true;
            }

            string sum2 = oFunctions.GetString("SELECT SUM(Items.RegularPrice * Items.Discount / 100) AS Expr1 FROM ShoppingCart INNER JOIN Items ON ShoppingCart.ItemID = Items.ItemID WHERE (ShoppingCart.UserName = '******') AND (ShoppingCart.Active = 1)");

            if (sum2 == string.Empty)
            {
                this.lblOrderTotal.Text = " ";
            }
            else
            {
                this.lblOrderTotal.Text = String.Format("Order Total: {0:c}", Convert.ToDouble(sum2));
            }
        }
Esempio n. 5
0
        protected void btnAddToCart_Click1(object sender, EventArgs e)
        {
            cFunctions oFunctions = new cFunctions();
            Hashtable  oHashTable = new Hashtable();

            oHashTable.Add("@UserName", Membership.GetUser().ToString().Trim());
            oHashTable.Add("@ItemID", Request.QueryString["i"].ToString().Trim());

            if (!oFunctions.RunSprocBool("AddToShoppingCart", oHashTable))
            {
                Response.Write("Error");
                Response.End();
            }

            Response.Redirect("ShoppingCart.aspx?m=n");
        }
Esempio n. 6
0
        protected void btnConfirm_Click(object sender, EventArgs e)
        {
            cFunctions ocFunctions = new cFunctions();
            Hashtable  oHashtable  = new Hashtable();
            int        count       = 0;

            oHashtable.Add("@UserName", Session["UserName"].ToString().Trim());
            oHashtable.Add("@FirstName", Session["First"].ToString().Trim());
            oHashtable.Add("@LastName", Session["Last"].ToString().Trim());
            oHashtable.Add("@MI", Session["MI"].ToString().Trim());
            oHashtable.Add("@Address", Session["Address"].ToString().Trim());
            oHashtable.Add("@City", Session["City"].ToString().Trim());
            oHashtable.Add("@State", Session["State"].ToString().Trim());
            oHashtable.Add("@ZipCode", Session["Zip"].ToString().Trim());
            oHashtable.Add("@PhoneNumber", Session["Phone"].ToString().Trim());
            oHashtable.Add("@Email", Session["Email"].ToString().Trim());

            // See if user record exists already
            count = ocFunctions.GetCount("SELECT count(*) from dbo.UserDetails WHERE UserName = '******'");
            if (count == 0)
            {
                // Add User Details for new user
                ocFunctions.RunSprocBool("AddUserDetails", oHashtable);
            }
            else
            {
                // Update User Details for exisiting user
                ocFunctions.RunSprocBool("UpdateUserDetails", oHashtable);
            }

            // Add to Orders
            oHashtable.Clear();
            oHashtable.Add("@UserName", Session["UserName"].ToString().Trim());
            ocFunctions.RunSprocBool("PlaceOrder", oHashtable);

            Response.Redirect("ThankYou.aspx");
        }
Esempio n. 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int        count      = 0;
            cFunctions oFunctions = new cFunctions();
            string     itemID;

            itemID = Request.QueryString["c"].ToString().Trim();
            if (itemID == string.Empty)
            {
                count = 0;
            }
            else
            {
                count = oFunctions.GetCount("SELECT count(*) from dbo.Items WHERE CategoryID = " + Request.QueryString["c"].ToString().Trim());
            }
            if (count == 0)
            {
                this.lblNoItems.Visible = true;
            }
            else
            {
                this.lblNoItems.Visible = false;
            }
        }
Esempio n. 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack) // If posting back (i.e. button press), don't perform this code
            {
                try
                {
                    if (Membership.GetUser().ToString().Trim() == string.Empty)
                    {
                        Response.Redirect("Login.aspx");
                    }
                }
                catch
                {
                    Response.Redirect("Login.aspx");
                }

                Session["UserName"] = Membership.GetUser().ToString().Trim();

                try
                {
                    if (Request.QueryString["f"].ToString().Trim() == string.Empty)
                    {
                        Response.Redirect("Checkout.aspx?f=y");
                    }
                }
                catch
                {
                    Response.Redirect("Checkout.aspx?f=y");
                }

                if (Request.QueryString["f"].ToString().Trim() == "n")
                {
                    // Get User Info from session
                    this.txtFirst.Text   = Session["First"].ToString().Trim();
                    this.txtMI.Text      = Session["MI"].ToString().Trim();
                    this.txtLast.Text    = Session["Last"].ToString().Trim();
                    this.txtAddress.Text = Session["Address"].ToString().Trim();
                    this.txtCity.Text    = Session["City"].ToString().Trim();
                    this.txtState.Text   = Session["State"].ToString().Trim();
                    this.txtZip.Text     = Session["Zip"].ToString().Trim();
                    this.txtPhone.Text   = Session["Phone"].ToString().Trim();
                    this.txtEmail.Text   = Session["Email"].ToString().Trim();
                }
                else
                {
                    // Get User Info from Database if it exists
                    try
                    {
                        Hashtable  oHash = new Hashtable();
                        DataSet    sqlDataSet;
                        cFunctions ocFunctions = new cFunctions();

                        oHash.Add("@UserName", Session["UserName"].ToString().Trim());
                        sqlDataSet = ocFunctions.RunSprocDataSet("GetUserDetails", oHash);

                        // get data from data set
                        this.txtFirst.Text    = sqlDataSet.Tables[0].Rows[0]["FirstName"].ToString().Trim();
                        this.txtMI.Text       = sqlDataSet.Tables[0].Rows[0]["MI"].ToString().Trim();
                        this.txtLast.Text     = sqlDataSet.Tables[0].Rows[0]["LastName"].ToString().Trim();
                        this.txtAddress.Text  = sqlDataSet.Tables[0].Rows[0]["Address"].ToString().Trim();
                        this.txtCity.Text     = sqlDataSet.Tables[0].Rows[0]["City"].ToString().Trim();
                        this.txtState.Text    = sqlDataSet.Tables[0].Rows[0]["State"].ToString().Trim();
                        this.txtZip.Text      = sqlDataSet.Tables[0].Rows[0]["ZipCode"].ToString().Trim();
                        this.txtPhone.Text    = sqlDataSet.Tables[0].Rows[0]["PhoneNumber"].ToString().Trim();
                        this.txtEmail.Text    = sqlDataSet.Tables[0].Rows[0]["Email"].ToString().Trim();
                        this.lblError.Visible = false;
                    }
                    catch
                    {
                        this.lblError.Text    = "Note: No shipping information found for current user.";
                        this.lblError.Visible = true;
                    }
                }
            }
        }
Esempio n. 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            cFunctions oFunctions = new cFunctions();
            String     path       = "";
            int        count      = 0;

            try
            {
                if (Membership.GetUser().ToString().Trim() == string.Empty)
                {
                    Response.Redirect("Login.aspx");
                }
            }
            catch
            {
                Response.Redirect("Login.aspx");
            }

            try
            {
                if (Request.QueryString["i"].ToString().Trim() == string.Empty)
                {
                    Response.Redirect("Categories.aspx");
                }
            }
            catch
            {
                Response.Redirect("Categories.aspx");
            }

            if (oFunctions.GetStringBool("SELECT ReleaseDate FROM dbo.Items WHERE ItemID = " + Request.QueryString["i"].ToString().Trim()) != true)
            {
                this.btnAddToCart.Enabled = true;
                this.lblNote.Visible      = false;
            }
            else
            {
                this.btnAddToCart.Enabled = false;
                this.lblNote.Visible      = true;
            }

            path = oFunctions.GetString("SELECT ImageURL FROM dbo.Items WHERE ItemID = " + Request.QueryString["i"].ToString().Trim());
            if (path != String.Empty)
            {
                this.Image1.ImageUrl = path;
            }
            else
            {
                this.Image1.ImageUrl = "";
            }

            count = oFunctions.GetCount("SELECT count(*) from dbo.Items WHERE ItemID = " + Request.QueryString["i"].ToString().Trim());
            if (count == 0)
            {
                this.Label2.Visible  = true;
                this.lblNote.Visible = false;
            }
            else
            {
                this.Label2.Visible = false;
            }
        }