protected void Page_Load(object sender, EventArgs e)
        {
            int ID   = Convert.ToInt32(Session["LoggedInUserID"]);
            var user = sr.GetUser(ID);

            if (Session["LoggedInUserID"] != null)
            {
                if (user.Usertype.Equals("client"))
                {
                    btn_removeProduct.Visible = false;
                }
                else if (user.Usertype.Equals("admin"))
                {
                    btn_AddtoCart.Visible = false;
                }
            }

            var itemid = Request.QueryString["ID"];
            var mask   = sr.GetProduct(Convert.ToInt32(itemid));

            string displayi = " ";
            string display  = " ";

            displayi        += "<center><img src='" + mask.Image + "' alt='" + mask.Name + "' class='img-fluid'></center>";
            display         += "<center><h1>" + mask.Name + "</h1><p>" + mask.Description + "</p><p> R" + Math.Round(mask.Unit_Price, 2) + "</p></center>";
            pimage.InnerHtml = displayi;
            prod.InnerHtml   = display;
        }
Exemple #2
0
        //Page load gets details of existing product off ID

        protected void Page_Load(object sender, EventArgs e)
        {
            //Get the product id using URL parameter
            String param      = Request.QueryString["ID"];
            int    product_ID = Convert.ToInt32(param);

            //If a product is selected
            if (product_ID > 0)
            {
                //Get product based off ID
                var product = SR.GetProduct(product_ID);
                //If its NOT the initial visit to page
                if (!IsPostBack)
                {
                    //Display product info to admin
                    ProName.Value        = product.Name;
                    ProDescription.Value = product.Description;
                    ProPrice.Value       = Convert.ToString(product.Unit_Price);
                    ProActive.Value      = Convert.ToString(product.Active);
                    ProCategory.Value    = Convert.ToString(product.Mask_Id);
                    ProQuantity.Value    = Convert.ToString(product.Product_Quantity);
                }
            }
            else
            {
                Response.Redirect("AboutProduct.aspx");
            }
        }
Exemple #3
0
 private void remOrUpdate()
 {
     if (Request["rem"] != null)
     {
         SR.RemoveFromCart(ClientId, int.Parse(Request["rem"]));
         Response.Redirect("ShoppingCart.aspx");
     }
     else if (Request["clear"] != null)
     {
         SR.ClearTheCart(ClientId);
         Response.Redirect("ShoppingCart.aspx");
     }
     else if (Request["prodId"] != null)
     {
         SR.EditFromCart(
             ClientId,
             int.Parse(Request["prodId"]),
             int.Parse(Request["quantity"]),
             SR.GetProduct(int.Parse(Request["prodId"])).Unit_Price *int.Parse(Request["quantity"])
             );
         Response.Redirect("ShoppingCart.aspx");
     }
 }