public EditBookForm(int bookID, FrmMenu frmMenu, Employee e) { InitializeComponent(); this.bookID = bookID; this.frmMenu = frmMenu; EMPLOYEE = e; authors = AuthorDAO.SelectAllAuthors(); publishers = PublisherDAO.SelectAllPublishers(); categories = CategoryDAO.SelectAllCategories(); }
public void UpdateComboBoxAuthors(int authorID) { comboBoxAuthors.Items.Clear(); authors = AuthorDAO.SelectAllAuthors(); for (int index = 0; index < authors.Count; index++) { Author author = authors[index]; comboBoxAuthors.Items.Add(author.FirstName + " " + author.LastName); if (author.AuthorID == authorID) { comboBoxAuthors.SelectedIndex = index; } } }
public SearchBookPanel(Form containerForm) { this.containerForm = containerForm; authors = AuthorDAO.SelectAllAuthors(); publishers = PublisherDAO.SelectAllPublishers(); categories = CategoryDAO.SelectAllCategories(); Size = new Size(1205, 265); groupBox = new GroupBox() { Text = "Search Book", Location = new Point(12, 12), Size = new Size(1190, 250) }; labelTitle = new Label() { Text = "Title", AutoSize = true, Location = new Point(6, 23), Size = new Size(27, 13) }; textBoxTitle = new TextBox() { Location = new Point(69, 19), Size = new Size(175, 20) }; labelAuthor = new Label() { Text = "Author", AutoSize = true, Location = new Point(6, 49), Size = new Size(38, 13) }; comboBoxAuthors = new ComboBox() { Location = new Point(69, 46), Size = new Size(175, 21) }; labelPublisher = new Label() { Text = "Publisher", AutoSize = true, Location = new Point(6, 76), Size = new Size(30, 13) }; comboBoxPublishers = new ComboBox() { Location = new Point(69, 73), Size = new Size(175, 21) }; labelCategories = new Label() { Text = "Categories", AutoSize = true, Location = new Point(6, 103), Size = new Size(57, 13) }; checkedListBoxCategories = new CheckedListBox() { ScrollAlwaysVisible = true, Location = new Point(69, 103), Size = new Size(175, 94) }; labelPublicationDate = new Label() { Text = "Publication Date", AutoSize = true, Location = new Point(6, 204), Size = new Size(85, 13) }; comboBoxPublicationDate = new ComboBox() { Location = new Point(9, 221), Size = new Size(82, 21) }; labelMonth = new Label() { Text = "Month", AutoSize = true, Location = new Point(97, 204), Size = new Size(37, 13) }; comboBoxMonth = new ComboBox() { Location = new Point(97, 221), Size = new Size(72, 21) }; labelYear = new Label() { Text = "Year", AutoSize = true, Location = new Point(172, 204), Size = new Size(29, 13) }; numericUpDownYear = new NumericUpDown() { Location = new Point(175, 222), Size = new Size(69, 20) }; labelSearchResult = new Label() { Text = "Search Result", AutoSize = true, Location = new Point(250, 16), Size = new Size(74, 13) }; dataGridViewSearchResult = new DataGridView() { AllowUserToAddRows = false, AllowUserToDeleteRows = false, AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells, Location = new Point(253, 32), Size = new Size(600, 210) }; AddControls(); AddItemsToComboBoxAuthors(); AddItemsToComboBoxPublishers(); AddItemsToCheckedListBoxCategories(); AddItemsToComboBoxPublicationDate(); AddItemsToComboBoxMonth(); AddItemsToNumericUpDownYear(); AddEventsToControls(); UpdateDataGridViewSearchResult(); }