/// <summary> /// Called when right click ->view details is called /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void viewDetailsToolStripMenuItem_Click(object sender, EventArgs e) { MainForm parent = (MainForm)this.ParentForm.MdiParent; BookDAO dao = new BookDAO(parent.CurrentDatabase.FullName); foreach (string id in this.SelectedIds) { AddBookForm form = new AddBookForm(_mode, Constants.AddBookMode.VIEWONLY); form.BookData = dao.GetBookById(id); form.MdiParent = parent; form.Show(); } }
/// <summary> /// We override refresh to refresh the text boxees from the data /// </summary> public override void Refresh() { if(_bookId != null) { MainForm frm = this.MdiParent as MainForm; BookDAO dao = new BookDAO(frm.CurrentDatabase.Name); this._book = dao.GetBookById(_bookId); } Book b = _book; base.Refresh(); txtISBN.Text = b.ISBN; txtShortTitle.Text = b.ShortTitle; txtLongTitle.Text = b.LongTitle; string authors = ""; foreach (Person p in b.Authors) authors += p.FullName + Environment.NewLine; txtAuthors.Text = authors; string editors = ""; foreach (Person p in b.Editors) editors += p.FullName + Environment.NewLine; txtEditors.Text = editors; txtPublisher.Text = b.PublisherInfo; txtDewey.Text = b.Dewey; txtDeweyNorm.Text = b.DeweyNormalized; txtLCC.Text = b.LibraryOfCongress; txtPhysDesc.Text = b.PhysicalDescription; txtEdition.Text = b.Edition; txtLanguage.Text = b.Language; txtSummary.Text = b.Summary; txtNotes.Text = b.Notes; txtAwards.Text = b.Awards; txtURLs.Text = b.Urls; txtNewPrice.Text = b.NewPrice; txtUsedPrice.Text = b.UsedPrice; string subjects = ""; foreach (Subject s in b.Subjects) { subjects += s.Name + "\r\n"; } txtSubjects.Text = subjects; }