private void button2_Click(object sender, EventArgs e) { Form OutInventory = new OutInventory(); OutInventory.MdiParent = ParentForm; OutInventory.Show(); }
public static void OutInventoryUpdate(int Barcode, int Number, string Location) { try { ConnectDatabase(); using (con) { using (SQLiteCommand cmd = new SQLiteCommand(con)) { SQLiteTransaction transaction = null; transaction = con.BeginTransaction(); cmd.CommandText = @" UPDATE stock SET stock_number = stock_number - @Number WHERE stock_id IN (SELECT stock_id FROM stock WHERE product_id IN (SELECT product_id FROM products WHERE product_barcode = @Barcode) AND location_id IN (SELECT location_id FROM locations WHERE location = @Location)); INSERT INTO history (product_id, history_status, location_id, stock_number) VALUES ((SELECT product_id FROM products WHERE product_barcode = @Barcode), '0', (SELECT location_id FROM locations WHERE location = @Location), @Number) "; cmd.Prepare(); cmd.Parameters.AddWithValue("Barcode", Barcode); cmd.Parameters.AddWithValue("Location", Location); cmd.Parameters.AddWithValue("Number", Number); cmd.ExecuteNonQuery(); transaction.Commit(); } } OutInventory.labelChange("Out!", Barcode + " \n " + Number + " \n " + Location); } catch (SQLiteException SQLiteThrow) { MessageBox.Show("OutInventory Message: " + SQLiteThrow.Message); } }