private void AddShow_btn_Click(object sender, RoutedEventArgs e) { if(ShowNameTextBox.Text != String.Empty && TypeShowTextBox.Text != String.Empty && DescriptionTextBox.Text != String.Empty && TroupeNameComboBox.Text != String.Empty && PutNumberPlacesTxtBox.Text != String.Empty && !GetInfos.IsShowNameExisting(ShowNameTextBox.Text)) { using (var context = new CircusContext()) { Troupe troupe = GetInfos.GetTroupeByName(TroupeNameComboBox.Text); Show newShow = new Show(); newShow.ShowName = ShowNameTextBox.Text; newShow.ShowType = TypeShowTextBox.Text; newShow.TroupeName = troupe.NameTroupe; newShow.Description = DescriptionTextBox.Text; TicketOffice ticketOffice = new TicketOffice(); ticketOffice.NameTroupe = troupe.NameTroupe; ticketOffice.ShowName = newShow.ShowName; ticketOffice.AvailableTickets = Convert.ToInt32(PutNumberPlacesTxtBox.Text); ticketOffice.SoldTickets = 0; troupe.ShowsList.Add(newShow); context.Add(newShow); context.Add(ticketOffice); context.Update(troupe); context.SaveChanges(); } MessageBox.Show("Your show is save."); } else { MessageBox.Show("Have you complete all cases ?"); } }
private void Button_Click(object sender, RoutedEventArgs e) { string show = ShowNameComboBox.Text; int numberTicket = Convert.ToInt32(NumberTicketBox.Text); int availablePlace = GetInfos.GetNumberAvailableTickets(show); if (availablePlace > 0 && numberTicket <= availablePlace) { int price = Convert.ToInt32(priceTextBox.Text); int ticketNumber = numberTicket; TotalTextBox.Text = Convert.ToString(price * ticketNumber); int availablePlaces = Convert.ToInt32(RemainingPlacesTextBox.Text); int numberPlace = availablePlaces - ticketNumber; RemainingPlacesTextBox.Text = numberPlace.ToString(); } else { MessageBox.Show("There is no place you can't sold it."); } if (availablePlace <= 0) { RemainingPlacesTextBox.Text = "0"; } using (var context = new CircusContext()) { TicketOfficesList = GetInfos.GetTicketOffices(); TicketOffice ticketOffice = TicketOfficesList.FirstOrDefault(s => s.ShowName == ShowNameComboBox.Text); ticketOffice.AvailableTickets = Convert.ToInt32(RemainingPlacesTextBox.Text); ticketOffice.SoldTickets = ticketOffice.SoldTickets + Convert.ToInt32(NumberTicketBox.Text); context.Update(ticketOffice); context.SaveChanges(); } }
public Reservations() { InitializeComponent(); var list = GetInfos.GetShowByTroupe(); List <string> shows = list.Select(x => x.ShowName).ToList(); ShowNameComboBox.ItemsSource = shows; }
private void DisplayInfo_Click(object sender, RoutedEventArgs e) { string troupe = TroupeNameComboBox.Text; List <Troupe> listTroupe = GetInfos.ReturnTroupeData(troupe); foreach (Troupe tp in listTroupe) { InfoTroupe.Text += "Name Troupe : " + tp.NameTroupe + "\nShow Type : " + tp.ShowType; } List <MemberTroupe> memberList = GetInfos.GetMembersByTroupe(troupe); foreach (MemberTroupe mb in memberList) { InfoTroupe.Text += "\nMember Name : " + mb.Name; } List <Show> showList = GetInfos.GetShowByTroupeName(troupe); foreach (Show sh in showList) { InfoTroupe.Text += "\nShow Name : " + sh.ShowName + "\nDescription of the show : " + sh.Description; } }
public Troupes() { InitializeComponent(); TroupeNameComboBox.ItemsSource = GetInfos.GetTroupesName(); }
private void ClearComboBox() { TroupeNameComboBox.ItemsSource = null; TroupeNameComboBox.ItemsSource = GetInfos.GetTroupesName(); }
private void Display_Click(object sender, RoutedEventArgs e) { string show = ShowNameComboBox.Text; RemainingPlacesTextBox.Text = GetInfos.GetNumberAvailableTickets(show).ToString(); }