Exemplo n.º 1
0
    protected void Button1_Click(object sender, EventArgs e)

    {
        //设置参数
        Dictionary <string, object> para = new  Dictionary <string, object>();
        CrowdTask task = new CrowdTask(TextBox1.Text, TextBox2.Text);

        para.Add("task", task);

        //启动工作流
        WorkflowApplication crowdsourcing = new WorkflowApplication(new mainTask1(), para);

        task.taskType = TaskType.mainTask;
        crowdsourcing.Run();
        task.taskWorkflowId = crowdsourcing.Id.ToString();
        try
        {
            crowdTaskService = new CrowdTaskService();
            int result = crowdTaskService.insert(task);
            if (result == 1)
            {
                //插入成功,保存对应的工作流实例
                MyWorkflowInstance.setWorkflowApplication(crowdsourcing.Id.ToString(), crowdsourcing);
                crowdTaskService.mainTaskSetCrowdTaskMainTaskIdByWorkflowId(crowdsourcing.Id.ToString());
                Server.Transfer("viewMyTask.aspx?workflowId=" + task.taskWorkflowId);
            }
        }
        catch (Exception exception)
        {
            throw exception;
        }
    }
    protected void Button1_Click(object sender, EventArgs e)

    {
     
           //设置参数
            Dictionary<string,object> para=new  Dictionary<string, object>();
            CrowdTask task = new CrowdTask(TextBox1.Text,TextBox2.Text);
            para.Add("task", task);

            //启动工作流
           WorkflowApplication crowdsourcing = new WorkflowApplication(new mainTask1(),para);
           task.taskType= TaskType.mainTask;
           crowdsourcing.Run();
           task.taskWorkflowId = crowdsourcing.Id.ToString();
           try
           {
               crowdTaskService = new CrowdTaskService();
               int result = crowdTaskService.insert(task);
               if(result==1){
                   //插入成功,保存对应的工作流实例
                   MyWorkflowInstance.setWorkflowApplication(crowdsourcing.Id.ToString(),crowdsourcing);
                   crowdTaskService.mainTaskSetCrowdTaskMainTaskIdByWorkflowId(crowdsourcing.Id.ToString());
                   Server.Transfer("viewMyTask.aspx?workflowId=" + task.taskWorkflowId);
               }
           }
           catch (Exception exception)
           {
               throw exception ;
           }
          
        
    }
Exemplo n.º 3
0
        public void startDevideVotingProcess(Dictionary <string, ArrayList> solutionTasks)
        {
            //创建输入参数
            Dictionary <string, object> para = new Dictionary <string, object>();

            para.Add("solutionTasks", solutionTasks);

            //创建实例对象
            WorkflowApplication currentWorkflowInstance = new WorkflowApplication(new decomposeVoting(), para);

            //委托流程结束时候调用的方法
            currentWorkflowInstance.Completed = new Action <WorkflowApplicationCompletedEventArgs>(DevideVotingWorkflowCompleted);

            //启动实例
            currentWorkflowInstance.Run();

            CrowdTaskService crowdTaskService = new CrowdTaskService();
            //分解任务
            CrowdTask divideTask = crowdTaskService.findCrowdTaskByWorkflowId(solutionTasks.First().Key);


            CrowdTask crowdTask = new CrowdTask();

            crowdTask.taskName        = divideTask.taskName;
            crowdTask.taskDescription = divideTask.taskDescription;
            crowdTask.taskType        = TaskType.decomposeVotingTask;

            crowdTask.taskWorkflowId = currentWorkflowInstance.Id.ToString();

            crowdTask.taskParentWorkflowId = crowdTaskService.findCrowdTaskByWorkflowId(solutionTasks.Keys.First().ToString()).taskParentWorkflowId;


            int result = crowdTaskService.insert(crowdTask);

            //更新每个实例的主工作流Id
            crowdTaskService.updateCrowdTaskMainTaskIdByWorkflowId(currentWorkflowInstance.Id.ToString());


            if (result == 1)
            {
                //将当前实例加入到分解任务集合中
                MyWorkflowInstance.setDecomposeVotingWorkflowApplication(currentWorkflowInstance.Id.ToString(), currentWorkflowInstance);
            }
        }
