Beispiel #1
0
        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);
                }
            }
        }
Beispiel #2
0
        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);
                }
            }
        }