private void ButtonSave_Click(object sender, RoutedEventArgs e) { bool allgood = true; if (TextSurname.Text == "") { TextSurname.BorderBrush = Brushes.Red; allgood = false; } if (TextPhone.Text == "") { TextPhone.BorderBrush = Brushes.Red; allgood = false; } if (ComboBoxSlots.SelectedItem == null) { ComboBoxSlots.BorderBrush = Brushes.Red; allgood = false; } if (!allgood) { return; } string[] reservation = new string[7]; reservation[0] = TextName.Text; reservation[1] = TextSurname.Text; reservation[2] = ComboBoxRoom.Text; reservation[3] = ComboBoxSlots.Text; reservation[4] = TextPhone.Text; reservation[5] = loggedUserID.ToString(); reservation[6] = date.Date.ToString("yyyy-MM-dd"); Database sql = new Database(); sql.addReservation(reservation); w2.getReservations(); this.Close(); }