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));
            }
        }
Example #2
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");
        }
Example #3
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;
            }
        }
Example #4
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;
            }
        }