Exemplo n.º 4
0
        public void startSubDivideProcess(Guid parentWorkflowId, CrowdTask task)
        {
            //创建输入参数
            Dictionary <string, object> para = new Dictionary <string, object>();

            CrowdTask crowdTask = new CrowdTask();

            crowdTask.taskName             = task.taskName;
            crowdTask.taskDescription      = task.taskDescription;
            crowdTask.taskParentWorkflowId = parentWorkflowId.ToString();
            crowdTask.taskType             = TaskType.decomposeTask;

            para.Add("parentWorkflowId", parentWorkflowId);
            para.Add("task", crowdTask);
            //创建实例对象
            WorkflowApplication currentWorkflowInstance = new WorkflowApplication(new decompose(), para);

            //委托流程结束时候调用的方法
            currentWorkflowInstance.Completed = new Action <WorkflowApplicationCompletedEventArgs>(SubDivideWorkflowCompleted);

            //启动实例
            currentWorkflowInstance.Run();

            //继续绑定crowdTask 参数
            crowdTask.taskWorkflowId = currentWorkflowInstance.Id.ToString();

            //将这个任务插入到到数据库

            CrowdTaskService crowdTaskService = new CrowdTaskService();
            int result = crowdTaskService.insert(crowdTask);

            //更新每个实例的主工作流Id
            crowdTaskService.updateCrowdTaskMainTaskIdByWorkflowId(currentWorkflowInstance.Id.ToString());

            if (result == 1)
            {
                //将当前实例加入到分解任务集合中
                MyWorkflowInstance.setDecomposeWorkflowApplication(currentWorkflowInstance.Id.ToString(), currentWorkflowInstance);
            }
        }
