private void customerScheduleButton_Click(object sender, EventArgs e) { var customers = customerService.FindAll(); var form = formManager.GetForm <SelectionPopUp>(); form.SetSelectionOptions(customers.Select(c => c.customerName)); form.SetSubmitSelection((string selectedOption, Form selectionForm) => { var customer = customers.Find(c => c.customerName.Equals(selectedOption)); var appointments = appointmentService.FindAllAggregatesByCustomerId(customer.customerId).OrderBy(p => p.Start); var reportForm = formManager.GetForm <ReportForm>(); reportForm.onDoneClick = ((Form formToClose) => { formToClose.Close(); Show(); }); var reportItems = new List <ReportBase>(); foreach (var appointment in appointments) { Dictionary <string, string> properties = new Dictionary <string, string>(); properties.Add("Customer", appointment.CustomerName); properties.Add("Start", appointment.Start.ToShortTimeString()); properties.Add("End", appointment.End.ToShortTimeString()); reportItems.Add(new ReportBase() { Title = appointment.Start.ToShortDateString(), Properties = properties }); } reportForm.SetReportItems(reportItems); form.Close(); reportForm.Show(); }); form.Show(); }