/// <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> /// 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; } } } }