private void AddShow_Button_Click(object sender, RoutedEventArgs e) { if (IsAllBoxFilled() == true) { var context = new CircusContext(); Show newShow = new Show(); newShow.Name = Name_TextBox.Text; newShow.Date = Date_DatePicker.SelectedDate.Value; newShow.Location = Location_TextBox.Text; newShow.Price = Convert.ToInt32(Price_TextBox.Text); List <Performer> selectedPerformers = new List <Performer>(); foreach (var item in Performers_ListBox.SelectedItems) { Performer performer = (Performer)item; selectedPerformers.Add(performer); } List <PerformerShow> performerShows = CircusInformation.AssociatedShowWithPerformer(newShow, selectedPerformers); newShow.ManyPerformerShow.AddRange(performerShows); context.Update(newShow); context.SaveChanges(); MessageBox.Show("New Show added"); } else { MessageBox.Show("You must filled every fields"); } }
private void Validate_btn_Click(object sender, RoutedEventArgs e) { if (Quantity_ComboBox.SelectedItem != null) { var context = new CircusContext(); var ticketOrder = new TicketOrder() { Price = Convert.ToDecimal(Price_TextBlock.Text), TicketNumber = Convert.ToInt32(Quantity_ComboBox.SelectedItem), OrderDate = DateTime.Today, }; ShowOrder showOrder = CircusInformation.AssociatedShowWithOrder(SelectedShow, ticketOrder); ticketOrder.ManyShowOrder.Add(showOrder); context.Update(ticketOrder); context.SaveChanges(); MessageBox.Show("Ticket(s) ordered for the show : " + SelectedShow.Name); this.Close(); } else { MessageBox.Show("Select a quantity"); } }
public AddShowWindow() { InitializeComponent(); List <Performer> performers = CircusInformation.GetPerformers(); Performers_ListBox.ItemsSource = performers; }
private void Add_Shows_Btn_Click(object sender, RoutedEventArgs e) { AddShowWindow addShowWindow = new AddShowWindow(); addShowWindow.Show(); addShowWindow.Closed += (s, eventarg) => { Shows = CircusInformation.GetShows(); Shows_ListView.ItemsSource = Shows; }; }
public OrderTicketsWindow() { InitializeComponent(); List <Show> shows = CircusInformation.GetShows(); Shows_ListView.ItemsSource = shows; List <int> quantity = new List <int> { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; //Quantity_ComboBox.ItemsSource = quantity; //Quantity_ComboBox.SelectionChanged += new SelectionChangedEventHandler(Quantity_ComboBox_SelectionChanged); }
public PerformersWindow() { InitializeComponent(); List <Performer> performers = CircusInformation.GetPerformers(); Performers_ComboBox.ItemsSource = performers; Performers_ComboBox.SelectionChanged += new SelectionChangedEventHandler(Performers_ComboBox_SelectionChanged); int nbOfPerformers = performers.Count; Random rdm = new Random(); int indexAlea = rdm.Next(0, nbOfPerformers); PerformerName_TextBlock.Text = performers[indexAlea].Name; PerformerDescription_TextBlock.Text = performers[indexAlea].Descritpion; BitmapImage bi3 = new BitmapImage(); bi3.BeginInit(); bi3.UriSource = new Uri(performers[indexAlea].Image, UriKind.Relative); bi3.EndInit(); Image_Performers.Source = bi3; }
public ShowsWindow() { InitializeComponent(); Shows = CircusInformation.GetShows(); Shows_ListView.ItemsSource = Shows; }