Exemple #1
0
 // Assigning a required content for each auto generated Document
 void windowsUIView_QueryControl(object sender, QueryControlEventArgs e)
 {
     if (e.Document == ucScaleManualDocument)
     {
         e.Control = new Cookies_V2._0.Views.ucScaleManual();
     }
     if (e.Document == ucScalewScanDocument)
     {
         e.Control = new Cookies_V2._0.Views.ucScalewScan();
     }
     if (e.Document == ucStatisticDocument)
     {
         e.Control = new Cookies_V2._0.Views.ucStatistic();
     }
     if (e.Document == ucShiftInfoDocument)
     {
         e.Control = new Cookies_V2._0.Views.ucShiftInfo();
     }
     if (e.Document == ucItemInfoDocument)
     {
         e.Control = new Cookies_V2._0.Views.ucItemInfo();
     }
     if (e.Control == null)
     {
         e.Control = new System.Windows.Forms.Control();
     }
 }
Exemple #2
0
 void View_QueryControl(object sender, QueryControlEventArgs e)
 {
     this.CurrentAppointmentForm = e.Control as SchedulerAppointmentForm;
     if (this.CurrentAppointmentForm != null)
     {
         this.CurrentAppointmentForm.Initialize(this.schedulerControl, this.CurrentAppointmentArgs.Appointment);
     }
 }
        void windowsUIView_QueryControl(object sender, QueryControlEventArgs e)
        {
            Type       moduleType = typeof(EntertainmentNetworkMainForm).Assembly.GetType(e.Document.ControlTypeName);
            BaseModule module     = Activator.CreateInstance(moduleType, this.ViewsManager) as BaseModule;

            //module.Init(barManager);
            e.Control = module;
        }
 private void widgetView1_QueryControl(object sender, QueryControlEventArgs e)
 {
     if (e.Document.Caption == "二氧化硫")
     {
         AQMSUI.DocmentSO2 docSO2 = new AQMSUI.DocmentSO2();
         e.Control = docSO2;
     }
     else if (e.Document.Caption == "氮氧化物")
     {
         AQMSUI.DocmentSO2 docSO2 = new AQMSUI.DocmentSO2();
         e.Control = docSO2;
     }
     else if (e.Document.Caption == "一氧化碳")
     {
         AQMSUI.DocmentSO2 docSO2 = new AQMSUI.DocmentSO2();
         e.Control = docSO2;
     }
     else if (e.Document.Caption == "臭氧")
     {
         AQMSUI.DocmentSO2 docSO2 = new AQMSUI.DocmentSO2();
         e.Control = docSO2;
     }
     else if (e.Document.Caption == "可吸入颗粒物")
     {
         AQMSUI.DocmentSO2 docSO2 = new AQMSUI.DocmentSO2();
         e.Control = docSO2;
     }
     else if (e.Document.Caption == "细颗粒物")
     {
         AQMSUI.DocmentSO2 docSO2 = new AQMSUI.DocmentSO2();
         e.Control = docSO2;
     }
     else if (e.Document.Caption == "气象五参数")
     {
         AQMSUI.DocmentSO2 docSO2 = new AQMSUI.DocmentSO2();
         e.Control = docSO2;
     }
     else if (e.Document.Caption == "能见度")
     {
         AQMSUI.DocmentSO2 docSO2 = new AQMSUI.DocmentSO2();
         e.Control = docSO2;
     }
     else if (e.Document.Caption == "总悬浮颗粒物")
     {
         AQMSUI.DocmentSO2 docSO2 = new AQMSUI.DocmentSO2();
         e.Control = docSO2;
     }
     else if (e.Document.Caption == "系统状态")
     {
         AQMSUI.HomeInfo docHomeInfo = new AQMSUI.HomeInfo();
         e.Control = docHomeInfo;
     }
     else if (e.Document.Caption == "主页曲线")
     {
         AQMSUI.HomeChart docHomeChart = new AQMSUI.HomeChart();
         e.Control = docHomeChart;
     }
 }
        private void navigationFrameMain_QueryControl(object sender, QueryControlEventArgs e)
        {
            if (sender is NavigationFrame)
            {
                NavigationFrame senderNavigationFrame = sender as NavigationFrame;

                if (senderNavigationFrame.Visible == false)
                {
                    throw new NotSupportedException();
                }

                NavigationPage activeNavigationPage = (NavigationPage)e.Page;
                int            controlsCount        = activeNavigationPage.Controls.Count;

                #region  Clear Form or Control
                if (false)
                {
                    foreach (var eachvar in navigationFrameMain.Controls)
                    {
                        if (eachvar is DevExpress.XtraBars.Navigation.NavigationPage)
                        {
                            DevExpress.XtraBars.Navigation.NavigationPage eachNavigationPage = eachvar as DevExpress.XtraBars.Navigation.NavigationPage;
                            if (eachNavigationPage == activeNavigationPage)
                            {
                                while (eachNavigationPage.Controls.Count > 0)
                                {
                                    var ctrl = eachNavigationPage.Controls[0];
                                    ////ctrl.Parent = null;
                                    ctrl.Dispose();
                                    ctrl = null;
                                }
                            }
                        }
                    }
                }
                #endregion

                if (false)
                {
                    ////String userControlName = typeof(UserControl1).Name;
                    String       userControlName   = typeof(ucVaginoscopeView).Name;
                    XtraFormBase newFormColpModule = newXtraFormBase(userControlName);

                    newcontrolcount++;
                    this.barStaticItemCount.Caption = newcontrolcount.ToString();

                    activeNavigationPage.SuspendLayout();
                    activeNavigationPage.Controls.Add((Control)(newFormColpModule));
                    newFormColpModule.Visible = true;
                    newFormColpModule.Dock    = DockStyle.Fill;
                    newFormColpModule.ResumeLayout(false);

                    activeNavigationPage.ResumeLayout(false);
                    activeNavigationPage.PerformLayout();
                }
            }
        }
        /// <summary>
        /// 匹配每个document
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void widgetView_QueryControl(object sender, QueryControlEventArgs e)
        {
            Control widget = new Control();

            widget.Text = companyFullNames[e.Document.Caption];
            e.Control   = widget;
            (e.Document as Document).MaximizedControl = new Control();
            //if (++count >= this._documents.Count)
            //    Jesus.Utility.DevExpressHelper.DevExpressDeal.CloseWaitForm();
        }
