protected void Page_Load(object sender, EventArgs e)
    {
        connectstr = Session["connectstr"].ToString();
        string PlatForm_connectstr = Session["PlatForm_connectstr"].ToString();

        if (connectstr != "")
        {
            string   sss      = "select * from ProjectTaskTree where Creator=" + Session["userID"].ToString() + " or Chargor=" + Session["userID"].ToString();
            string[] childIDs = new TreeJson().getChildID("ProjectTaskTree", connectstr, "ID", "ParentID", sss);
            string   IDs      = string.Join(",", childIDs);
            if (!string.IsNullOrEmpty(Request["limit"]))
            {
                limit = int.Parse(Request["limit"]);
            }
            if (!string.IsNullOrEmpty(Request["start"]))
            {
                start = int.Parse(Request["start"]);
            }
            if (string.IsNullOrEmpty(Request["OperateType"]))//如果没有传来的projectname的值就显示所有文档EmployeeList
            {
                sql = "Set ARITHABORT ON select top " + limit +
                      " TaskList.*,TaskState.TaskStateName,TaskDetailInf.value('(/Task/@StandardTaskID)[1]','int') as  TaskTemplateID,TaskDetailInf.value('(//TaskName)[1]','varchar(50)') as  TaskName,EmployeeList.人员名称 as CreatorName,P1.Name as ProjectName,P2.Name as PrjTaskTreeName from TaskList,TaskState,EmployeeList,ProjectTaskTree P1,ProjectTaskTree P2 where TaskID not in (select top " + start
                      + " TaskID from TaskList where BelongProjectTreeNode in (" + IDs + ") and TaskState=0 order by TaskCreateDate ) and TaskState=0 and TaskList.TaskState= TaskState.TaskStateID and TaskList.TaskCreator=EmployeeList.人员ID and TaskList.BelongProject=P1.ID and TaskList.BelongProjectTreeNode=P2.ID and  TaskList.BelongProjectTreeNode in (" + IDs + ") order by TaskCreateDate";
                getcountSql = "select  TaskID  from TaskList where BelongProjectTreeNode in (" + IDs + ") and TaskState=0";
            }
            else
            {
                TreeJson ss = new TreeJson();

                string filter = "";
                if (Request["StandardTaskID"] != null && !Request["StandardTaskID"].ToString().Equals(""))
                {
                    string[] tempIDs = ss.getChildID("StandardTask", PlatForm_connectstr, "StandardTaskID", "StandardTaskParentID", "select StandardTaskID from StandardTask where StandardTaskID=" + Request["StandardTaskID"].ToString());
                    filter += " and TaskDetailInf.value('(/Task/@StandardTaskID)[1]','int') in (" + string.Join(",", tempIDs) + ")";
                }
                if (Request["ProjectTaskID"] != null && !Request["ProjectTaskID"].ToString().Equals(""))
                {
                    string[] tempIDs = ss.getChildID("ProjectTaskTree", connectstr, "ID", "ParentID", "select ID from ProjectTaskTree where ID=" + Request["ProjectTaskID"].ToString());
                    filter += " and BelongProjectTreeNode in (" + string.Join(",", tempIDs) + ")";
                }
                if (Request["TaskName"] != null && !Request["TaskName"].ToString().Equals(""))
                {
                    filter += " and TaskDetailInf.value('(//TaskName)[1]','varchar(50)') like '%" + Request["TaskName"].ToString().Trim() + "%'";
                }

                sql = "Set ARITHABORT ON select " +
                      " TaskList.*,TaskState.TaskStateName,TaskDetailInf.value('(/Task/@StandardTaskID)[1]','int') as  TaskTemplateID,TaskDetailInf.value('(//TaskName)[1]','varchar(50)') as  TaskName,EmployeeList.人员名称 as CreatorName,P1.Name as ProjectName,P2.Name as PrjTaskTreeName " +
                      " from TaskList,EmployeeList,TaskState,ProjectTaskTree P1,ProjectTaskTree P2 where TaskList.TaskState= TaskState.TaskStateID and TaskList.TaskCreator=EmployeeList.人员ID and TaskList.BelongProject=P1.ID and TaskList.BelongProjectTreeNode=P2.ID and  TaskList.BelongProjectTreeNode in (" + IDs + ") " + filter + " order by TaskCreateDate";
                getcountSql = "Set ARITHABORT ON select  TaskID  from TaskList where BelongProjectTreeNode in (" + IDs + ") and TaskState=0 " + filter;
            }


            SQLToJson.ReaderSQLToJson.SetCount(getcountSql, connectstr);
            Response.Write(GetJsonStr(sql));

            Response.End();
            Response.Clear();
        }
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        connectstr = Session["connectstr"].ToString();
        string PlatForm_connectstr = Session["PlatForm_connectstr"].ToString();

        if (connectstr != "")
        {
            //  connectstr = "server=(local);Initial Catalog=" + connectstr + ";User ID=sa;Password=zju308;connect timeout=30";
            if (!string.IsNullOrEmpty(Request["limit"]))
            {
                limit = int.Parse(Request["limit"]);
            }
            if (!string.IsNullOrEmpty(Request["start"]))
            {
                start = int.Parse(Request["start"]);
            }
            if (string.IsNullOrEmpty(Request["OperateType"]))//如果没有传来的projectname的值就显示所有文档EmployeeList
            {
                sql = "select top " + limit +
                      " ApplyForService.*,UserInfor.userName,TaskDetailInf.value('(//TaskName)[1]','varchar(50)') as  TaskName,ServResource.资源名称 as ServiceName  from ApplyForService,UserInfor,TaskList,ServResource where ID not in (select top " + start
                      + " ID from ApplyForService) and  ApplyForService.ApplicantEntID*=UserInfor.UserID and  ApplyForService.TaskID*=TaskList.ID and  ApplyForService.ServiceID*=ServResource.资源编号";
                getcountSql = "select  ID  from ApplyForService";
            }
            else if (Request["OperateType"].Equals("search"))
            {
                TreeJson ss = new TreeJson();

                string filter = "";
                if (Request["StandardTaskID"] != null && !Request["StandardTaskID"].ToString().Equals(""))
                {
                    string[] tempIDs = ss.getChildID("StandardTask", PlatForm_connectstr, "StandardTaskID", "StandardTaskParentID", "select StandardTaskID from StandardTask where StandardTaskID=" + Request["StandardTaskID"].ToString());
                    filter += " and TaskDetailInf.value('(/Task/@StandardTaskID)[1]','int') in (" + string.Join(",", tempIDs) + ")";
                }
                if (Request["ProjectTaskID"] != null && !Request["ProjectTaskID"].ToString().Equals(""))
                {
                    string[] tempIDs = ss.getChildID("ProjectTaskTree", connectstr, "ID", "ParentID", "select ID from ProjectTaskTree where ID=" + Request["ProjectTaskID"].ToString());
                    filter += " and BelongProjectTreeNode in (" + string.Join(",", tempIDs) + ")";
                }
                if (Request["TaskName"] != null && !Request["TaskName"].ToString().Equals(""))
                {
                    filter += " and TaskDetailInf.value('(//TaskName)[1]','varchar(50)') like '%" + Request["TaskName"].ToString().Trim() + "%'";
                }

                sql = "Set ARITHABORT ON select " +
                      " TaskList.*,TaskState.TaskStateName,TaskDetailInf.value('(/Task/@StandardTaskID)[1]','int') as  TaskTemplateID,TaskDetailInf.value('(//TaskName)[1]','varchar(50)') as  TaskName,EmployeeList.人员名称 as CreatorName,P1.Name as ProjectName,P2.Name as PrjTaskTreeName " +
                      " from TaskList,EmployeeList,TaskState,ProjectTaskTree P1,ProjectTaskTree P2 where TaskList.TaskState= TaskState.TaskStateID and TaskList.TaskCreator=EmployeeList.人员ID and TaskList.BelongProject=P1.ID and TaskList.BelongProjectTreeNode=P2.ID " + filter;
                getcountSql = "Set ARITHABORT ON select  TaskID  from TaskList where TaskID >-1  " + filter;
            }

            SQLToJson.ReaderSQLToJson.SetCount(getcountSql, connectstr);
            Response.Write(GetJsonStr(sql));

            Response.End();
            Response.Clear();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //connectstr = Session["connectstr"].ToString();
        string PlatForm_connectstr = Session["PlatForm_connectstr"].ToString();

        if (PlatForm_connectstr != "")
        {
            //  connectstr = "server=(local);Initial Catalog=" + connectstr + ";User ID=sa;Password=zju308;connect timeout=30";
            if (!string.IsNullOrEmpty(Request["limit"]))
            {
                limit = int.Parse(Request["limit"]);
            }
            if (!string.IsNullOrEmpty(Request["start"]))
            {
                start = int.Parse(Request["start"]);
            }
            if (string.IsNullOrEmpty(Request["OperateType"]))//如果没有传来的projectname的值就显示所有文档EmployeeList
            {
                string filter = " Type ='任务' ";
                sql = "Set ARITHABORT ON select top " + limit +
                      " TaskList.*,WorkFlow.WorkFlowName,TaskState.TaskStateName,TaskName,ServiceTree.StandardTaskName,UserInfor.userName as EntName from TaskList,WorkFlow,TaskState,UserInfor,ServiceTree where TaskList.ID not in (select top " + start
                      + " ID from TaskList where " + filter + ") and  TaskList.WorkFlowID*=WorkFlow.ID  and TaskList.TaskState*= TaskState.TaskStateID and TaskList.Publisher*=UserInfor.UserID  and TaskDetailInf.value('(/Task/@StandardTaskID)[1]','int')*=ServiceTree.NodeId and" + filter;
                getcountSql = "select  ID  from TaskList where " + filter;
            }
            else if (Request["OperateType"].Equals("search"))
            {
                string filter = " and Type ='任务' ";
                if (Request["StandardTaskID"] != null && !Request["StandardTaskID"].ToString().Equals(""))
                {
                    TreeJson ss      = new TreeJson();
                    string[] tempIDs = ss.getChildID("ServiceTree", PlatForm_connectstr, "NodeId", "PNodeId", "select NodeId,PNodeId from ServiceTree where NodeId=" + Request["StandardTaskID"].ToString());
                    filter += " and TaskDetailInf.value('(/Task/@StandardTaskID)[1]','int') in (" + string.Join(",", tempIDs) + ")";
                }
                if (Request["TaskName"] != null && !Request["TaskName"].ToString().Equals(""))
                {
                    filter += " and TaskName like '%" + Request["TaskName"].ToString() + "%'";
                }
                if (Request["TaskEnt"] != null && !Request["TaskEnt"].ToString().Equals(""))
                {
                    filter += " and TaskList.Publisher in ( select UserID from UserInfor where userName like '%" + Request["TaskEnt"].ToString() + "%' )";
                }

                sql = "Set ARITHABORT ON select top " + limit +
                      " TaskList.*,WorkFlow.WorkFlowName,TaskState.TaskStateName,TaskName,ServiceTree.StandardTaskName,UserInfor.userName as EntName from TaskList,WorkFlow,TaskState,UserInfor,ServiceTree where TaskList.ID not in (select top " + start
                      + " ID from TaskList where  ID >-1 " + filter + " order by ID ) and  TaskList.WorkFlowID*=WorkFlow.ID  and TaskList.TaskState*= TaskState.TaskStateID and TaskList.Publisher*=UserInfor.UserID  and TaskDetailInf.value('(/Task/@StandardTaskID)[1]','int')*=ServiceTree.NodeId " + filter + " order by TaskList.ID";
                getcountSql = " select  ID  from TaskList where ID >-1  " + filter;
            }

            SQLToJson.ReaderSQLToJson.SetCount(getcountSql, PlatForm_connectstr);
            Response.Write(GetJsonStr(sql, PlatForm_connectstr));

            Response.End();
            Response.Clear();
        }
    }
Esempio n. 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        connectstr = Session["connectstr"].ToString();
        string PlatForm_connectstr = Session["PlatForm_connectstr"].ToString();

        if (connectstr != "")
        {
            //  connectstr = "server=(local);Initial Catalog=" + connectstr + ";User ID=sa;Password=zju308;connect timeout=30";
            if (!string.IsNullOrEmpty(Request["limit"]))
            {
                limit = int.Parse(Request["limit"]);
            }
            if (!string.IsNullOrEmpty(Request["start"]))
            {
                start = int.Parse(Request["start"]);
            }
            if (string.IsNullOrEmpty(Request["OperateType"]))//如果没有传来的projectname的值就显示所有文档EmployeeList
            {
                sql = "Set ARITHABORT ON select top " + limit +
                      " TaskList.*,workflow.name as WorkFlowName,TaskType.TypeName,TaskState.TaskStateName,TaskDetailInf.value('(/Task/@StandardTaskID)[1]','int') as StandardTaskID,TaskDetailInf.value('(/Task/@StandardTaskID)[1]','int') as  TaskTemplateID,EmployeeList.人员名称 as CreatorName,P1.Name as ProjectName,P2.Name as PrjTaskTreeName,P2.Chargor as TaskCreator,ProjList.项目负责人 as ProjectChargorID from TaskList,workflow,TaskState,TaskType,EmployeeList,ProjectTaskTree P1,ProjectTaskTree P2,ProjList where TaskID not in (select top " + start
                      + " TaskID from TaskList) and TaskList.TaskState*= TaskState.TaskStateID and  TaskList.TypeID*=TaskType.TypeID and  TaskList.WorkFlowID*=workflow.ID  and TaskList.BelongProject=P1.ID and TaskList.BelongProjectTreeNode=P2.ID and P2.ProjectID=ProjList.序号 and P2.Chargor=EmployeeList.人员ID";
                getcountSql = "select  TaskID  from TaskList";
            }
            else if (Request["OperateType"].Equals("search"))
            {
                string filter = "";
                if (Request["StandardTaskID"] != null && !Request["StandardTaskID"].ToString().Equals(""))
                {
                    TreeJson ss      = new TreeJson();
                    string[] tempIDs = ss.getChildID("ServiceTree", PlatForm_connectstr, "NodeId", "PNodeId", "select NodeId,PNodeId from ServiceTree where NodeId=" + Request["StandardTaskID"].ToString());
                    filter += " and TaskDetailInf.value('(/Task/@StandardTaskID)[1]','int') in (" + string.Join(",", tempIDs) + ")";
                }
                if (Request["ProjectTaskID"] != null && !Request["ProjectTaskID"].ToString().Equals(""))
                {
                    TreeJson ss      = new TreeJson();
                    string[] tempIDs = ss.getChildID("ProjectTaskTree", connectstr, "ID", "ParentID", "select ID from ProjectTaskTree where ID=" + Request["ProjectTaskID"].ToString());
                    filter += " and BelongProjectTreeNode in (" + string.Join(",", tempIDs) + ")";
                }
                if (Request["TaskName"] != null && !Request["TaskName"].ToString().Equals(""))
                {
                    filter += " and BelongProjectTreeNode in ( select ID from ProjectTaskTree where Name like '%" + Request["TaskName"].ToString().Trim() + "%')";
                }

                sql = "Set ARITHABORT ON select top " + limit +
                      " TaskList.*,workflow.name as WorkFlowName,TaskType.TypeName,TaskState.TaskStateName,TaskDetailInf.value('(/Task/@StandardTaskID)[1]','int') as StandardTaskID,TaskDetailInf.value('(/Task/@StandardTaskID)[1]','int') as  TaskTemplateID,EmployeeList.人员名称 as CreatorName,P1.Name as ProjectName,P2.Name as PrjTaskTreeName,P2.Chargor as TaskCreator,ProjList.项目负责人 as ProjectChargorID from TaskList,workflow,TaskState,TaskType,EmployeeList,ProjectTaskTree P1,ProjectTaskTree P2,ProjList where TaskID not in (select top " + start
                      + " TaskID from TaskList where TaskID >-1  " + filter + " order by TaskID) and TaskList.TaskState*= TaskState.TaskStateID and  TaskList.TypeID*=TaskType.TypeID and  TaskList.WorkFlowID*=workflow.ID and P2.Chargor=EmployeeList.人员ID and TaskList.BelongProject=P1.ID and TaskList.BelongProjectTreeNode=P2.ID and P2.ProjectID=ProjList.序号 " + filter + " order by TaskID";
                getcountSql = "Set ARITHABORT ON select  TaskID  from TaskList where TaskID >-1  " + filter;
            }
            else if (Request["OperateType"].Equals("LoadtaskByPrjTree"))
            {
                string   sss      = "select * from ProjectTaskTree where ID=" + Request["ProjectTaskID"];
                string[] childIDs = new TreeJson().getChildID("ProjectTaskTree", connectstr, "ID", "ParentID", sss);
                if (childIDs != null)
                {
                    string TaskID = String.Join(",", childIDs);
                    string filter = "and BelongProjectTreeNode in (" + TaskID + ") ";

                    sql = "Set ARITHABORT ON select top " + limit +
                          " TaskList.*,workflow.name as WorkFlowName,TaskType.TypeName,TaskState.TaskStateName,TaskDetailInf.value('(/Task/@StandardTaskID)[1]','int') as StandardTaskID,TaskDetailInf.value('(/Task/@StandardTaskID)[1]','int') as  TaskTemplateID,EmployeeList.人员名称 as CreatorName,P1.Name as ProjectName,P2.Name as PrjTaskTreeName,P2.Chargor as TaskCreator,ProjList.项目负责人 as ProjectChargorID from TaskList,workflow,TaskState,TaskType,EmployeeList,ProjectTaskTree P1,ProjectTaskTree P2,ProjList where TaskID not in (select top " + start
                          + " TaskID from TaskList where TaskID >-1  " + filter + " order by TaskID) and TaskList.TaskState*= TaskState.TaskStateID and  TaskList.TypeID*=TaskType.TypeID and  TaskList.WorkFlowID*=workflow.ID and P2.Chargor=EmployeeList.人员ID and TaskList.BelongProject=P1.ID and TaskList.BelongProjectTreeNode=P2.ID and P2.ProjectID=ProjList.序号 " + filter + " order by TaskID";
                    getcountSql = "Set ARITHABORT ON select  TaskID  from TaskList where TaskID >-1  " + filter;
                }
            }
            //else if (Request["taskOperaType"].Equals("TaskSearch"))
            //{
            //    string s = " ID,State,Project,Task.value('(/Task/@name)[1]','varchar(50)') as  任务名," +
            //  "Task.value('(//Creator)[1]','varchar(50)') as 任务创建人," +
            // "Task.value('(//Batch)[1]','varchar(50)') as  批量," +
            // "Task.value('(//ReleaseTime)[1]','varchar(50)') as  任务释放时间," +
            // "Task.value('(//PlanEndTime)[1]','varchar(50)') as  任务计划结束时间," +
            // "Task.value('(//Description)[1]','varchar(500)') as  任务描述," +
            // "Task.value('(//Accuracy)[1]','varchar(50)') as  精度";
            //    sql = "Set ARITHABORT ON select  " + s + "  from TaskList where Task.value('(/Task/@name)[1]','varchar(50)')='" + Request["taskName"] + "'";
            //    getcountSql = "Set ARITHABORT ON select  " + s + "  from TaskList where Task.value('(/Task/@name)[1]','varchar(50)')='" + Request["taskName"] + "'";

            //}

            SQLToJson.ReaderSQLToJson.SetCount(getcountSql, connectstr);
            Response.Write(GetJsonStr(sql));

            Response.End();
            Response.Clear();
        }
    }