Exemplo n.º 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();
            }
        }
Exemplo n.º 2
0
        private void InsertPodcasts()
        {
            dataGridPodcast.Rows.Clear();

            podcastController.RetrieveAllPodcasts().ForEach(aPodcast =>
            {
                podcastBindingSource.Add(aPodcast);
            });

            dataGridPodcast.DataSource = podcastBindingSource;
        }
Exemplo n.º 3
0
        //Fills a DataGridView table with all saved podcasts
        public static void AllPodcasts(DataGridView podcastFeed)
        {
            Validation validator = new Validation();

            if (validator.PodcastFileExists())
            {
                PodcastController podcastController = new PodcastController();
                List <Podcast>    listToBeReturned  = podcastController.RetrieveAllPodcasts();
                foreach (var item in listToBeReturned)
                {
                    podcastFeed.Rows.Add(item.TotalEpisodes, item.Name, item.Interval, item.Category);
                }
            }
        }