Exemple #7
0
 void OnQueryControl(object sender, QueryControlEventArgs e)
 {
     if (!string.IsNullOrEmpty(e.Document.ControlTypeName))
     {
         e.Control = Activator.CreateInstance(Type.GetType(e.Document.ControlTypeName)) as Control;
     }
     else
     {
         e.Control = new Control();
     }
 }
 void windowsUIView1_QueryControl(object sender, QueryControlEventArgs e)
 {
     if (e.Document == document1)
     {
         e.Control = new Views.ucModuleA(new ViewModels.ViewModelModuleA());
     }
     if (e.Document == document2)
     {
         e.Control = new Views.ucModuleB(new ViewModels.ViewModelModuleB());
     }
 }
Exemple #9
0
 private void tabbedView_QueryControl(object sender, QueryControlEventArgs e)
 {
     e.Control = e.Document.ControlName switch
     {
         "Dashboard" => new Dashboard(),
         "CustomerList" => new CustomerList(),
         "EventView" => new EventView(),
         "RoomBookingView" => new RoomBookingView(),
         "PivotOverview" => new PivotOverview(),
         _ => new Control()
     };
 }
Exemple #10
0
 private void OnQueryControl(object sender, QueryControlEventArgs e)
 {
     if (!string.IsNullOrEmpty(e.Document.ControlTypeName))
     {
         e.Control = Activator.CreateInstance(Type.GetType(e.Document.ControlTypeName)) as Control;
         if (e.Control is IDashboardWidget)
         {
             ((IDashboardWidget)e.Control).LoadDashboard(ViewModel);
         }
     }
     else
     {
         e.Control = new Control();
     }
 }
        void windowsUIView_QueryControl(object sender, QueryControlEventArgs e)
        {
            BaseModule module = e.Document.Tag is BaseModule ? (BaseModule)e.Document.Tag :
                                Activator.CreateInstance(typeof(frmMain).Assembly.GetType(e.Document.ControlTypeName)) as BaseModule;

            module.InitModule(barManager1, windowsUIView);
            BaseTile tile = null;

            if (windowsUIView.Tiles.TryGetValue(e.Document, out tile))
            {
                TileItemFrame frame = tile.CurrentFrame;
                object        data  = current ?? ((frame != null) ? frame.Tag : null);
                module.ShowModule(data);
            }
            e.Document.Tag = module;
            e.Control      = module;
        }
 // Assigning a required content for each auto generated Document
 void windowsUIView1_QueryControl(object sender, QueryControlEventArgs e)
 {
     if (e.Document == xuUsuariosDocument)
     {
         e.Control = new MMercadoAPU.Herramientas.xuUsuarios();
     }
     if (e.Document == xuGruposDocument)
     {
         e.Control = new MMercadoAPU.Herramientas.xuGrupos();
     }
     if (e.Document == xuModulosDocument)
     {
         e.Control = new MMercadoAPU.Herramientas.xuModulos();
     }
     if (e.Document == xuTerminalDocument)
     {
         e.Control = new MMercadoAPU.Herramientas.xuTerminal();
     }
     if (e.Control == null)
     {
         e.Control = new System.Windows.Forms.Control();
     }
 }
