/// <summary>
        /// 对象编辑
        /// </summary>
        /// <param name="tMisMonitorQcTwinQhd_UpdateSet">UpdateSet用户对象</param>
        /// <param name="tMisMonitorQcTwinQhd_UpdateWhere">UpdateWhere用户对象</param>
        /// <returns>是否成功</returns>
        public bool Edit(TMisMonitorQcTwinQhdVo tMisMonitorQcTwinQhd_UpdateSet, TMisMonitorQcTwinQhdVo tMisMonitorQcTwinQhd_UpdateWhere)
        {
            string strSQL = SqlHelper.BuildUpdateExpress(tMisMonitorQcTwinQhd_UpdateSet, TMisMonitorQcTwinQhdVo.T_MIS_MONITOR_QC_TWIN_QHD_TABLE);

            strSQL += this.BuildWhereStatement(tMisMonitorQcTwinQhd_UpdateWhere);
            return(SqlHelper.ExecuteNonQuery(CommandType.Text, strSQL) > 0 ? true : false);
        }
        /// <summary>
        /// 对象编辑
        /// </summary>
        /// <param name="tMisMonitorQcTwinQhd">用户对象</param>
        /// <returns>是否成功</returns>
        public bool Edit(TMisMonitorQcTwinQhdVo tMisMonitorQcTwinQhd)
        {
            string strSQL = SqlHelper.BuildUpdateExpress(tMisMonitorQcTwinQhd, TMisMonitorQcTwinQhdVo.T_MIS_MONITOR_QC_TWIN_QHD_TABLE);

            strSQL += string.Format(" where ID='{0}' ", tMisMonitorQcTwinQhd.ID);
            return(SqlHelper.ExecuteNonQuery(CommandType.Text, strSQL) > 0 ? true : false);
        }
        /// <summary>
        /// 获取对象DataTable
        /// </summary>
        /// <param name="tMisMonitorQcTwinQhd">对象</param>
        /// <param name="iIndex">起始页码</param>
        /// <param name="iCount">每页数目</param>
        /// <returns>返回结果</returns>
        public DataTable SelectByTable(TMisMonitorQcTwinQhdVo tMisMonitorQcTwinQhd, int iIndex, int iCount)
        {
            string strSQL = " select * from T_MIS_MONITOR_QC_TWIN_QHD {0} ";

            strSQL = String.Format(strSQL, BuildWhereStatement(tMisMonitorQcTwinQhd));
            return(SqlHelper.ExecuteDataTable(BuildPagerExpress(strSQL, iIndex, iCount)));
        }
        /// <summary>
        /// 对象删除
        /// </summary>
        /// <param name="Id">ID</param>
        /// <returns>是否成功</returns>
        public bool Delete(TMisMonitorQcTwinQhdVo tMisMonitorQcTwinQhd)
        {
            string strSQL = "delete from T_MIS_MONITOR_QC_TWIN_QHD ";

            strSQL += this.BuildWhereStatement(tMisMonitorQcTwinQhd);

            return(SqlHelper.ExecuteNonQuery(CommandType.Text, strSQL) > 0 ? true : false);
        }
 /// <summary>
 /// 对象删除
 /// </summary>
 /// <param name="Id">ID</param>
 /// <returns>是否成功</returns>
 public bool Delete(TMisMonitorQcTwinQhdVo tMisMonitorQcTwinQhd)
 {
     return(access.Delete(tMisMonitorQcTwinQhd));
 }
 /// <summary>
 /// 对象编辑
 /// </summary>
 /// <param name="tMisMonitorQcTwinQhd_UpdateSet">UpdateSet用户对象</param>
 /// <param name="tMisMonitorQcTwinQhd_UpdateWhere">UpdateWhere用户对象</param>
 /// <returns>是否成功</returns>
 public bool Edit(TMisMonitorQcTwinQhdVo tMisMonitorQcTwinQhd_UpdateSet, TMisMonitorQcTwinQhdVo tMisMonitorQcTwinQhd_UpdateWhere)
 {
     return(access.Edit(tMisMonitorQcTwinQhd_UpdateSet, tMisMonitorQcTwinQhd_UpdateWhere));
 }
 /// <summary>
 /// 对象编辑
 /// </summary>
 /// <param name="tMisMonitorQcTwinQhd">用户对象</param>
 /// <returns>是否成功</returns>
 public bool Edit(TMisMonitorQcTwinQhdVo tMisMonitorQcTwinQhd)
 {
     return(access.Edit(tMisMonitorQcTwinQhd));
 }
 /// <summary>
 /// 对象添加
 /// </summary>
 /// <param name="sysRole">对象</param>
 /// <returns>是否成功</returns>
 public bool Create(TMisMonitorQcTwinQhdVo tMisMonitorQcTwinQhd)
 {
     return(access.Create(tMisMonitorQcTwinQhd));
 }
        /// <summary>
        /// 对象添加
        /// </summary>
        /// <param name="tMisMonitorQcTwinQhd">对象</param>
        /// <returns>是否成功</returns>
        public bool Create(TMisMonitorQcTwinQhdVo tMisMonitorQcTwinQhd)
        {
            string strSQL = SqlHelper.BuildInsertExpress(tMisMonitorQcTwinQhd, TMisMonitorQcTwinQhdVo.T_MIS_MONITOR_QC_TWIN_QHD_TABLE);

            return(SqlHelper.ExecuteNonQuery(CommandType.Text, strSQL) > 0 ? true : false);
        }
 /// <summary>
 /// 获取对象DataTable
 /// </summary>
 /// <param name="tMisMonitorQcTwinQhd">对象</param>
 /// <param name="iIndex">起始页码</param>
 /// <param name="iCount">每页数目</param>
 /// <returns>返回结果</returns>
 public DataTable SelectByTable(TMisMonitorQcTwinQhdVo tMisMonitorQcTwinQhd, int iIndex, int iCount)
 {
     return(access.SelectByTable(tMisMonitorQcTwinQhd, iIndex, iCount));
 }
 /// <summary>
 /// 对象明细
 /// </summary>
 /// <param name="tMisMonitorQcTwinQhd">对象条件</param>
 /// <returns>对象</returns>
 public TMisMonitorQcTwinQhdVo Details(TMisMonitorQcTwinQhdVo tMisMonitorQcTwinQhd)
 {
     return(access.Details(tMisMonitorQcTwinQhd));
 }
        /// <summary>
        /// 获取对象List
        /// </summary>
        /// <param name="tMisMonitorQcTwinQhd">对象</param>
        /// <param name="iIndex">起始页码</param>
        /// <param name="iCount">每页数目</param>
        /// <returns>返回结果</returns>
        public List <TMisMonitorQcTwinQhdVo> SelectByObject(TMisMonitorQcTwinQhdVo tMisMonitorQcTwinQhd, int iIndex, int iCount)
        {
            string strSQL = String.Format("select * from  T_MIS_MONITOR_QC_TWIN_QHD " + this.BuildWhereStatement(tMisMonitorQcTwinQhd));

            return(SqlHelper.ExecuteObjectList(tMisMonitorQcTwinQhd, BuildPagerExpress(strSQL, iIndex, iCount)));
        }
        /// <summary>
        /// 对象明细
        /// </summary>
        /// <param name="tMisMonitorQcTwinQhd">对象条件</param>
        /// <returns>对象</returns>
        public TMisMonitorQcTwinQhdVo Details(TMisMonitorQcTwinQhdVo tMisMonitorQcTwinQhd)
        {
            string strSQL = String.Format("select * from  T_MIS_MONITOR_QC_TWIN_QHD " + this.BuildWhereStatement(tMisMonitorQcTwinQhd));

            return(SqlHelper.ExecuteObject(new TMisMonitorQcTwinQhdVo(), strSQL));
        }
        /// <summary>
        /// 获得查询结果总行数,用于分页
        /// </summary>
        /// <param name="tMisMonitorQcTwinQhd">对象</param>
        /// <returns>返回行数</returns>
        public int GetSelectResultCount(TMisMonitorQcTwinQhdVo tMisMonitorQcTwinQhd)
        {
            string strSQL = "select Count(*) from T_MIS_MONITOR_QC_TWIN_QHD " + this.BuildWhereStatement(tMisMonitorQcTwinQhd);

            return(Convert.ToInt32(SqlHelper.ExecuteScalar(strSQL)));
        }
        /// <summary>
        /// 根据对象构造条件语句
        /// </summary>
        /// <param name="tMisMonitorQcTwinQhd"></param>
        /// <returns></returns>
        public string BuildWhereStatement(TMisMonitorQcTwinQhdVo tMisMonitorQcTwinQhd)
        {
            StringBuilder strWhereStatement = new StringBuilder(" Where 1=1 ");

            if (null != tMisMonitorQcTwinQhd)
            {
                //ID
                if (!String.IsNullOrEmpty(tMisMonitorQcTwinQhd.ID.ToString().Trim()))
                {
                    strWhereStatement.Append(string.Format(" AND ID = '{0}'", tMisMonitorQcTwinQhd.ID.ToString()));
                }
                //原始样分析结果 ID
                if (!String.IsNullOrEmpty(tMisMonitorQcTwinQhd.RESULT_ID_SRC.ToString().Trim()))
                {
                    strWhereStatement.Append(string.Format(" AND RESULT_ID_SRC = '{0}'", tMisMonitorQcTwinQhd.RESULT_ID_SRC.ToString()));
                }
                //平行样分析结果ID1
                if (!String.IsNullOrEmpty(tMisMonitorQcTwinQhd.RESULT_ID_TWIN1.ToString().Trim()))
                {
                    strWhereStatement.Append(string.Format(" AND RESULT_ID_TWIN1 = '{0}'", tMisMonitorQcTwinQhd.RESULT_ID_TWIN1.ToString()));
                }
                //平行样分析结果ID2
                if (!String.IsNullOrEmpty(tMisMonitorQcTwinQhd.RESULT_ID_TWIN2.ToString().Trim()))
                {
                    strWhereStatement.Append(string.Format(" AND RESULT_ID_TWIN2 = '{0}'", tMisMonitorQcTwinQhd.RESULT_ID_TWIN2.ToString()));
                }
                //平行样测定值1
                if (!String.IsNullOrEmpty(tMisMonitorQcTwinQhd.TWIN_RESULT1.ToString().Trim()))
                {
                    strWhereStatement.Append(string.Format(" AND TWIN_RESULT1 = '{0}'", tMisMonitorQcTwinQhd.TWIN_RESULT1.ToString()));
                }
                //平行样测定值2
                if (!String.IsNullOrEmpty(tMisMonitorQcTwinQhd.TWIN_RESULT2.ToString().Trim()))
                {
                    strWhereStatement.Append(string.Format(" AND TWIN_RESULT2 = '{0}'", tMisMonitorQcTwinQhd.TWIN_RESULT2.ToString()));
                }
                //平行测定均值
                if (!String.IsNullOrEmpty(tMisMonitorQcTwinQhd.TWIN_AVG.ToString().Trim()))
                {
                    strWhereStatement.Append(string.Format(" AND TWIN_AVG = '{0}'", tMisMonitorQcTwinQhd.TWIN_AVG.ToString()));
                }
                //相对偏差(%)
                if (!String.IsNullOrEmpty(tMisMonitorQcTwinQhd.TWIN_OFFSET.ToString().Trim()))
                {
                    strWhereStatement.Append(string.Format(" AND TWIN_OFFSET = '{0}'", tMisMonitorQcTwinQhd.TWIN_OFFSET.ToString()));
                }
                //是否合格
                if (!String.IsNullOrEmpty(tMisMonitorQcTwinQhd.TWIN_ISOK.ToString().Trim()))
                {
                    strWhereStatement.Append(string.Format(" AND TWIN_ISOK = '{0}'", tMisMonitorQcTwinQhd.TWIN_ISOK.ToString()));
                }
                //质控类型(0、原始样;1、现场空白;2、现场加标;3、现场平行;4、实验室密码平行;5、实验室空白;6、实验室加标;7、实验室明码平行;8、标准样  9、质控平行 10、空白加标)
                if (!String.IsNullOrEmpty(tMisMonitorQcTwinQhd.QC_TYPE.ToString().Trim()))
                {
                    strWhereStatement.Append(string.Format(" AND QC_TYPE = '{0}'", tMisMonitorQcTwinQhd.QC_TYPE.ToString()));
                }
                //备注1
                if (!String.IsNullOrEmpty(tMisMonitorQcTwinQhd.REMARK1.ToString().Trim()))
                {
                    strWhereStatement.Append(string.Format(" AND REMARK1 = '{0}'", tMisMonitorQcTwinQhd.REMARK1.ToString()));
                }
                //备注2
                if (!String.IsNullOrEmpty(tMisMonitorQcTwinQhd.REMARK2.ToString().Trim()))
                {
                    strWhereStatement.Append(string.Format(" AND REMARK2 = '{0}'", tMisMonitorQcTwinQhd.REMARK2.ToString()));
                }
                //备注3
                if (!String.IsNullOrEmpty(tMisMonitorQcTwinQhd.REMARK3.ToString().Trim()))
                {
                    strWhereStatement.Append(string.Format(" AND REMARK3 = '{0}'", tMisMonitorQcTwinQhd.REMARK3.ToString()));
                }
                //备注4
                if (!String.IsNullOrEmpty(tMisMonitorQcTwinQhd.REMARK4.ToString().Trim()))
                {
                    strWhereStatement.Append(string.Format(" AND REMARK4 = '{0}'", tMisMonitorQcTwinQhd.REMARK4.ToString()));
                }
                //备注5
                if (!String.IsNullOrEmpty(tMisMonitorQcTwinQhd.REMARK5.ToString().Trim()))
                {
                    strWhereStatement.Append(string.Format(" AND REMARK5 = '{0}'", tMisMonitorQcTwinQhd.REMARK5.ToString()));
                }
            }
            return(strWhereStatement.ToString());
        }
 public TMisMonitorQcTwinQhdLogic(TMisMonitorQcTwinQhdVo _tMisMonitorQcTwinQhd)
 {
     tMisMonitorQcTwinQhd = _tMisMonitorQcTwinQhd;
     access = new TMisMonitorQcTwinQhdAccess();
 }
 /// <summary>
 /// 获得查询结果总行数,用于分页
 /// </summary>
 /// <param name="tMisMonitorQcTwinQhd">对象</param>
 /// <returns>返回行数</returns>
 public int GetSelectResultCount(TMisMonitorQcTwinQhdVo tMisMonitorQcTwinQhd)
 {
     return(access.GetSelectResultCount(tMisMonitorQcTwinQhd));
 }
        /// <summary>
        /// 根据对象获取全部数据,用Table承载
        ///  数据量较小时使用【不推荐】
        /// </summary>
        /// <param name="tMisMonitorQcTwinQhd"></param>
        /// <returns></returns>
        public DataTable SelectByTable(TMisMonitorQcTwinQhdVo tMisMonitorQcTwinQhd)
        {
            string strSQL = "select * from T_MIS_MONITOR_QC_TWIN_QHD " + this.BuildWhereStatement(tMisMonitorQcTwinQhd);

            return(SqlHelper.ExecuteDataTable(strSQL));
        }
 /// <summary>
 /// 获取对象List
 /// </summary>
 /// <param name="tMisMonitorQcTwinQhd">对象</param>
 /// <param name="iIndex">起始页码</param>
 /// <param name="iCount">每页数目</param>
 /// <returns>返回结果</returns>
 public List <TMisMonitorQcTwinQhdVo> SelectByObject(TMisMonitorQcTwinQhdVo tMisMonitorQcTwinQhd, int iIndex, int iCount)
 {
     return(access.SelectByObject(tMisMonitorQcTwinQhd, iIndex, iCount));
 }
 /// <summary>
 /// 根据对象特征获取单一对象
 /// </summary>
 /// <param name="tMisMonitorQcTwinQhd">对象</param>
 /// <returns></returns>
 public TMisMonitorQcTwinQhdVo SelectByObject(TMisMonitorQcTwinQhdVo tMisMonitorQcTwinQhd)
 {
     return(access.SelectByObject(tMisMonitorQcTwinQhd));
 }
 /// <summary>
 /// 根据对象获取全部数据,用Table承载
 ///  数据量较小时使用【不推荐】
 /// </summary>
 /// <param name="tMisMonitorQcTwinQhd"></param>
 /// <returns></returns>
 public DataTable SelectByTable(TMisMonitorQcTwinQhdVo tMisMonitorQcTwinQhd)
 {
     return(access.SelectByTable(tMisMonitorQcTwinQhd));
 }
    private static bool createQcInfo(string strSubTaskId, string strQcType, string strItemId)
    {
        bool isSuccess = true;

        if (strItemId == "")
        {
            return(isSuccess);
        }

        TMisMonitorSampleInfoVo objSample = new TMisMonitorSampleInfoVo();
        string strQcSampleId = GetSerialNumber("MonitorSampleId");

        objSample.ID         = strQcSampleId;
        objSample.SUBTASK_ID = strSubTaskId;
        objSample.QC_TYPE    = strQcType;
        //objSample.SAMPLE_CODE = GetSampleCode_QHD(strQcSampleId);
        TMisMonitorSubtaskVo objSubtask = new TMisMonitorSubtaskLogic().Details(objSample.SUBTASK_ID);
        TMisMonitorTaskVo    objTask    = new TMisMonitorTaskLogic().Details(objSubtask.TASK_ID);
        TBaseSerialruleVo    objSerial  = new TBaseSerialruleVo();

        objSerial.SAMPLE_SOURCE = objTask.SAMPLE_SOURCE;
        objSerial.SERIAL_TYPE   = "2";

        objSample.SAMPLECODE_CREATEDATE = DateTime.Now.ToString("yyyy-MM-dd");

        objSample.SAMPLE_CODE = CreateBaseDefineCodeForSample(objSerial, objTask, objSubtask);

        objSample.NOSAMPLE = "1";

        if (strQcType == "9")
        {
            objSample.SAMPLE_NAME = "质控平行样";
        }
        objSample.SAMPLE_COUNT = "";
        //在样品表中添加样品数据
        if (!new TMisMonitorSampleInfoLogic().Create(objSample))
        {
            isSuccess = false;
        }

        //遍历监测项目信息,将监测项目信息添加到结果表、结果分析执行表、平行样结果表中
        for (int i = 0; i < strItemId.Split(',').Length; i++)
        {
            //将数据写入结果表中
            TMisMonitorResultVo objResult = new TMisMonitorResultVo();
            objResult.ID        = GetSerialNumber("MonitorResultId");
            objResult.SAMPLE_ID = strQcSampleId;
            objResult.QC_TYPE   = strQcType;
            objResult.ITEM_ID   = strItemId.Split(',')[i];

            //填充默认分析方法和方法依据
            TBaseItemAnalysisVo objItemAnalysis = new TBaseItemAnalysisVo();
            objItemAnalysis.ITEM_ID    = objResult.ITEM_ID;
            objItemAnalysis.IS_DEFAULT = "是";
            objItemAnalysis.IS_DEL     = "0";
            objItemAnalysis            = new TBaseItemAnalysisLogic().Details(objItemAnalysis);

            if (objItemAnalysis.ID.Length == 0)
            {
                objItemAnalysis         = new TBaseItemAnalysisVo();
                objItemAnalysis.ITEM_ID = objResult.ITEM_ID;
                objItemAnalysis.IS_DEL  = "0";
                objItemAnalysis         = new TBaseItemAnalysisLogic().Details(objItemAnalysis);
            }

            if (objItemAnalysis.ID.Length > 0)
            {
                TBaseMethodAnalysisVo objMethod = new TBaseMethodAnalysisLogic().Details(objItemAnalysis.ANALYSIS_METHOD_ID);
                objResult.ANALYSIS_METHOD_ID = objMethod.ID;
                objResult.STANDARD_ID        = objMethod.METHOD_ID;
            }

            objResult.ANALYSIS_METHOD_ID = "";
            objResult.STANDARD_ID        = "";
            objResult.TASK_TYPE          = "发送";
            objResult.RESULT_STATUS      = "01";

            if (!new TMisMonitorResultLogic().Create(objResult))
            {
                isSuccess = false;
            }
            //将数据写入结果分析执行表中
            InsertResultAPP(objResult.ID);

            //将结果写入分析样结果表中
            TMisMonitorQcTwinQhdVo objQcTwin = new TMisMonitorQcTwinQhdVo();
            objQcTwin.ID            = GetSerialNumber("QcTwinId_QHD");
            objQcTwin.RESULT_ID_SRC = objResult.ID;
            objQcTwin.QC_TYPE       = strQcType;
            if (!new TMisMonitorQcTwinQhdLogic().Create(objQcTwin))
            {
                isSuccess = false;
            }
        }
        return(isSuccess);
    }