Example #1
0
        private void consultantScheduleButton_Click(object sender, EventArgs e)
        {
            var users = userService.FindAllUsers();
            IEnumerable <string> userNames = users.Select(u => u.userName);
            var form = formManager.GetForm <SelectionPopUp>();

            form.SetSelectionOptions(userNames);


            form.SetSubmitSelection((string selectedOption, Form popupForm) =>
            {
                popupForm.Close();
                var reportForm = formManager.GetForm <ReportForm>();

                reportForm.onDoneClick = ((Form formToClose) =>
                {
                    formToClose.Close();
                    Show();
                });
                var appointments = appointmentService.FindAllByContact(selectedOption).OrderBy(p => p.Start);
                if (appointments.Count() == 0)
                {
                    return;
                }
                var reportItems = new List <ReportBase>();
                foreach (var appointment in appointments)
                {
                    var reportItem   = new ReportBase();
                    reportItem.Title = appointment.Start.ToShortDateString();
                    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());
                    reportItem.Properties = properties;
                    reportItems.Add(reportItem);
                }
                reportForm.SetReportItems(reportItems);
                Hide();
                reportForm.Show();
            });
            form.Show();
        }