private void button1_Click(object sender, EventArgs e) { var client = context.Clients.FirstOrDefault(c => c.EGN == textBox1.Text); if (client != null && comboBox2.Text != string.Empty) { bool isAdd = insert.InsertIntoReservation(textBox1.Text, comboBox1.Text, dateTimePicker1.Value.Date, dateTimePicker2.Value.Date, decimal.Parse(comboBox2.Text), textBox3.Text); if (isAdd) { context.Rooms.FirstOrDefault(r => r.RoomNumebr == comboBox1.Text).isFree = false; context.SaveChanges(); comboBox1.Items.Clear(); LoadFreeRooms(); MessageBox.Show("Добавен"); } else { MessageBox.Show("Не"); } } else { AddClients settingsForm = new AddClients(context); settingsForm.Show(); } }
private void button3_Click(object sender, EventArgs e) { AddClients form = new AddClients(context); form.Show(); }