Exemplo n.º 1
0
        protected void btn_next_Click(object sender, EventArgs e)
        {
            int?        bookindb   = 0;
            string      coursecode = Request.Form[ddl_cdepartment.UniqueID] + txt_cnumber.Text.Trim();
            AmazonBook  amazon     = new AmazonBook();
            BookManager book       = new BookManager();
            string      isbn       = txt_isbn.Text.Trim();

            bookindb = book.CheckBookInDB(isbn, coursecode);
            if (bookindb > 0)
            {
                Response.Redirect("~/confirmtb?" + QueryString.ISBN + "=" + isbn + "&" +
                                  QueryString.CourseCode + "=" + coursecode + "&" +
                                  QueryString.InDb + "=" + bookindb);
            }
            else
            {
                Dictionary <string, string> bookInfo = amazon.LookUpBook(isbn);
                if (bookInfo[Book.Name] != null)
                {
                    Session[USession.Book] = bookInfo;
                    Response.Redirect("~/confirmtb?" + QueryString.ISBN + "=" + txt_isbn.Text.Trim() + "&" +
                                      QueryString.CourseCode + "=" + coursecode);
                }
                else
                {
                    Response.Redirect("~/newbooklist?" + QueryString.ISBN + "=" + txt_isbn.Text.Trim() + "&" +
                                      QueryString.CourseCode + "=" + coursecode);
                }
            }
        }