private void txtEmpID_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter) { txtPartNumber.Focus(); } } private void txtPartNumber_KeyPress(object sender, KeyPressEventArgs e) { txtQuantity.Focus(); } private void txtQuantity_KeyPress(object sender, KeyPressEventArgs e) { try { if (e.KeyChar == (char)Keys.Enter) { SQLInventoryClass MySQL = new SQLInventoryClass(); int Quantity = int.Parse(txtQuantity.Text); lb1PartName.Text = MySQL.GetPartName(txtPartNumber.Text); if (txtPartNumber.Text == "p1-1" || txtPartNumber.Text == "p1-2" || txtPartNumber.Text == "p1-3" || txtPartNumber.Text == "p1-4") { MySQL.AddInventory(txtPartNumber.Text, Int32.Parse(txtQuantity.Text), txtEmpID.Text); lb1Status.Text = txtPartNumber.Text + " added "; } // Manufacture a p2-1 else if (txtPartNumber.Text == "p2-1") { int numPart1 = MySQL.GetQuantity("p1-1"); int numPart2 = MySQL.GetQuantity("p2-1"); if (numPart1 >= Quantity && numPart2 >= Quantity * 2) { MySQL.RemoveInventory("p1-1", 1 * Quantity, txtEmpID.Text); MySQL.RemoveInventory("p1-2", 2 * Quantity, txtEmpID.Text); MySQL.AddInventory("p2-1", 1 * Quantity, txtEmpID.Text); lb1Status.Text = "Quantity of " + txtQuantity.Text + " added with part number " + txtPartNumber.Text; txtEmpID.Text = ""; txtPartNumber.Text = ""; txtQuantity.Text = ""; txtEmpID.Focus(); } else { lb1Status.Text = "Error: not enough parts in inventory of manufacture parts."; } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)