Example #1
0
        protected void isbn_TextChanged(object sender, EventArgs e)
        {
            System.Threading.Thread.Sleep(1000);
            BookService.BookService service = new BookService.BookService();
            Book book = service.checkBookExist(isbn.Text);

            if (book != null)
            {
                title.Value       = book.title;
                author.Value      = book.author;
                tag.Value         = book.tag;
                language.Value    = book.language;
                description.Value = book.description;

                disableInput(true);
                //
                idBookTxt.Value = book.id + "";
            }
            else
            {
                title.Value       = "";
                author.Value      = "";
                tag.Value         = "";
                language.Value    = "";
                description.Value = "";

                disableInput(false);
            }
        }
Example #2
0
        protected void uploadBtn_Click(object sender, EventArgs e)
        {
            int idBook = 0;

            int.TryParse(idBookTxt.Value, out idBook);
            if (checkRules.Checked && Session["currentUser"] != null)
            {
                User user = (User)Session["currentUser"];
                TradingService.TradingService tradingService = new TradingService.TradingService();
                BookService.BookService       bookService    = new BookService.BookService();

                if (bookService.checkBookExist(isbn.Text) == null) // if book not exist then create new book first
                {
                    idBook = bookService.createBook(isbn.Text, title.Value, author.Value, tag.Value, language.Value, description.Value, user.id);
                    uploadCoverBook(user.id, idBook);
                }
                string xx = user.id + "";
                if (idBook != 0)
                {
                    tradingService.createTrading(user.id, idBook);
                    Server.Transfer(string.Format("BookDetails.aspx?id={0}", idBook));
                }
            }
        }