/// <summary> /// When the user chooses a different category option this event will fire /// </summary> /// <param name="sender">The category option combobox</param> /// <param name="e">The selected index changed event</param> private void comboBox_CategoryOption_SelectedIndexChanged(object sender, EventArgs e) { int index = default(int); if (PerformanceReportType == ReportingType.KpaComparisonReport) { index = comboBox_CategoryOption.SelectedIndex; foreach (KpaOption option in Enum.GetValues(typeof(KpaOption))) { if (index == (int)option) { KPAOption = option; } } } else // The Performance Report Type is KPI Comparison Report { index = comboBox_CategoryOption.SelectedIndex; foreach (KpiOption option in Enum.GetValues(typeof(KpiOption))) { if (index == (int)option) { KPIOption = option; } } } }
/// <summary> /// Generates the report by applying the KPI to each filter /// </summary> /// <param name="filters">The list of filters the user wants to use in the report</param> /// <param name="_option">The KPI option to use in the report</param> public bool GenerateReport(List <string> filters, KpiOption _option) { bool result = true; Content = new Dictionary <string, KeyPerformanceIndicator>(); try { foreach (string filter in filters) { // Get the KPA the user would like to use KeyPerformanceIndicator indicator = GetIndicator(_option); // Get the structure type of the template being used. TemplateStructure = GetTemplateStructure(indicator); if (indicator != null) { // add the filter and the action to the dictionary Content.Add(filter, indicator); } else { MessageBox.Show("An error occured while trying to get the KPA", "Comparison Creation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); result = false; } } } catch (ArgumentNullException) { MessageBox.Show("Argument null exception was thrown", "Comparison Report Creation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); result = false; } catch (ArgumentException) { MessageBox.Show("Argument exception was thrown", "Comparison Report Creation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); result = false; } // Return the result of the creation return(result); }
/// <summary> /// Event that fires when the check state of a radio button changes /// </summary> /// <param name="sender">The radio button</param> /// <param name="e">The CheckedChanged event</param> private void radioBtn_Reporting_CheckedChanged(object sender, EventArgs e) { // Clear the items in the category combobox so a new list can be added. comboBox_CategoryOption.Items.Clear(); if (radioBtn_KpaReporting.Checked) { label_CategoryOption.Text = "KPA Option:"; PerformanceReportType = ReportingType.KpaComparisonReport; KPAOption = default(KpaOption); LoadKpaOptions(); } else { label_CategoryOption.Text = "KPI Option:"; PerformanceReportType = ReportingType.KpiComparisonReport; KPIOption = default(KpiOption); LoadKpiOptions(); } }
/// <summary> /// Get the KPI that the user would like to use as the base of the report /// </summary> /// <param name="_option">The KPI Option used to get the KPI</param> /// <returns>The KPI the user wants as the base of the report</returns> private KeyPerformanceIndicator GetIndicator(KpiOption _option) { KeyPerformanceIndicator indicator = null; switch (_option) { case KpiOption.Plan_CurrentPlanDateVsPrPlanDate: indicator = new KeyPerformanceIndicators.Plan.CurrentPlanDateVsPRPlanDate(); break; case KpiOption.Plan_OrigPlanDateMinusPrFullReleaseDateVsCodedLead: indicator = new KeyPerformanceIndicators.Plan.OriginalPlanDateTo2ndLvlReleaseDateVsCodedLead(); break; case KpiOption.Plan_CurrentPlanDateMinusPrFullReleaseDateVsCodedLead: indicator = new KeyPerformanceIndicators.Plan.CurrentPlanDateTo2ndLvlReleaseDateVsCodedLead(); break; case KpiOption.Purch_InitialConfirmationDateVsPrPlanDate: indicator = new KeyPerformanceIndicators.Purch.InitialConfirmationDateVsPRPlanDate(); break; case KpiOption.FollowUp_CurrentConfirmationDateVsInitialConfirmationDate: indicator = new KeyPerformanceIndicators.FollowUp.CurrentConfirmationDateVsInitialConfirmationDate(); break; case KpiOption.FollowUp_FinalConfirmationDateVsInitialConfirmationDate: indicator = new KeyPerformanceIndicators.FollowUp.FinalConfirmationDateVsFinalPlanDate(); break; case KpiOption.FollowUp_ReceiptDateVsCurrentPlanDate: indicator = new KeyPerformanceIndicators.FollowUp.ReceiptDateVsCurrentPlanDate(); break; case KpiOption.FollowUp_ReceiptDateVsOriginalConfirmationDate: indicator = new KeyPerformanceIndicators.FollowUp.ReceiptDateVsOriginalConfirmationDate(); break; case KpiOption.FollowUp_ReceiptDateVsCurrentConfirmationDate: indicator = new KeyPerformanceIndicators.FollowUp.ReceiptDateVsCurrentConfirmationDate(); break; case KpiOption.PlanTwo_MaterialDueOriginalPlannedDate: indicator = new KeyPerformanceIndicators.PlanTwo.MaterialDueOriginalPlannedDate(); break; case KpiOption.PlanTwo_MaterialDueFinalPlannedDate: indicator = new KeyPerformanceIndicators.PlanTwo.MaterialDueFinalPlannedDate(); break; case KpiOption.PlanTwo_PrReleaseDateVsPrCreationDate: indicator = new KeyPerformanceIndicators.PlanTwo.PrReleaseVsPrCreation(); break; case KpiOption.PurchTwo_PrFullyReleaseDateVsPoCreationDate: indicator = new KeyPerformanceIndicators.PurchTwo.PR2ndLvlReleaseDateVsPOCreationDate(); break; case KpiOption.PurchTwo_PoCreationDateVsPoReleaseDate: indicator = new KeyPerformanceIndicators.PurchTwo.POCreationDateVsPOReleaseDate(); break; case KpiOption.PurchTwo_PoReleaseDateVsPoConfirmationDate: indicator = new KeyPerformanceIndicators.PurchTwo.POReleaseDateVsPOConfirmationDate(); break; case KpiOption.FollowUpTwo_PoReleaseToLastPoReceiptDate: indicator = new KeyPerformanceIndicators.FollowUpTwo.PoReleaseToLasteReceiptDate(); break; case KpiOption.PurchSub_PrReleaseVsPoReleaseDate: indicator = new KeyPerformanceIndicators.PurchSub.PRReleaseDateVsPOReleaseDate(); break; case KpiOption.PurchSub_PoCreationDateVsConfirmationEntryDate: indicator = new KeyPerformanceIndicators.PurchSub.POCreationDateVsConfirmationEntry(); break; case KpiOption.PurchTotal_PrReleaseDateToConfirmationEntryDate: indicator = new KeyPerformanceIndicators.PurchTotal.PRReleaseDateToConfirmationEntry(); break; case KpiOption.PurchPlan_PoReleaseVsPrDeliveryDate: indicator = new KeyPerformanceIndicators.PurchPlan.POReleaseVsPRDeliveryDate(); break; case KpiOption.Other_PrsCreated: indicator = new KeyPerformanceIndicators.Other.PRsCreated(); break; case KpiOption.Other_PrsReleased: indicator = new KeyPerformanceIndicators.Other.PRsReleased(); break; case KpiOption.Other_TotalSpend: indicator = new KeyPerformanceIndicators.Other.TotalSpend(); break; case KpiOption.Other_PrValueVsPoValue: indicator = new KeyPerformanceIndicators.Other.PRValueVsPOValue(); break; case KpiOption.Other_HotJobPRs: indicator = new KeyPerformanceIndicators.Other.HotJobPRs(); break; default: break; } // Return the requested indicator return(indicator); }