protected void Page_Load(object sender, EventArgs e)
        {
            //if the role is not admin, redirect to default
            if (!(Request.Cookies["roles"].Value == "2"))
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(),
                                                       "{noAccess}", "alert('{You have no Access to this!}');window.location.href='Default.aspx' ", true);
            }

            ProductAccess pa = new ProductAccess();

            txtProductID.Text = "" + (pa.getMaxProductID() + 1);
            pa.CloseConnection();   //should I close it?
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            product_id = Convert.ToInt16(Request.QueryString["product_id"]);
            ProductAccess pa     = new ProductAccess();
            SqlDataReader reader = pa.SearchProductByID(product_id);
            OrderAccess   oa     = new OrderAccess();

            while (reader.Read())
            {
                //set the datas to the UI
                ImageProduct.ImageUrl = reader.GetString(6);
                lblProductName.Text   = reader.GetString(5) + " " + reader.GetString(1);
                lblPrice.Text         = "$" + reader.GetDouble(2);
                lblDescription.Text   = reader.GetString(3);
            }
            pa.CloseConnection();
        }