コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            IBookStoreWebService searchSevice = new BookStoreWebService();
            List <Book>          returnBooks  = searchSevice.GetAllBooks();

            displayBooks(returnBooks);
        }
コード例 #2
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            string field = searchddl.SelectedValue;
            string value = searchtxt.Text;
            IBookStoreWebService searchSevice = new BookStoreWebService();
            List <Book>          returnBooks  = searchSevice.SearchBook(field, value);

            displayBooks(returnBooks);
        }
コード例 #3
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            string field = deleteddl.SelectedValue;
            string value = deletetxt.Text;

            IBookStoreWebService bookService = new BookStoreWebService();

            if (bookService.DeleteBook(field, value))
            {
                displayBooks(bookService.GetAllBooks());
            }
            else
            {
                errorlbl.Text = "Delete failed!";
            }
        }
コード例 #4
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            Book book = new Book();

            book.ID     = idtxt.Text;
            book.Name   = nametxt.Text;
            book.Author = authortxt.Text;
            book.Year   = Convert.ToInt32(yeartxt.Text);
            book.Price  = float.Parse(pricetxt.Text);
            book.Stock  = Convert.ToInt32(stocktxt.Text);

            IBookStoreWebService bookService = new BookStoreWebService();

            if (bookService.AddBook(book))
            {
                displayBooks(bookService.GetAllBooks());
            }
            else
            {
                errorlbl.Text = "Add failed!";
            }
        }