コード例 #1
0
        public void loadBookSongs(string code)
        {
            try
            {
                lstSongResults.Items.Clear();
                lstSongids.Items.Clear();

                sqlQuery = "SELECT songid, number, title FROM songs WHERE book='" + code + "';";
                appDB    = new AppDatabase();
                dRowCol  = appDB.getList(sqlQuery);

                foreach (DataRow row in dRowCol)
                {
                    lstSongResults.Items.Add(row["number"] + "# " + row["title"]);
                    lstSongids.Items.Add(row["songid"]);
                    lstSongResults.SelectedIndex = 0;
                    lstSongids.SelectedIndex     = 0;
                }
                grpSongResults.Text = lstSongResults.Items.Count + " " + lstBookcodes.Text + " songs found";
            }
            catch (Exception ex)
            {
                loadFeedback("Oops! Sorry, songs listing failed: " + ex.Message, false);
            }
        }
コード例 #2
0
        public void seachForSongs(string searchstr, bool criteria)
        {
            if (txtSearch.Text != "Search for Songs")
            {
                try
                {
                    lstSongResults.Items.Clear();
                    lstSongids.Items.Clear();

                    string searchcriteria = "";
                    if (!criteria)
                    {
                        searchcriteria = " AND book='" + lstBookcodes.Text + "'";
                    }

                    if (searchstr.Length < 5)
                    {
                        sqlQuery = "SELECT songid, number, title FROM songs " +
                                   "WHERE number=" + int.Parse(searchstr) + searchcriteria + ";";
                    }
                    else
                    {
                        sqlQuery = "SELECT songid, number, title FROM songs " +
                                   "WHERE title LIKE '%" + searchstr + "%' " + searchcriteria +
                                   "OR content LIKE '%" + searchstr + searchcriteria + "%';";
                    }

                    appDB   = new AppDatabase();
                    dRowCol = appDB.getList(sqlQuery);

                    foreach (DataRow row in dRowCol)
                    {
                        lstSongResults.Items.Add(row["number"] + "# " + row["title"]);
                        lstSongids.Items.Add(row["songid"]);
                        lstSongResults.SelectedIndex = 0;
                        lstSongids.SelectedIndex     = 0;
                    }
                    grpSongResults.Text = lstSongResults.Items.Count + " songs found with '" + searchstr + "'";
                }
                catch (Exception ex)
                {
                    loadFeedback("Oops! Sorry, songs searching has failed due to the error: " + ex.Message, false);
                }
            }
        }
コード例 #3
0
        public void loadNewTestament()
        {
            try
            {
                lstNewtt.Items.Clear();
                lstNewTestament.Items.Clear();
                sqlQuery = "SELECT * FROM books WHERE testament=2;";
                appDB    = new AppDatabase();
                dRowCol  = appDB.getList(sqlQuery);

                foreach (DataRow row in dRowCol)
                {
                    lstNewtt.Items.Add(row["title"] + " (" + row["code"] + ")");
                    lstNewTestament.Items.Add(row["title"]);
                    lstNewtt.SelectedIndex        = 0;
                    lstNewTestament.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
                loadFeedback("Oops! Sorry, books listing failed: " + ex.Message, false);
            }
        }
コード例 #4
0
        public void loadBooks()
        {
            try
            {
                cmbBooks.Items.Clear();
                lstBookcodes.Items.Clear();
                sqlQuery = "SELECT * FROM books WHERE state=1;";
                appDB    = new AppDatabase();
                dRowCol  = appDB.getList(sqlQuery);

                foreach (DataRow row in dRowCol)
                {
                    cmbBooks.Items.Add(row["title"] + " (" + row["songs"] + ")");
                    lstBookcodes.Items.Add(row["code"]);
                    cmbBooks.SelectedIndex     = 0;
                    lstBookcodes.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
                loadFeedback("Oops! Sorry, books listing failed: " + ex.Message, false);
            }
        }
コード例 #5
0
        public void loadBooks()
        {
            try
            {
                lstBooks.Items.Clear();
                lstBookids.Items.Clear();
                sqlQuery = "SELECT * FROM books;";
                appDB    = new AppDatabase();
                dRowCol  = appDB.getList(sqlQuery);

                foreach (DataRow row in dRowCol)
                {
                    lstBooks.Items.Add(row["title"] + " (" + row["songs"] + ")");
                    lstBookids.Items.Add(row["bookid"]);
                    lstBooks.SelectedIndex   = 0;
                    lstBookids.SelectedIndex = 0;
                }
                grpBookResults.Text = lstBooks.Items.Count + " books exist currently";
            }
            catch (Exception ex)
            {
                loadFeedback("Oops! Sorry, books listing failed: " + ex.Message, false);
            }
        }