Exemple #1
0
        /// <summary>
        /// Delete - removes a sermon data from the connected database
        /// </summary>
        /// <param name="id">Sermon Id</param>
        /// <returns></returns>
        public async Task DeleteSermonAsync(int?id)
        {
            Sermon sermon = await GetSermonByIdAsync(id);

            _context.Sermon.Remove(sermon);
            await _context.SaveChangesAsync();
        }
        public async Task <IActionResult> Edit(int id, [Bind("SermonID,SermonTitle,SermonLink,SermonDate")] Sermon sermon)
        {
            if (id != sermon.SermonID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sermon);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SermonExists(sermon.SermonID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(sermon));
        }
Exemple #3
0
        private static void AddSermons(DBConnection dbCon, SermonSeries series)
        {
            string query = "SELECT * FROM sermons WHERE series = @seriesId ";
            var    cmd   = new MySqlCommand(query, dbCon.Connection);

            cmd.Parameters.AddWithValue("@seriesId", series.id);
            cmd.Prepare();
            var reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                var sermon = new Sermon();
                sermon.id                   = reader.GetInt32(0);
                sermon.title                = reader.GetString(1);
                sermon.slug                 = reader.GetString(2);
                sermon.description          = reader.GetString(3);
                sermon.speaker              = reader.GetString(4);
                sermon.duration             = reader.GetInt32(5);
                sermon.kitclub_id           = reader.GetInt32(6);
                sermon.vimeo_id             = reader.GetInt64(7);
                sermon.vimeo_sd_url         = reader.GetString(8);
                sermon.vimeo_live_url       = reader.GetString(9);
                sermon.audio_link           = reader.GetString(10);
                sermon.audio_size           = reader.GetString(11);
                sermon.series               = reader.GetInt32(12);
                sermon.campus               = reader.GetInt32(13);
                sermon.podcast_views        = reader.GetInt32(14);
                sermon.date                 = reader.GetInt64(15);
                sermon.notes_downloaded     = reader.GetInt32(16);
                sermon.questions_downloaded = reader.GetInt32(17);
                sermon.deleted              = reader.GetBoolean(18);
                series.sermons.Add(sermon);
            }
            reader.Close();
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name,SermonDate,SermonTitle,BibleReading,VideoLink,BulletinLink")] Sermon sermon)
        {
            if (id != sermon.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sermon);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SermonExists(sermon.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(sermon));
        }
Exemple #5
0
        private void DeleteTreeNode(TreeNode treeNodeSelected)
        {
            try
            {
                if (treeNodeSelected.Name == "PARENTNODE")//the selected node is a parentNode
                {
                    if (MessageBox.Show("Do you want to delete this parent node [" + treeNodeSelected.Text + "]" +
                                        " and all its children?\n(NB: This action cannot be undone.)",
                                        "Warning!", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        foreach (TreeNode child in treeNodeSelected.Nodes)//close tabpage if possible
                        {
                            CloseTabPage(child.Name);
                            RecentlyOpenedDocs.DeleteSermonFromID(int.Parse(child.Name));
                            Sermon.DeleteSermon(int.Parse(child.Name));
                        }
                        if (int.TryParse(treeNodeSelected.Name, out int id))
                        {
                            CloseTabPage(treeNodeSelected.Name);
                            RecentlyOpenedDocs.DeleteSermonFromID(int.Parse(treeNodeSelected.Name));
                            Sermon.DeleteSermon(int.Parse(treeNodeSelected.Name));
                        }
                        treeNodeSelected.Remove();
                    }
                }
                else//i.e. the selected node is not a parent node
                {
                    TreeNode parentNode = treeNodeSelected.Parent;

                    if (treeNodeSelected.Name != null)
                    {
                        if (MessageBox.Show("Do you want to delete this node [" + treeNodeSelected.Text + "]" +
                                            "?\n(NB: This action cannot be undone.)",
                                            "Warning!", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            CloseTabPage(treeNodeSelected.Name);//close tabpage if possible
                            treeNodeSelected.Remove();
                            RecentlyOpenedDocs.DeleteSermonFromID(int.Parse(treeNodeSelected.Name));
                            Sermon.DeleteSermon(int.Parse(treeNodeSelected.Name));
                            StatusBarMessages.SetStatusBarMessageAction("Deleted " + treeNodeSelected.Text);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Could not access node data.\nPlease try again.", "Failed to delete!");
                    }
                    if (parentNode.GetNodeCount(false) == 0)
                    {
                        parentNode.Remove();
                    }
                }
            }
            catch
            {
                MessageBox.Show("Kindly specify the node to be deleted.");
            }
        }
        /// <summary>
        /// Sort the sermons based on the current filter.
        /// </summary>
        private void SortSermons()
        {
            List <SortedSermons> list = Sermon.Sort(CurrentFilter, AllSermons);

            SermonsToDisplay.Clear();
            foreach (SortedSermons item in list)
            {
                SermonsToDisplay.Add(item);
            }
        }
Exemple #7
0
        public ActionResult SermonDetails(Sermon sermon, int id)
        {
            var _sermon = _uow.Sermons.Get(id);
            var civm    = new SermonIndexViewModel
            {
                sermon = _sermon
            };

            return(View(civm));
        }
Exemple #8
0
        private async Task <bool> SermonExists(int id)
        {
            Sermon sermon = await _sermon.GetSermonByIdAsync(id);

            if (sermon != null)
            {
                return(true);
            }
            return(false);
        }
 /// <summary>
 /// Viewer constructor.
 /// </summary>
 /// <param name="sermon">Sermon to be displayed.</param>
 public MSViewer(Sermon sermon) : base()
 {
     this.InitializeComponent();
     this.sermon = sermon;
     if (sermon != null)
     {
         this.ViewerTitle   = this.sermon.Title;
         this.ViewerContent = this.sermon.Content;
     }
 }
        public async Task <IActionResult> Create([Bind("SermonID,SermonTitle,SermonLink,SermonDate")] Sermon sermon)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sermon);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(sermon));
        }
        public async Task <IActionResult> Create([Bind("ID,Name,SermonDate,SermonTitle,BibleReading,VideoLink,BulletinLink")] Sermon sermon)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sermon);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(sermon));
        }
