Esempio n. 1
0
        /// <summary>
        /// 取得 VDS_CRM_ORDER_MAIN && VDS_CRM_ORDER_DETL 的 Data
        /// </summary>
        /// <param name="ParameterList"></param>
        /// <returns>回傳查詢結果</returns>
        public DataSet QUERY_CRM041_MAIN_AND_DETL(ArrayList ParameterList)
        {
            try
            {
                DataSet ds_Return = new DataSet();
                DataTable dt_Return_Main = new DataTable();
                DataTable dt_Return_Detl = new DataTable();

                DBO.VDS_CRM_ORDER_MAINDBO VCOM = new VDS_CRM_ORDER_MAINDBO(ref USEDB);
                DBO.VDS_CRM_ORDER_DETLDBO VCOD = new VDS_CRM_ORDER_DETLDBO(ref USEDB);

                dt_Return_Main = VCOM.QUERY_CRM041_MAIN(ParameterList);
                dt_Return_Main.TableName = "VDS_CRM_ORDER_MAIN";

                dt_Return_Detl = VCOD.QUERY_CRM041_DETL(ParameterList);
                dt_Return_Detl.TableName = "VDS_CRM_ORDER_DETL";

                ds_Return.Tables.Add(dt_Return_Main.Copy());
                ds_Return.Tables.Add(dt_Return_Detl.Copy());

                dt_Return_Main.Clear();
                dt_Return_Detl.Clear();
                dt_Return_Main.Dispose();
                dt_Return_Detl.Dispose();

                return ds_Return;

            }
            catch (Exception ex)
            { throw GetNewException(ex); }
        }
Esempio n. 2
0
 /// <summary>
 /// 取得 VDS_CRM_ORDER_DETL 的 SCHEMA
 /// </summary>
 /// <param name="ParameterList"></param>
 /// <returns>回傳查詢結果</returns>
 public DataTable QUERY_CRM041_DETL_SCHEMA(ArrayList ParameterList)
 {
     try
     {
         DBO.VDS_CRM_ORDER_DETLDBO VCOD = new VDS_CRM_ORDER_DETLDBO(ref USEDB);
         return VCOD.QUERY_CRM041_DETL_SCHEMA(ParameterList);
     }
     catch (Exception ex)
     { throw GetNewException(ex); }
 }
 /// <summary>
 /// 根據條件,查詢商品儲區移轉明細
 /// </summary>
 /// <param name="ParameterList">
 /// [@訂單擷轉日]
 /// </param>
 /// <returns></returns>
 public DataTable QueryCRMStockTransfer(ArrayList ParameterList)
 {
     try
     {
         DBO.VDS_CRM_ORDER_DETLDBO VCOD = new VDS_CRM_ORDER_DETLDBO(ref USEDB);
         return VCOD.QUERY_CRM_STOCKTRANSFER(ParameterList);
     }
     catch (Exception ex)
     { throw GetNewException(ex); }
 }
