//get job data
        public Job OpenJob(int JobId)
        {
            JobsManager JM  = WorkflowModule.GetManager <JobsManager>("");
            var         ret = JM.GetJob(JobId);

            return(ret);
        }
        //get pre-defined query
        public QueryResult GetJobs()
        {
            JobsManager JM  = WorkflowModule.GetManager <JobsManager>("");
            var         ret = JM.ExecuteQuery(QueryName);

            return(ret);
        }
        public IReadOnlyList <GroupInfo> GetGroups()
        {
            ConfigurationManager CM = WorkflowModule.GetManager <ConfigurationManager>("");
            var ret = CM.GetAllGroups();

            return(ret);
        }
Пример #4
0
        //get job data
        public async Task <Job> OpenJobAsync(string JobId)
        {
            var wfCon = await WorkflowModule.ConnectAsync();

            JobsManager JM  = wfCon.GetManager <JobsManager>();
            var         ret = JM.GetJob(JobId);

            return(ret);
        }
Пример #5
0
        //get pre-defined query
        public async Task <QueryResult> GetJobsAsync()
        {
            var wfCon = await WorkflowModule.ConnectAsync();

            JobsManager JM  = wfCon.GetManager <JobsManager>();
            var         ret = JM.ExecuteQuery(QueryName);

            return(ret);
        }
Пример #6
0
        public async Task <IReadOnlyList <GroupInfo> > GetGroupsAsync()
        {
            var wfCon = await WorkflowModule.ConnectAsync();

            ConfigurationManager CM = wfCon.GetManager <ConfigurationManager>();
            var ret = CM.GetAllGroups();

            return(ret);
        }
Пример #7
0
        public static async Task GetJobTypesAsync()
        {
            #region How to get job types

            // GetVisibleJobTypes returns a list of job types
            var wfCon = await WorkflowModule.ConnectAsync();

            var configManager = wfCon.GetManager <ConfigurationManager>();
            var jobTypes      = configManager.GetVisibleJobTypes();
            #endregion
        }
Пример #8
0
        public static async Task GetUsersAsync()
        {
            #region How to get users

            // GetAllUsers returns a list of Workflow Manager users
            var wfCon = await WorkflowModule.ConnectAsync();

            var configManager = wfCon.GetManager <ConfigurationManager>();
            var allUsers      = configManager.GetAllUsers();
            #endregion
        }
Пример #9
0
        public static async Task CreateJobAsync(string jobTypeID)
        {
            #region How to create a job

            // CreateJob returns an ID of a new job
            // it is a passed a valid job type ID as an integer
            var wfCon = await WorkflowModule.ConnectAsync();

            var jobManager = wfCon.GetManager <JobsManager>();
            var jobID      = jobManager.CreateNewJob(jobTypeID);
            #endregion
        }
Пример #10
0
        public static async Task GetManagerObjectsAsync()
        {
            #region How to get managers objects

            // WorkflowModule.GetManager returns a manager of the type specified
            // keyword is currently just an empty string
            var wfCon = await WorkflowModule.ConnectAsync();

            var jobManager    = wfCon.GetManager <JobsManager>();
            var configManager = wfCon.GetManager <ConfigurationManager>();
            #endregion
        }
Пример #11
0
        public static async Task ExecuteQueryAsync()
        {
            #region How to execute a Query

            // ExecuteQuery returns a query result
            // Its passed either an ID or a name
            var wfCon = await WorkflowModule.ConnectAsync();

            var jobManager        = wfCon.GetManager <JobsManager>();
            var queryResultReturn = jobManager.ExecuteQuery("All Jobs");
            #endregion
        }
Пример #12
0
        public static async Task CloseJobAsync(IReadOnlyList <string> jobIdsToClose)
        {
            #region How to close a job

            // CloseJobs returns a list of closed job IDs
            // it is passed a list of job IDs to close
            var wfCon = await WorkflowModule.ConnectAsync();

            var jobManager = wfCon.GetManager <JobsManager>();
            var jobIDs     = jobManager.CloseJobs(jobIdsToClose);
            #endregion
        }
