private void btnFavourite_Click(object sender, EventArgs e) { if (btnFavourite.ImageIndex == 0) { Cursor.Current = Cursors.WaitCursor; try { _dbManager.OpenConnection(); _dbManager.BeginTransaction(); _dbManager.InsertSeries(_series); _dbManager.Commit(); dgvEpisodes.Columns["Watched"].Visible = true; MessageBox.Show("Added to Favourites"); toolTip1.SetToolTip(btnFavourite, "Unfavourite"); btnSelectAll.Enabled = true; btnDeselectAll.Enabled = true; btnConfirm.Enabled = true; _favouriteFlag = true; } catch (Exception ex) { MessageBox.Show("Couldn't add series to favourites. Please try again later"); } finally { if (_dbManager.TheTransaction != null) { _dbManager.Rollback(); } _dbManager.CloseConnection(); Cursor.Current = Cursors.Default; } } else { Cursor.Current = Cursors.WaitCursor; try { _dbManager.OpenConnection(); _dbManager.BeginTransaction(); _dbManager.DeleteSeries(_series.SeriesID); _dbManager.Commit(); dgvEpisodes.Columns["Watched"].Visible = false; MessageBox.Show("Removed from Favourites"); toolTip1.SetToolTip(btnFavourite, "Favourite"); btnSelectAll.Enabled = false; btnDeselectAll.Enabled = false; btnConfirm.Enabled = false; _favouriteFlag = true; } catch (Exception ex) { MessageBox.Show("Couldn't remove series from favourites. Please try again later"); } finally { if (_dbManager.TheTransaction != null) { _dbManager.Rollback(); } Cursor.Current = Cursors.Default; } } }