/// <summary> /// refreshes the grid with base results /// </summary> public override void Refresh() { base.Refresh(); MainForm parent = (MainForm)this.ParentForm.MdiParent; BookDAO dao = new BookDAO(parent.CurrentDatabase.FullName); if (_mode == Constants.LibraryMode.LOANHISTORY) this.gridBooks.DataSource = dao.SearchBooks(_mode, Constants.SearchMode.BOOK_ID, _bookId).Tables[0]; else this.gridBooks.DataSource = dao.SearchBooks(_mode, Constants.SearchMode.NONE, null).Tables[0]; if (_mode == Constants.LibraryMode.LOANHISTORY && this.gridBooks.Rows.Count > 0) { ViewBooksForm f = this.ParentForm as ViewBooksForm; f.SetTitleBar(_mode, this.gridBooks.Rows[0].Cells["short_title"].Value.ToString()); } }
/// <summary> /// This calls on the dao to get the results depending on the mode we are currently in /// </summary> /// <param name="mode"></param> /// <param name="value"></param> public void Search(Constants.SearchMode mode, string value) { MainForm main = (MainForm)this.ParentForm.MdiParent; BookDAO dao = new BookDAO(main.CurrentDatabase.FullName); this.gridBooks.DataSource = dao.SearchBooks(_mode, mode, value).Tables[0]; }