private void button2_Click(object sender, EventArgs e) { try { Mapping.Metbron metclient = new Mapping.Metbron(); metclient.Delete(Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value)); obnclienta(); } catch { MessageBox.Show("Error"); } }
private void button1_Click(object sender, EventArgs e) { try { Mapping.Metbron d = new Mapping.Metbron(); if (dateTimePicker1.Value <= dateTimePicker2.Value) { if (dateTimePicker2.Value < dateTimePicker3.Value) { d.ADD(Convert.ToInt32(dataGridView2.CurrentRow.Cells[0].Value), Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value), dateTimePicker1.Value, dateTimePicker2.Value, dateTimePicker3.Value); Email email = new Email(); var linq = from n in dbhotel.hotel where n.id == 1 select n; RabotaSKlientomi.Pass p = new Pass(); p.ShowDialog(); foreach (var i in linq) { email.otpravka(dataGridView2.CurrentRow.Cells[2].Value.ToString(), i.email, hotel.Program.Pole.pass, dateTimePicker1.Value, dataGridView2.CurrentRow.Cells[1].Value.ToString(), dataGridView1.CurrentRow.Cells[1].Value.ToString(), Convert.ToInt32(dataGridView1.CurrentRow.Cells[2].Value), i.nazvanie, i.fioglbuha); } this.Close(); } else { MessageBox.Show("Дата заезда не может быть больше даты выезда"); } } else { MessageBox.Show("Дата брони не может быть больше даты заезда"); } } catch (ArgumentOutOfRangeException) { } catch { MessageBox.Show("Error"); } }