private void AddListItem( Book book ) { ListViewItem lvi = new ListViewItem( new string[] { book.BookId, book.Authors, book.Title } ); lvi.Tag = book; this.listViewBooks.Items.Add( lvi ); }
private void okButton_Click( object sender, EventArgs e ) { Book book = new Book(); book.Authors = this.authorsTextBox.Text; book.BookId = this.bookIdTextBox.Text; book.Isbn = this.isbnTextBox.Text; book.Title = this.titleTextBox.Text; try { book.LostPenalty = decimal.Parse( this.maskedTextBoxPenalty.Text ); } catch ( FormatException exc ) { MessageBox.Show( this, "The amount is incorrectly formatted: " + exc.Message ); return; } this.bookProcesses.Value.CreateBook( book ); this.Close(); }
public Book CreateBook( Book book ) { BusinessRulesManager.Assert( "CreateBook", book ); StorageContext.Current.Insert( book ); return book; }