/// <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 > 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);
                        }
                    }
                }
            }
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// 获取监测计划监测类型负责人信息
    /// </summary>
    /// <returns></returns>
    private string GetContractDutyUser(string strMonitorId, string task_id, string strPlanId)
    {
        string    result = "";
        DataTable dt     = new DataTable();
        TMisContractUserdutyVo objItems = new TMisContractUserdutyVo();

        objItems.CONTRACT_ID      = task_id;
        objItems.MONITOR_TYPE_ID  = strMonitorId;
        objItems.CONTRACT_PLAN_ID = strPlanId;
        dt     = new TMisContractUserdutyLogic().SelectDutyUser(objItems);
        result = PageBase.LigerGridDataToJson(dt, dt.Rows.Count);
        return(result);
    }
Exemplo n.º 3
0
 /// <summary>
 /// 获得采样人员相关信息
 /// </summary>
 /// <param name="strMonitorID">监测类别</param>
 /// <param name="strItemID">监测项目</param>
 /// <param name="strSampleManager">采样负责人ID</param>
 /// <param name="strSampleID">采样协同人ID</param>
 protected void GetSamplingMan(string strMonitorID, string strContractID, ref string strSampleManager, ref string strSampleID)
 {
     if (!String.IsNullOrEmpty(strMonitorID) && !string.IsNullOrEmpty(strContractID))
     {
         TMisContractUserdutyVo objItems = new TMisContractUserdutyVo();
         objItems.CONTRACT_ID     = strContractID;
         objItems.MONITOR_TYPE_ID = strMonitorID;
         DataTable dt = new TMisContractUserdutyLogic().SelectDutyUser(objItems);
         if (dt.Rows.Count > 0)
         {
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 DataRow dr = dt.Rows[i] as DataRow;
                 strSampleManager = dt.Rows[0]["SAMPLING_MANAGER_ID"].ToString().Length > 0 ? dt.Rows[0]["SAMPLING_MANAGER_ID"].ToString() : (dr["SAMPLING_MANAGER_ID"].ToString().Length > 0 ? dr["SAMPLING_MANAGER_ID"].ToString() : strSampleManager);
                 strSampleID     += strSampleID.Contains(dr["SAMPLING_ID"].ToString()) ? "" : (dr["SAMPLING_ID"].ToString().Length > 0 ? dr["SAMPLING_ID"].ToString() + "," : "");
             }
         }
     }
     strSampleID = strSampleID.Length > 0 ? strSampleID.Remove(strSampleID.LastIndexOf(",")) : "";
 }
    /// <summary>
    /// 获取监测计划监测类型负责人信息
    /// </summary>
    /// <returns></returns>
    private string GetContractDutyUser()
    {
        DataTable dt = new DataTable();
        TMisContractUserdutyVo objItems = new TMisContractUserdutyVo();

        if (!string.IsNullOrEmpty(Request.QueryString["task_id"]))
        {
            objItems.CONTRACT_ID = Request.QueryString["task_id"].ToString();
        }
        if (!string.IsNullOrEmpty(Request.QueryString["strMonitorId"]))
        {
            objItems.MONITOR_TYPE_ID = Request.QueryString["strMonitorId"].ToString();
        }
        if (!string.IsNullOrEmpty(Request.QueryString["strPlanId"]))
        {
            objItems.CONTRACT_PLAN_ID = Request.QueryString["strPlanId"].ToString();
        }
        dt = new TMisContractUserdutyLogic().SelectDutyUser(objItems);
        return(PageBase.LigerGridDataToJson(dt, dt.Rows.Count));
    }
    /// <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);
                        }
                    }
                }
            }
        }
    }