コード例 #1
0
        //string product_name, product_desc, product_image;
        //string product_price, product_qty;

        protected void Page_Load(object sender, EventArgs e)
        {
            Product_id = Convert.ToInt16(Request.QueryString["pid"].ToString());
            Models.Products pro_details = new Models.Products();
            pro_details.pid = Product_id;
            pro_details     = pro_details.GetDetails(pro_details);
            Label1.Text     = pro_details.price.ToString();
            Label2.Text     = pro_details.name;
            Label4.Text     = pro_details.description;
            Image1.ImageUrl = pro_details.path;
        }
コード例 #2
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            Models.Connection   gcon = new Models.Connection();
            Models.ClearTextBox ct   = new Models.ClearTextBox();
            Models.Products     pro  = new Models.Products();
            pro.name        = TextBox1.Text;
            pro.description = TextBox2.Text;
            pro.price       = Convert.ToInt32(TextBox3.Text);
            pro.quantity    = Convert.ToInt32(TextBox4.Text);
            SqlCommand    com = new SqlCommand("select Cid from CategoryView where CategoryName ='" + DropDownList1.Text + "'", gcon.getConnection());
            SqlDataReader rd  = com.ExecuteReader();

            while (rd.Read())
            {
                pro.categoryID = Convert.ToInt32(rd["Cid"].ToString());
            }
            pro.path = Label1.Text;
            pro.Add(pro);
            Response.Write("<script>alert('Successfully Inserted Product')</script>");
            //Response.Redirect("AdminHome.aspx");
            ct.ClearTextbox(TextBox1, TextBox2, TextBox3, TextBox4);
            Label1.Text     = "";
            Image1.ImageUrl = "";
        }