public ArrayList findAllSolveCompeletedCrowdTaskByMainTaskId(string mainTaskId)
    {
        //  int result = 0;
        SqlCommand com = null;
        ArrayList list = new ArrayList();
        try
        {
            conn.Open();
            string sql = string.Format("select distinct taskName  from solveResult where mainTaskId='{0}'",mainTaskId);
            com = new SqlCommand(sql, conn);
            SqlDataReader dr = com.ExecuteReader();
            while (dr.Read())
            {
                    SolveResult solveResult = new SolveResult();
                    solveResult.taskName = dr["taskName"].ToString();
                /*
                    solveResult.taskDescription = dr["taskDescription"].ToString();
                    solveResult.taskWorkflowId = dr["workflow_id"].ToString();
                    solveResult.taskParentWorkflowId = dr["parent_workflow_id"].ToString();
                    solveResult.taskSolution = dr["solutions"].ToString();
                 * */
                    list.Add(solveResult);
            }
        }
        catch (Exception e)
        {
            throw e;
        }
        finally
        {
            if (com != null)
            {
                com.Dispose();
            }
            if (conn != null)
            {
                conn.Close();
            }

        }
        return list;
    }
 public ArrayList findSolveResultByTaskName(string taskName,string mainTaskId)
 {
     ArrayList al = new ArrayList();
     SqlCommand com = null;
     try
     {
         conn.Open();
         string sql = string.Format("select * from solveResult where taskName='{0}' and mainTaskId='{1}'", taskName,mainTaskId);
         com = new SqlCommand(sql, conn);
         SqlDataReader dr = com.ExecuteReader();
         while (dr.Read())
         {
             SolveResult solveResult = new SolveResult();
             solveResult.taskName = dr["taskName"].ToString();
             solveResult.taskDescription = dr["taskDescription"].ToString();
             solveResult.taskWorkflowId = dr["workflow_id"].ToString();
             solveResult.taskParentWorkflowId = dr["parent_workflow_id"].ToString();
             solveResult.taskSolution = dr["solutions"].ToString();
             solveResult.mainTaskId = dr["mainTaskId"].ToString();
             al.Add(solveResult);
         }
       
     }
     catch (Exception e)
     {
         throw e;
     }
     finally
     {
         if (com != null)
         {
             com.Dispose();
         }
         if (conn != null)
         {
             conn.Close();
         }
     }
     return al;
     
 }
    public SolveResult findSolveResultByTaskNameAndBestAnswer(string taskName, string mainTaskId)
    {
        SolveResult sr = new SolveResult();
        SqlCommand com = null;
        try
        {
            conn.Open();
            string sql = string.Format("select * from solveResult where taskName='{0}' and mainTaskId='{1}' and  bestAnswer='{2}'", taskName,mainTaskId,"yes");
            com = new SqlCommand(sql, conn);
            SqlDataReader dr = com.ExecuteReader();
            while (dr.Read())
            {

                sr.taskName = dr["taskName"].ToString();
                sr.taskDescription = dr["taskDescription"].ToString();
                sr.taskWorkflowId = dr["workflow_id"].ToString();
                sr.taskParentWorkflowId = dr["parent_workflow_id"].ToString();
                sr.taskSolution = dr["solutions"].ToString();
                sr.mainTaskId = dr["mainTaskId"].ToString();
               
            }
          
        }
        catch (Exception e)
        {
            throw e;
        }
        finally
        {
            if (com != null)
            {
                com.Dispose();
            }
            if (conn != null)
            {
                conn.Close();
            }
        }
        return sr;
        
    }