protected void btXacNhan_Click(object sender, EventArgs e) { string id = Request.QueryString["id"].ToString(); L.UpdateProduct(id, DropDownList1.SelectedValue.ToString(), txtTen.Text, FileUpload1.FileName, txtQuantity.Text, txtGia.Text); Ld.UpdateDetailProduct(id, txtTitle.Text, txtDescription.Text, txtPhoto.FileName, txtTit1.Text, txtDes1.Text, txtPhoto1.FileName, txtTit2.Text, txtDes2.Text, txtPhoto2.FileName, txtTit3.Text, txtDes3.Text, txtPhoto3.FileName, txtTit4.Text, txtDes4.Text, txtPhoto4.FileName, txtTit5.Text, txtDes5.Text, txtPhoto5.FileName); Response.Redirect("~/Page/Admin/Product/DetailManger.aspx?id=" + id); }
protected void btXacNhan_Click(object sender, EventArgs e) { string ID = Request.QueryString["id"].ToString(); L.UpdateProduct(ID, DropDownList1.SelectedValue.ToString(), txtTen.Text, FileUpload1.FileName, txtQuantity.Text, txtGia.Text); string alert = "Sửa thành công"; Response.Redirect("~/Page/Admin/Product/Product.aspx?alert=" + alert); }
//public void SavePhoto() //{ // string path = ""; // HttpPostedFile image = Request.Files["FileUploadAnh"]; // if (image != null && image.ContentLength > 0) // { // path = Server.MapPath("~/Public/images/products/") + Path.GetFileName(image.FileName); // image.SaveAs(path); // } //} protected void btnUpdate_Click(object sender, EventArgs e) { int id = int.Parse(txtProductID.Text); int vendorid = int.Parse(DropDownList1.SelectedValue); int categoryid = int.Parse(DropDownList2.SelectedValue); string productname = txtName.Text; string description = txtDescription.Text; int quantity = int.Parse(txtQuantity.Text); decimal cost = Convert.ToDecimal(txtCost.Text); string linkImage; if (FileUploadAnh.FileName != "") { string path = Server.MapPath("~/Public/images/products/" + FileUploadAnh.FileName); FileUploadAnh.PostedFile.SaveAs(path); linkImage = FileUploadAnh.FileName; } else { linkImage = lbImage.Text; } int state; if (chbState.Checked) { state = 1; } else { state = 0; } if (txtCost.Text == "" || txtDescription.Text == "" || txtName.Text == "" || txtQuantity.Text == "" || linkImage == "") { Response.Write("<script>alert('Mời nhập đủ thông tin sản phẩm!')</script>"); } else { bus.UpdateProduct(id, vendorid, categoryid, productname, description, linkImage, quantity, cost, state); //string alert = "Sửa thành công"; Response.Redirect("~/Page/Admin/Product/Product.aspx"); } }