private void btn_preparate_Click_1(object sender, EventArgs e) { this.Hide(); var vizualizareMeniu = new MeniuPersonalRestaurant_Preparate(cont); vizualizareMeniu.ShowDialog(); this.Close(); }
private void btnInapoi_Click_1(object sender, EventArgs e) { this.Hide(); var MeniuPersonal = new MeniuPersonalRestaurant_Preparate(ContPersonal); MeniuPersonal.ShowDialog(); this.Close(); }
private void btn_salveaza_Click_1(object sender, EventArgs e) { { String numePreparat = txtNume.Text; String pret = txtPret.Text; String ingrediente = txtIngrediente.Text; String tip = txtTipPreparat.Text; lblErrorNume.Text = ""; lblErrorPret.Text = ""; if (numePreparat == "" || pret == "" || ingrediente == "" || tip == "") { lblErrorNume.Text = "Toate campurile sunt obligatorii!"; } else { // TO TO: Inregistrarea noului utilizator OleDbCommand cmdSelect, cmdInsert, cmdInsertDetalii; string insert, insertDetalii; OleDbDataReader reader; insert = "INSERT INTO Preparate([NumePreparat],[Ingrediente],[TipPreparat],[Pret]) VALUES ('" + txtNume.Text + "','" + txtIngrediente.Text + "', '" + txtTipPreparat.Text + "', '" + txtPret.Text + "')"; cmdInsert = new OleDbCommand(insert, conn); OleDbDataAdapter adapter = new OleDbDataAdapter(); try { // inserarea in meniu conn.Open(); adapter.InsertCommand = new OleDbCommand(insert, conn); adapter.InsertCommand.ExecuteNonQuery(); cmdInsert.Dispose(); MessageBox.Show("Preparatul a fost adaugat!"); conn.Close(); //deschidere meniu this.Hide(); var meniu = new MeniuPersonalRestaurant_Preparate(ContPersonal); meniu.ShowDialog(); this.Close(); } catch (OleDbException ex) { MessageBox.Show(ex.Message); } } } }