Esempio n. 1
0
 //code to search products from tblProduct using barcode in txtSearch
 private void txtSearch_TextChanged(object sender, EventArgs e)
 {
     try
     {
         if (txtSearch.Text == String.Empty)
         {
             return;
         }
         else
         {
             connString.Open();
             cm = new SqlCommand("select * from tblProduct where barCode like'" + txtSearch.Text + "'", connString);
             dr = cm.ExecuteReader();
             dr.Read();
             if (dr.HasRows)
             {
                 frmQty frm = new frmQty(this);
                 frm.productDetails(dr["proCode"].ToString(), dr["proDesc"].ToString(), double.Parse(dr["price"].ToString()), lblTransactionNo.Text);
                 dr.Close();
                 connString.Close();
                 frm.ShowDialog();
             }
             else
             {
                 dr.Close();
                 connString.Close();
             }
         }
     }
     catch (Exception ex)
     {
         connString.Close();
         MessageBox.Show(ex.Message, eTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Esempio n. 2
0
        //Loading products to cart when searching a product by name
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string colName = dataGridView1.Columns[e.ColumnIndex].Name;

            if (colName == "Select")
            {
                frmQty frm = new frmQty(f);
                //frm.productDetails(dr["proCode"].ToString(), dr["proDesc"].ToString(), double.Parse(dr["price"].ToString()), lblTransactionNo.Text);
                frm.productDetails(dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(), dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString(), Double.Parse(dataGridView1.Rows[e.RowIndex].Cells[6].Value.ToString()), f.lblTransactionNo.Text);
                frm.ShowDialog();
            }
        }