Beispiel #1
0
        public void DeleteDiscountInvoice(ArrayList ParameterList1, DbTransaction RootDBT)
        {
            try
            {
                DBO.VAM17_DBO dbo = new VAM17_DBO(ref USEDB);

                Conn = USEDB.CreateConnection();
                Conn.Open();
                DBT = Conn.BeginTransaction();

                //先刪除原發票資料
                dbo.doDeleteDiscountInvoice(ParameterList1, DBT);
                DBT.Commit();
            }
            catch (Exception ex)
            {
                if (DBT != null)
                    DBT.Rollback();

                throw ex;
            }
            finally
            {
                //獨立呼叫Transcation,關閉連線
                if (Conn.State == ConnectionState.Connecting)
                {
                    Conn.Close();
                }
            }
        }
Beispiel #2
0
        public void UpdateDiscountInvoice(ArrayList ParameterList1, ArrayList ParameterList, DataTable dtA, DataTable dtB, string V_DISC_NO, int N_ID)
        {
            try
            {
                DBO.VAM17_DBO dbo = new VAM17_DBO(ref USEDB);


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


                //先刪除原發票資料
                dbo.doDeleteDiscountInvoice(ParameterList1, DBT);

                //做折讓主檔新增
                dbo.doUpdateDiscountMain(ParameterList, N_ID, V_DISC_NO, DBT);


                //做折讓明細檔新增
                ArrayList Parameter_Det = new ArrayList();

                if (dtA != null)
                {
                    for (int i = 0; i < dtA.Rows.Count; i++)
                    {
                        Parameter_Det.Clear();
                        Parameter_Det.Add(N_ID);              //N_PID
                        Parameter_Det.Add(V_DISC_NO);         //V_DISC_NO
                        Parameter_Det.Add(ParameterList[1]);  //V_TAX_TYPE     
                        Parameter_Det.Add(GetValueSetParameter(dtA.Rows[i]["PROMOTE_ID"].ToString(), "string", false));  //V_SOURCE_NO                        
                        Parameter_Det.Add(GetValueSetParameter(dtA.Rows[i]["AMT"].ToString(), "float", false));         //N_AMT
                        Parameter_Det.Add(ParameterList[6]);    //D_UPDATEDATE
                        Parameter_Det.Add(ParameterList[7]);    //V_UPDATEUID
                        Parameter_Det.Add(ParameterList[8]);    //D_CREATEDATE
                        Parameter_Det.Add(ParameterList[9]);    //V_CREATEUID
                        Parameter_Det.Add(ParameterList[2]);    //V_VENDOR
                        dbo.doInsertDiscountDetl(Parameter_Det, DBT);
                    }
                }


                //做發票折讓明細檔新增

                if (dtB != null)
                {
                    for (int i = 0; i < dtB.Rows.Count; i++)
                    {
                        Parameter_Det.Clear();
                        Parameter_Det.Add(V_DISC_NO); //V_DISC_NO
                        Parameter_Det.Add(GetValueSetParameter(dtB.Rows[i]["INV_NO"].ToString(), "string", false)); //V_INV_NO
                        Parameter_Det.Add(GetValueSetParameter(dtB.Rows[i]["DISC_AMT"].ToString(), "float", false)); //N_DISC_AMT
                        Parameter_Det.Add(ParameterList[7]);  //V_UPDATEUID
                        Parameter_Det.Add(ParameterList[6]);  //D_UPDATEDATE
                        Parameter_Det.Add(ParameterList[9]);  //V_CREATEUID
                        Parameter_Det.Add(ParameterList[8]);  //D_CREATEDATE

                        dbo.doInsertDiscountInvoice(Parameter_Det, DBT);
                    }
                }


                DBT.Commit();


            }
            catch (Exception ex)
            {
                if (DBT != null)
                    DBT.Rollback();

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