Exemple #12
0
        public ActionResult Sermons(int page = 0, string id = null)
        {
            if (page < 0)
            {
                page = 0;
            }

            this.ViewBag.PrevPage = page - 1;
            this.ViewBag.NextPage = page + 1;

            long sermonsCount = this.Context.Sermons.Count();

            this.ViewBag.SermonsCount = sermonsCount;

            if (!string.IsNullOrEmpty(id))
            {
                var ids = this.Repo.FindAll(this.Context.Sermons).SetFields(new string[] { "_id", "Date" }).OrderByDescending(s => s.Date).ToList();

                for (int i = 0; i < ids.Count; i++)
                {
                    if (ids[i].Id == id)
                    {
                        this.ViewBag.PrevPage = i - 1;
                        this.ViewBag.NextPage = i + 1;

                        break;
                    }
                }

                var sermonById = this.Repo.FindOneById <Sermon>(this.Context.Sermons, id);

                return(View(sermonById));
            }

            Sermon sermon = new Sermon();

            try
            {
                sermon = this.Repo.FindAll <Sermon>(this.Context.Sermons).OrderByDescending(s => s.Date).Skip(page).FirstOrDefault();

                if (sermon == null)
                {
                    sermon = this.Repo.FindAll <Sermon>(this.Context.Sermons).OrderByDescending(s => s.Date).FirstOrDefault();
                    this.ViewBag.NextPage = 1;
                    this.ViewBag.PrevPage = -1;
                }
            }
            catch (System.Exception)
            {
            }

            return(View(sermon));
        }
        public Sermon Edit(Sermon entity, SermonModel model)
        {
            entity.SermonTitle      = model.SermonTitle;
            entity.ShortDescription = model.ShortDescription;
            entity.PreacherName     = model.PreacherName;
            entity.LongDescription  = model.LongDescription;
            entity.IsLiked          = model.IsLike;
            entity.CatId            = model.SermId;
            entity.SermonText       = model.SermonText;
            entity.SermonDate       = model.SermonDate;

            return(entity);
        }
