public DataTable QueryRow(ArrayList ParameterList, bool likeSearch)
 {
     try
     {
         IFM_DBO.IFM_SysRequestDBO Req = new IFM_DBO.IFM_SysRequestDBO(ref USEDB);
         if (likeSearch)
         {
             ParameterList[0] = ParameterList[0] + "%";//req_no
             ParameterList[1] = ParameterList[1];//sign_date
             ParameterList[2] = ParameterList[2];//want_date
             ParameterList[3] = ParameterList[3] + "%";//rolecode
             ParameterList[4] = ParameterList[4] + "%";//user_id
             ParameterList[5] = ParameterList[5] + "%";//sys_id
             ParameterList[6] = ParameterList[6] + "%";//req_type
             ParameterList[7] = ParameterList[7] + "%";//req_level
             ParameterList[8] = ParameterList[8] + "%";//emp_id
             ParameterList[9] = ParameterList[9] + "%";//req_status
             ParameterList[10] = ParameterList[10];//process_date
             ParameterList[11] = ParameterList[11];//close_date       
             ParameterList[12] = ParameterList[12];//createdate_s
             ParameterList[13] = ParameterList[13];//createdate_e
             ParameterList[14] = ParameterList[14] + "%";//createuid
             ParameterList[15] = ParameterList[15];//updatedate_s
             ParameterList[16] = ParameterList[16];//updatedate_e
             ParameterList[17] = ParameterList[17] + "%";//updateuid
             ParameterList[18] = ParameterList[18]; //rownum
         }
         return Req.QueryRow(ParameterList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public DataTable QueryReqByALL()
 {
     try
     {
         IFM_DBO.IFM_SysRequestDBO Req = new IFM_DBO.IFM_SysRequestDBO(ref USEDB);
         return Req.doQueryAll();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public string GetReqNo()
 {
     try
     {
         IFM_DBO.IFM_SysRequestDBO Req = new IFM_DBO.IFM_SysRequestDBO(ref USEDB);
         return Req.doQueryReqNo();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        /// <summary>
        /// 基本表單刪除BCO
        /// </summary>
        /// <param name="ParameterList">刪除變數</param>
        /// <param name="RootDBT">是否有主交易,無主交易輸入null</param>
        /// <returns>回傳影響筆數</returns>
        public void DeleteReq(ArrayList ParameterList,
                                DataRow oldMasterRow,
                                DbTransaction RootDBT

                                      )
        {
            bool IsRootTranscation = false;

            try
            {
                IFM_DBO.IFM_SysRequestDBO Req = new IFM_DBO.IFM_SysRequestDBO(ref USEDB);

                //判斷是否有傳入Root Transcation 
                IsRootTranscation = (RootDBT == null) ? true : false;

                #region 啟動交易或指定RootTranscation

                if (IsRootTranscation)
                {
                    //獨立呼叫啟動Transcation
                    Conn = USEDB.CreateConnection();
                    Conn.Open();
                    DBT = Conn.BeginTransaction();
                }
                else
                {
                    DBT = RootDBT;
                }

                #endregion

                //刪除Req主檔
                int rtnValue = Req.doDelete(ParameterList, oldMasterRow, DBT);

                //刪除Req明細檔
                if (rtnValue > 0)
                {
                    DeleteDetailByPK(oldMasterRow["ID"].ToString(), oldMasterRow["REQ_NO"].ToString(), DBT);
                }


                #region 交易成功

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation成立
                    DBT.Commit();
                }

                #endregion

            }
            catch (Exception ex)
            {
                #region 交易失敗

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation失敗
                    DBT.Rollback();
                }

                #endregion

                throw ex;
            }
            finally
            {
                #region 判斷是否關閉交易連線

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation,關閉連線
                    if (Conn.State == ConnectionState.Connecting)
                    {
                        Conn.Close();
                    }
                }

                #endregion

            }
        }
        // <summary>
        /// 基本表單更新BCO
        /// </summary>
        /// <param name="ParameterList">更新變數</param>
        /// <param name="RootDBT">是否有主交易,無主交易輸入null</param>
        /// <returns>回傳影響筆數</returns>
        public void UpdateReq(ArrayList ParameterList,
                                 DataRow OldMasterRow,
                                 DbTransaction RootDBT
                                )
        {
            bool IsRootTranscation = false;

            try
            {
                //判斷是否有傳入Root Transcation 
                IsRootTranscation = (RootDBT == null) ? true : false;

                #region 啟動交易或指定RootTranscation

                if (IsRootTranscation)
                {
                    //獨立呼叫啟動Transcation
                    Conn = USEDB.CreateConnection();
                    Conn.Open();
                    DBT = Conn.BeginTransaction();
                }
                else
                {
                    DBT = RootDBT;
                }

                #endregion

                IFM_DBO.IFM_SysRequestDBO Req = new IFM_DBO.IFM_SysRequestDBO(ref USEDB);
                Req.doUpdate(ParameterList, OldMasterRow, DBT);

                #region 交易成功

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation成立
                    DBT.Commit();
                }

                #endregion

            }
            catch (Exception ex)
            {
                #region 交易失敗

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation失敗
                    DBT.Rollback();
                }

                #endregion

                throw ex;
            }
            finally
            {
                #region 判斷是否關閉交易連線

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation,關閉連線
                    if (Conn.State == ConnectionState.Connecting)
                    {
                        Conn.Close();
                    }
                }

                #endregion

            }
        }
 public DataTable QueryReqDetlByID(ArrayList ParameterList)
 {
     try
     {
         IFM_DBO.IFM_SysRequestDBO Req = new IFM_DBO.IFM_SysRequestDBO(ref USEDB);
         return Req.doQueryDetlByID(ParameterList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public DataTable PrintRequest(ArrayList ParameterList)
 {
     try
     {
         IFM_DBO.IFM_SysRequestDBO Req = new IFM_DBO.IFM_SysRequestDBO(ref USEDB);
         return Req.doPrint(ParameterList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
  public DataTable GetMis()
 {
     try
     {
         IFM_DBO.IFM_SysRequestDBO Req = new IFM_DBO.IFM_SysRequestDBO(ref USEDB);
         return Req.GetMis();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }