public void loadSingleSong(int songid) { try { cur_stz = 0; sqlQuery = "SELECT * FROM songs WHERE songid=" + songid + ";"; appDB = new AppDatabase(); reader = appDB.getSingle(sqlQuery); while (reader.Read()) { lblSongno.Text = "#" + reader["number"].ToString(); lblSongTitle.Text = vsbf.textRender(reader["title"].ToString()); songtext = reader["content"].ToString(); } appDB.sqlClose(); songstanzas = songtext.Split('`'); stanzas = songstanzas.Length; lblSongText.Text = vsbf.songRender(songstanzas[cur_stz]); } catch (Exception ex) { lblSongTitle.Text = "Song projection failed"; lblSongText.Text = "Oops! Song projection failed due to: " + ex.Message; } }
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); } }
private void btnUpdate_Click(object sender, EventArgs e) { appDB = new AppDatabase(); bool editbook = appDB.editBook(lstBookids.Text, txtBookTitle.Text, txtBookCode.Text, txtNotes.Text); if (editbook) { loadFeedback("A new book has been added successfully!", true, true); loadBooks(); } loadBooks(); }
private void btnSaveNew_Click(object sender, EventArgs e) { appDB = new AppDatabase(); bool newbook = appDB.addNewBook(txtBookTitle.Text, txtBookCode.Text, txtNotes.Text); if (newbook) { loadFeedback("A new book has been added successfully!", true, true); loadBooks(); } clearFields(); }
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); } } }
public void loadSingleSong(int songid) { try { txtSongContent.Clear(); sqlQuery = "SELECT * FROM songs WHERE songid=" + songid + ";"; appDB = new AppDatabase(); reader = appDB.getSingle(sqlQuery); while (reader.Read()) { txtSongContent.Text = vsbf.songRender(reader["content"].ToString()); } appDB.sqlClose(); } catch (Exception ex) { loadFeedback("Oops! Sorry song viewing failed: " + ex.Message, false, true); } }
public void loadBookDetails(string songid) { try { txtNotes.Clear(); sqlQuery = "SELECT * FROM books WHERE bookid=" + songid + ";"; appDB = new AppDatabase(); reader = appDB.getSingle(sqlQuery); while (reader.Read()) { txtBookTitle.Text = reader["title"].ToString(); txtBookCode.Text = reader["code"].ToString(); txtNotes.Text = reader["notes"].ToString(); lblInfo.Text = reader["songs"].ToString() + " songs"; } appDB.sqlClose(); } catch (Exception ex) { loadFeedback("Oops! Sorry book viewing failed: " + ex.Message, false, true); } }
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); } }
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); } }
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); } }