Exemplo n.º 1
0
        public virtual void StartQualificationProcess()
        {
            Guid leadManagementProcessUId = (Guid)Terrasoft.Core.Configuration.SysSettings.GetValue(
                UserConnection, "LeadManagementProcess");
            ProcessSchema schema;

            if (leadManagementProcessUId.IsEmpty())
            {
                schema = UserConnection.ProcessSchemaManager.GetInstanceByName("LeadManagement");
            }
            else
            {
                schema = UserConnection.ProcessSchemaManager.GetInstanceByUId(leadManagementProcessUId);
            }
            bool canUseFlowEngine = ProcessSchemaManager.GetCanUseFlowEngine(UserConnection, schema);

            if (canUseFlowEngine)
            {
                var flowEngine = new FlowEngine(UserConnection);
                var param      = new Dictionary <string, string>();
                param["LeadId"] = Entity.Id.ToString();
                flowEngine.RunProcess(schema, param);
            }
            else
            {
                Process process = schema.CreateProcess(UserConnection);
                process.SetPropertyValue("LeadId", Entity.Id);
                process.Execute(UserConnection);
            }
        }
        public virtual void RunFlowEngineProcess(ProcessSchema processSchema, Dictionary <string, string> nameValueMap)
        {
            var flowEngine = new FlowEngine(UserConnection);

            flowEngine.RunProcess(processSchema, nameValueMap);
        }