private void Template() { cashbox.AddPerformance("Ромео и Джульета", new DateTime(2019, 6, 7, 19, 00, 00)); cashbox.AddPerformance("Снежная королева", new DateTime(2019, 6, 17, 19, 00, 00)); cashbox.AddPerformance("Щелкунчик", new DateTime(2019, 6, 17, 19, 00, 00)); cashbox.SaleTicket(new Client("Трофимов Е.В."), cashbox.SelectPerformance(0), typeTicket.balcony); cashbox.SaleTicket(new Client("Трофимов Е.В."), cashbox.SelectPerformance(0), typeTicket.lodge); cashbox.SaleTicket(new Client("Трофимов Е.В."), cashbox.SelectPerformance(0), typeTicket.lodge); cashbox.SaleTicket(new Client("Липский Д.С."), cashbox.SelectPerformance(1), typeTicket.lodge); cashbox.SaleTicket(new Client("Липский Д.С."), cashbox.SelectPerformance(1), typeTicket.lodge); cashbox.SaleTicket(new Client("Трофимов Е.В."), cashbox.SelectPerformance(1), typeTicket.balcony); }
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 = "Не все поля заполнены"; } }