Exemple #14
0
        public void AddNewTreeNode(string szTitle, string ID)
        {
            bool doesParentNodeExist = false;
            bool doesChildNodeExist  = false;

            foreach (TreeNode parentNode in Nodes)
            {
                foreach (TreeNode childNode in parentNode.Nodes)
                {
                    if (childNode.Name == ID)
                    {
                        doesChildNodeExist = true;
                    }
                }
            }
            if (!doesChildNodeExist)
            {
                string newParent = Sermon.GetSermonComponent(int.Parse(ID), FILTER);
                foreach (TreeNode parentNode in Nodes)
                {
                    if (newParent == parentNode.Text)
                    {
                        doesParentNodeExist = true;

                        string   szChildNode = Sermon.GetSermonComponent(int.Parse(ID), "Title");
                        TreeNode tvnodeChild = new TreeNode(szChildNode)
                        {
                            Name = ID
                        };
                        parentNode.Nodes.Add(tvnodeChild);
                        break;
                    }//Else create a new ParentNode
                }
                if (!doesParentNodeExist)
                {
                    TreeNode tvnodeParentNew = new TreeNode(Sermon.GetSermonComponent(int.Parse(ID), FILTER));
                    TreeNode tvnodeChildNew  = new TreeNode(Sermon.GetSermonComponent(int.Parse(ID), "Title"))
                    {
                        Name = ID
                    };
                    Nodes.Add(tvnodeParentNew);
                    tvnodeParentNew.Nodes.Add(tvnodeChildNew);
                }
            }
            else
            {
            }
            SortTreeView(FILTER);
        }
