Esempio n. 1
0
 public DataTable QueryITEM_PERIOD(ArrayList ParameterList)
 {
     try
     {
         DBO.ITM07_DBO dbo = new ITM07_DBO(ref USEDB);
         return dbo.doQueryITEM_PERIOD(ParameterList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 取得匯入異常的資料
 /// </summary>
 /// <param name="ParameterList"></param>
 /// <returns></returns>
 public DataTable QUERYERRORBYFIND(ArrayList ParameterList)
 {
     try
     {
         ITM07_DBO ITM07 = new ITM07_DBO(ref USEDB);
         return ITM07.QUERYERRORBYFIND(ParameterList);
     }
     catch (Exception ex)
     { throw ex; }
 }
Esempio n. 3
0
        /// <summary>
        /// ITM071, 按下BUTTON[確定匯入],將TempTable的資料寫入正式Table
        /// </summary>
        /// <param name="RootDBT"></param>
        /// <param name="ParameterList"></param>
        /// <returns></returns>
        public DataTable TmpToDB(DbTransaction RootDBT, ArrayList ParameterList)
        {
            bool IsRootTranscation = false;
            DataTable dt_Return = new DataTable();

            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

                #region 設定變數

                ITM07_DBO ITM07 = new ITM07_DBO(ref USEDB);

                #endregion

                #region 將TempTable的資料寫入正式Table

                dt_Return = ITM07.TmpToDB(DBT, ParameterList);

                #endregion

                #region 將文字檔資料,由"UpdTmp"資料夾移動至"UpdBak"資料夾

                string s_SourcePath = string.Empty;
                string s_DestinationPath = string.Empty;
                DataRow[] dr_Row = dt_Return.Select("STATUS = 'FILE_NAME'");

                if (dr_Row.Length == 1)
                {
                    s_SourcePath = ParameterList[2].ToString() + dr_Row[0]["count"].ToString();
                    s_DestinationPath = ParameterList[3].ToString() + dr_Row[0]["count"].ToString();
                }
                else
                { throw new Exception("移動檔案至正式資料夾發生錯誤"); }

                System.IO.File.Move(s_SourcePath, s_DestinationPath);

                #endregion

                #region 交易成功

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

                #endregion

                return dt_Return;
            }
            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
            }
        }
Esempio n. 4
0
        public void DeleteOne(DataRow[] drs, string strITEM, string strPERIOD, string strUID, string strUPDATEDATE, DbTransaction RootDBT)
        {
            bool IsRootTranscation = false;

            try
            {
                DBO.ITM07_DBO dbo = new ITM07_DBO(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
                ArrayList ParameterList = new ArrayList();
                foreach (DataRow dr in drs)
                {
                    ParameterList.Clear();
                    ParameterList.Add(strITEM);
                    ParameterList.Add(strPERIOD);
                    ParameterList.Add(dr["CHAN_NO"].ToString());
                    ParameterList.Add(strUPDATEDATE);
                    ParameterList.Add(strUID);
                    ParameterList.Add(dr["UPDATEDATE"].ToString());
                    ParameterList.Add(dr["UPDATEUID"].ToString());
                    dbo.doDeleteOne(ParameterList, 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
            }

        }
Esempio n. 5
0
        /// <summary>
        /// ITM071, 按下BUTTON[載入檔案],AP端資料匯入至TempTable
        /// </summary>
        /// <param name="RootDBT"></param>
        /// <param name="s_LogUser"></param>
        /// <param name="dt_Temp"></param>
        /// <returns></returns>
        public DataTable FileToTmp(DbTransaction RootDBT, string s_LogUser, DataTable dt_Temp)
        {
            bool IsRootTranscation = false;
            DataTable dt_Return = new DataTable();

            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

                #region 設定變數

                ITM07_DBO ITM07 = new ITM07_DBO(ref USEDB);

                #endregion

                #region 刪除 VDS_ITM_CHAN_TMP 的資料

                ITM07.DELETE_VDS_ITM_CHAN_TMP(DBT, s_LogUser);

                #endregion

                #region 新增 VDS_ITM_CHAN_TMP 的資料

                foreach (DataRow dr_Temp in dt_Temp.Rows)
                { ITM07.ADD_VDS_ITM_CHAN_TMP(DBT, dr_Temp); }

                #endregion

                #region 檢查文字檔資料是否正確

                ITM07.CHECK_FILETOTMP(DBT, s_LogUser);

                #endregion

                #region 交易成功

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

                #endregion

                #region 取得處理結果

                dt_Return = ITM07.GET_THERESULTS(s_LogUser);

                #endregion

                return dt_Return;
            }
            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
            }
        }
Esempio n. 6
0
 /// <summary>
 /// 取得 VDS_ITM_CHAN_TMP SCHEMA
 /// </summary>
 /// <param name="ParameterList"></param>
 /// <returns></returns>
 public DataTable GET_VDS_ITM_CHAN_TMP_SCHEMA(ArrayList ParameterList)
 {
     try
     {
         ITM07_DBO ITM07 = new ITM07_DBO(ref USEDB);
         return ITM07.GET_VDS_ITM_CHAN_TMP_SCHEMA(ParameterList);
     }
     catch (Exception ex)
     { throw ex; }
 }
Esempio n. 7
0
        /// <summary>
        /// 按下ITM075的Button[整批修改]鈕
        /// </summary>
        /// <param name="RootDBT"></param>
        /// <param name="dt_Temp"></param>
        public void UPDATE_ITM075_BULK(DbTransaction RootDBT, DataTable dt_Temp)
        {
            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

                #region 異動資料庫資料

                DBO.ITM07_DBO dbo = new ITM07_DBO(ref USEDB);

                foreach (DataRow dr in dt_Temp.Rows)
                { dbo.UPDATE_ITM075_BULK(DBT, dr); }

                #endregion

                #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
            }
        }
Esempio n. 8
0
        public void UpdateBath(ArrayList ParameterList)
        {
            bool IsRootTranscation = false;

            try
            {
                DBO.ITM07_DBO dbo = new ITM07_DBO(ref USEDB);

                //獨立呼叫啟動Transcation
                Conn = USEDB.CreateConnection();
                Conn.Open();
                DBT = Conn.BeginTransaction();

                dbo.doUpdateBath(ParameterList, DBT);

                #region 交易成功
                //獨立呼叫Transcation成立
                DBT.Commit();
                #endregion

            }
            catch (Exception ex)
            {
                #region 交易失敗
                //獨立呼叫Transcation失敗
                DBT.Rollback();
                #endregion

                throw ex;
            }
            finally
            {
                #region 判斷是否關閉交易連線
                //獨立呼叫Transcation,關閉連線
                if (Conn.State == ConnectionState.Connecting)
                {
                    Conn.Close();
                }
                #endregion
            }

        }
Esempio n. 9
0
        public void UpdateOne(DataRow[] drs, string strITEM, string strPERIOD, string strUID, string strUPDATEDATE, DbTransaction RootDBT)
        {
            bool IsRootTranscation = false;

            try
            {
                DBO.ITM07_DBO dbo = new ITM07_DBO(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
                ArrayList ParameterList = new ArrayList();
                foreach (DataRow dr in drs)
                {
                    ParameterList.Clear();
                    ParameterList.Add(strITEM);
                    ParameterList.Add(strPERIOD);
                    ParameterList.Add(dr["CHAN_NO"].ToString());
                    ParameterList.Add(dr["ITEM_MAP"].ToString());
                    ParameterList.Add(dr["TRUN_OUT"].ToString());
                    ParameterList.Add(dr["EFFECTIVE_DATE"].ToString());
                    ParameterList.Add(dr["CHAN_END_DATE"].ToString());
                    ParameterList.Add(dr["FREQUENCY_TYPE"].ToString());
                    ParameterList.Add(dr["STATE"].ToString());
                    ParameterList.Add(dr["CHAN_DIS_NO"].ToString());
                    ParameterList.Add(dr["NOTICE_RETURN_DATE"].ToString());
                    ParameterList.Add(dr["BACKWARD_DATE"].ToString());
                    ParameterList.Add(dr["CHAN_ISS_DATE"].ToString());
                    ParameterList.Add(dr["RETURN_TYPE"].ToString());
                    ParameterList.Add(dr["PLAN_RETURN_DATE"].ToString());
                    ParameterList.Add(dr["NEXT_PLAN_RETURN_DATE"].ToString());
                    ParameterList.Add(dr["DISPLAY_DAY"].ToString());
                    ParameterList.Add(dr["RTN_DDL"].ToString());
                    ParameterList.Add(strUPDATEDATE);
                    ParameterList.Add(strUID);
                    ParameterList.Add(dr["UPDATEDATE"].ToString());
                    ParameterList.Add(dr["UPDATEUID"].ToString());
                    dbo.doUpdateOne(ParameterList, 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
            }

        }
Esempio n. 10
0
        public void CopyNew(DataTable dtNew, string strITEM, string strPERIOD, string strUID, string strUPDATEDATE)
        {
            bool IsRootTranscation = false;

            try
            {
                DBO.ITM07_DBO dbo = new ITM07_DBO(ref USEDB);

                //獨立呼叫啟動Transcation
                Conn = USEDB.CreateConnection();
                Conn.Open();
                DBT = Conn.BeginTransaction();

                ArrayList ParameterList = new ArrayList();
                for (int i = 0; i < dtNew.Rows.Count; i++)
                {
                    ParameterList.Clear();
                    ParameterList.Add(strITEM);
                    ParameterList.Add(strPERIOD);
                    ParameterList.Add(dtNew.Rows[i]["EDIT_NO"].ToString());
                    ParameterList.Add(dtNew.Rows[i]["CHAN_NO"].ToString());
                    ParameterList.Add(dtNew.Rows[i]["ITEM_MAP"].ToString());
                    ParameterList.Add(dtNew.Rows[i]["EFFECTIVE_DATE"].ToString());
                    ParameterList.Add(dtNew.Rows[i]["CHAN_END_DATE"].ToString());
                    ParameterList.Add(dtNew.Rows[i]["FREQUENCY_TYPE"].ToString());
                    ParameterList.Add(dtNew.Rows[i]["TRUN_OUT"].ToString());
                    ParameterList.Add(dtNew.Rows[i]["STATE"].ToString());
                    ParameterList.Add(dtNew.Rows[i]["PLAN_RETURN_DATE"].ToString());
                    ParameterList.Add(dtNew.Rows[i]["NEXT_PLAN_RETURN_DATE"].ToString());
                    ParameterList.Add(dtNew.Rows[i]["NOTICE_RETURN_DATE"].ToString());
                    ParameterList.Add(dtNew.Rows[i]["BACKWARD_DATE"].ToString());
                    ParameterList.Add(dtNew.Rows[i]["CHAN_ISS_DATE"].ToString());
                    ParameterList.Add(dtNew.Rows[i]["CHAN_DIS_NO"].ToString());
                    ParameterList.Add(dtNew.Rows[i]["RETURN_TYPE"].ToString());
                    ParameterList.Add(dtNew.Rows[i]["RTN_DDL"].ToString());
                    ParameterList.Add(dtNew.Rows[i]["DISPLAY_DAY"].ToString());
                    ParameterList.Add(strUPDATEDATE);
                    ParameterList.Add(strUID);
                    ParameterList.Add(strUPDATEDATE);
                    ParameterList.Add(strUID);
                    dbo.doInsertOne(ParameterList, DBT);
                }

                #region 交易成功
                //獨立呼叫Transcation成立
                DBT.Commit();
                #endregion

            }
            catch (Exception ex)
            {
                #region 交易失敗
                //獨立呼叫Transcation失敗
                DBT.Rollback();
                #endregion

                throw ex;
            }
            finally
            {
                #region 判斷是否關閉交易連線
                //獨立呼叫Transcation,關閉連線
                if (Conn.State == ConnectionState.Connecting)
                {
                    Conn.Close();
                }
                #endregion
            }

        }