Exemple #13
0
        private void windowsUIView_QueryControl(object sender, QueryControlEventArgs e)
        {
            Datasource.dsData.RoleDetialRow RuleElemet = Classes.Managers.UserManager.defaultInstance.RuleElementInformation(e.Document.ControlName);
            if (e.Control != null)
            {
                return;
            }
            if (e.Document == docUserSetting)
            {
                e.Control = new UserSettingsUC();
            }
            //---------Code
            else if (e.Document == docCodeCdAssetplace)
            {
                e.Control = new CdAssetplaceEditorUC(RuleElemet);
            }
            else if (e.Document == docCodecdJob)
            {
                e.Control = new CdJobEditorUC(RuleElemet);
            }
            else if (e.Document == docCodeCdDepertment)
            {
                e.Control = new CdDepertmentEditorUC(RuleElemet);
            }
            else if (e.Document == docCodeCdAssetPropertiy)
            {
                e.Control = new CdAssetPropertiyEditorUC(RuleElemet);
            }
            else if (e.Document == docCodeCdAssetState)
            {
                e.Control = new CdAssetStateEditorUC(RuleElemet);
            }
            else if (e.Document == docCodeCDComponents)
            {
                e.Control = new CDComponentsEditorUC(RuleElemet);
            }
            else if (e.Document == docCodeCDInsuranceCo)
            {
                e.Control = new CDInsuranceCoEditorUC(RuleElemet);
            }
            else if (e.Document == docCodeTBLCompany)
            {
                e.Control = new CompanyUC(RuleElemet);
            }

            //---------Data
            else if (e.Document == docDataCdAssetsCategory)
            {
                e.Control = new CdAssetsCategoryEditorUC(RuleElemet);
            }
            else if (e.Document == docDataTblEmp)
            {
                e.Control = new TblEmpEditorUC(RuleElemet);
            }
            else if (e.Document == docDataTBLSuppliers)
            {
                e.Control = new TBLSuppliersEditorUC(RuleElemet);
            }
            else if (e.Document == docDataTBLTwreedOrder)
            {
                e.Control = new TBLTwreedOrderEditorUC(RuleElemet);
            }
            else if (e.Document == docDataTBLCheck)
            {
                e.Control = new TBLCheckUC(RuleElemet);
            }
            else if (e.Document == docDataTBLEznEdafa)
            {
                e.Control = new TBLEznEdafaUC(RuleElemet);
            }
            else if (e.Document == docDataTBLEznSarf)
            {
                e.Control = new TBLEznSarfUC(RuleElemet);
            }

            //---------Rules
            else if (e.Document == docRuleUsers)
            {
                e.Control = new UsersUC(RuleElemet);
            }
            else if (e.Document == docRuleRule)
            {
                e.Control = new RolesUC(RuleElemet);
            }
            else if (e.Document == docRuleUserRoles)
            {
                e.Control = new UserRolesUC(RuleElemet);
            }
            else if (e.Document == docRuleRuleDetails)
            {
                e.Control = new RuleDetailsUC(RuleElemet);
            }
            else if (e.Document == docQryQry001)//Qry
            {
                e.Control = new Qry001UC();
            }
            else if (e.Document == docQryQry002)
            {
                e.Control = new Qry002UC();
            }
            else if (e.Document == docQryQry003)
            {
                e.Control = new Qry003UC();
            }
        }
        private void windowsUIView_QueryControl(object sender, QueryControlEventArgs e)
        {
            NICSQLTools.Data.dsData.AppRuleDetailRow RuleElemet = Classes.Managers.UserManager.defaultInstance.RuleElementInformation(e.Document.ControlName);
            if (e.Control != null)
                return;
            if (e.Document == docLogin)
            {
                e.Control = new LoginUC();
            }
            else if (e.Document == docUserSetting)
            {
                e.Control = new UserSettingsUC();
            }

            else if (e.Document == docRuleUser)//----------------------- Rules
            {
                e.Control = new Permission.UserUC(RuleElemet);
            }
            else if (e.Document == docRuleRule)
            {
                e.Control = new Permission.RuleUC(RuleElemet);
            }
            else if (e.Document == docRuleUserRule)
            {
                e.Control = new Permission.UserRuleUC(RuleElemet);
            }
            else if (e.Document == docRuleRuleDetails)
            {
                e.Control = new Permission.RuleDetailsUC(RuleElemet);
            }
            else if (e.Document == docRuleRuleSalesDisitrct3)
            {
                e.Control = new Permission.RuleSalesDisitrct3UC(RuleElemet);
            }

            else if (e.Document == docQueriesQryPivot)//----------------------- Queries
            {
                e.Control = new Qry.QryPivotUC(RuleElemet);
            }
            else if (e.Document == docQueriesQryCustomerInfo)
            {
                e.Control = new Qry.QryCustomerInfoUC(RuleElemet);
            }
            else if (e.Document == docQueriesExcelDynamicUpdate)
            {
                e.Control = new Qry.ExcelDynamicUpdateUC(RuleElemet);
            }
            else if (e.Document == docQryPivotOLap)
            {
                e.Control = new Qry.QryPivotOLapUC(RuleElemet);
            }
            else if (e.Document == docQueriesCustomerMap)
            {
                e.Control = new NICSQLTools.Views.Qry.CustomerMapUC(RuleElemet);
            }

            else if (e.Document == docDashboardDesigner)//--------------------  Dashboard
            {
                e.Control = new Dashboard.DashboardDesignerUC(RuleElemet);
            }
            else if (e.Document == docDashboardViewer)
            {
                e.Control = new Dashboard.DashboardViewerUC();
            }

            else if (e.Document == docEditorsRoutes)//------------------------  Editors
            {
                e.Control = new Data.RouteEditorUC(RuleElemet);
            }
            else if (e.Document == docEditorsProducts)
            {
                e.Control = new Data.ProductEditorUC(RuleElemet);
            }
            else if (e.Document == docEditorsCustomers)
            {
                e.Control = new Data.CustomerEditorUC(RuleElemet);
            }
            else if (e.Document == docAppDatasourceEditor)
            {
                e.Control = new Data.AppDatasourceEditorUC(RuleElemet);
            }
            else if (e.Document == docEditorsAppDatasourceLookup)
            {
                e.Control = new Data.AppDatasourceLookupEditorUC(RuleElemet);
            }
            else if (e.Document == docEditorsTargetKPI)
            {
                e.Control = new Data.TargetKPIEditorUC(RuleElemet);
            }
            else if (e.Document == docEditorsTargetNCE)
            {
                e.Control = new Data.TargetNCEEditorUC(RuleElemet);
            }
            //else if (e.Document == docEditorsRoutesPlate)
            //{
            //    e.Control = new Data.GPS.TSrv_RoutePlateEditorUC(RuleElemet);
            //}
            //else if (e.Document == docEditorsPlate)
            //{
            //    e.Control = new Data.GPS.TSrv_PlateEditorUC(RuleElemet);
            //}
            else if (e.Document == docEditorsImportDays)
            {
                e.Control = new Import.ImportDaysUC(RuleElemet);
            }
            else if (e.Document == docEditorsImportCustomerRoute)
            {
                e.Control = new Import.ImportCustomerRouteUC(RuleElemet);
            }
            else if (e.Document == docEditorsImportCustomerInfo)
            {
                e.Control = new Import.ImportCustomerInfoUC(RuleElemet);
            }
            else if (e.Document == docEditorsImportCustomerSSInfo)
            {
                e.Control = new Import.ImportCustomerSSInfoUC(RuleElemet);
            }
            else if (e.Document == docEditorsImportUMD)
            {
                e.Control = new Import.ImportUMDUC(RuleElemet);
            }
            else if (e.Document == docEditorsImportDamageMaster)
            {
                e.Control = new Import.ImportDMG_MasterUC(RuleElemet);
            }
            else if (e.Document == docEditorsImportEquipment)
            {
                e.Control = new Import.ImportEquipmentUC(RuleElemet);
            }
            else if (e.Document == docEditorsImportEquipmentAll)
            {
                e.Control = new Import.ImportEquipmentAllUC(RuleElemet);
            }
            else if (e.Document == docEditorsImportUpdateProductDetails)
            {
                e.Control = new Import.ImportUpdateProductDetailsUC(RuleElemet);
            }
            else if (e.Document == docEditorsImportStock_List)
            {
                e.Control = new Import.ImportStock_ListUC(RuleElemet);
            }
            else if (e.Document == docEditorsImportStock_Material)
            {
                e.Control = new Import.ImportStock_MaterialUC(RuleElemet);
            }
            else if (e.Document == docEditorsImportStock_Data)
            {
                e.Control = new Import.ImportStock_DataUC(RuleElemet);
            }
            else if (e.Document == docEditorsImportDst_Master)
            {
                e.Control = new Import.ImportDst_MasterUC(RuleElemet);
            }
            else if (e.Document == docEditorsImportEst_Actual_R3UC)
            {
                e.Control = new Import.ImportEst_Actual_R3UC(RuleElemet);
            }
            else if (e.Document == docEditorsImportActualBillArg)
            {
                e.Control = new Import.ImportActualBillArgUC(RuleElemet);
            }
            else if (e.Document == docEditorsImportGPS_Data)
            {
                e.Control = new Import.ImportGPS_DataUC(RuleElemet);
            }
            else if (e.Document == docEditorsImportHH_Data)
            {
                e.Control = new Import.ImportHH_DataUC(RuleElemet);
            }
            else if (e.Document == docEditorsCostControl)
            {
                e.Control = new Data.CostControlEditorUC(RuleElemet);
            }
            else if (e.Document == docEditorsTaskManagerTask)// Tasks
            {
                e.Control = new Data.TaskManager.TaskEditorUC(RuleElemet);
            }
            else if (e.Document == docEditorsTaskManagerEmp)
            {
                e.Control = new Data.TaskManager.EmpEditorUC(RuleElemet);
            }
            else if (e.Document == docEditorsTaskManagerEmpTask)
            {
                e.Control = new Data.TaskManager.EmpTaskEditorUC(RuleElemet);
            }
            else if (e.Document == docEditorsTaskManagerFactor)
            {
                e.Control = new Data.TaskManager.FactorEditorUC(RuleElemet);
            }
            else if (e.Document == docEditorsTaskManagerEmpTaskActual)
            {
                e.Control = new Data.TaskManager.EmpTaskActualEditorUC(RuleElemet);
            }
            else if (e.Document == docEditorsActivities_Actual)// Activities
            {
                e.Control = new Data.Activities.ImportSTI_Actv_ActualUC(RuleElemet);
            }
            else if (e.Document == docEditorsMSrv_TypeEditor)// MSrv
            {
                e.Control = new Data.MSrv.MSrv_TypeEditorUC(RuleElemet);
            }
            else if (e.Document == docEditorsMSrv_TechnicianEditor)
            {
                e.Control = new Data.MSrv.MSrv_TechnicianEditorUC(RuleElemet);
            }
            else if (e.Document == docEditorsMSrv_TicketEditor){
                e.Control = new MSrv_TicketEditorUC(RuleElemet);
            }
            else if (e.Document == docEditorsMSrv_TechnicianSalesDistrictEditor)
            {
                e.Control = new Data.MSrv.MSrv_TechnicianSalesDistrictUC(RuleElemet);
            }
            else if (e.Document == docEditorsMSrv_TechnicianCompanyEditor){
                e.Control = new Data.MSrv.MSrv_TechnicianCompanyEditorUC(RuleElemet);
            }
            else if (e.Document == docEditorsMSrv_PartEditor)
            {
                e.Control = new Data.MSrv.MSrv_PartEditorUC(RuleElemet);
            }
            else if (e.Document == docEditorsMSrv_01)
            {
                e.Control = new Qry.MSrv.MSrv_01();
            }
            else if (e.Document == docEditorsMSrv_02)
            {
                e.Control = new Qry.MSrv.MSrv_02();
            }
            else if (e.Document == docEditorsMSrv_03)
            {
                e.Control = new Qry.MSrv.MSrv_03();
            }
            else if (e.Document == docEditorsMSrv_04)
            {
                e.Control = new Qry.MSrv.MSrv_04();
            }
            else if (e.Document == docEditorsTSrv_TruckServiceEditor)//TSrv
            {
                e.Control = new Data.TSrv.Data.TSrv_TruckServiceEditorUC(RuleElemet);
            }
            else if (e.Document == docEditorsTSrv_DriverEditor)
            {
                e.Control = new Data.TSrv.Code.TSrv_DriverEditorUC(RuleElemet);
            }
            else if (e.Document == docEditorsTSrv_PlateEditor)
            {
                e.Control = new Data.TSrv.Code.TSrv_PlateEditorUC(RuleElemet);
            }
            else if (e.Document == docEditorsTSrv_RoutePlateEditor)
            {
                e.Control = new Data.TSrv.Code.TSrv_RoutePlateEditorUC(RuleElemet);
            }
            else if (e.Document == docEditorsTSrv_RouteTypeEditor)
            {
                e.Control = new Data.TSrv.Code.TSrv_RouteTypeEditorUC(RuleElemet);
            }
            else if (e.Document == docEditorsTSrv_StatusEditor)
            {
                e.Control = new Data.TSrv.Code.TSrv_StatusEditorUC(RuleElemet);
            }

            else if (e.Document == docEditorsXRep01)
            {
                XRep.MSrv.XRep01 rep = new XRep.MSrv.XRep01();
                e.Control = new Main.XRepViewerUC(rep);
            }
            else if (e.Document == docEditorsMSrv_Dmg_ReasonEditor){
                e.Control = new Data.MSrv.MSrv_Dmg_ReasonEditorUC(RuleElemet);
            }
            else if (e.Document == docEditorsRDMEditorRDM_Promo_Type)// RDM
            {
                e.Control = new Data.RDM.RDM_Promo_TypeEditorUC(RuleElemet);
            }
            else if (e.Document == docEditorsRDMEditorRDM_Receipt)
            {
                e.Control = new Data.RDM.RDM_ReceiptEditorUC(RuleElemet);
            }

            else if (e.Document == docReportsReportViewer)
            {
                e.Control = new System.Windows.Forms.Control();//ToDo
            }
        }
