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));
            }
        }
예제 #2
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;
            }
        }