private void lendBookToolStripMenuItem1_Click(object sender, EventArgs e) { Window_Popup_LendBook w = new Window_Popup_LendBook(); w.setMainWindowRefrence(this); w.ShowDialog(); }
private void dgvListOfCopies_CellClick(object sender, DataGridViewCellEventArgs e) { DataGridView dgv = sender as DataGridView; if (dgv == null) { return; } if (dgv.CurrentRow.Selected) { int _book_id = Convert.ToInt32(dgv.SelectedRows[0].Cells["Book ID"].Value); Book _book = EntityBroker.getBookByBookID(_book_id); if (_book.BookStatus == 1) { try { Window_Popup_LendBook w = new Window_Popup_LendBook(_book_id); w.setMainWindowRefrence(MainWindowObject); w.ShowDialog(); winObj.Close(); } catch { MessageBox.Show("Please close the window manually"); } } else { Window_Popup_ReturnBook w = new Window_Popup_ReturnBook(_book_id); w.setMainWindowRefrence(MainWindowObject); w.ShowDialog(); winObj.Close(); } } }
private void btnSearchByBookID_Click(object sender, EventArgs e) { int _book_id = 0; try { _book_id = Convert.ToInt32(txtSearchByBookID.Text); } catch { MessageBox.Show("Book ID you entered is not valid type."); return; } Book _book = new Book(); _book = EntityBroker.getBookByBookID(_book_id); if (_book == null) { MessageBox.Show("Book ID you entered is not in the library."); return; } if (_book.BookStatus == 1) { Window_Popup_LendBook w = new Window_Popup_LendBook(_book_id); w.setMainWindowRefrence(MainWindowObject); w.ShowDialog(); } else if (_book.BookStatus == 0) { Window_Popup_ReturnBook w = new Window_Popup_ReturnBook(_book_id); w.setMainWindowRefrence(MainWindowObject); w.ShowDialog(); } }