Esempio n. 1
0
 private void grvData_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         string colName = grvData.Columns[e.ColumnIndex].Name;
         if (colName == "Select")
         {
             frmQty frm = new frmQty(_frm);
             frm.productDetails(
                 grvData.Rows[e.RowIndex].Cells[1].Value.ToString(),
                 Convert.ToDouble(grvData.Rows[e.RowIndex].Cells[6].Value.ToString()),
                 _frm.lblTransactionNo.Text.Trim()
                 );
             frm.ShowDialog();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, message, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 2
0
 private void txtSearchBarcode_TextChanged(object sender, EventArgs e)
 {
     try
     {
         if (string.IsNullOrEmpty(txtSearchBarcode.Text.Trim()))
         {
             return;
         }
         else
         {
             using (SqlConnection sqlConnection = new SqlConnection(DBConnection.MyConnection()))
             {
                 string query = "select * from tblProduct where barcode like '" + txtSearchBarcode.Text.Trim() + "' ";
                 sqlConnection.Open();
                 SqlCommand    sqlCommand    = new SqlCommand(query, sqlConnection);
                 SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
                 sqlDataReader.Read();
                 if (sqlDataReader.HasRows)
                 {
                     frmQty frm = new frmQty(this);
                     frm.productDetails(
                         sqlDataReader["pcode"].ToString(),
                         double.Parse(sqlDataReader["price"].ToString()),
                         lblTransactionNo.Text.Trim()
                         );
                     frm.ShowDialog();
                 }
                 sqlDataReader.Close();
                 sqlConnection.Close();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, message, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }