protected void Button1_Click(object sender, EventArgs e) { Guid photoGuid = Guid.NewGuid(); string fileName = imagesUpload.FileName; string photoFileName = photoGuid.ToString() + fileName; DateTime dt = Convert.ToDateTime(TextBox1.Text); if (bookBL.photo_HasFile(imagesUpload)) { if (BL.add_Book(name.Text, DropDownList1.SelectedValue, DropDownList2.SelectedValue, DropDownList3.SelectedValue, author.Text, publisher.Text, dt, ISBN.Text, binding.Text, language.Text, price.Text, amonet.Text, introduction.Text, content.Text, photoFileName) > 0) { bookBL.file_Upload(imagesUpload, photoGuid.ToString()); name.Text = ""; author.Text = ""; publisher.Text = ""; ISBN.Text = ""; language.Text = ""; amonet.Text = ""; TextBox1.Text = ""; binding.Text = ""; price.Text = ""; introduction.Text = ""; content.Text = ""; Response.Write("<script>alert('新增書籍成功!');</script>"); } else { Response.Write("<script>alert('新增書籍失敗!');</script>"); } } else { Response.Write("<script>alert('請上傳書籍封面!');</script>"); } }