public void buildTree(ArrayList al, ResultNode[] rn,int parentId,int currentId)
    {
        
        for (int i = 0; i < al.Count; i++)
        {
            CrowdTask ctl = al[i] as CrowdTask;
            ArrayList  alist = findDecomposeResultByWorkflowIdAndVote(ctl.taskWorkflowId,ctl.mainTaskId);
            if (alist.Count != 0 )
            {
                int t = currentId;
                //记录下分解内rong
                for (int k=0;k<alist.Count;k++)
	            {
                    t++;
                    DecomposeResult dr = alist[k] as DecomposeResult;
                    rn[t].taskName =dr.taskName;
                    rn[t].parentId = parentId;
                    if (dr.simple == "yes")
                    {
                        rn[t].taskSolution = findSolveResultByTaskNameAndBestAnswer(dr.taskName,dr.mainTaskId).taskSolution;
                    }
                   
	            }
                int r = currentId;
                for (int k = 0; k < alist.Count; k++)
                {
                    DecomposeResult dr = alist[k] as DecomposeResult;
                   
                    if (dr.simple != "yes")
                    {
                        ArrayList klist = findCrowdTaskByParentWorkflowIdAndTaskTypeAndTaskName(dr.workflow_id, dr.taskName, TaskType.decomposeTask, dr.mainTaskId);
                        buildTree(klist, rn,k+currentId+1,currentId+alist.Count);
                    } 
                 
                }
              
            }

        }
    }
   public ResultNode[] getDivideTree(string workflow_id)
   {

       CrowdTask ct = findCrowdTaskByWorkflowId(workflow_id);

       ArrayList al = new ArrayList();

       al = findCrowdTaskByParentWorkflowIdAndTaskType(ct.taskWorkflowId, TaskType.decomposeTask, ct.mainTaskId);

       int count = findallDecomposeResultByVoted(ct.mainTaskId).Count;
       ResultNode[] rn = new ResultNode[count + 1];

       for (int j = 0; j < rn.Length; j++)
       {
           rn[j] = new ResultNode(null, null);
       }

       rn[0].taskName = ct.taskName;
       rn[0].parentId = rn.Length;

       //根据al里面的每个分解,去decomposeResult里面去寻找vote的东西。

       buildTree(al, rn, 0,0);

       return rn;

   }