Exemple #1
0
        //Deletes a category
        private void BtnDeleteCat_Click(object sender, EventArgs e)
        {
            FormHandler.HideNewPodcastName(TxtNewPodName, BtnNewPodName);
            string            message = "Are you sure you want to delete this category?\nAll podcasts of this category will be deleted";
            string            header  = "Delete category";
            MessageBoxButtons buttons = MessageBoxButtons.YesNo;
            DialogResult      result;

            result = MessageBox.Show(message, header, buttons);
            if (result == DialogResult.Yes)
            {
                string category = LstCat.SelectedItem.ToString();
                var    podList  = podcastController.RetrieveAllPodcasts();
                foreach (var item in podList)
                {
                    if (item.Category.Equals(category))
                    {
                        //If the deleted category has any podcasts they are deleted
                        podcastController.DeletePodcast(category);
                    }
                }
                categoryController.DeleteCategory(LstCat.SelectedIndex);
                ClearAndSet();
            }
        }
Exemple #2
0
        private void RemovePodcastBtn_Click(object sender, EventArgs e)
        {
            try
            {
                validator.DataGridViewHasSelected(dataGridPodcast);

                for (int index = 0; index < dataGridPodcast.SelectedRows.Count; index++)
                {
                    var selectedRow = dataGridPodcast.SelectedRows[index];
                    var podcast     = (Podcast)selectedRow.DataBoundItem;

                    podcastController.DeletePodcast(podcast);
                }

                podcastController.SavePodcastData();
                ClearTimer();
                CreateTimerData();
                InsertPodcasts();

                InsertCommandConsole("Item removed.");
            }
            catch (InvalidDataGridException dataGridError)
            {
                CreateInformationMessage(dataGridError.ErrorMessage());
            }
        }
Exemple #3
0
        private void btnDeletePodcast_Click(object sender, EventArgs e)
        {
            if (dgPodcastFeed.CurrentCell != null)
            {
                int rowindex    = dgPodcastFeed.CurrentCell.RowIndex;
                int columnindex = 1;
                var podcastName = dgPodcastFeed.Rows[rowindex].Cells[columnindex].Value.ToString();

                DialogResult response = MessageBox.Show("Are you sure you want to delete the podcast " + podcastName + "?", "Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                if (response == DialogResult.OK)
                {
                    podcastController.DeletePodcast(selectedPodcast);
                    FillPodcastList();
                    ClearInputs();
                    ClearEpisodesList();
                }
            }
        }