Пример #13
0
        public static async Task GetJobAsync(string jobID)
        {
            #region How to get a job

            // GetJob returns an existing job
            // it is passed a valid job ID as an integer
            var wfCon = await WorkflowModule.ConnectAsync();

            var jobManager = wfCon.GetManager <JobsManager>();
            var job        = jobManager.GetJob(jobID);
            #endregion
        }
Пример #14
0
        public static async Task AccessJobChangeItAsync(string jobID)
        {
            #region How to access job info and change it

            // You can change many of the exposed properties of a job and then save them
            var wfCon = await WorkflowModule.ConnectAsync();

            var jobManager = wfCon.GetManager <JobsManager>();
            var job        = jobManager.GetJob(jobID);
            job.Description = "This is a test";
            job.Save();
            #endregion
        }
        //create a job based off a pre-defined job type
        //then assigned it to the specified owner
        public int CreateJob(OwnerComboBoxItem owner)
        {
            JobsManager JM  = WorkflowModule.GetManager <JobsManager>("");
            var         ret = JM.CreateJob(JobTypeID);
            var         job = JM.GetJob(ret);

            if (owner != null)
            {
                job.AssignedTo   = owner.AssignedTo;
                job.AssignedType = owner.AssignmentType;
            }
            job.Save();
            return(ret);
        }
Пример #16
0
        public static async Task GetJobAsync(Map map)
        {
            #region How to get a job associated with a map

            // Get a job associated with the map
            var wfCon = await WorkflowModule.ConnectAsync();

            var jobManager = wfCon.GetManager <JobsManager>();
            var job        = jobManager.GetJob(map);
            if (job != null)
            {
                // Job found, do something with the job
                var jobId = job.ID;
            }
            #endregion
        }
Пример #17
0
        //create a job based off a pre-defined job type
        //then assigned it to the specified owner
        public async Task <string> CreateJobAsync(OwnerComboBoxItem owner)
        {
            var wfCon = await WorkflowModule.ConnectAsync();

            JobsManager JM  = wfCon.GetManager <JobsManager>();
            var         ret = JM.CreateNewJob(JobTypeID.ToString());
            var         job = JM.GetJob(ret);

            if (owner != null && job.CurrentStepInfo?.Count > 0)
            {
                job.CurrentStepInfo[0].AssignedTo   = owner.AssignedTo;
                job.CurrentStepInfo[0].AssignedType = owner.AssignmentType;
            }
            job.Save();
            return(ret);
        }
Пример #18
0
        public static async void ExecuteStepOnJobAsync(string jobID)
        {
            #region How to Execute a step on a job

            // Gets the current step
            // checks to see if it can execute it
            // proceeds to do so if it can
            var wfCon = await WorkflowModule.ConnectAsync();

            var    jobManager = wfCon.GetManager <JobsManager>();
            var    job        = jobManager.GetJob(jobID);
            string stepID     = job.GetCurrentSteps().First();
            if (job.CanExecuteStep(stepID).Item1)
            {
                job.ExecuteStep(stepID);
            }
            #endregion
        }
