Esempio n. 1
0
        /// <summary>
        /// ����SP�������
        /// </summary>
        /// <param name="ParameterList">�ܼ�</param>
        /// <param name="RootDBT">�O�_���D���,�L�D�����Jnull</param>
        public void TestTranscation(ArrayList ParameterList1,
            ArrayList ParameterList2,
            ArrayList ParameterList3,
            DbTransaction RootDBT
            )
        {
            bool IsRootTranscation = false;

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

                //�P�_�O�_���ǤJRoot Transcation
                IsRootTranscation = (RootDBT == null) ? true : false;

                #region �Ұʥ���Ϋ��wRootTranscation

                if (IsRootTranscation)
                {
                    //�W�ߩI�s�Ұ�Transcation
                    Conn = USEDB.CreateConnection();
                    Conn.Open();
                    DBT = Conn.BeginTransaction();
                }
                else
                {
                    DBT = RootDBT;
                }

                #endregion

                dbo.doCreate(ParameterList1, DBT);

                dbo.doUpdate(ParameterList2, DBT);

                dbo.doDelete(ParameterList3, DBT);

                throw new Exception("�������");

                #region ������\

                if (IsRootTranscation)
                {
                    //�W�ߩI�sTranscation����
                    DBT.Commit();
                }

                #endregion

            }
            catch (Exception ex)
            {
                #region �������

                if (IsRootTranscation)
                {
                    //�W�ߩI�sTranscation����
                    DBT.Rollback();
                }

                #endregion

                throw ex;
            }
            finally
            {
                #region �P�_�O�_��������s�u

                if (IsRootTranscation)
                {
                    //�W�ߩI�sTranscation,�����s�u
                    if (Conn.State == ConnectionState.Connecting)
                    {
                        Conn.Close();
                    }
                }

                #endregion
            }
        }
Esempio n. 2
0
        /// <summary>
        /// �򥻪��s�WBCO
        /// </summary>
        /// <param name="ParameterList">��J�ܼ�</param>
        /// <param name="RootDBT">�O�_���D���,�L�D�����Jnull</param>
        /// <returns>�^�Ǽv�T����</returns>
        public int CreateVendorBase(ArrayList ParameterList,
            DbTransaction RootDBT
            )
        {
            int PID = 0;
            bool IsRootTranscation = false;

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

                //�P�_�O�_���ǤJRoot Transcation
                IsRootTranscation = (RootDBT == null) ? true : false;

                #region �Ұʥ���Ϋ��wRootTranscation

                if (IsRootTranscation)
                {
                    //�W�ߩI�s�Ұ�Transcation
                    Conn = USEDB.CreateConnection();
                    Conn.Open();
                    DBT = Conn.BeginTransaction();
                }
                else
                {
                    DBT = RootDBT;
                }

                #endregion

                PID = dbo.doCreate(ParameterList, DBT);

                #region ������\

                if (IsRootTranscation)
                {
                    //�W�ߩI�sTranscation����
                    DBT.Commit();
                }

                #endregion

                return 0;
            }
            catch (Exception ex)
            {
                #region �������

                if (IsRootTranscation)
                {
                    //�W�ߩI�sTranscation����
                    DBT.Rollback();
                }

                #endregion

                throw ex;
            }
            finally
            {
                #region �P�_�O�_��������s�u

                if (IsRootTranscation)
                {
                    //�W�ߩI�sTranscation,�����s�u
                    if (Conn.State == ConnectionState.Connecting)
                    {
                        Conn.Close();
                    }
                }

                #endregion

            }
        }