// Barcode Scan private void tbProdNo_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Return) { string search = tbProdNo.Text; string scan = "SELECT prodNo FROM datainventory WHERE prodNo= '" + search + "'"; con.query(scan); try { con.Open(); MySqlDataReader reader = con.read(); if (reader.Read()) { string[] row = { reader.GetString(0) }; checker.Text = row[0]; if (checker.Text == search) { var ans = MessageBox.Show("Do you want to restock this item?", "Item Already Exist", MessageBoxButton.YesNo, MessageBoxImage.Question); if (ans == MessageBoxResult.Yes) { window_restockItem wit = new window_restockItem(); wit.ShowDialog(); Clear(); } else { con.Close(); Clear(); } } } reader.Close(); reader.Dispose(); con.Close(); } catch (Exception x) { MessageBox.Show(x.Message); } } }
// Restock Button private void sortRestock_Click(object sender, RoutedEventArgs e) { window_restockItem restockItem = new window_restockItem(); restockItem.ShowDialog(); }