protected void uploadBtn_Click(object sender, EventArgs e) { User user = (User)Session["currentUser"]; int tradingID = -1; int bookID = -1; if (user != null) { BookDAO bookDAO = new BookDAO(); Book book = bookDAO.getByISBN(isbn.Text.Trim()); if (book == null) { string filename = uploadBookCover(); bookID = bookDAO.CreateBook(title.Value.Trim(), author.Value.Trim(), isbn.Text.Trim(), language.Value.Trim(), description.Value.Trim(), filename, user.Id, int.Parse(cate.SelectedItem.Value)); } else { bookID = book.Id; } if (bookID != -1) { TradingDAO tradingDAO = new TradingDAO(); tradingID = tradingDAO.CreateNewTrading(condition.Value.Trim(), bookID, user.Id); uploadTradingImage(tradingID); } Response.Redirect(string.Format("BookDetail.aspx?id={0}", bookID)); } }