Пример #19
0
        private void Start_(string connectionString, string applicationName)
        {
            ServerApplication serverApplication = new ServerApplication();

            serverApplication.ApplicationName = applicationName;
            serverApplication.Modules.Add(new WorkflowDemoEFModule());
            serverApplication.ConnectionString = connectionString;
            WorkflowModule workflowModule = serverApplication.Modules.FindModule <WorkflowModule>();

            serverApplication.Setup();
            serverApplication.Logon();

            IObjectSpaceProvider objectSpaceProvider = serverApplication.ObjectSpaceProvider;

            server = new WorkflowServer("http://localhost:46232", objectSpaceProvider, objectSpaceProvider);
            server.StartWorkflowListenerService.DelayPeriod      = TimeSpan.FromSeconds(10);
            server.StartWorkflowByRequestService.DelayPeriod     = TimeSpan.FromSeconds(10);
            server.RefreshWorkflowDefinitionsService.DelayPeriod = TimeSpan.FromSeconds(15);
            server.CustomizeHost += delegate(object sender, CustomizeHostEventArgs e) {
                //    // NOTE: Uncomment this section to use alternative workflow configuration.
                //    //
                //    // SqlWorkflowInstanceStoreBehavior
                //    //
                //    //e.WorkflowInstanceStoreBehavior = null;
                //    //System.ServiceModel.Activities.Description.SqlWorkflowInstanceStoreBehavior sqlWorkflowInstanceStoreBehavior = new System.ServiceModel.Activities.Description.SqlWorkflowInstanceStoreBehavior("Integrated Security=SSPI;Pooling=false;Data Source=(local);Initial Catalog=WorkflowsStore");
                //    //sqlWorkflowInstanceStoreBehavior.RunnableInstancesDetectionPeriod = TimeSpan.FromSeconds(2);
                //    //e.Host.Description.Behaviors.Add(sqlWorkflowInstanceStoreBehavior);
                //e.WorkflowIdleBehavior.TimeToPersist = TimeSpan.FromSeconds(10);
                e.WorkflowIdleBehavior.TimeToUnload = TimeSpan.FromSeconds(10);
                e.WorkflowInstanceStoreBehavior.WorkflowInstanceStore.RunnableInstancesDetectionPeriod = TimeSpan.FromSeconds(1);
            };

            server.CustomHandleException += delegate(object sender, CustomHandleServiceExceptionEventArgs e) {
                Tracing.Tracer.LogError(e.Exception);
                if (OnCustomHandleException_ != null)
                {
                    OnCustomHandleException_(this, new ExceptionEventArgs("Exception occurs:\r\n\r\n" + e.Exception.Message + "\r\n\r\n'" + e.Service.GetType().FullName + "' service"));
                }
                e.Handled = true;
            };
            server.Start();
        }
