private void Add_client_FormClosing(object sender, FormClosingEventArgs e) { if (flag_ok != "OK" && flag_cancel != "CANCEL") { if (MessageBox.Show("Сохранить изменения", "Уведомление", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { mysql.add_new_registration_clients(((KeyValuePair <int, string>)comboBox1.SelectedItem).Key, ((KeyValuePair <int, string>)comboBox2.SelectedItem).Key, dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm:ss"), textBox1.Text, list_services, ((KeyValuePair <int, string>)comboBox4.SelectedItem).Key); Dispose(); list_reg_add_clients list_Reg_Add_Clients = new list_reg_add_clients(); list_Reg_Add_Clients.ShowDialog(); } } }
private void button1_Click(object sender, EventArgs e) { foreach (var item in listBox1.Items) { list_services.Add(((KeyValuePair <int, string>)item).Key); } mysql.add_new_registration_clients(((KeyValuePair <int, string>)comboBox1.SelectedItem).Key, ((KeyValuePair <int, string>)comboBox2.SelectedItem).Key, dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm:ss"), textBox1.Text, list_services, ((KeyValuePair <int, string>)comboBox4.SelectedItem).Key); if (MessageBox.Show("Регистрация обращения клиента на СТО прошла успешно!", "Уведомление", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK) { flag_ok = "OK"; this.Close(); list_reg_add_clients list_Reg_Add_Clients = new list_reg_add_clients(); list_Reg_Add_Clients.ShowDialog(); } flag_ok = "OK"; }