/// <summary> /// Button operation for seat reservation /// </summary> /// <param name="sender"></param> /// <param name="e">RoutedEventArgs</param> private void Reserve_Seat_Button_Click(object sender, RoutedEventArgs e) { var index = SeatsDataGrid.SelectedIndex; if (index > -1) { var seat = seats.ElementAt(index); if (seat.IsSeatFree) { seats.Remove(seat); seat.IsSeatFree = false; seats.Add(seat); _service.UpdateSeat(seat.IdSeat, false); ClientWindow clientWindow = new ClientWindow(idScreening, seat.IdSeat); clientWindow.Show(); this.Close(); } else { string messageBoxText = "This seat is not free"; string caption = "Select seat"; MessageBox.Show(messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.Error); } ; } else { string messageBoxText = "Select seat to see reserve"; string caption = "Select seat"; MessageBox.Show(messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.Information); } }
/// <summary> /// Handling the event of pressing a button to close reservation /// </summary> /// <param name="sender"></param> /// <param name="e">RoutedEventArgs</param> private void Back_Button_Click(object sender, RoutedEventArgs e) { _service.UpdateSeat(idSeat, true); this.Close(); }