Exemple #15
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Sermon = await _sermon.GetSermonByIdAsync(id);

            if (Sermon == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Exemple #16
0
 private bool GetPrintText(int DocumentID)
 {
     try
     {
         rtbPrintContent = new RichTextBoxEx()
         {
             Rtf = SermonReader.DisplayStoredSermon(Sermon.GetSermonComponents(DocumentID)).RTFpublic
         };
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemple #17
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Sermon = await _sermon.GetSermonByIdAsync(id);

            if (Sermon != null)
            {
                await _sermon.DeleteSermonAsync(id);
            }

            return(RedirectToPage("./Index"));
        }
        public ActionResult AddSermon(SermonModel model)
        {
            if (ModelState.IsValid)
            {
                var    sermoncat = _context.SermonCategories.Where(s => s.SermonName == model.SermonCategoryName).FirstOrDefault();
                string fileName  = Path.GetFileNameWithoutExtension(model.ImageFile.FileName);
                string extension = Path.GetExtension(model.ImageFile.FileName);
                fileName       = fileName + DateTime.Now.ToString("yymmssffff") + extension;
                model.ImageUrl = fileName;
                fileName       = Path.Combine(Server.MapPath("~/Content/Images/"), fileName);
                model.ImageFile.SaveAs(fileName);

                //
                var addsermon = new Sermon
                {
                    SermonDate        = model.SermonDate,
                    CatId             = model.CatId,
                    SermonTitle       = model.SermonTitle,
                    SermonText        = model.SermonText,
                    PreacherName      = model.PreacherName,
                    LongDescription   = model.LongDescription,
                    ShortDescription  = model.ShortDescription,
                    SermonCategory    = sermoncat,
                    ImageUrl          = model.ImageUrl,
                    ImageThumbnailUrl = model.ImageUrl,

                    //SermonvideoUrl=sv.SermonvideoUrl,
                    //SermonvideoThumbnail=sv.SermonvideoUrl
                };
                _context.Sermons.Add(addsermon);
                _context.SaveChanges();
                TempData["message"] = string.Format("{0} has been saved.", model.SermonTitle);
                return(RedirectToAction("SermonList"));
                //  var result = _sermonServices.CreatSermon(model);
            }
            else
            {
                var sermoncategory = _context.SermonCategories.Select(r => r.SermonName);
                ViewBag.SermonCategory = new SelectList(sermoncategory);
                return(View(model));
            }
        }
Exemple #19
0
        public ActionResult SermonAdd(SermonInputModel inputSermon)
        {
            if (this.ModelState.IsValid)
            {
                var sermon = new Sermon();

                sermon.Date     = DateTime.Now;
                sermon.Author   = inputSermon.Author;
                sermon.Text     = this.sanitizer.Sanitize(inputSermon.Text);
                sermon.Theme    = inputSermon.Theme;
                sermon.Title    = inputSermon.Title;
                sermon.ImageUrl = string.Empty;

                this.Repo.Insert(this.Context.Sermons, sermon);

                return(RedirectToAction("Sermons", "Home"));
            }

            return(View(inputSermon));
        }
Exemple #20
0
        public ActionResult PrintPdf(Sermon s, int id)
        {
            var _sermon = _uow.Sermons.Get(id);
            var sivm    = new SermonIndexViewModel
            {
                sermon    = _sermon,
                ReturnUrl = ""
            };
            var pdfView = new ViewAsPdf("SermonDetails", sivm)
            {
                FileName    = sivm.sermon.Title,
                PageSize    = Rotativa.Options.Size.A4,
                PageMargins =
                {
                    Left  = 0,
                    Right = 0
                }
            };

            return(pdfView);
        }
Exemple #21
0
        private void MenuItemPrintAll_Click(object sender, EventArgs e)
        {
            DialogResult userChoice = MessageBox.Show("If many files are to be printed, your PC will be taxed. Do you wish to continue?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (userChoice == DialogResult.Yes)
            {
                try
                {
                    RichTextBoxEx rtbSource = new RichTextBoxEx();
                    foreach (TreeNode tnParentNode in Nodes)
                    {
                        foreach (TreeNode tnChildNode in tnParentNode.Nodes)
                        {
                            try
                            {
                                string rtf = SermonReader.DisplayStoredSermon(Sermon.GetSermonComponents(int.Parse(tnChildNode.Name))).RTFpublic;
                                try
                                {
                                    if (rtbSource.Rtf.ToLower().Contains("rtf"))
                                    {
                                        rtf = AppendRTF(rtbSource.Rtf, rtf);
                                    }
                                }
                                catch { }

                                rtbSource.Rtf = rtf;

                                rtbSource.Text += PAGE_BREAK;
                            }
                            catch
                            {
                                MessageBox.Show("An error was encountered in opening [" + tnChildNode.Text + "].");
                            }
                        }
                    }
                    MyPrintDialog myPrintDialog = new MyPrintDialog(parentForm, rtbSource);
                }
                catch {; }
            }
        }
Exemple #22
0
        public ActionResult AddSermon(SermonView sv)
        {
            if (ModelState.IsValid)
            {
                var    sermoncat = _uow.SermonCategories.Find(s => s.SermonName == sv.SermonCategoryName).FirstOrDefault();
                string fileName  = Path.GetFileNameWithoutExtension(sv.ImageFile.FileName);
                string extension = Path.GetExtension(sv.ImageFile.FileName);
                fileName    = fileName + DateTime.Now.ToString("yymmssffff") + extension;
                sv.ImageUrl = fileName;
                fileName    = Path.Combine(Server.MapPath("~/Content/Images/"), fileName);
                sv.ImageFile.SaveAs(fileName);



                var addsermon = new Sermon
                {
                    SermonDate        = sv.SermonDate,
                    Title             = sv.SermonTitle,
                    Bibletext         = sv.SermonText,
                    PreacherName      = sv.PreacherName,
                    LongDescription   = sv.LongDescription,
                    ShortDescription  = sv.ShortDescription,
                    SermonCategory    = sermoncat,
                    ImageUrl          = sv.ImageUrl,
                    ImageThumbnailUrl = sv.ImageUrl,
                    VideoLink         = sv.SermonvideoUrl
                };
                _uow.Sermons.Add(addsermon);
                _uow.Commit();
                TempData["message"] = string.Format("{0} has been saved.", sv.SermonTitle);
                return(RedirectToAction("SermonList"));
            }
            else
            {
                var sermoncategory = _uow.SermonCategories.GetAll().Select(r => r.SermonName);
                ViewBag.SermonCategory = new SelectList(sermoncategory);
                return(View(sv));
            }
        }
 public MainWindow()
 {
     if (Database.Initialise())
     {
         AllSermons       = Sermon.Read();
         SermonsToDisplay = new ObservableCollection <SortedSermons>();
         Filters          = new List <string>()
         {
             "Date", "Location", "Speaker", "Theme", "Title"
         };
         ChildContextMenuItems = new List <string>()
         {
             "View", "Edit", "Print", "Delete"
         };
         this.InitializeComponent();
         this.BaseComboBoxFilters.SelectedIndex = 1;
     }
     else
     {
         MessageBox.Show("Database initialisation failed.");
     }
 }
Exemple #24
0
        ////////////////// MY FUNCTIONS START HERE //////////////////
        private void AssignSearch(string FILTER, string searchString, bool considerCase, bool matchWhole)
        {
            string[,] foundItems = Sermon.Search(FILTER, searchString, considerCase, matchWhole);

            if (foundItems.GetLength(1) < 1)
            {
                MessageBox.Show("The " + FILTER.ToUpper() + ": " + searchString + " could not be found.");
            }
            else
            {
                for (int i = 0; i < foundItems.GetLength(1); i++)
                {
                    ListViewItem lvItem = new ListViewItem(foundItems[0, i]);
                    ListViewItem.ListViewSubItem lvSubItem = new ListViewItem.ListViewSubItem(lvItem, foundItems[1, i]);
                    lvItem.SubItems.Add(lvSubItem);
                    lvItem.Name = foundItems[2, i];

                    lvShowFoundItems.Items.Add(lvItem);
                }
                lvShowFoundItems.Sort();
            }
        }
Exemple #25
0
        private void MenuItemDeleteAll_Click(object sender, EventArgs e)
        {
            DialogResult userChoice = MessageBox.Show("This option is going to delete every record in your library. Do you wish to continue?\n(NB: This action cannot be undone.)", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (userChoice == DialogResult.Yes)
            {
                try
                {
                    foreach (TreeNode tnParentNode in Nodes)
                    {
                        foreach (TreeNode tnChildNode in tnParentNode.Nodes)
                        {
                            try
                            {
                                string szRemoved = tnChildNode.Name;
                                CloseTabPage(szRemoved);//close tabpage if possible
                                Sermon.DeleteSermon(int.Parse(szRemoved));
                                RecentlyOpenedDocs.DeleteSermonFromID(int.Parse(szRemoved));
                            }
                            catch {; }
                        }
                    }
                    Nodes.Clear();
                    Sort();
                    if (Nodes.Count != 0)
                    {
                        MessageBox.Show("An error was encountered in deleting some nodes. Please try again.");
                        StatusBarMessages.SetStatusBarMessageAction("Partial deletion");
                    }
                    else
                    {
                        StatusBarMessages.SetStatusBarMessageAction("Deleted all stored sermons");
                    }
                }
                catch {; }
            }
        }
 public SermonViewModel(Sermon sermon)
 {
     this.Assign(sermon);
 }
Exemple #27
0
        private void SaveTypedData()
        {
            try
            {
                DateTime datetime = dtPicker.Value;

                int series;
                try
                {
                    if (!int.TryParse(cmbxSeries.SelectedValue.ToString(), out series))
                    {
                        series = 0;
                    }
                }
                catch
                {
                    series = 0;
                }

                string venue;
                if (string.IsNullOrEmpty(txbVenue_Name.Text))
                {
                    venue = "NOT SET";
                }
                if (txbVenue_Name.Text == txbVenue_Name.Watermark)
                {
                    venue = "NOT SET";
                }
                else
                {
                    venue = txbVenue_Name.Text;
                }

                string town;
                if (string.IsNullOrEmpty(txbVenue_Town.Text))
                {
                    town = "NOT SET";
                }
                if (txbVenue_Town.Text == txbVenue_Town.Watermark)
                {
                    town = "NOT SET";
                }
                else
                {
                    town = txbVenue_Town.Text;
                }

                string activity;
                if (string.IsNullOrEmpty(txbVenue_Activity.Text))
                {
                    activity = "NOT SET";
                }
                if (txbVenue_Activity.Text == txbVenue_Activity.Watermark)
                {
                    activity = "NOT SET";
                }
                else
                {
                    activity = txbVenue_Activity.Text;
                }

                string speaker;
                if (string.IsNullOrEmpty(txbSpeakerName.Text))
                {
                    speaker = "NOT SET";
                }
                if (txbSpeakerName.Text == txbSpeakerName.Watermark)
                {
                    speaker = "NOT SET";
                }
                else
                {
                    speaker = txbSpeakerName.Text;
                }

                string keytext;
                if (string.IsNullOrEmpty(txbKeyText.Text))
                {
                    keytext = "NOT SET";
                }
                if (txbKeyText.Text == txbKeyText.Watermark)
                {
                    keytext = "NOT SET";
                }
                else
                {
                    keytext = txbKeyText.Text;
                }

                string hymn;
                if (string.IsNullOrEmpty(txbHymn.Text))
                {
                    hymn = "NOT SET";
                }
                if (txbHymn.Text == txbHymn.Watermark)
                {
                    hymn = "NOT SET";
                }
                else
                {
                    hymn = txbHymn.Text;
                }

                string title;
                if (string.IsNullOrEmpty(txbTitle.Text))
                {
                    title = "NOT SET";
                }
                if (txbTitle.Text == txbTitle.Watermark)
                {
                    title = "NOT SET";
                }
                else
                {
                    title = txbTitle.Text;
                }

                string theme;
                if (string.IsNullOrEmpty(txbTheme.Text))
                {
                    theme = "NOT SET";
                }
                if (txbTheme.Text == txbTheme.Watermark)
                {
                    theme = "NOT SET";
                }
                else
                {
                    theme = txbTheme.Text;
                }

                string content = rtbContent.Rtf;

                StatusBarMessages.SetStatusBarMessageAction("Saving " + title);

                if (isEdited == false)//new sermon
                {
                    Sermon sermon = new Sermon(0, series, datetime, venue, town, activity, speaker, keytext, hymn, title, theme, content);

                    string[] arraySubItems = Sermon.ComponentsToString(sermon);
                    if (Sermon.WriteSermon(arraySubItems) == 1)//sermon inserted successfully
                    {
                        AppEngine.Database.Sermon dummy = new AppEngine.Database.Sermon()
                        {
                            Activity    = sermon.Activity,
                            Content     = sermon.Content,
                            DateCreated = sermon.DateCreated,
                            Hymn        = sermon.Hymn,
                            KeyText     = sermon.KeyText,
                            Speaker     = sermon.Speaker,
                            Title       = sermon.Title,
                            Theme       = sermon.Theme,
                            Town        = sermon.Town,
                            Venue       = sermon.Venue
                        };
                        if (dummy.Exists(dummy))
                        {
                            sermon.Id = dummy.Id;
                            parentForm.tabControl.TabPages.Remove(parentForm.tabControl.SelectedTab);
                            parentForm.AddNewTabPage(SermonReader.DisplayStoredSermon(Sermon.ComponentsToString(sermon)));
                            treeViewEx.AddNewTreeNode(dummy.Title, dummy.Id.ToString());
                        }
                    }
                    else
                    {
                        MessageBox.Show("Document not added.\nPlease try again.");
                    }
                }
                else//edited sermon: use existing ID
                {
                    Sermon   sermon        = new Sermon(editedID, series, datetime, venue, town, activity, speaker, keytext, hymn, title, theme, content);
                    string[] arraySubItems = Sermon.ComponentsToString(sermon);
                    arraySubItems[iID] = editedID.ToString();
                    Sermon.OverwriteSermon(arraySubItems);
                    parentForm.tabControl.TabPages.Remove(parentForm.tabControl.SelectedTab);
                    parentForm.AddNewTabPage(SermonReader.DisplayStoredSermon(arraySubItems));
                }
                StatusBarMessages.SetStatusBarMessageAction("Saved " + title);
            }
            catch
            {
                StatusBarMessages.SetStatusBarMessageAction("Error saving " + txbTitle.Text);
            }
        }
Exemple #28
0
 private void LoadSeries()
 {
     #region Load Series Details
     seriesName = GetColumnValue(dsSeries, "SeriesName");
     seriesDesc = GetColumnValue(dsSeries, "SeriesDescription");
     seriesBy = GetColumnValue(dsSeries, "SeriesBy");
     seriesArtLink = GetColumnValue(dsSeries, "ArtLink");
     seriesArtSmallLink = GetColumnValue(dsSeries, "ArtSmallLink");
     #endregion
     #region Load the sermons under this series
     if (dsSeries.Tables[1].Rows.Count > 0)
     {
         sermons.Clear();
         foreach (DataRow row in dsSeries.Tables[1].Rows)
         {
             Sermon sermon = new Sermon(
                 row["SermonID"].ToString(),
                 row["SermonName"].ToString(),
                 row["SermonDescription"].ToString(),
                 row["SermonBy"].ToString(),
                 row["SermonDate"].ToString(),
                 row["ImageLink"].ToString(),
                 row["AudioLink"].ToString(),
                 row["VideoLink"].ToString(),
                 row["ArtLink"].ToString(),
                 row["ArtSmallLink"].ToString());
             sermons.Add(sermon);
         }
     }
     #endregion
 }
Exemple #29
0
 /// <summary>
 /// Update - modifies a sermon data from the connected database
 /// </summary>
 /// <param name="sermon">Sermon object containing updated sermon data</param>
 /// <returns></returns>
 public async Task UpdateSermonAsync(Sermon sermon)
 {
     _context.Sermon.Update(sermon);
     await _context.SaveChangesAsync();
 }
Exemple #30
0
        /// <summary>
        /// Create - saves a sermon data by saving a Sermon object into the connected database
        /// </summary>
        /// <param name="sermon">Sermon object containing new sermon data</param>
        /// <returns></returns>
        public async Task CreateSermonAsync(Sermon sermon)
        {
            await _context.Sermon.AddAsync(sermon);

            await _context.SaveChangesAsync();
        }
Exemple #31
0
 public async Task OnGetAsync()
 {
     LatestSermon = await _sermon.GetLatestSermonAsync();
 }