private void otworz_baze_B_Click(object sender, EventArgs e) { Otworz_baze_WF otworz_b_ref = new Otworz_baze_WF(); otworz_b_ref.form1_ref = this; otworz_b_ref.Show(); otworz_b_ref.Show_data(); }
private void dodaj_ADD_B_Click(object sender, EventArgs e) { SqlCommand cmd = o_b_ref.form1_ref.conn.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = $"INSERT INTO MAGAZYN VALUES ('{nazwa_tB.Text}', {cena_tB.Text}, {ilosc_tB.Text})"; cmd.ExecuteNonQuery(); o_b_ref.Show_data(); this.Close(); }
/// <summary> /// Aktualizuje stan bazy, tzn. do stanu w bazie dodaje wprowadzoną dostawę. /// </summary> private void Zatwierdz_B_Click(object sender, EventArgs e) { foreach (Control control in panel1.Controls) { if (control is TextBox) { int download_id; int.TryParse(control.Name, out download_id); int supply_quantity; int.TryParse(control.Text, out supply_quantity); SqlCommand cmd = supply_otworz_Baze_ref.form1_ref.conn.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = $"UPDATE MAGAZYN SET M_quantity += {supply_quantity} where M_Id = {download_id}"; cmd.ExecuteNonQuery(); } } supply_otworz_Baze_ref.Show_data(); this.Close(); }