void ExportVariationReport(TeamVariationsForm form, TeamVariationsForm.ExportFileType exportFileType, string exportFileName) { VariationReportData variationReportData = controller.GetVariationReportData(form.NumberOfTeams, form.NumberOfLegs); controller.ExportRelayVariationsReport(form.NumberOfTeams, form.NumberOfLegs, exportFileType, exportFileName); }
void SetVariationReportBody(TeamVariationsForm form) { if (form.NumberOfTeams == 0) { form.SetBody(new Reports().CreateRelayVariationNotCreated()); } else { VariationReportData variationReportData = controller.GetVariationReportData(form.NumberOfTeams, form.NumberOfLegs); form.SetBody(new Reports().CreateRelayVariationReport(variationReportData)); } }
private void courseVariationReportMenu_Click(object sender, EventArgs e) { int numTeams, numLegs; controller.GetRelayParameters(out numTeams, out numLegs); TeamVariationsForm reportForm = new TeamVariationsForm(); reportForm.NumberOfTeams = numTeams; reportForm.NumberOfLegs = numLegs; reportForm.DefaultExportFileName = controller.GetDefaultVariationExportFileName(); SetVariationReportBody(reportForm); reportForm.CalculateVariationsPressed += (reportSender, reportEventArgs) => { SetVariationReportBody(reportForm); }; reportForm.ExportFilePressed += (reportSender, reportEventArgs) => { ExportVariationReport(reportForm, reportEventArgs.FileType, reportEventArgs.FileName); }; reportForm.ShowDialog(this); if (numTeams != reportForm.NumberOfTeams || numLegs != reportForm.NumberOfLegs) controller.SetRelayParameters(reportForm.NumberOfTeams, reportForm.NumberOfLegs); reportForm.Dispose(); }