protected override void doDelete(EventJournal e) { Payment st = (Payment)e; MySql.Data.MySqlClient.MySqlTransaction trc = m_connection.BeginTransaction(); m_command.Transaction = trc; try { if (getEventStatus(st.ID) == EventStatus.Confirm) { throw new Exception("Revise before delete"); } foreach (PaymentItem sti in e.EVENT_JOURNAL_ITEMS) { if (sti.PAYMENT_TYPE == PaymentType.APDebitNote) { m_command.CommandText = APDebitNote.UpdateUsedForPayment(sti.AP_DEBIT_NOTE.ID, false); m_command.ExecuteNonQuery(); } } m_command.CommandText = PaymentItem.DeleteAllByEventSQL(st.ID); m_command.ExecuteNonQuery(); m_command.CommandText = Payment.DeleteSQL(st.ID); m_command.ExecuteNonQuery(); trc.Commit(); } catch (Exception x) { trc.Rollback(); throw x; } }
protected override void doDeleteNoTransaction(EventJournal e) { Payment st = (Payment)e; try { if (getEventStatus(st.ID) == EventStatus.Confirm) { throw new Exception("Revise before delete"); } m_command.CommandText = PaymentItem.DeleteAllByEventSQL(st.ID); m_command.ExecuteNonQuery(); m_command.CommandText = Payment.DeleteSQL(st.ID); m_command.ExecuteNonQuery(); } catch (Exception x) { throw x; } }