protected void Button1_Click1(object sender, EventArgs e)
 {
     DataAccessClass dac = new DataAccessClass();
     DataTable dt1 = dac.SelectDataFromProduct();
     GridView1.DataSource = dt1;
     GridView1.DataBind();
 }
        protected void Button1_Click(object sender, EventArgs e)
        {
            string item = DropDownList1.SelectedItem.ToString();
            string operat = DropDownList2.SelectedItem.ToString();
            string val = TextBox1.Text;

            DataAccessClass dac = new DataAccessClass();
            DataTable dt1 = dac.SearchProducts(item,operat,val);
            GridView1.DataSource = dt1;
            GridView1.DataBind();
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            int pid = Convert.ToInt32(txtPid.Text);
            string name = txtPname.Text;
            decimal price = Convert.ToDecimal(txtPprice.Text);
            int qty = Convert.ToInt32(txtPqty.Text);

            DataAccessClass dac = new DataAccessClass();
            if (dac.UpdateProduct(pid, name, price, qty))
                lblMsg.Text = "Data Update Successfully";
            else
                lblMsg.Text = "Not Updated,, Mising Sometihng,.";
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            int pid =Convert.ToInt32(txtPid.Text);
            string name = txtPname.Text;
            decimal price = Convert.ToDecimal(txtPprice.Text);
            int qty = Convert.ToInt32(txtPqty.Text);

            DataAccessClass dac = new DataAccessClass();
            if (dac.InsertDataIntoProduct(pid, name, price, qty))
                lblMsg.Text = "Data Inserted Successfully";
            else
                lblMsg.Text = "Try again Please,.";
        }
        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            int pid=Convert.ToInt32(txtPid.Text);
            DataAccessClass dac = new DataAccessClass();
            SqlDataReader reader = dac.SearchProductForEdit(pid);

            while (reader.Read())
            {
                txtPname.Text = reader.GetString(1);
                txtPprice.Text = reader.GetValue(2).ToString();
                txtPqty.Text =reader.GetInt32(3).ToString();

            }
        }