// Methods private void CreateReservation(object obj) { CurrentReservation.Guest = SelectedGuest; CurrentReservation.Area = SelectedArea; CurrentReservation.ArrivalStatus = SelectedArrivalStatus; CurrentReservation.WantedSeats = SelectedWantedSeats; foreach (var table in SelectedReservedTables) { CurrentReservation.Tables.Add(table); } CurrentReservation.TimeIn = SelectedDate.ChangeTime(SelectedTimeIn.Hour, SelectedTimeIn.Minute); if (SelectedTimeOut.Hour != 0 && SelectedTimeOut.Minute != 0) { CurrentReservation.TimeOut = new DateTime(); CurrentReservation.TimeOut = SelectedDate.ChangeTime(SelectedTimeOut.Hour, SelectedTimeOut.Minute); } if (!string.IsNullOrEmpty(SelectedGuest.FirstName) || !string.IsNullOrEmpty(SelectedGuest.LastName)) { CurrentReservation.Guest = SelectedGuest; } string result = CurrentReservation.IsValid(); if (result == "true") { SqlConnector conn = new SqlConnector(); // If guest is not null then insert or update in people table. if (CurrentReservation.Guest != null) { conn.CreateOrUpdateGuest(CurrentReservation.Guest); } // Whether guest is null or not does not affect the reservation itself. conn.CreateReservation(CurrentReservation); MessageBox.Show("Your reservation has been saved!"); ClearAll(); } else { MessageBox.Show(result); } }