Beispiel #1
0
        public InsertOrUpdatePublisherForm(int?publisherId = null)
        {
            InitializeComponent();
            _database = new MyLibraryDatabase();

            if (publisherId.HasValue)
            {
                _isUpdate  = true;
                _publisher = _database.GetPublishers(p => p.PublisherId == publisherId).Single();

                txtName.Text = _publisher.Name;
            }
        }
Beispiel #2
0
        public InsertOrUpdateBookForm(int?bookId = null)
        {
            InitializeComponent();
            _database = new MyLibraryDatabase();

            cmbPublishers.DataSource = _database.GetPublishers();

            if (bookId.HasValue)
            {
                _isUpdate = true;
                _book     = _database.GetBooks(b => b.BookId == bookId).Single();

                txtName.Text = _book.Name;
                cmbPublishers.SelectedValue = _book.PublisherId;
                txtAuthor.Text      = _book.Author;
                dtPublishedOn.Value = _book.PublishedOn;
                txtISBN.Text        = _book.ISBN;
                txtDescription.Text = _book.Description;
            }
        }
Beispiel #3
0
 public MainForm()
 {
     InitializeComponent();
     _database = new MyLibraryDatabase();
 }