public void DeleteNoTransaction(Event e, MySql.Data.MySqlClient.MySqlCommand command) { OpeningStock st = (OpeningStock)e;//this.Get(e.ID); m_command = command; try { if (getEventStatus(st.ID) == EventStatus.Confirm) { throw new Exception("Revise before delete"); } m_command.CommandText = OpeningStockItem.DeleteAllByEventSQL(st.ID); m_command.ExecuteNonQuery(); m_command.CommandText = OpeningStock.DeleteSQL(st.ID); m_command.ExecuteNonQuery(); } catch (Exception x) { throw x; } }
protected override void doDelete(Event e) { OpeningStock st = (OpeningStock)e;//this.Get(e.ID); 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"); } m_command.CommandText = OpeningStockItem.DeleteAllByEventSQL(st.ID); m_command.ExecuteNonQuery(); m_command.CommandText = OpeningStock.DeleteSQL(st.ID); m_command.ExecuteNonQuery(); trc.Commit(); } catch (Exception x) { trc.Rollback(); throw x; } }