/// <summary>
    /// 修改项目复制人
    /// </summary>
    /// <param name="strPlanId"></param>
    private void ModifTaskSampleDutyUser(string strPlanId)
    {
        if (!String.IsNullOrEmpty(strPlanId))
        {
            TMisMonitorTaskVo objTaskDetail = new TMisMonitorTaskLogic().Details(new TMisMonitorTaskVo {
                PLAN_ID = strPlanId
            });
            TMisMonitorSubtaskVo objSubTask = new TMisMonitorSubtaskVo();
            objSubTask.TASK_ID = objTaskDetail.ID;
            DataTable dt = new TMisMonitorSubtaskLogic().SelectByTable(objSubTask, 0, 0);

            TMisContractUserdutyVo objUserDuty = new TMisContractUserdutyVo();
            objUserDuty.CONTRACT_PLAN_ID = strPlanId;
            DataTable dtDuty = new TMisContractUserdutyLogic().SelectByTable(objUserDuty, 0, 0);
            //如果没有获取到委托书的默认采样人 则取对应监测类别的 岗位职责数据
            if (dt.Rows.Count > 0 && dtDuty.Rows.Count < 1)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    TSysDutyVo objDuty = new TSysDutyVo();
                    objDuty.MONITOR_TYPE_ID = dt.Rows[i]["MONITOR_ID"].ToString();
                    objDuty.DICT_CODE       = "duty_sampling";
                    DataTable objDutyDt = new TSysDutyLogic().GetDutyUser(objDuty);
                    DataRow   drr       = null;

                    if (objDutyDt.Rows.Count > 0)
                    {
                        //如果设置了默认负责人,则取默认负责人
                        DataRow[] drArr = objDutyDt.Select(" IF_DEFAULT='0'");
                        if (drArr.Length > 0)
                        {
                            drr = drArr[0];
                        }
                        else
                        {
                            //如果未设置默认负责人,则取第一行数据
                            drr = objDutyDt.Rows[0];
                        }

                        if (drr != null)
                        {
                            TMisMonitorSubtaskVo objUpSubTask = new TMisMonitorSubtaskVo();
                            objUpSubTask.ID = dt.Rows[i]["ID"].ToString();
                            objUpSubTask.SAMPLING_MANAGER_ID = drr["USERID"].ToString();
                            new TMisMonitorSubtaskLogic().Edit(objUpSubTask);
                        }
                    }
                }
            }
            if (dt.Rows.Count > 0 && dtDuty.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    foreach (DataRow drr in dtDuty.Rows)
                    {
                        if (dr["MONITOR_ID"].ToString() == drr["MONITOR_TYPE_ID"].ToString())
                        {
                            TMisMonitorSubtaskVo objUpSubTask = new TMisMonitorSubtaskVo();
                            objUpSubTask.ID = dr["ID"].ToString();
                            objUpSubTask.SAMPLING_MANAGER_ID = drr["SAMPLING_MANAGER_ID"].ToString();
                            new TMisMonitorSubtaskLogic().Edit(objUpSubTask);
                        }
                    }
                }
            }
        }
    }
    /// <summary>
    /// 保存默认监测计划岗位负责人 Create By Castle (胡方扬) 2013-4-1
    /// </summary>
    /// <returns></returns>
    public static void SavePlanPeopleForEnv(string strPlanId)
    {
        DataTable dtMonitor = new DataTable();
        TMisContractPointFreqVo objItemspan = new TMisContractPointFreqVo();

        objItemspan.IF_PLAN = "0";
        dtMonitor           = new TMisContractPointFreqLogic().GetPointMonitorInforForPlan(objItemspan, strPlanId);

        //DataTable dtMonitor = GetPointMonitorInfor(strPlanId);

        DataTable  dtTemple     = new DataTable();
        TSysDutyVo objItemspan1 = new TSysDutyVo();

        objItemspan1.DICT_CODE = "duty_sampling";
        dtTemple = new TSysDutyLogic().SelectTableDutyUser(objItemspan1);
        //DataTable dtTemple = GetMonitorDutyInforTable();
        DataTable dtMonitorDutyUser = new DataTable();

        dtMonitorDutyUser = dtTemple.Copy();

        dtMonitorDutyUser.Clear();
        //获取默认负责人
        for (int n = 0; n < dtMonitor.Rows.Count; n++)
        {
            DataRow[] drowArr = dtTemple.Select(" IF_DEFAULT='0' AND MONITOR_TYPE_ID='" + dtMonitor.Rows[0]["ID"].ToString() + "'");
            if (drowArr.Length > 0)
            {
                foreach (DataRow drow in drowArr)
                {
                    dtMonitorDutyUser.ImportRow(drow);
                }
                dtMonitorDutyUser.AcceptChanges();
            }
            else
            {
                drowArr = dtTemple.Select(" MONITOR_TYPE_ID='" + dtMonitor.Rows[0]["ID"].ToString() + "'");
                if (drowArr.Length > 0)
                {
                    dtMonitorDutyUser.ImportRow(drowArr[0]);
                }
                dtMonitorDutyUser.AcceptChanges();
            }
        }

        //if (drowArr.Length > 0)
        //{
        //    foreach (DataRow drow in drowArr)
        //    {
        //        dtMonitorDutyUser.ImportRow(drow);
        //    }
        //    dtMonitorDutyUser.AcceptChanges();
        //}
        string strMonitorId = "", strUserId = "";

        foreach (DataRow drr in dtMonitor.Rows)
        {
            for (int i = 0; i < dtMonitorDutyUser.Rows.Count; i++)
            {
                if (drr["ID"].ToString() == dtMonitorDutyUser.Rows[i]["MONITOR_TYPE_ID"].ToString())
                {
                    strMonitorId += drr["ID"].ToString() + ";";
                    strUserId    += dtMonitorDutyUser.Rows[i]["USERID"].ToString() + ";";
                }
            }
        }
        TMisContractUserdutyVo objItems = new TMisContractUserdutyVo();

        if (!String.IsNullOrEmpty(strPlanId))
        {
            objItems.CONTRACT_PLAN_ID = strPlanId;
            string[] strMonitArr = null, strUserArr = null;
            if (!String.IsNullOrEmpty(strMonitorId) && !String.IsNullOrEmpty(strUserId))
            {
                strMonitArr = strMonitorId.Substring(0, strMonitorId.Length - 1).Split(';');
                strUserArr  = strUserId.Substring(0, strUserId.Length - 1).Split(';');
                if (strMonitArr != null && strUserArr != null)
                {
                    new TMisContractUserdutyLogic().SaveContractPlanDutyForEnv(objItems, strMonitArr, strUserArr);
                }
            }
        }
    }