private void DeleteButton_Click(object sender, RoutedEventArgs e) { string performanceName = performancesComboBox.SelectedValue.ToString(); string clientName = clientsComboBox.SelectedValue.ToString(); DateTime date = ConvertStringToDateTime(dateComboBox.SelectedValue.ToString()); typeTicket type = Cashbox.FindTicket(typeComboBox.SelectedValue.ToString()); if (cashbox.ReturnTicket(performanceName, date, clientName, type)) { msgTextBlock.Text = "Билет успешно сдан в кассу."; } else { msgTextBlock.Text = "Не найден данный билет, на указанный спектакль."; } }
private void BuyTicketButton_Click(object sender, RoutedEventArgs e) { if (nameInputBox.Text.Length > 0 && comboPerformanceBox.Text.Length > 0 && comboDateBox.Text.Length > 0 && comboTypeBox.Text.Length > 0) { string fullname = nameInputBox.Text; string performanceName = comboPerformanceBox.Text; typeTicket type = Cashbox.FindTicket(comboTypeBox.Text.Split()[0].ToLower()); DateTime date = ConvertStringToDateTime(comboDateBox.Text); cashbox.SaleTicket(new Client(fullname), new Performance(performanceName, date), type); sumTicketBox.Text = "Билет успешно куплен на спектакль \"" + performanceName + "\", который пройдёт: " + comboDateBox.Text; } else { sumTicketBox.Text = "Не все поля заполнены"; } }
private void ClientListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { //headlineLabel.Content = cashbox.GetClient(e.AddedItems[0].ToString()).fullName; statusTextBlock.Text = cashbox.GetClient(e.AddedItems[0].ToString()).GetStatus(); column1.Children.Clear(); column2.Children.Clear(); column3.Children.Clear(); foreach (Ticket ticket in cashbox.GetClient(e.AddedItems[0].ToString()).tickets) { TextBlock namePerformance = new TextBlock(); TextBlock typeTicketBlock = new TextBlock(); TextBlock dateText = new TextBlock(); namePerformance.Text = ticket.namePerformance; typeTicketBlock.Text = Cashbox.FindTicket(ticket.type); dateText.Text = ticket.date.ToLongDateString(); namePerformance.Width = column1.Width; namePerformance.Height = 30; typeTicketBlock.Width = column2.Width; typeTicketBlock.Height = 30; dateText.Width = column3.Width; dateText.Height = 30; column1.Children.Add(namePerformance); column2.Children.Add(typeTicketBlock); column3.Children.Add(dateText); } /* * TextBlock namePerformance = new TextBlock(); * TextBlock countOfTicket = new TextBlock(); * TextBlock dateText = new TextBlock(); * * nameBlock.Width = column1.Width; * nameBlock.Height = 60; * ticketBlock.Width = column2.Width; * ticketBlock.Height = 60; * dateBlock.Width = column3.Width; * dateBlock.Height = 60; */ }