Пример #20
0
        private void InitializeComponent()
        {
            _module1                         = new SystemModule();
            _module2                         = new SystemAspNetModule();
            _module5                         = new ValidationModule();
            _module6                         = new BusinessClassLibraryCustomizationModule();
            _securityModule1                 = new SecurityModule();
            _sqlConnection1                  = new SqlConnection();
            _securityComplex1                = new SecurityStrategyComplex();
            _authenticationStandard1         = new XpandAuthenticationStandard();
            _featureCenterModule1            = new FeatureCenterModule();
            _cloneObjectModule1              = new CloneObjectModule();
            _viewVariantsModule1             = new ViewVariantsModule();
            _pivotChartModuleBase1           = new PivotChartModuleBase();
            _scriptRecorderModuleBase1       = new ScriptRecorderModuleBase();
            _featureCenterAspNetModule1      = new FeatureCenterAspNetModule();
            _pivotChartAspNetModule1         = new PivotChartAspNetModule();
            _fileAttachmentsAspNetModule1    = new FileAttachmentsAspNetModule();
            _conditionalAppearanceModule1    = new ConditionalAppearanceModule();
            _kpiModule1                      = new KpiModule();
            _workflowModule1                 = new WorkflowModule();
            _htmlPropertyEditorAspNetModule1 = new HtmlPropertyEditorAspNetModule();
            _treeListEditorsAspNetModule1    = new TreeListEditorsAspNetModule();
            _schedulerModuleBase1            = new SchedulerModuleBase();
            _schedulerAspNetModule1          = new SchedulerAspNetModule();
            _stateMachineModule1             = new StateMachineModule();
            _treeListEditorsModuleBase2      = new TreeListEditorsModuleBase();
            ((ISupportInitialize)this).BeginInit();
            //
            // module5
            //
            _module5.AllowValidationDetailsAccess     = true;
            _module5.IgnoreWarningAndInformationRules = false;
            //
            // securityModule1
            //
            _securityModule1.UserType = typeof(SecuritySystemUser);
            //
            // sqlConnection1
            //
            _sqlConnection1.ConnectionString =
                "Data Source=(local);Initial Catalog=XpandFeatureCenter;Integrated Security=SSPI;P" +
                "ooling=false";
            _sqlConnection1.FireInfoMessageEventOnUserErrors = false;
            //
            // securityComplex1
            //
            _securityComplex1.Authentication = _authenticationStandard1;
            _securityComplex1.RoleType       = typeof(XpandRole);
            _securityComplex1.UserType       = typeof(SecuritySystemUser);
            //
            // authenticationStandard1
            //
            _authenticationStandard1.LogonParametersType = typeof(XpandLogonParameters);
            //
            // viewVariantsModule1
            //
            _viewVariantsModule1.FrameVariantsEngine = null;
            _viewVariantsModule1.VariantsProvider    = null;
            //
            // pivotChartModuleBase1
            //
            _pivotChartModuleBase1.ShowAdditionalNavigation = false;
            //
            // workflowModule1
            //
            _workflowModule1.RunningWorkflowInstanceInfoType   = typeof(XpoRunningWorkflowInstanceInfo);
            _workflowModule1.StartWorkflowRequestType          = typeof(XpoStartWorkflowRequest);
            _workflowModule1.UserActivityVersionType           = typeof(XpoUserActivityVersion);
            _workflowModule1.WorkflowControlCommandRequestType = typeof(XpoWorkflowInstanceControlCommandRequest);
            _workflowModule1.WorkflowDefinitionType            = typeof(XpoWorkflowDefinition);
            _workflowModule1.WorkflowInstanceKeyType           = typeof(XpoInstanceKey);
            _workflowModule1.WorkflowInstanceType = typeof(XpoWorkflowInstance);
            //
            // reportsModule1
            //

            //
            // stateMachineModule1
            //
            _stateMachineModule1.StateMachineStorageType = typeof(XpoStateMachine);
            //
            // FeatureCenterAspNetApplication
            //
            ApplicationName = "FeatureCenter";
            Connection      = _sqlConnection1;
            Modules.Add(_module1);
            Modules.Add(_module2);
            Modules.Add(_module5);
            Modules.Add(_module6);
            Modules.Add(_securityModule1);
            Modules.Add(_cloneObjectModule1);
            Modules.Add(_viewVariantsModule1);
            Modules.Add(_conditionalAppearanceModule1);
            Modules.Add(_pivotChartModuleBase1);
            Modules.Add(_scriptRecorderModuleBase1);
            Modules.Add(_kpiModule1);
            Modules.Add(_workflowModule1);
            Modules.Add(_stateMachineModule1);
            Modules.Add(_featureCenterModule1);
            Modules.Add(_pivotChartAspNetModule1);
            Modules.Add(_fileAttachmentsAspNetModule1);
            Modules.Add(_htmlPropertyEditorAspNetModule1);

            Modules.Add(_treeListEditorsModuleBase2);
            Modules.Add(_treeListEditorsAspNetModule1);
            Modules.Add(_schedulerModuleBase1);
            Modules.Add(_schedulerAspNetModule1);
            Modules.Add(_featureCenterAspNetModule1);
            Security = _securityComplex1;
            DatabaseVersionMismatch += AspNetApplicationDatabaseVersionMismatch;
            ((ISupportInitialize)this).EndInit();
        }
