Beispiel #1
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            try
            {
                JournalEntry j = new JournalEntry();

                j.BookId      = int.Parse(bookComboBox.SelectedValue.ToString());
                j.Chapter     = int.Parse(chapterTextBox.Text);
                j.BeginVerse  = int.Parse(beginVerseTextBox.Text);
                j.EndVerse    = int.Parse(endVerseTextBox.Text);
                j.EntryTypeId = int.Parse(comboBox1.SelectedValue.ToString());
                j.Title       = titleTextBox.Text;
                j.NoteText    = noteTextBox.Text;

                using (var helper = new JournalEntryHelper())
                {
                    j = helper.AddJournalEntry(j);
                    dbStatusLabel.Text = $"Saved with ID {j.JournalEntryId}";
                }

                // Reset
                titleTextBox.Text = null;
                noteTextBox.Text  = null;
                bookComboBox.Focus();
            }
            catch (Exception caught)
            {
                MessageBox.Show($"Exception occured: {caught.Message}");
            }
        }
Beispiel #2
0
        private List <JournalEntry> GetJournalEntriesForReference(Reference r)
        {
            int beginVerse = 0;
            int endVerse   = 0;

            if (r.Verses.Any())
            {
                beginVerse = r.Verses.Min();
                endVerse   = r.Verses.Max();
            }

            using (var helper = new JournalEntryHelper())
            {
                return(helper.GetJournalEntries(r.Book.BookNumber, r.Chapter, beginVerse, endVerse));
            }
        }