private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { e.SuppressKeyPress = true; e.Handled = true; String ProdID = "", ProdName = "", ProdDesc = "", Price = ""; String sqlprod = String.Format(@"SELECT ProdID,ProdName,ProdDesc,Price FROM Products WHERE ProdID = '{0}'", txtBarcode2.Text); OleDbDataReader Addprodreader = null; crud.RetrieveRecords(sqlprod, ref Addprodreader); if (Addprodreader.HasRows) { Addprodreader.Read(); ProdID = Addprodreader[0].ToString(); ProdName = Addprodreader[1].ToString(); ProdDesc = Addprodreader[2].ToString(); Price = Addprodreader[3].ToString(); crud.CloseConnection(); //MessageBox.Show(String.Format("{0}-{1}-{2}-{3}",ProdID,ProdName,ProdDesc,Price)); listProdName.Items.Add(ProdDesc); Double quant = double.Parse(numupQuantity.Value.ToString()); listQTY.Items.Add(quant); listPrice.Items.Add(Price); Double ttprice = double.Parse(Price); Double res = ttprice * quant; listTotal.Items.Add(res); basket(); listProdName.SelectedIndex = listProdName.Items.Count - 1; String date = "MM/dd/yyyy"; DateTime dateTime1 = DateTime.Now; String textDate = dateTime1.ToString(date); //String sqlInsertprod = String.Format(@"INSERT INTO PointOfSale //VALUES('{0}','{1}','{2}','{3}','{4}','{5}','1')", lblTransaction.Text, //ProdID, ProdName, ProdDesc, Price, textDate); } else { MessageBox.Show("The product code is invalid!", "O.M.T | Cashier"); crud.CloseConnection(); } txtBarcode2.Text = ""; Panelquantity.Hide(); txtBarcode.Enabled = true; } }
private void bunifuFlatButton2_Click(object sender, EventArgs e) { Panelquantity.Hide(); txtBarcode.Enabled = true; }