private void button1_Click(object sender, EventArgs e) { if (textBox1.Text != "" && comboBox1.Text != "" && comboBox2.Text != "" && textBox2.Text != "") { MySqlOperations.Insert_Update(MySqlQueries.Insert_Product, null, MySqlOperations.Select_ID_From_ComboBox(MySqlQueries.Select_Sklad_ID, comboBox1.Text), textBox1.Text, comboBox2.Text, textBox2.Text.Replace(',', '.')); this.Close(); } else { MessageBox.Show("Поля не заполнены.", "Добавление", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void button1_Click(object sender, EventArgs e) { string date = dateTimePicker1.Value.Year.ToString() + '-' + dateTimePicker1.Value.Month.ToString() + '-' + dateTimePicker1.Value.Day.ToString(); MySqlOperations.Insert_Update(MySqlQueries.Insert_Zayavka_GP, ID_Zakaza, date); MySqlOperations.Select_Text(MySqlQueries.Select_Last_Insert, ref ID_Zayavki_GP); MySqlOperations.Insert_Update(MySqlQueries.Insert_Zayavka_CUP, ID_Zakaza, date); MySqlOperations.Select_Text(MySqlQueries.Select_Last_Insert, ref ID_Zayavki_CUP); for (int i = 0; i < dataGridView1.Rows.Count; i++) { MySqlOperations.Insert_Update(MySqlQueries.Insert_Sostav_Zayavki, ID_Zayavki_GP, MySqlOperations.Select_ID_From_ComboBox(MySqlQueries.Select_Product_ID, dataGridView1.Rows[i].Cells[1].Value.ToString()), dataGridView1.Rows[i].Cells[2].Value.ToString()); } for (int i = 0; i < dataGridView2.Rows.Count; i++) { MySqlOperations.Insert_Update(MySqlQueries.Insert_Sostav_Zayavki, ID_Zayavki_CUP, MySqlOperations.Select_ID_From_ComboBox(MySqlQueries.Select_Product_ID, dataGridView2.Rows[i].Cells[1].Value.ToString()), dataGridView2.Rows[i].Cells[2].Value.ToString()); } MySqlOperations.Insert_Update(MySqlQueries.Update_Identify_Zakaz, ID_Zakaza); this.Close(); }