コード例 #1
0
ファイル: Form1.cs プロジェクト: BackupTheBerlios/puzzle-svn
        private void listBooksButton_Click(object sender, System.EventArgs e)
        {
            //clear the data grid
            dataGrid1.DataSource = null;

            //Call the service layer and
            //ask it to fetch all books
            IList books = BookServices.FetchAllBooks(context);

            //bind the result to the data grid
            dataGrid1.DataSource = books;
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: BackupTheBerlios/puzzle-svn
        private void createBookButton_Click(object sender, System.EventArgs e)
        {
            //Call the service layer and
            //ask it to create a new book object
            Book book = BookServices.CreateBook(
                context,
                titleTextBox.Text,
                isbnTextBox.Text);

            //Display the id of the new author
            bookIdTextBox.Text = book.Id.ToString();
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: BackupTheBerlios/puzzle-svn
        private void deleteBookButton_Click(object sender, System.EventArgs e)
        {
            //Make sure the user has entered a book id
            if (bookIdTextBox.Text == "")
            {
                MessageBox.Show("Please enter the id of the book first!");
                return;
            }

            //Call the service layer and
            //ask it to delete the book
            BookServices.DeleteBook(
                context,
                int.Parse(bookIdTextBox.Text));
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: BackupTheBerlios/puzzle-svn
        private void fetchBookButton_Click(object sender, System.EventArgs e)
        {
            //Make sure the user has entered a book id
            if (bookIdTextBox.Text == "")
            {
                MessageBox.Show("Please enter the id of the book first!");
                return;
            }

            //Call the service layer and
            //ask it to fetch a book by id
            Book book = BookServices.FetchBookById(
                context,
                int.Parse(bookIdTextBox.Text));

            //Display the title and isbn
            titleTextBox.Text = book.Title;
            isbnTextBox.Text  = book.Isbn;
        }