Exemplo n.º 5
0
        public void startSolveVoteProcess(Dictionary <string, SolveResult> solveResutDic)
        {
            //开启解决投票实例
            //创建输入参数
            Dictionary <string, object> para = new Dictionary <string, object>();

            para.Add("sovleResultDic", solveResutDic);

            //创建实例对象
            WorkflowApplication currentWorkflowInstance = new WorkflowApplication(new solveVoting(), para);

            //委托流程结束时候调用的方法
            currentWorkflowInstance.Completed = new Action <WorkflowApplicationCompletedEventArgs>(solveVotingWorkflowCompleted);

            //启动实例
            currentWorkflowInstance.Run();

            CrowdTaskService crowdTaskService = new CrowdTaskService();



            CrowdTask crowdTask = new CrowdTask();

            crowdTask.taskName        = solveResutDic.Values.First().taskName;
            crowdTask.taskDescription = solveResutDic.Values.First().taskDescription;
            crowdTask.taskType        = TaskType.solveVotingTask;
            crowdTask.taskWorkflowId  = currentWorkflowInstance.Id.ToString();

            int result = crowdTaskService.insert(crowdTask);

            //更新每个实例的主工作流Id
            crowdTaskService.updateCrowdTaskMainTaskIdByWorkflowId(currentWorkflowInstance.Id.ToString());

            if (result == 1)
            {
                //将当前实例加入到分解任务集合中
                MyWorkflowInstance.setSolveVotingWorkflowApplication(currentWorkflowInstance.Id.ToString(), currentWorkflowInstance);
            }
        }
        public void startSubDivideProcess(Guid parentWorkflowId,CrowdTask task)
        {
            //创建输入参数
           Dictionary<string, object> para = new Dictionary<string, object>();
           
            CrowdTask crowdTask = new CrowdTask();
            crowdTask.taskName = task.taskName;
            crowdTask.taskDescription = task.taskDescription;
            crowdTask.taskParentWorkflowId=parentWorkflowId.ToString();
            crowdTask.taskType = TaskType.decomposeTask;
            
            para.Add("parentWorkflowId", parentWorkflowId);
            para.Add("task", crowdTask);
            //创建实例对象
             WorkflowApplication  currentWorkflowInstance = new WorkflowApplication(new decompose(), para);

            //委托流程结束时候调用的方法
             currentWorkflowInstance.Completed = new Action<WorkflowApplicationCompletedEventArgs>(SubDivideWorkflowCompleted);

            //启动实例
            currentWorkflowInstance.Run();

            //继续绑定crowdTask 参数
            crowdTask.taskWorkflowId = currentWorkflowInstance.Id.ToString();
            
            //将这个任务插入到到数据库

            CrowdTaskService crowdTaskService = new CrowdTaskService();
            int result = crowdTaskService.insert(crowdTask);

            //更新每个实例的主工作流Id
            crowdTaskService.updateCrowdTaskMainTaskIdByWorkflowId(currentWorkflowInstance.Id.ToString());

            if (result == 1)
            {
                //将当前实例加入到分解任务集合中
                MyWorkflowInstance.setDecomposeWorkflowApplication(currentWorkflowInstance.Id.ToString(), currentWorkflowInstance);
            }
        }
        public  void startSolveVoteProcess(Dictionary<string, SolveResult> solveResutDic)
        {
            //开启解决投票实例
            //创建输入参数
            Dictionary<string, object> para = new Dictionary<string, object>();
            para.Add("sovleResultDic", solveResutDic);

            //创建实例对象
            WorkflowApplication currentWorkflowInstance = new WorkflowApplication(new solveVoting(), para);

            //委托流程结束时候调用的方法
            currentWorkflowInstance.Completed = new Action<WorkflowApplicationCompletedEventArgs>(solveVotingWorkflowCompleted);

            //启动实例
            currentWorkflowInstance.Run();

            CrowdTaskService crowdTaskService = new CrowdTaskService();

          

            CrowdTask crowdTask = new CrowdTask();
            crowdTask.taskName =  solveResutDic.Values.First().taskName;
            crowdTask.taskDescription = solveResutDic.Values.First().taskDescription;
            crowdTask.taskType = TaskType.solveVotingTask;
            crowdTask.taskWorkflowId = currentWorkflowInstance.Id.ToString();

            int result = crowdTaskService.insert(crowdTask);
            //更新每个实例的主工作流Id
            crowdTaskService.updateCrowdTaskMainTaskIdByWorkflowId(currentWorkflowInstance.Id.ToString());

            if (result == 1)
            {
                //将当前实例加入到分解任务集合中
                MyWorkflowInstance.setSolveVotingWorkflowApplication(currentWorkflowInstance.Id.ToString(), currentWorkflowInstance);
            }
        }
        public void startDevideVotingProcess(Dictionary<string, ArrayList> solutionTasks)
        {
            //创建输入参数
            Dictionary<string, object> para = new Dictionary<string, object>();
            para.Add("solutionTasks", solutionTasks);

            //创建实例对象
            WorkflowApplication  currentWorkflowInstance = new WorkflowApplication(new decomposeVoting(), para);

            //委托流程结束时候调用的方法
            currentWorkflowInstance.Completed = new Action<WorkflowApplicationCompletedEventArgs>(DevideVotingWorkflowCompleted);

            //启动实例
            currentWorkflowInstance.Run();

            CrowdTaskService crowdTaskService = new CrowdTaskService();
            //分解任务
            CrowdTask divideTask = crowdTaskService.findCrowdTaskByWorkflowId(solutionTasks.First().Key);

         
            CrowdTask crowdTask = new CrowdTask();
            crowdTask.taskName = divideTask.taskName;
            crowdTask.taskDescription = divideTask.taskDescription;
            crowdTask.taskType = TaskType.decomposeVotingTask;

            crowdTask.taskWorkflowId = currentWorkflowInstance.Id.ToString();

            crowdTask.taskParentWorkflowId = crowdTaskService.findCrowdTaskByWorkflowId(solutionTasks.Keys.First().ToString()).taskParentWorkflowId;


            int result = crowdTaskService.insert(crowdTask);

            //更新每个实例的主工作流Id
            crowdTaskService.updateCrowdTaskMainTaskIdByWorkflowId(currentWorkflowInstance.Id.ToString());


            if (result == 1)
            {
                //将当前实例加入到分解任务集合中
                MyWorkflowInstance.setDecomposeVotingWorkflowApplication(currentWorkflowInstance.Id.ToString(), currentWorkflowInstance);
            }
        }