Пример #21
0
        public WorkFlowVCModel(string id, WorkflowModule workflowModule, string parentTitle, List <WorkflowFormField> externalFormFields, IJsonSerializer jsonSerializer)
        {
            Id             = id;
            ParentTitle    = parentTitle;
            WorkflowModule = workflowModule;
            Form.FormFields.AddRange(externalFormFields);

            List <ActionNotificationSetting> actionNotificationSettings = new List <ActionNotificationSetting>();

            actionNotificationSettings.Add(new ActionNotificationSetting()
            {
                Action = ActionType.Start
            });
            actionNotificationSettings.Add(new ActionNotificationSetting()
            {
                Action = ActionType.Successful
            });
            actionNotificationSettings.Add(new ActionNotificationSetting()
            {
                Action = ActionType.Failed
            });
            actionNotificationSettings.Add(new ActionNotificationSetting()
            {
                Action = ActionType.Deligated
            });
            actionNotificationSettings.Add(new ActionNotificationSetting()
            {
                Action = ActionType.Edit
            });

            Notifications.ActionNotificationSettings = actionNotificationSettings;

            #region GridsConfigs
            List <object> ApprovalRouteCommands = new List <object>();
            ApprovalRouteCommands.Add(new { type = "Delete", buttonOption = new { iconCss = "e-icons e-delete", cssClass = "e-flat e-DeleteButton" } });
            ApprovalRouteCommands.Add(new { type = "Cancel", buttonOption = new { iconCss = "e-icons e-cancel-icon", cssClass = "e-flat" } });
            ApprovalRouteCommands.Add(new { type = "Save", buttonOption = new { iconCss = "e-icons e-update", cssClass = "e-flat" } });
            ApprovalRouteCommands.Add(new { type = "MoveUp", buttonOption = new { iconCss = "e-icons e-c-moveup", cssClass = "e-flat" } });
            ApprovalRouteCommands.Add(new { type = "MoveDown", buttonOption = new { iconCss = "e-icons e-c-movedown", cssClass = "e-flat" } });
            ApprovalRouteCommands.Add(new { type = "Edit", buttonOption = new { iconCss = "e-icons e-edit", cssClass = "e-flat" } });

            ApprovalRouteGridColumns = new List <GridColumn>()
            {
                new GridColumn {
                    Field = "id", Visible = false, ShowInColumnChooser = false, IsPrimaryKey = true
                },
                new GridColumn {
                    Field = "apId", Visible = false, ShowInColumnChooser = false
                },
                new GridColumn {
                    Field = "routeIndex", Visible = false, HeaderText = "Route Index", TextAlign = TextAlign.Center, MinWidth = "10"
                },
                new GridColumn {
                    Field = "active", AllowSorting = false, AutoFit = true, HeaderText = "Active", EditType = "booleanEdit", DisplayAsCheckBox = true, TextAlign = TextAlign.Center, MinWidth = "10"
                },
                new GridColumn {
                    Field = "notifyEmployee", AllowSorting = false, AutoFit = true, HeaderText = "Notify", EditType = "booleanEdit", DisplayAsCheckBox = true, TextAlign = TextAlign.Center, MinWidth = "10"
                },
                new GridColumn {
                    Field = "isPoster", AllowSorting = false, AutoFit = true, HeaderText = "Allow Posting", EditType = "booleanEdit", DisplayAsCheckBox = true, TextAlign = TextAlign.Center, MinWidth = "10"
                },
                new GridColumn {
                    Field = "getAllDepartmentNames", AllowSorting = false, AutoFit = true, HeaderText = "Department", AllowEditing = false, TextAlign = TextAlign.Center, MinWidth = "10"
                },
                new GridColumn {
                    Field = "getAllPositionTitles", AllowSorting = false, AutoFit = true, HeaderText = "Position", AllowEditing = false, TextAlign = TextAlign.Center, MinWidth = "10"
                },
                new GridColumn {
                    Field = "getAllEmployeeNames", AllowSorting = false, AutoFit = true, HeaderText = "Employee", AllowEditing = false, TextAlign = TextAlign.Center, MinWidth = "10"
                },
                new GridColumn {
                    Width = "50", HeaderText = "Actions", TextAlign = TextAlign.Center, MinWidth = "10", Commands = ApprovalRouteCommands
                }
            };

            List <object> TasksCommands = new List <object>();
            TasksCommands.Add(new { type = "Delete", buttonOption = new { iconCss = "e-icons e-delete", cssClass = "e-flat e-DeleteButton" } });
            TasksCommands.Add(new { type = "Cancel", buttonOption = new { iconCss = "e-icons e-cancel-icon", cssClass = "e-flat" } });
            TasksCommands.Add(new { type = "Save", buttonOption = new { iconCss = "e-icons e-update", cssClass = "e-flat" } });
            TasksCommands.Add(new { type = "MoveUp", buttonOption = new { iconCss = "e-icons e-c-moveup", cssClass = "e-flat" } });
            TasksCommands.Add(new { type = "MoveDown", buttonOption = new { iconCss = "e-icons e-c-movedown", cssClass = "e-flat" } });
            TasksCommands.Add(new { type = "Edit", buttonOption = new { iconCss = "e-icons e-edit", cssClass = "e-flat" } });

            TasksGridColumns = new List <GridColumn>()
            {
                new GridColumn {
                    Field = "id", Visible = false, ShowInColumnChooser = false, IsPrimaryKey = true
                },
                new GridColumn {
                    Field = "routeIndex", Visible = false, HeaderText = "Route Index", TextAlign = TextAlign.Center, MinWidth = "10"
                },
                new GridColumn {
                    Field = "active", AllowSorting = false, AutoFit = true, HeaderText = "Active", EditType = "booleanEdit", DisplayAsCheckBox = true, TextAlign = TextAlign.Center, MinWidth = "10"
                },
                new GridColumn {
                    Field = "notifyEmployee", AllowSorting = false, AutoFit = true, HeaderText = "Notify", EditType = "booleanEdit", DisplayAsCheckBox = true, TextAlign = TextAlign.Center, MinWidth = "10"
                },
                new GridColumn {
                    Field = "getAllDepartmentNames", AllowSorting = false, AutoFit = true, HeaderText = "Department", AllowEditing = false, TextAlign = TextAlign.Center, MinWidth = "10"
                },
                new GridColumn {
                    Field = "getAllPositionTitles", AllowSorting = false, AutoFit = true, HeaderText = "Position", AllowEditing = false, TextAlign = TextAlign.Center, MinWidth = "10"
                },
                new GridColumn {
                    Field = "getAllEmployeeNames", AllowSorting = false, AutoFit = true, HeaderText = "Employee", AllowEditing = false, TextAlign = TextAlign.Center, MinWidth = "10"
                },
                new GridColumn {
                    Field = "taskDescription", AllowSorting = false, AutoFit = true, HeaderText = "Description", TextAlign = TextAlign.Center, MinWidth = "10"
                },
                new GridColumn {
                    Width = "50", HeaderText = "Actions", TextAlign = TextAlign.Center, MinWidth = "10", Commands = TasksCommands
                }
            };

            APTasksGridColumns = new List <GridColumn>()
            {
                new GridColumn {
                    Field = "id", Visible = false, ShowInColumnChooser = false, IsPrimaryKey = true
                },
                new GridColumn {
                    Field = "apId", Visible = false, ShowInColumnChooser = false
                },
                new GridColumn {
                    Field = "routeIndex", Visible = false, HeaderText = "Route Index", TextAlign = TextAlign.Center, MinWidth = "10"
                },
                new GridColumn {
                    Field = "active", AllowSorting = false, AutoFit = true, HeaderText = "Active", EditType = "booleanEdit", DisplayAsCheckBox = true, TextAlign = TextAlign.Center, MinWidth = "10"
                },
                new GridColumn {
                    Field = "notifyEmployee", AllowSorting = false, AutoFit = true, HeaderText = "Notify", EditType = "booleanEdit", DisplayAsCheckBox = true, TextAlign = TextAlign.Center, MinWidth = "10"
                },
                new GridColumn {
                    Field = "getAllDepartmentNames", AllowSorting = false, AutoFit = true, HeaderText = "Department", AllowEditing = false, TextAlign = TextAlign.Center, MinWidth = "10"
                },
                new GridColumn {
                    Field = "getAllPositionTitles", AllowSorting = false, AutoFit = true, HeaderText = "Position", AllowEditing = false, TextAlign = TextAlign.Center, MinWidth = "10"
                },
                new GridColumn {
                    Field = "getAllEmployeeNames", AllowSorting = false, AutoFit = true, HeaderText = "Employee", AllowEditing = false, TextAlign = TextAlign.Center, MinWidth = "10"
                },
                new GridColumn {
                    Field = "taskDescription", AllowSorting = false, AutoFit = true, HeaderText = "Description", TextAlign = TextAlign.Center, MinWidth = "10"
                },
            };

            APSecondaryDetailsGrid = new Grid()
            {
                DataSource   = new List <dynamic>(),
                QueryString  = "apId",
                EditSettings = new Syncfusion.EJ2.Grids.GridEditSettings()
                {
                },
                AllowExcelExport = true,
                //AllowGrouping = true,
                AllowPdfExport     = true,
                HierarchyPrintMode = HierarchyGridPrintMode.All,
                AllowSelection     = true,
                AllowFiltering     = false,
                AllowSorting       = true,
                AllowMultiSorting  = true,
                AllowResizing      = true,
                GridLines          = GridLine.Both,
                SearchSettings     = new GridSearchSettings()
                {
                },
                Columns = APTasksGridColumns
            };
            JsonSerializer = jsonSerializer;
            #endregion
        }
