private void button1_Click(object sender, EventArgs e) { if (TProdyct.Text.Length != 0 && TKol.Text.Length != 0 && TIzmeren.Text.Length != 0) { Form_InformAdd form = new Form_InformAdd(); form.ShowDialog(); this.OnLoad(e); int prava = form.pravo; if (prava == 1) { int idprod = getProdict(TProdyct.SelectedItem.ToString()); int idediz = getizmer(TIzmeren.SelectedItem.ToString()); string quest = "INSERT INTO Склад (ID_продукта, ID_ЕдИзмерний, Количество) VALUES('" + idprod + "','" + idediz + "','" + TKol.Text + "')"; db.connect.Open(); OleDbCommand dataAdapter = new OleDbCommand(quest, db.connect); dataAdapter.ExecuteNonQuery(); db.connect.Close(); Form_Add formadd = new Form_Add(); formadd.ShowDialog(); } } else { using (Form_Add_PoleNo form = new Form_Add_PoleNo()) { form.ShowDialog(); this.OnLoad(e); } } }
private void button1_Click(object sender, EventArgs e) { if (TName.Text.Length != 0 && TKategor.Text.Length != 0 && TGod.Text.Length != 0 && TCena.Text.Length != 0 && TVes.Text.Length != 0) { Form_InformAdd form = new Form_InformAdd(); form.ShowDialog(); this.OnLoad(e); int prava = form.pravo; if (prava == 1) { int idkategor = getKategor(TKategor.SelectedItem.ToString()); string quest = "INSERT INTO Блюда (Название, Вес_порции, Цена, СрокГодности, ID_категор) VALUES('" + TName.Text + "','" + TVes.Text + "','" + TCena.Text + "','" + TGod.Text + "','" + idkategor + "')"; db.connect.Open(); OleDbCommand dataAdapter = new OleDbCommand(quest, db.connect); dataAdapter.ExecuteNonQuery(); db.connect.Close(); Form_Add formadd = new Form_Add(); formadd.ShowDialog(); } } else { using (Form_Add_PoleNo form = new Form_Add_PoleNo()) { form.ShowDialog(); this.OnLoad(e); } } }
public void getEdit() { string quest1 = $"UPDATE Меню SET ID_блюд = '{idprodict}', Количество = '{summenu + Convert.ToInt32(TKol.Text)}' where ID_запМеню = {idmenu}"; db.connect.Open(); OleDbCommand dataAdapter = new OleDbCommand(quest1, db.connect); dataAdapter.ExecuteNonQuery(); db.connect.Close(); Form_Add form = new Form_Add(); form.ShowDialog(); }
public void getAdd() { string quest1 = "INSERT INTO Меню (ID_блюд, Дата, Количество) VALUES('" + idprodict + "','" + DateTime.Now.ToString().Split(' ')[0] + "','" + TKol.Text + "')"; db.connect.Open(); OleDbCommand dataAdapter = new OleDbCommand(quest1, db.connect); dataAdapter.ExecuteNonQuery(); db.connect.Close(); Form_Add form = new Form_Add(); form.ShowDialog(); }