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