Пример #22
0
        protected override void OnStart(string[] args)
        {
            if (server == null)
            {
                ServerApplication serverApplication;

                try
                {
                    serverApplication = new ServerApplication();
                }
                catch (Exception)
                {
                    throw new Exception("Error i creating server application.");
                }

                try
                {
                    serverApplication.ApplicationName = "Tralus.Shell.WorkflowService";
                    // The service can only manage workflows for those business classes that are contained in Modules specified by the serverApplication.Modules collection.
                    // So, do not forget to add the required Modules to this collection via the serverApplication.Modules.Add method.
                    serverApplication.Modules.BeginInit();

                    var workflowModule = new WorkflowModule();

                    workflowModule.RunningWorkflowInstanceInfoType   = typeof(DevExpress.ExpressApp.Workflow.EF.EFRunningWorkflowInstanceInfo);
                    workflowModule.StartWorkflowRequestType          = typeof(DevExpress.ExpressApp.Workflow.EF.EFStartWorkflowRequest);
                    workflowModule.UserActivityVersionType           = typeof(DevExpress.ExpressApp.Workflow.Versioning.EFUserActivityVersion);
                    workflowModule.WorkflowControlCommandRequestType = typeof(DevExpress.ExpressApp.Workflow.EF.EFWorkflowInstanceControlCommandRequest);
                    workflowModule.WorkflowDefinitionType            = typeof(DevExpress.ExpressApp.Workflow.EF.EFWorkflowDefinition);
                    workflowModule.WorkflowInstanceKeyType           = typeof(DevExpress.Workflow.EF.EFInstanceKey);
                    workflowModule.WorkflowInstanceType = typeof(DevExpress.Workflow.EF.EFWorkflowInstance);

                    serverApplication.Modules.Add(workflowModule);
                    serverApplication.Modules.Add(new ShellModule());
                }
                catch (Exception ex)
                {
                    throw new Exception("Error in creating server", ex);
                }

                try
                {
                    IEnumerable <Type> loadedModuleTypes;
                    ReflectionHelper.GetImportedModules(out loadedModuleTypes, out _loadedContextTypes);

                    foreach (var loadedModuleType in loadedModuleTypes)
                    {
                        var loadedModule = (ModuleBase)Activator.CreateInstance(loadedModuleType);
                        serverApplication.Modules.Insert(0, loadedModule);
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception("Error in loading modules", ex);
                }


                try
                {
                    if (ConfigurationManager.ConnectionStrings["Default"] != null)
                    {
                        serverApplication.ConnectionString = ConfigurationManager.ConnectionStrings["Default"].ConnectionString;
                    }
                    serverApplication.Setup();
                    serverApplication.Logon();
                }
                catch (Exception ex)
                {
                    throw new Exception("Error in setting up.", ex);
                }

                try
                {
                    IObjectSpaceProvider objectSpaceProvider = serverApplication.ObjectSpaceProvider;

                    //WorkflowCreationKnownTypesProvider.AddKnownType(typeof(DevExpress.Xpo.Helpers.IdList));

                    try
                    {
                        server = new WorkflowServer("http://localhost:46232", objectSpaceProvider, objectSpaceProvider);
                    }
                    catch (Exception e)
                    {
                        throw new Exception("Error in creating WorkflowServer.", e);
                    }

                    try
                    {
                        server.StartWorkflowListenerService.DelayPeriod      = TimeSpan.FromSeconds(15);
                        server.StartWorkflowByRequestService.DelayPeriod     = TimeSpan.FromSeconds(15);
                        server.RefreshWorkflowDefinitionsService.DelayPeriod = TimeSpan.FromMinutes(15);
                    }
                    catch (Exception e)
                    {
                        throw new Exception(
                                  $"Error in configuring WorkflowServer. Server={server}, StartWorkflowListenerService={server.StartWorkflowListenerService}, StartWorkflowByRequestService={server.StartWorkflowByRequestService}, RefreshWorkflowDefinitionsService={server.RefreshWorkflowDefinitionsService}", e);
                    }

                    server.CustomizeHost += delegate(object sender, CustomizeHostEventArgs e)
                    {
                        e.WorkflowInstanceStoreBehavior.WorkflowInstanceStore.RunnableInstancesDetectionPeriod = TimeSpan.FromSeconds(15);
                    };

                    server.CustomHandleException += delegate(object sender, CustomHandleServiceExceptionEventArgs e)
                    {
                        Tracing.Tracer.LogError(e.Exception);
                        e.Handled = false;
                    };
                }
                catch (Exception ex)
                {
                    throw new Exception("Error in configuring server", ex);
                }
            }

            try
            {
                server.Start();
            }
            catch (Exception ex)
            {
                throw new Exception("Error in starting server", ex);
            }
        }
        static void Main(string[] arguments)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            EditModelPermission.AlwaysGranted = System.Diagnostics.Debugger.IsAttached;
            WorkflowDemoWindowsFormsApplication xafApplication = new WorkflowDemoWindowsFormsApplication();
            WorkflowModule workflowModule = xafApplication.Modules.FindModule <WorkflowModule>();

            workflowModule.WorkflowInstanceType    = null;
            workflowModule.WorkflowInstanceKeyType = null;

#if EASYTEST
            try {
                DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register();
            }
            catch (Exception) { }
#endif

            if (ConfigurationManager.ConnectionStrings["ConnectionString"] != null)
            {
                xafApplication.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            }
#if EASYTEST
            if (ConfigurationManager.ConnectionStrings["EasyTestConnectionString"] != null)
            {
                xafApplication.ConnectionString = ConfigurationManager.ConnectionStrings["EasyTestConnectionString"].ConnectionString;
            }
#endif
            xafApplication.Modules.FindModule <WorkflowWindowsFormsModule>().QueryAvailableActivities += delegate(object sender, ActivitiesInformationEventArgs e) {
                e.ActivitiesInformation.Add(new ActivityInformation(typeof(CreateTask), "Code Activities", "Create Task", ImageLoader.Instance.GetImageInfo("CreateTask").Image));
            };

            xafApplication.LastLogonParametersReading += new EventHandler <LastLogonParametersReadingEventArgs>(xafApplication_LastLogonParametersReading);
            WorkflowServerStarter starter = null;
            xafApplication.LoggedOn += delegate(object sender, LogonEventArgs e) {
                if (starter == null)
                {
                    starter = new WorkflowServerStarter();
                    starter.OnCustomHandleException += delegate(object sender1, ExceptionEventArgs args1) {
                        MessageBox.Show(args1.Message);
                    };

                    starter.Start(xafApplication.ConnectionString, xafApplication.ApplicationName);
                }
            };

            try
            {
                xafApplication.Setup();
                xafApplication.Start();
            }
            catch (Exception e)
            {
                xafApplication.HandleException(e);
            }

            if (starter != null)
            {
                starter.Stop();
            }
        }
Пример #24
0
        public async Task <IViewComponentResult> InvokeAsync(WorkflowModule WorkflowModule, string Id, string ParentTitle, List <WorkflowFormField> externalFormFields)
        {
            WorkFlowVCModel model = new WorkFlowVCModel(Id, WorkflowModule, ParentTitle, externalFormFields, JsonSerializer);

            return(View(model));
        }