コード例 #1
0
        protected void btnPrev_Click(object sender, EventArgs e)
        {
            // Web Service methods are available webService.methodName() from this instance
            var webService = new BooksWebServiceProxy.BooksWebServiceSoapClient();

            // here I get the minId value from the first book
            var getMin = webService.getFirstBookAndAuthor();
            // then store it in minId to be used in the getPreviousBookAndAuthor method
            var minId = getMin.BookId.ToString();

            // look in the Web Service for more information on the methods used
            if (long.Parse(lblBookId.Text) <= long.Parse(minId))
            {
                lblAddEditStatus.Text = "This is the first Book";
            }
            else
            {
                var navData = webService.getPreviousBookAndAuthor(lblBookId.Text, minId);
                lblBookId.Text        = navData.BookId.ToString();
                lblBookTitle.Text     = navData.BookTitle.ToString();
                lblBookGenre.Text     = navData.BookGenre.ToString();
                lblBookAuthor.Text    = navData.AuthorName.ToString();
                lblAddEditStatus.Text = "Previous Book";
            }
        }
コード例 #2
0
        protected void btnFirst_Click(object sender, EventArgs e)
        {
            // Web Service methods are available webService.methodName() from this instance
            var webService = new BooksWebServiceProxy.BooksWebServiceSoapClient();

            // look in the Web Service for more information on the methods used
            try
            {
                var navData = webService.getFirstBookAndAuthor();
                lblBookId.Text        = navData.BookId.ToString();
                lblBookTitle.Text     = navData.BookTitle.ToString();
                lblBookGenre.Text     = navData.BookGenre.ToString();
                lblBookAuthor.Text    = navData.AuthorName.ToString();
                lblAddEditStatus.Text = "First Book";
            }
            catch
            {
                lblAddEditStatus.Text = "Could not find first Book";
            }
        }