Esempio n. 4
0
        /// <summary>
        /// 刪除 VDS_CRM_ORDER_MAIN 和 VDS_CRM_ORDER_DETL 的資料

        /// </summary>
        /// <param name="ParameterList">MASTER TABLE 的變數</param>
        /// <param name="RootDBT">是否有主交易,無主交易輸入null</param>
        /// <param name="dt_Detail">DETAIL TABLE</param>
        public void DeleteCRMOrder(ArrayList ParameterList, DbTransaction RootDBT, DataTable dt_Detail)
        {
            bool IsRootTranscation = false;

            try
            {
                DBO.VDS_CRM_ORDER_MAINDBO VCOM = new VDS_CRM_ORDER_MAINDBO(ref USEDB);
                DBO.VDS_CRM_ORDER_DETLDBO VCOD = new VDS_CRM_ORDER_DETLDBO(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

                //2010/09/20 reverse DETL & MAIN executive progress
                if (dt_Detail.Rows.Count != 0)
                {
                    foreach (DataRow dRow in dt_Detail.Rows)
                    { VCOD.DELETE_CRM041_DETL(ParameterList, DBT, dRow); }
                }

                VCOM.DELETE_CRM041_MAIN(ParameterList, DBT);

                #region 交易成功

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

                #endregion

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

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

                #endregion

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

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

                #endregion
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 根據條件,更新STATUS、PROC_DESC。
        /// </summary>
        /// <param name="ParameterList">
        /// @PID,@品號,@期別,@PROC_DESC,@USER_ID
        /// </param>
        /// <param name="RootDBT"></param>
        public bool UpdateCrm22(ArrayList ParameterList, DbTransaction RootDBT, out string str_ErrMsg)
        {
            bool bResult = false;

            bool IsRootTranscation = false;

            try
            {
                DBO.VDS_CRM_ORDER_DETLDBO VCOD = new VDS_CRM_ORDER_DETLDBO(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

                bResult = VCOD.doUpdateCrm22(ParameterList, DBT, out str_ErrMsg);

                #region 交易成功

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

                #endregion

                return bResult;


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

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

                #endregion

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

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

                #endregion
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 根據條件,更新備註欄位。

        /// </summary>
        /// <param name="ParameterList">
        /// @訂單擷轉日, @品號,@期別,@來源儲區,@目標儲區, @注意事項
        /// </param>
        /// <returns></returns>
        public void UpdateTransferMemo(ArrayList ParameterList, DbTransaction RootDBT)
        {
            bool IsRootTranscation = false;

            try
            {
                DBO.VDS_CRM_ORDER_DETLDBO VCOD = new VDS_CRM_ORDER_DETLDBO(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

                VCOD.UPDATE_TRANSFERMEMO(ParameterList, DBT);

                #region 交易成功

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

                #endregion

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

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

                #endregion

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

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

                #endregion
            }
        }
Esempio n. 7
0
        /// <summary>
        /// 修改 VDS_CRM_ORDER_DETL 的資料

        /// </summary>
        /// <param name="ParameterList"></param>
        /// <param name="RootDBT"></param>
        /// <param name="dt_Detail"></param>
        public void UpdateCRMOrder(ArrayList ParameterList, DbTransaction RootDBT, DataTable dt_Detail_Changes_Delete, DataTable dt_Detail_Changes_Add, DataTable dt_Detail_Changes_Modify, DataTable dt_Detail_Original)
        {
            bool IsRootTranscation = false;

            try
            {
                DBO.VDS_CRM_ORDER_DETLDBO VCOD = new VDS_CRM_ORDER_DETLDBO(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

                string s_Log_User = ParameterList[0].ToString();
                DateTime d_Now = DateTime.Parse(ParameterList[1].ToString());
                int i_Master_id = int.Parse(ParameterList[2].ToString());

                if (dt_Detail_Changes_Delete != null)
                {
                    foreach (DataRow dRow in dt_Detail_Changes_Delete.Rows)
                    { VCOD.DELETE_CRM041_DETL(ParameterList, DBT, dRow); }
                }

                if (dt_Detail_Changes_Add != null)
                {
                    foreach (DataRow dRow in dt_Detail_Changes_Add.Rows)
                    { VCOD.ADD_CRM041_DETL(DBT, dRow, i_Master_id, s_Log_User, d_Now); }
                }

                if (dt_Detail_Changes_Modify != null)
                {
                    foreach (DataRow dRow in dt_Detail_Changes_Modify.Rows)
                    {
                        string s_FilterExpression = string.Empty;
                        s_FilterExpression = "ID =" + dRow["ID"].ToString() + " and PID =" + dRow["PID"].ToString();
                        DataRow dRow_Oringinal = dt_Detail_Original.Select(s_FilterExpression)[0];
                        VCOD.UPDATE_CRM041_DETL(ParameterList, DBT, dRow_Oringinal, dRow);
                    }
                }

                #region 交易成功

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

                #endregion

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

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

                #endregion

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

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

                #endregion
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 新增 VDS_CRM_RECORD_MAIN 和 VDS_CRM_RECORD_DETL 的資料
        /// </summary>
        /// <param name="ParameterList">MASTER TABLE 的變數</param>
        /// <param name="RootDBT">是否有主交易,無主交易輸入null</param>
        /// <param name="dt_Detail">DETAIL TABLE</param>
        /// <returns>VDS_CRM_RECORD_MAIN.ID</returns>
        public int CreateCRMOrder(ArrayList ParameterList, DbTransaction RootDBT, DataTable dt_Detail)
        {
            int i_Id = 0;
            string s_Log_User = string.Empty;
            DateTime d_Now;
            bool IsRootTranscation = false;

            try
            {
                DBO.VDS_CRM_ORDER_MAINDBO VCOM = new VDS_CRM_ORDER_MAINDBO(ref USEDB);
                DBO.VDS_CRM_ORDER_DETLDBO VCOD = new VDS_CRM_ORDER_DETLDBO(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

                //寫入 Master Table
                i_Id = VCOM.ADD_CRM041_MAIN(ParameterList, DBT);

                d_Now = DateTime.Parse(ParameterList[2].ToString());
                s_Log_User = ParameterList[3].ToString();

                foreach (DataRow dRow in dt_Detail.Rows)
                { VCOD.ADD_CRM041_DETL(DBT, dRow, i_Id, s_Log_User, d_Now); }

                #region Commit前檢查同門市未結案品項是否重複
                ArrayList CheckList = new ArrayList();
                CheckList.Clear();
                CheckList.Add(ParameterList[9].ToString());//CHAN_NO
                CheckList.Add(ParameterList[10].ToString());//STORE
                CheckList.Add(i_Id);                        // MASTER.ID
                CheckList.Add(ParameterList[3].ToString()); //CREATEUID
                string sCheck = CheckOrderItemBeforeCommit(CheckList, DBT);
                #endregion

                #region 交易成功

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

                #endregion

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

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

                #endregion

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

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

                #endregion

            }
        }
Esempio n. 9
0
        /// <summary>
        /// 根據條件,查詢並回前一筆傳客服補書訂單資訊(含明細)

        /// </summary>
        /// <param name="ParameterList">[@訂單編號]</param>
        /// <returns>回傳查詢結果</returns>
        public DataSet QueryPriorCRMOrder(ArrayList ParameterList)
        {
            try
            {
                DataSet ds_Return = new DataSet();
                DataTable dt_Return_Main = new DataTable();
                DataTable dt_Return_Detl = new DataTable();
                int i_Id = 0;
                string s_Log_User = string.Empty;

                DBO.VDS_CRM_ORDER_MAINDBO VCOM = new VDS_CRM_ORDER_MAINDBO(ref USEDB);
                DBO.VDS_CRM_ORDER_DETLDBO VCOD = new VDS_CRM_ORDER_DETLDBO(ref USEDB);

                dt_Return_Main = VCOM.QUERY_PRIORCRMORDER(ParameterList);

                if (dt_Return_Main.Rows.Count != 0)
                {
                    dt_Return_Main.TableName = "VDS_CRM_ORDER_MAIN";

                    i_Id = int.Parse(dt_Return_Main.Rows[0]["ID"].ToString());
                    s_Log_User = ParameterList[1].ToString();

                    ParameterList.Clear();
                    ParameterList.Add(i_Id);
                    ParameterList.Add(s_Log_User);

                    dt_Return_Detl = VCOD.QUERY_CRM041_DETL(ParameterList);
                    dt_Return_Detl.TableName = "VDS_CRM_ORDER_DETL";

                    ds_Return.Tables.Add(dt_Return_Main.Copy());
                    ds_Return.Tables.Add(dt_Return_Detl.Copy());
                }
                else
                { ds_Return = null; }

                dt_Return_Main.Clear();
                dt_Return_Detl.Clear();
                dt_Return_Main.Dispose();
                dt_Return_Detl.Dispose();

                return ds_Return;
            }
            catch (Exception ex)
            { throw GetNewException(ex); }
        }
Esempio n. 10
0
        /// <summary>
        /// 根據條件,取得該筆訂單明細的所有修改履歷

        /// </summary>
        /// <param name="ParameterList"></param>
        /// <returns>回傳查詢結果</returns>
        public DataTable QueryCRMOrderDetailLog(ArrayList ParameterList)
        {
            try
            {
                DBO.VDS_CRM_ORDER_DETLDBO VCOD = new VDS_CRM_ORDER_DETLDBO(ref USEDB);
                return VCOD.QUERY_CRMORDER_DETAILLOG(ParameterList);
            }
            catch (Exception ex)
            { throw GetNewException(ex); }
        }