/// <summary> /// Instantiates a template object and adds the control to the active page panel for loading/viewing /// </summary> private void CreateKpiOtherTemplate() { topHandleBarModel.Section = "Other"; KPIOtherTemplate kpiOtherTemplate = new KPIOtherTemplate() { Name = "Other", Dock = DockStyle.Fill }; pnl_activePage.Controls.Add(kpiOtherTemplate); kpiOtherTemplate.BringToFront(); }
/// <summary> /// Refreshes the active template that is within pnl_activePage. This is called when the /// application is made full screen and normal size. This is for the column chart located /// on each template. /// </summary> public void RefreshTemplate() { if (activeSectionBtn.Tag != null) { int tag = int.Parse(activeSectionBtn.Tag.ToString()); switch (tag) { case 1: KPAPlanTemplate kpaPlan = (KPAPlanTemplate)activeTemplate; kpaPlan.RefreshTemplate(); break; case 2: KPAPurchTemplate kpaPurch = (KPAPurchTemplate)activeTemplate; kpaPurch.RefreshTemplate(); break; case 3: KPAPurchSubTemplate kpaPurchSub = (KPAPurchSubTemplate)activeTemplate; kpaPurchSub.RefreshTemplate(); break; case 4: KPAPurchTotalTemplate kpaPurchTotal = (KPAPurchTotalTemplate)activeTemplate; kpaPurchTotal.RefreshTemplate(); break; case 6: KPAFollowUpTemplate kpaFollowUp = (KPAFollowUpTemplate)activeTemplate; kpaFollowUp.RefreshTemplate(); break; case 9: KPAHotJobsTemplate kpaHotJobs = (KPAHotJobsTemplate)activeTemplate; kpaHotJobs.RefreshTemplate(); break; case 12: KPACurrentPlanActualTemplate kpaCurrPlanActual = (KPACurrentPlanActualTemplate)activeTemplate; kpaCurrPlanActual.RefreshTemplate(); break; case 15: KPIPlanTemplate kpiPlan = (KPIPlanTemplate)activeTemplate; kpiPlan.RefreshTemplate(); break; case 16: KPIPurchTemplate kpiPurch = (KPIPurchTemplate)activeTemplate; kpiPurch.RefreshTemplate(); break; case 17: KPIFollowUpTemplate kpiFollowUp = (KPIFollowUpTemplate)activeTemplate; kpiFollowUp.RefreshTemplate(); break; case 19: KPIPurchTwoTemplate kpiPurchTwo = (KPIPurchTwoTemplate)activeTemplate; kpiPurchTwo.RefreshTemplate(); break; case 20: KPIPurchSubTemplate kpiPurchSub = (KPIPurchSubTemplate)activeTemplate; kpiPurchSub.RefreshTemplate(); break; case 21: KPIPurchTotalTemplate kpiPurchTotal = (KPIPurchTotalTemplate)activeTemplate; kpiPurchTotal.RefreshTemplate(); break; case 22: KPIPurchPlanTemplate kpiPurchPlan = (KPIPurchPlanTemplate)activeTemplate; kpiPurchPlan.RefreshTemplate(); break; case 24: KPIOtherTemplate kpiOther = (KPIOtherTemplate)activeTemplate; kpiOther.RefreshTemplate(); break; default: break; } } }
/// <summary> /// Triggered when a controls is added to the active page panel (pnl_activePage). depending on /// what control was added, that templates data will be loaded. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pnl_activePage_ControlAdded(object sender, ControlEventArgs e) { if (e.Control is UserControl) { //if (e.Control.GetType() == typeof(LoadingScreen)) // return; int tag = int.Parse(activeSectionBtn.Tag.ToString()); switch (tag) { case 1: KPAPlanTemplate kpaPlan = (KPAPlanTemplate)e.Control; kpaPlan.LoadPanel(overallData); activeTemplate = kpaPlan; break; case 2: KPAPurchTemplate kpaPurch = (KPAPurchTemplate)e.Control; kpaPurch.LoadPanel(overallData); activeTemplate = kpaPurch; break; case 3: KPAPurchSubTemplate kpaPurchSub = (KPAPurchSubTemplate)e.Control; kpaPurchSub.LoadPanel(overallData); activeTemplate = kpaPurchSub; break; case 4: KPAPurchTotalTemplate kpaPurchTotal = (KPAPurchTotalTemplate)e.Control; kpaPurchTotal.LoadPanel(overallData); activeTemplate = kpaPurchTotal; break; case 6: KPAFollowUpTemplate kpaFollowUp = (KPAFollowUpTemplate)e.Control; kpaFollowUp.LoadPanel(overallData); activeTemplate = kpaFollowUp; break; case 9: KPAHotJobsTemplate kpaHotJobs = (KPAHotJobsTemplate)e.Control; kpaHotJobs.LoadPanel(overallData); activeTemplate = kpaHotJobs; break; case 12: KPACurrentPlanActualTemplate kpaCurrPlanActual = (KPACurrentPlanActualTemplate)e.Control; kpaCurrPlanActual.LoadPanel(overallData); activeTemplate = kpaCurrPlanActual; break; case 15: KPIPlanTemplate kpiPlan = (KPIPlanTemplate)e.Control; kpiPlan.LoadPanel(overallData); activeTemplate = kpiPlan; break; case 16: KPIPurchTemplate kpiPurch = (KPIPurchTemplate)e.Control; kpiPurch.LoadPanel(overallData); activeTemplate = kpiPurch; break; case 17: KPIFollowUpTemplate kpiFollowUp = (KPIFollowUpTemplate)e.Control; kpiFollowUp.LoadPanel(overallData); activeTemplate = kpiFollowUp; break; case 19: KPIPurchTwoTemplate kpiPurchTwo = (KPIPurchTwoTemplate)e.Control; kpiPurchTwo.LoadPanel(overallData); activeTemplate = kpiPurchTwo; break; case 20: KPIPurchSubTemplate kpiPurchSub = (KPIPurchSubTemplate)e.Control; kpiPurchSub.LoadPanel(overallData); activeTemplate = kpiPurchSub; break; case 21: KPIPurchTotalTemplate kpiPurchTotal = (KPIPurchTotalTemplate)e.Control; kpiPurchTotal.LoadPanel(overallData); activeTemplate = kpiPurchTotal; break; case 22: KPIPurchPlanTemplate kpiPurchPlan = (KPIPurchPlanTemplate)e.Control; kpiPurchPlan.LoadPanel(overallData); activeTemplate = kpiPurchPlan; break; case 24: KPIOtherTemplate kpiOther = (KPIOtherTemplate)e.Control; kpiOther.LoadPanel(overallData); activeTemplate = kpiOther; break; default: break; } } }
/// <summary> /// This event will trigger when the user clicks on any sections contained within either /// KPA or KPI. The only section buttons that will load pages are the Overall sections /// of both KPA and KPI. /// </summary> /// <param name="sender">The section button</param> /// <param name="e">The click event</param> public void sectionBtn_Click(object sender, EventArgs e) { Button btn = sender as Button; activateSectionBtn(btn); int actSecTag = int.Parse(btn.Tag.ToString()); int mainActTag = int.Parse(mainNavActiveBtn.Tag.ToString()); switch (actSecTag) { case 0: // KPA --> Overall LoadOverallTemplate(); break; case 1: // KPA --> Plan pnl_activePage.Controls.Clear(); pnl_activePage.BringToFront(); KPAPlanTemplate kpaPlanTemp = new KPAPlanTemplate(); kpaPlanTemp.Dock = DockStyle.Fill; pnl_activePage.Controls.Add(kpaPlanTemp); break; case 2: // KPA --> Purch pnl_activePage.Controls.Clear(); pnl_activePage.BringToFront(); KPAPurchTemplate kpaPurchTemp = new KPAPurchTemplate(); kpaPurchTemp.Dock = DockStyle.Fill; pnl_activePage.Controls.Add(kpaPurchTemp); break; case 3: // KPA --> Purch Sub pnl_activePage.Controls.Clear(); pnl_activePage.BringToFront(); KPAPurchSubTemplate kpaPurchSubTemp = new KPAPurchSubTemplate(); kpaPurchSubTemp.Dock = DockStyle.Fill; pnl_activePage.Controls.Add(kpaPurchSubTemp); break; case 4: // KPA --> Purch Total pnl_activePage.Controls.Clear(); pnl_activePage.BringToFront(); KPAPurchTotalTemplate kpaPurchTotalTemp = new KPAPurchTotalTemplate(); kpaPurchTotalTemp.Dock = DockStyle.Fill; pnl_activePage.Controls.Add(kpaPurchTotalTemp); break; case 5: // KPA --> Purch/Plan Total LoadDataComingSoonTemplate(); break; case 6: // KPA --> Follow Up pnl_activePage.Controls.Clear(); pnl_activePage.BringToFront(); KPAFollowUpTemplate kpaFollowUpTemp = new KPAFollowUpTemplate(); kpaFollowUpTemp.Dock = DockStyle.Fill; pnl_activePage.Controls.Add(kpaFollowUpTemp); break; case 7: // KPA --> Cancellations LoadDataComingSoonTemplate(); break; case 8: // KPA --> NCRs LoadDataComingSoonTemplate(); break; case 9: // KPA --> Hot Jobs pnl_activePage.Controls.Clear(); pnl_activePage.BringToFront(); KPAHotJobsTemplate kpaHotJobs = new KPAHotJobsTemplate(); kpaHotJobs.Dock = DockStyle.Fill; pnl_activePage.Controls.Add(kpaHotJobs); break; case 10: // KPA --> Excess Stock - Stock LoadDataComingSoonTemplate(); break; case 11: // KPA --> Excess Stock - Open Orders LoadDataComingSoonTemplate(); break; case 12: // KPA --> Current Plan vs Actual pnl_activePage.Controls.Clear(); pnl_activePage.BringToFront(); KPACurrentPlanActualTemplate kpaCurrPlanActual = new KPACurrentPlanActualTemplate(); kpaCurrPlanActual.Dock = DockStyle.Fill; pnl_activePage.Controls.Add(kpaCurrPlanActual); break; case 13: // KPA --> MTC LoadDataComingSoonTemplate(); break; case 14: // KPI --> Overall LoadOverallTemplate(); break; case 15: // KPI --> Plan pnl_activePage.Controls.Clear(); pnl_activePage.BringToFront(); KPIPlanTemplate kpiPlanTemplate = new KPIPlanTemplate(); kpiPlanTemplate.Dock = DockStyle.Fill; pnl_activePage.Controls.Add(kpiPlanTemplate); break; case 16: // KPI --> Purch pnl_activePage.Controls.Clear(); pnl_activePage.BringToFront(); KPIPurchTemplate kpiPurchTemplate = new KPIPurchTemplate(); kpiPurchTemplate.Dock = DockStyle.Fill; pnl_activePage.Controls.Add(kpiPurchTemplate); break; case 17: // KPI --> Follow Up pnl_activePage.Controls.Clear(); pnl_activePage.BringToFront(); KPIFollowUpTemplate kpiFollowUpTemplate = new KPIFollowUpTemplate(); kpiFollowUpTemplate.Dock = DockStyle.Fill; pnl_activePage.Controls.Add(kpiFollowUpTemplate); break; case 18: // KPI --> Plan LoadDataComingSoonTemplate(); break; case 19: // KPI --> Purch pnl_activePage.Controls.Clear(); pnl_activePage.BringToFront(); KPIPurchTwoTemplate kpiPurchTwoTemplate = new KPIPurchTwoTemplate(); kpiPurchTwoTemplate.Dock = DockStyle.Fill; pnl_activePage.Controls.Add(kpiPurchTwoTemplate); break; case 20: // KPI --> Purch Sub pnl_activePage.Controls.Clear(); pnl_activePage.BringToFront(); KPIPurchSubTemplate kpiPurchSubTemplate = new KPIPurchSubTemplate(); kpiPurchSubTemplate.Dock = DockStyle.Fill; pnl_activePage.Controls.Add(kpiPurchSubTemplate); break; case 21: // KPI --> Purch Total pnl_activePage.Controls.Clear(); pnl_activePage.BringToFront(); KPIPurchTotalTemplate kpiPurchTotalTemplate = new KPIPurchTotalTemplate(); kpiPurchTotalTemplate.Dock = DockStyle.Fill; pnl_activePage.Controls.Add(kpiPurchTotalTemplate); break; case 22: // KPI --> Purch/Plan pnl_activePage.Controls.Clear(); pnl_activePage.BringToFront(); KPIPurchPlanTemplate kpiPurchPlanTemplate = new KPIPurchPlanTemplate(); kpiPurchPlanTemplate.Dock = DockStyle.Fill; pnl_activePage.Controls.Add(kpiPurchPlanTemplate); break; case 23: // KPI --> Purch/Plan Total LoadDataComingSoonTemplate(); break; case 24: // KPI --> Other pnl_activePage.Controls.Clear(); pnl_activePage.BringToFront(); KPIOtherTemplate kpiOtherTemplate = new KPIOtherTemplate(); kpiOtherTemplate.Dock = DockStyle.Fill; pnl_activePage.Controls.Add(kpiOtherTemplate); break; default: break; } }
/// <summary> /// Refreshes the active template that is within pnl_activePage. This is called when the /// application is made full screen and normal size. This is for the column chart located /// on each template. /// </summary> public void RefreshTemplate() { if (navigationController.MainTag == Navigation.MainNavigationTag.KPA) { switch (navigationController.SectionTag) { case Navigation.SectionNavigationTag.Plan: KPAPlanTemplate kpaPlan = (KPAPlanTemplate)activeTemplate; kpaPlan.RefreshTemplate(); break; case Navigation.SectionNavigationTag.Purch: KPAPurchTemplate kpaPurch = (KPAPurchTemplate)activeTemplate; kpaPurch.RefreshTemplate(); break; case Navigation.SectionNavigationTag.PurchSub: KPAPurchSubTemplate kpaPurchSub = (KPAPurchSubTemplate)activeTemplate; kpaPurchSub.RefreshTemplate(); break; case Navigation.SectionNavigationTag.PurchTotal: KPAPurchTotalTemplate kpaPurchTotal = (KPAPurchTotalTemplate)activeTemplate; kpaPurchTotal.RefreshTemplate(); break; case Navigation.SectionNavigationTag.FollowUp: KPAFollowUpTemplate kpaFollowUp = (KPAFollowUpTemplate)activeTemplate; kpaFollowUp.RefreshTemplate(); break; case Navigation.SectionNavigationTag.HotJobs: KPAHotJobsTemplate kpaHotJobs = (KPAHotJobsTemplate)activeTemplate; kpaHotJobs.RefreshTemplate(); break; case Navigation.SectionNavigationTag.ExcessStockStock: KPAExcessStockStock kapExcessStockStock = (KPAExcessStockStock)activeTemplate; kapExcessStockStock.RefreshTemplate(); break; case Navigation.SectionNavigationTag.ExcessStockOpenOrders: KPAExcessStockOpenOrders kpaExcessStockOpenOrders = (KPAExcessStockOpenOrders)activeTemplate; kpaExcessStockOpenOrders.RefreshTemplate(); break; case Navigation.SectionNavigationTag.CurrentPlanVsActual: KPACurrentPlanActualTemplate kpaCurrPlanActual = (KPACurrentPlanActualTemplate)activeTemplate; kpaCurrPlanActual.RefreshTemplate(); break; default: break; } } else // The has KPI currently loaded { switch (navigationController.SectionTag) { case Navigation.SectionNavigationTag.Plan: KPIPlanTemplate kpiPlan = (KPIPlanTemplate)activeTemplate; kpiPlan.RefreshTemplate(); break; case Navigation.SectionNavigationTag.Purch: KPIPurchTemplate kpiPurch = (KPIPurchTemplate)activeTemplate; kpiPurch.RefreshTemplate(); break; case Navigation.SectionNavigationTag.FollowUp: KPIFollowUpTemplate kpiFollowUp = (KPIFollowUpTemplate)activeTemplate; kpiFollowUp.RefreshTemplate(); break; case Navigation.SectionNavigationTag.PlanII: KPIPlanTwoTemplate kpiPlanTwo = (KPIPlanTwoTemplate)activeTemplate; kpiPlanTwo.RefreshTemplate(); break; case Navigation.SectionNavigationTag.PurchII: KPIPurchTwoTemplate kpiPurchTwo = (KPIPurchTwoTemplate)activeTemplate; kpiPurchTwo.RefreshTemplate(); break; case Navigation.SectionNavigationTag.FollowUpTwo: KPIFollowUpTwoTemplate kpiFollowUpTwo = (KPIFollowUpTwoTemplate)activeTemplate; kpiFollowUpTwo.RefreshTemplate(); break; case Navigation.SectionNavigationTag.PurchSub: KPIPurchSubTemplate kpiPurchSub = (KPIPurchSubTemplate)activeTemplate; kpiPurchSub.RefreshTemplate(); break; case Navigation.SectionNavigationTag.PurchTotal: KPIPurchTotalTemplate kpiPurchTotal = (KPIPurchTotalTemplate)activeTemplate; kpiPurchTotal.RefreshTemplate(); break; case Navigation.SectionNavigationTag.PurchPlan: KPIPurchPlanTemplate kpiPurchPlan = (KPIPurchPlanTemplate)activeTemplate; kpiPurchPlan.RefreshTemplate(); break; case Navigation.SectionNavigationTag.Other: KPIOtherTemplate kpiOther = (KPIOtherTemplate)activeTemplate; kpiOther.RefreshTemplate(); break; default: break; } } }
/// <summary> /// Triggered when a controls is added to the active page panel (pnl_activePage). depending on /// what control was added, that templates data will be loaded. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pnl_activePage_ControlAdded(object sender, ControlEventArgs e) { if (e.Control is Correlation.CorrelationControl) { return; } if (e.Control is UserControl) { if (navigationController.MainTag == Navigation.MainNavigationTag.KPA) { switch (navigationController.SectionTag) { case Navigation.SectionNavigationTag.Plan: KPAPlanTemplate kpaPlan = (KPAPlanTemplate)e.Control; kpaPlan.LoadPanel(); activeTemplate = kpaPlan; break; case Navigation.SectionNavigationTag.Purch: KPAPurchTemplate kpaPurch = (KPAPurchTemplate)e.Control; kpaPurch.LoadPanel(); activeTemplate = kpaPurch; break; case Navigation.SectionNavigationTag.PurchSub: KPAPurchSubTemplate kpaPurchSub = (KPAPurchSubTemplate)e.Control; kpaPurchSub.LoadPanel(); activeTemplate = kpaPurchSub; break; case Navigation.SectionNavigationTag.PurchTotal: KPAPurchTotalTemplate kpaPurchTotal = (KPAPurchTotalTemplate)e.Control; kpaPurchTotal.LoadPanel(); activeTemplate = kpaPurchTotal; break; case Navigation.SectionNavigationTag.FollowUp: KPAFollowUpTemplate kpaFollowUp = (KPAFollowUpTemplate)e.Control; kpaFollowUp.LoadPanel(); activeTemplate = kpaFollowUp; break; case Navigation.SectionNavigationTag.HotJobs: KPAHotJobsTemplate kpaHotJobs = (KPAHotJobsTemplate)e.Control; kpaHotJobs.LoadPanel(); activeTemplate = kpaHotJobs; break; case Navigation.SectionNavigationTag.ExcessStockStock: KPAExcessStockStock kpaExcessStockStock = (KPAExcessStockStock)e.Control; kpaExcessStockStock.LoadPanel(); activeTemplate = kpaExcessStockStock; break; case Navigation.SectionNavigationTag.ExcessStockOpenOrders: KPAExcessStockOpenOrders kpaExcessStockOpenOrders = (KPAExcessStockOpenOrders)e.Control; kpaExcessStockOpenOrders.LoadPanel(); activeTemplate = kpaExcessStockOpenOrders; break; case Navigation.SectionNavigationTag.CurrentPlanVsActual: KPACurrentPlanActualTemplate kpaCurrPlanActual = (KPACurrentPlanActualTemplate)e.Control; kpaCurrPlanActual.LoadPanel(); activeTemplate = kpaCurrPlanActual; break; default: break; } } else // the user is interacting with the KPIs { switch (navigationController.SectionTag) { case Navigation.SectionNavigationTag.Plan: KPIPlanTemplate kpiPlan = (KPIPlanTemplate)e.Control; kpiPlan.LoadPanel(); activeTemplate = kpiPlan; break; case Navigation.SectionNavigationTag.Purch: KPIPurchTemplate kpiPurch = (KPIPurchTemplate)e.Control; kpiPurch.LoadPanel(); activeTemplate = kpiPurch; break; case Navigation.SectionNavigationTag.FollowUp: KPIFollowUpTemplate kpiFollowUp = (KPIFollowUpTemplate)e.Control; kpiFollowUp.LoadPanel(); activeTemplate = kpiFollowUp; break; case Navigation.SectionNavigationTag.PlanII: KPIPlanTwoTemplate kpiPlanTwo = (KPIPlanTwoTemplate)e.Control; kpiPlanTwo.LoadPanel(); activeTemplate = kpiPlanTwo; break; case Navigation.SectionNavigationTag.PurchII: KPIPurchTwoTemplate kpiPurchTwo = (KPIPurchTwoTemplate)e.Control; kpiPurchTwo.LoadPanel(); activeTemplate = kpiPurchTwo; break; case Navigation.SectionNavigationTag.FollowUpTwo: KPIFollowUpTwoTemplate kpiFollowUpTwo = (KPIFollowUpTwoTemplate)e.Control; kpiFollowUpTwo.LoadPanel(); activeTemplate = kpiFollowUpTwo; break; case Navigation.SectionNavigationTag.PurchSub: KPIPurchSubTemplate kpiPurchSub = (KPIPurchSubTemplate)e.Control; kpiPurchSub.LoadPanel(); activeTemplate = kpiPurchSub; break; case Navigation.SectionNavigationTag.PurchTotal: KPIPurchTotalTemplate kpiPurchTotal = (KPIPurchTotalTemplate)e.Control; kpiPurchTotal.LoadPanel(); activeTemplate = kpiPurchTotal; break; case Navigation.SectionNavigationTag.PurchPlan: KPIPurchPlanTemplate kpiPurchPlan = (KPIPurchPlanTemplate)e.Control; kpiPurchPlan.LoadPanel(); activeTemplate = kpiPurchPlan; break; case Navigation.SectionNavigationTag.Other: KPIOtherTemplate kpiOther = (KPIOtherTemplate)e.Control; kpiOther.LoadPanel(); activeTemplate = kpiOther; break; default: break; } } } }