Exemple #15
0
        private void windowsUIView_QueryControl(object sender, QueryControlEventArgs e)
        {

        }
        private async void windowsUIViewMain_QueryControl(object sender, QueryControlEventArgs e)
        {
            try
            {
                var queryReportRegex = new Regex(@"QueryReport(?<idx>\d+)");
                var queryReportRegex2 = new Regex(@"QueryReport-2(?<idx>\d+)");
                var queryReportMatch = queryReportRegex.Match(e.Document.ControlName);
                var queryReportMatch2 = queryReportRegex2.Match(e.Document.ControlName);
                if (queryReportMatch.Success)
                {
                    try
                    {
                        var idx = int.Parse(queryReportMatch.Groups["idx"].Value);
                        e.Control = new XtraReportViewControl(windowsUIViewMain) {Report = ReportFactory.Reports[idx]};
                        return;
                    }
                    catch
                    {
                        throw new KeyNotFoundException("Отчет не найден");
                    }
                }
                if (queryReportMatch2.Success)
                {
                    try
                    {
                        var idx = int.Parse(queryReportMatch2.Groups["idx"].Value);
                        e.Control = new XtraReportViewControl2(windowsUIViewMain) { ReportData = ReportFactory2.Reports[idx] };
                        return;
                    }
                    catch
                    {
                        throw new KeyNotFoundException("Отчет не найден");
                    }
                }
                switch (e.Document.ControlName)
                {
                    case "Questionary":
                        {
                            //XtraDictionaryQuestionaryControl questionaryControl = new XtraDictionaryQuestionaryControl(this.windowsUIViewMain);
                            //int? questionaryId = TagHelper.GetQuestionaryId(e.Document.Tag.ToString());
                            //if (questionaryId.HasValue)
                            //    questionaryControl.CurrentQuestionary = RepoHelper.Repo.GetById<Questionary>(questionaryId.Value);
                            //e.Control = questionaryControl;
                            break;
                        }
                    case "QueriesEdu":
                        {
                            var repo = new Repository();
                            var queryControl = new XtraQueryEduControl(windowsUIViewMain, repo)
                            {
                                FormDataSource = await repo.GetFormsHaveQueries(FormType.Edu, FormType.OtherEdu),
                                YearDataSource = await repo.GetAvailableYears(),
                                QueryPartHeadDataSource = await repo.GetQueriesHeadParts()
                            };
                            e.Control = queryControl;
                            break;
                        }
                    case "QueriesMunicipality":
                        {
                            var repo = new Repository();
                            var queryControl = new XtraQueryMunicipalityControl(windowsUIViewMain, repo)
                            {
                                FormDataSource = await repo.GetFormsHaveQueries(FormType.Municipality, FormType.OtherMunicipality),
                                YearDataSource = await repo.GetAvailableYears(),
                                QueryPartHeadDataSource = await repo.GetQueriesHeadParts()
                            };
                            e.Control = queryControl;
                            break;
                        }
                    case "QueriesRegion":
                        {
                            var repo = new Repository();
                            var queryControl = new XtraQueryRegionControl(windowsUIViewMain, repo)
                            {
                                FormDataSource = await repo.GetFormsHaveQueries(FormType.Region, FormType.OtherRegion),
                                YearDataSource = await repo.GetAvailableYears(),
                                QueryPartHeadDataSource = await repo.GetQueriesHeadParts()
                            };
                            e.Control = queryControl;
                            break;
                        }
                    case "AlignData":
                        {
                            var repo = new Repository();
                            var formDataId = (int) RuntimeSettings.Current["FormDataId"];
                            var formType = (FormType) RuntimeSettings.Current["FormTypeId"];
                            var currentFormData = await repo.GetFormDataById(formDataId, formType);
                            var currentForm = currentFormData.form;
                            var previousData = await repo.FindYesteryearFormData(currentFormData);

                            var alignDataControl = new XtraAlignDataControl(windowsUIViewMain, repo)
                            {
                                PreviousFormData = previousData,
                                CurrentFormData = currentFormData
                            };
                            e.Control = alignDataControl;
                            await alignDataControl.Process(currentForm);
                            break;
                        }
                    case "DictAlignData":
                        {
                            var repo = new Repository();
                            var alignDataControl = new XtraDictionaryAlignDataFormulaControl(windowsUIViewMain, repo)
                            {
                                FormDataSource = await repo.GetForms()
                            };
                            e.Control = alignDataControl;
                            break;
                        }
                    case "DictCreateQuery":
                        {
                            var repo = new Repository();
                            var createQueryControl = new XtraCreateQueryControl(windowsUIViewMain, repo)
                            {
                                QueryAutocomletePartSource = await repo.GetQueriesAutocompleteParts(),
                                QueryHeadPartSource = await repo.GetQueriesHeadParts()
                            };
                            if (Authentication.Credentials.IsRegion)
                            {
                                createQueryControl.FormsWithTemplatesDataSource = 
                                    await repo.GetFormsWithTemplates();
                            }
                            else if (Authentication.Credentials.IsMunicipality)
                            {
                                createQueryControl.FormsWithTemplatesDataSource =
                                    await repo.GetFormsWithTemplatesForMunicipality(Authentication.Credentials.MunitId);
                            }
                            else if (Authentication.Credentials.IsEdu)
                            {
                                createQueryControl.FormsWithTemplatesDataSource =
                                    await repo.GetFormsWithTemplatesForEdu(Authentication.Credentials.EduId);
                            }
                            e.Control = createQueryControl;
                            break;
                        }
                    case "DictCredentials":
                    {
                        var repo = new Repository();
                        var dictCredControl = new XtraDictCredentials(windowsUIViewMain, repo)
                        {
                            CredentialsDataSource = await repo.GetCredential(),
                            EduDataSource = await repo.GetEdus(),
                            MunicipalityDataSource = await repo.GetMunicipalities(),
                            RegionDataSource = await repo.GetRegions()
                        };
                        e.Control = dictCredControl;
                        break;
                    }
                    case "DictEdu":
                        {
                            var repo = new Repository();
                            var dictionaryEduControl =
                                new XtraDictionaryEduControl(windowsUIViewMain, repo)
                                {
                                    EduDataSource = await repo.GetEdus(),
                                    MunicipalityDataSource = await repo.GetMunicipalities(),
                                    DataSourceEduKind = await repo.GetEduKinds()
                                };

                            e.Control = dictionaryEduControl;
                            break;
                        }
                    case "DictMunicipality":
                        {
                            var repo = new Repository();
                            var dictionaryMunitControl =
                                new XtraDictionaryMunitControl(windowsUIViewMain, repo)
                                {
                                    MunicipalityDataSource = await repo.GetMunicipalities()
                                };
                            e.Control = dictionaryMunitControl;
                            break;
                        }
                    case "DictTemplate":
                        {
                            var repo = new Repository();
                            var templateControl = new XtraDictionaryTemplateControl(windowsUIViewMain, repo)
                            {
                                FormsWithTemplatesDataSource = await repo.GetFormsWithTemplates(),
                                FormsWithoutTemplatesDataSource = await repo.GetFormsWithoutTemplates()
                            };
                            e.Control = templateControl;
                            break;
                        }
                    case "DictForms":
                        {
                            var repo = new Repository();
                            var dictionaryFormControl = new XtraDictionaryFormsControl(windowsUIViewMain, repo)
                            {
                                FormDataSource = await repo.GetForms(),
                                DataSourceEduKind = await repo.GetEduKinds(),
                                FormTypeDataSource = await repo.GetFormTypes(),
                                MunicipalityDataSource = await repo.GetMunicipalities()
                            };

                            e.Control = dictionaryFormControl;
                            break;
                        }
                    case "DictMunicipalityFormula":
                        {
                            var repo = new Repository();
                            var dictionaryMunicipalityFormulaControl = new XtraDictionarySummaryFormulaControl(windowsUIViewMain, repo);
                            e.Control = dictionaryMunicipalityFormulaControl;
                            dictionaryMunicipalityFormulaControl.RegularFormDataSource = await repo.GetForms();
                            dictionaryMunicipalityFormulaControl.SummaryFormDataSource = await repo.GetForms();
                            break;
                        }
                    case "ArchiveFormData6":
                    case "FormData6": //допформа
                    case "ArchiveFormData5":
                    case "FormData5": //форма региона
                        {
                            var dataId = TagHelper.GetFormDataId(e.Document.Tag.ToString());
                            if (dataId.HasValue)
                            {
                                var repo = new Repository();
                                var fd = await repo.GetRegionFormDataById(dataId.Value);
                                var sheetControl = new XtraSpreadsheet(windowsUIViewMain, repo)
                                {
                                    FormDataSource = await repo.GetRegionForms(),
                                    FormData = fd,
                                    FormStatus = (Status)fd.status,
                                    Source = XtraSpreadsheet.FormSource.File,
                                    Mode = XtraSpreadsheet.ControlMode.Edit,
                                    ActiveForm = fd.form
                                };
                                sheetControl.LoadDocument();

                                e.Control = sheetControl;
                            }
                            else
                            {
                                e.Control = new Control();
                            }
                            break;
                        }
                    case "ArchiveFormData4":
                    case "FormData4": //допформа
                    case "ArchiveFormData3":
                    case "FormData3": //форма муниципалитета
                        {
                            var dataId = TagHelper.GetFormDataId(e.Document.Tag.ToString());
                            if (dataId.HasValue)
                            {
                                var repo = new Repository();
                                var fd = await repo.GetMunitFormDataById(dataId.Value);
                                var sheetControl = new XtraSpreadsheet(windowsUIViewMain, repo)
                                {
                                    FormDataSource = await repo.GetMunicipalityForms(),
                                    FormData = fd,
                                    FormStatus = (Status)fd.status,
                                    Source = XtraSpreadsheet.FormSource.File,
                                    Mode = await fd.form.IsBlockedAsync() ? XtraSpreadsheet.ControlMode.Disabled : XtraSpreadsheet.ControlMode.Edit,
                                    ActiveForm = fd.form
                                };
                                sheetControl.LoadDocument();

                                e.Control = sheetControl;
                            }
                            else
                            {
                                e.Control = new Control();
                            }
                            break;
                        }
                    case "ArchiveFormData1":
                    case "ArchiveFormData2":
                    case "FormData2": //допформа
                    case "FormData1": //форма организации
                        {
                            var dataId = TagHelper.GetFormDataId(e.Document.Tag.ToString());
                            if (dataId.HasValue)
                            {
                                var repo = new Repository();
                                var fd = await repo.GetEduFormDataById(dataId.Value);
                                var sheetControl = new XtraSpreadsheet(windowsUIViewMain, repo)
                                {
                                    FormData = fd,
                                    FormStatus = (Status)fd.status,
                                    Source = XtraSpreadsheet.FormSource.File,
                                    Mode = await fd.form.IsBlockedAsync() ? XtraSpreadsheet.ControlMode.Disabled : XtraSpreadsheet.ControlMode.Edit
                                };
                                if (Authentication.Credentials.IsEdu)
                                {
                                    var edu = await repo.GetEdu(Authentication.Credentials.EduId);
                                    if (edu.edu_kind_id.HasValue)
                                        sheetControl.FormDataSource = await repo.GetFormsByEduKind(edu.edu_kind_id.Value);
                                }
                                else
                                {
                                    sheetControl.FormDataSource = await repo.GetForms();
                                }
                                sheetControl.ActiveForm = fd.form;
                                sheetControl.LoadDocument();

                                e.Control = sheetControl;
                            }
                            else
                            {
                                e.Control = new Control();
                            }
                            break;
                        }
                    case "XtraProgress":
                        e.Control = new XtraProgress();
                        break;
                    case "Authentication":
                        e.Control = _authForm;
                        break;
                    case "Passport":
                        {
                            var repo = new Repository();
                            if (Authentication.Credentials.IsEdu)
                            {
                                var passportControl = new XtraDictionaryEduPassportControl(windowsUIViewMain, repo)
                                {
                                    MunicipalityDataSource = await repo.GetMunicipalities(),
                                    ActivityTypeDataSource = await repo.GetActivityTypes(),
                                    EduStatusDataSource = await repo.GetEduStatuses(),
                                    EduTypeDataSource = await repo.GetEduTypes(),
                                    DataSourceEduKind = await repo.GetEduKinds(),
                                    ManagementAgencyDataSource = await repo.GetManagementAgencies(),
                                    ManagementAgencyActivityDataSource = await repo.GetManagementAgencyActivities(),
                                    OwnershipTypeDataSource = await repo.GetOwnershipTypes(),
                                    Edu = await repo.GetEdu(Authentication.Credentials.EduId)
                                };
                                e.Control = passportControl;
                            }
                            else if(Authentication.Credentials.IsMunicipality)
                            {
                                var passportControl = new XtraDictionaryMunicipalityPassportControl(windowsUIViewMain, repo)
                                {
                                    Municipality = await repo.GetMunicipality(Authentication.Credentials.MunitId)
                                };
                                e.Control = passportControl;
                            }
                            break;
                        }
                    case "UploadSheetFromFile":
                        {
                            var repo = new Repository();
                            var sheetControl = new XtraSpreadsheet(windowsUIViewMain, repo)
                            {
                                Source = XtraSpreadsheet.FormSource.File,
                                Mode = XtraSpreadsheet.ControlMode.New
                            };
                            var forms = new List<form>();
                            if (Authentication.Credentials.IsEdu)
                            {
                                var edu = await repo.GetEdu(Authentication.Credentials.EduId);
                                forms = await repo.GetFormsByEduKind(edu.edu_kind.edu_kind_id);
                            }
                            else if (Authentication.Credentials.IsMunicipality)
                            {
                                forms = await repo.GetMunicipalityForms();
                            }
                            else if (Authentication.Credentials.IsRegion)
                            {
                                forms = await repo.GetForms();
                            }
                            sheetControl.FormDataSource = forms;
                            sheetControl.ActiveForm = forms.FirstOrDefault();
                            e.Control = sheetControl;
                            break;
                        }
                    case "UploadSheetFromTemplate":
                        {
                            var repo = new Repository();
                            var sheetControl = new XtraSpreadsheet(windowsUIViewMain, repo)
                            {
                                Source = XtraSpreadsheet.FormSource.Template,
                                Mode = XtraSpreadsheet.ControlMode.New
                            };
                            var forms = new List<form>();
                            if (Authentication.Credentials.IsEdu)
                            {
                                var edu = await repo.GetEdu(Authentication.Credentials.EduId);
                                forms = await repo.GetFormsByEduKind(edu.edu_kind.edu_kind_id);
                            }
                            else if (Authentication.Credentials.IsMunicipality)
                            {
                                forms = await repo.GetFormsByType(false, FormType.Municipality, FormType.OtherMunicipality, FormType.Edu, FormType.OtherEdu);
                            }
                            else if (Authentication.Credentials.IsRegion)
                            {
                                forms = await repo.GetForms();
                            }
                            sheetControl.FormDataSource = forms;
                            sheetControl.ActiveForm = forms.FirstOrDefault();
                            e.Control = sheetControl;
                            break;
                        }
                    case "RequestQuery":
                        {
                            var repo = new Repository();
                            var messageControl = new XtraMessageControl(windowsUIViewMain, repo)
                            {
                                MessageType = XtraMessageControl.MessageTypeEnum.RequestForQuery,
                                FormDataSource = await repo.GetForms()
                            };

                            e.Control = messageControl;
                            break;
                        }
                    case "BugReport":
                        {
                            var repo = new Repository();
                            var messageControl = new XtraMessageControl(windowsUIViewMain, repo)
                            {
                                MessageType = XtraMessageControl.MessageTypeEnum.BugReport,
                                FormDataSource = await repo.GetForms()
                            }; e.Control = messageControl;
                            break;
                        }
                    case "MessageList":
                        {
                            var repo = new Repository();
                            var messageListControl = new XtraMessageListControl(windowsUIViewMain, repo)
                            {
                                DataSourceMessage = await repo.GetMessages()
                            };
                            e.Control = messageListControl;
                            break;
                        }
                    case "FormDetailedStatisticsReport":
                        {
                            var doc = windowsUIViewMain.Documents.FindFirst(t => t.ControlName == "FormDetailedStatistics");
                            var formStatData = new List<t_detailed_form_statistics>();
                            if (doc != null)
                            {
                                formStatData = (List<t_detailed_form_statistics>)doc.Tag;
                            }
                            var formStatisticReport = new XtraDetailedFormStatisticReport();
                            var formStatisticReportControl = new XtraReportViewControl(windowsUIViewMain);
                            formStatisticReport.FormStatisticDataSource = formStatData;
                            formStatisticReportControl.Report = formStatisticReport;
                            formStatisticReport.CreateDocument();

                            e.Control = formStatisticReportControl;
                            break;
                        }
                    case "FormDetailedStatistics":
                        {
                            var repo = new Repository();
                            var detailedFormStatisticsReport = new XtraFormDetailedStatisticControl(windowsUIViewMain, repo);
                            e.Control = detailedFormStatisticsReport;
                            detailedFormStatisticsReport.FormStatisticDataSource =
                                Authentication.Credentials.IsMunicipality
                                    ? await repo.GetDetailedFormStatistics(Authentication.Credentials.MunitId, DateTime.Now.Year)
                                    : await repo.GetDetailedFormStatistics(DateTime.Now.Year);
                            detailedFormStatisticsReport.YearsDataSource = await repo.GetAvailableYears();
                            break;
                        }
                    case "FormStatistics":
                        using (var repo = new Repository())
                        {
                            var formStatisticReport = new XtraFormStatisticReport
                            {
                                FormStatisticDataSource = Authentication.Credentials.IsMunicipality
                                    ? repo.GetFormStatistics(Authentication.Credentials.MunitId).Result
                                    : repo.GetFormStatistics().Result
                            };
                            var formStatisticReportControl = new XtraReportViewControl(windowsUIViewMain)
                            {
                                Report = formStatisticReport
                            };
                            formStatisticReport.CreateDocument();

                            e.Control = formStatisticReportControl;
                            break;
                        }
                    case "MunicipalityFormStatistics":
                        using (var repo = new Repository())
                        {
                            var formStatisticReport = new XtraMunicipalityFormStatisticReport //не ясно почему вылетает deferredloadexception, если использовать await
                            {
                                FormStatisticDataSource = Authentication.Credentials.IsMunicipality
                                    ? repo.GetMunicipalityFormStatistics(Authentication.Credentials.MunitId).Result
                                    : repo.GetMunicipalityFormStatistics().Result
                            };
                            var formStatisticReportControl = new XtraReportViewControl(windowsUIViewMain)
                            {
                                Report = formStatisticReport
                            };
                            formStatisticReport.CreateDocument();

                            e.Control = formStatisticReportControl;
                            break;
                        }
                    case "MunicipalityFormDetailedStatisticsReport":
                        {
                            var doc = windowsUIViewMain.Documents.FindFirst(t => t.ControlName == "MunicipalityFormDetailedStatistics");
                            var formStatData = new List<t_detailed_municipality_form_statistics>();
                            if (doc != null)
                            {
                                formStatData = (List<t_detailed_municipality_form_statistics>)doc.Tag;
                            }
                            var formStatisticReport = new XtraDetailedMunicipalityFormStatisticReport();
                            var formStatisticReportControl = new XtraReportViewControl(windowsUIViewMain);

                            formStatisticReport.FormStatisticDataSource = formStatData;
                            formStatisticReportControl.Report = formStatisticReport;
                            formStatisticReport.CreateDocument();

                            e.Control = formStatisticReportControl;
                            break;
                        }
                    case "MunicipalityFormDetailedStatistics":
                        {
                            var repo = new Repository();
                            var detailedFormStatisticsReport = new XtraMunicipalityFormDetailedStatisticControl(windowsUIViewMain, repo)
                            {
                                FormStatisticDataSource = Authentication.Credentials.IsMunicipality
                                    ? repo.GetDetailedMunicipalityFormStatistics(Authentication.Credentials.MunitId).Result
                                    : repo.GetDetailedMunicipalityFormStatistics().Result,
                                YearsDataSource = await repo.GetAvailableYears()
                            };

                            e.Control = detailedFormStatisticsReport;
                            break;
                        }
                    case "FormStatisticsSummary":
                        using (var repo = new Repository())
                        {
                            var formStatisticReport = new XtraFormStatisticSummaryReport
                            {
                                FormStatisticSummaryDataSource = Authentication.Credentials.IsMunicipality
                                    ? repo.GetSummaryFormStatistics(Authentication.Credentials.MunitId).Result
                                    : repo.GetSummaryFormStatistics().Result
                            };
                            var formStatisticReportControl = new XtraReportViewControl(windowsUIViewMain)
                            {
                                Report = formStatisticReport
                            };
                            formStatisticReport.CreateDocument();

                            e.Control = formStatisticReportControl;
                            break;
                        }
                    case "SignInOutLog":
                        {
                            var repo = new Repository();
                            var signInOutReport = new XtraSignInOutReport {Repo = repo};
                            var signInOutReportControl = new XtraReportViewControl(windowsUIViewMain);

                            var startDate = DateTime.Now.AddDays(-30);
                            var endDate = DateTime.Now;

                            var logs = await repo.GetLoginLogs(startDate, endDate);
                            signInOutReport.SignInOutLogDataSource = logs;
                            signInOutReportControl.Report = signInOutReport;
                            signInOutReport.CreateDocument();

                            e.Control = signInOutReportControl;
                            break;
                        }
                    case "ExportReport":
                        {
                            var exportControl = new XtraExportReportControl();
                            e.Control = exportControl;
                            break;
                        }
                    default:
                        e.Control = new Control();
                        break;
                }
            }
            catch (Exception ex)
            {
                GuiUtility.ShowFlyoutMessage(windowsUIViewMain, flyoutMessage, "Ошибка", ex.Message + "\n" + ex.InnerException ?? ex.InnerException.Message, FlyoutCommand.OK);
                Logger.Error(ex.Message);
                Logger.Error(ex.StackTrace);
                e.Control = new Control();
            }
        }
Exemple #17
0
 void tabbedView1_QueryControl(object sender, QueryControlEventArgs e)
 {
     e.Control = new Control();
 }