private void CB_shorts_SelectedIndexChanged(object sender, EventArgs e) { if (CB_shorts.CheckedItems.Count != 1) { return; } string s = CB_shorts.CheckedItems[0].ToString(); //SelectedItem.ToString(); memo(s); int aid = util.getid(s); memo("aid = " + aid); CB_shorts.SetItemCheckState(CB_shorts.CheckedIndices[0], CheckState.Unchecked); CB_shorts.ClearSelected(); ChapterSong cs = (from c in db.ChapterSong where c.Id == aid select c).FirstOrDefault(); if (cs == null) { return; } FormDoBook fd = new FormDoBook(db, cs.BookAlbum); fd.Show(); }
private void ShortsButton_Click(object sender, EventArgs e) { // Waiting / hour glass Cursor.Current = Cursors.WaitCursor; var q = from c in db.AuthorChapter where c.Author == a.Id select c; Shortcountlabel.Text = q.Count().ToString() + " short stories"; if (q.Count() > 0) { foreach (AuthorChapter c in q) { ChapterSong art = c.ChapterSongChapterSong; string s = " (" + art.BookAlbumBookAlbum.YearFirst + ") " + art.Title; memo(s); CB_shorts.Items.Add("(" + art.BookAlbumBookAlbum.YearFirst + ") " + util.addid(art.Title, art.Id, 100)); } } else { CB_shorts.Items.Add("(no books)"); } // Back to normal Cursor.Current = Cursors.Default; }
private void register_current() { if (String.IsNullOrEmpty(TB_title.Text)) { return; } ChapterSong cs = new ChapterSong(); cs.Id = ics; ics++; cs.Title = TB_title.Text; parent.shortslist.Add(cs); AuthorChapter ac = make_authorchapter(TB_author.Text, cs.Id); if (ac != null) { parent.shortsauthorlist.Add(ac); } foreach (string s in LB_coauthor.Items) { AuthorChapter acc = make_authorchapter(s, cs.Id); if (acc != null) { parent.shortsauthorlist.Add(acc); } } }
private void Titlebutton_Click(object sender, EventArgs e) { FormFindTitle fa = new FormFindTitle(db); DialogResult faresult = fa.ShowDialog(); var tid = fa.titleid; var tit = fa.titletype; memo("titleid = " + tid.ToString()); memo("titletype = " + tit.ToString()); if (faresult == DialogResult.OK) { if (tit == 1) { FormDoArticle faa = new FormDoArticle(db, tid); faa.Show(); } else if (tit == 2) { FormDoBook fb = new FormDoBook(db, tid); fb.Show(); } else { ChapterSong cs = (from c in db.ChapterSong where c.Id == tid select c).FirstOrDefault(); if (cs != null) { FormDoBook fb = new FormDoBook(db, cs.BookAlbum); fb.Show(); } } } }
public static string ChapterAuthorString(Librarydb db, ChapterSong cs) { string s = ""; string sep = ""; foreach (AuthorChapter ab in cs.AuthorChapter) { s += sep + ab.AuthorAuthor.Name; sep = "&"; } return(s); }
private void delete_chapter(int csid) { var qac = from c in db.AuthorChapter where c.ChapterSong == csid select c; memo("qac " + qac.Count()); db.AuthorChapter.DeleteAllOnSubmit(qac); db.SubmitChanges(); ChapterSong cs = (from c in db.ChapterSong where c.Id == csid select c).FirstOrDefault(); memo("cs = " + cs.Title); if (cs != null) { db.ChapterSong.DeleteOnSubmit(cs); db.SubmitChanges(); } }