public AddBookForm(catalogBooksEntities dbCatalog, ShowForm parent = null) { InitializeComponent(); this.dbCatalog = dbCatalog; this.parent = parent; List <Genre> listGenre = // get genre from db (from genre in dbCatalog.Genre select genre).ToList(); cmbGenre.DataSource = listGenre; cmbGenre.DisplayMember = "name"; if (listGenre.Count > 0) { cmbGenre.SelectedItem = listGenre[0]; // set first record in combobox } List <Publishing> listPublishing = // get Publishing from db (from publishing in dbCatalog.Publishing select publishing).ToList(); cmbPublishing.DataSource = listPublishing; cmbPublishing.DisplayMember = "name"; if (listPublishing.Count > 0) { cmbPublishing.SelectedItem = listPublishing[0]; // set first record in combobox } }
public ShowForm() { InitializeComponent(); dbCatalog = new catalogBooksEntities(); UpdateListBook(0); }
public AddGenreForm(catalogBooksEntities dbCatalog) { InitializeComponent(); this.dbCatalog = dbCatalog; }
public MainForm() { InitializeComponent(); dbCatalog = new catalogBooksEntities(); }