protected void btnCapNhat_Click(object sender, EventArgs e) { if (Session["MaBL"] != null) { int id = int.Parse(Session["MaBL"].ToString()); BUS_BinhLuan bus = new BUS_BinhLuan(); BinhLuan bl = new BinhLuan(); bl.MABINHLUAN = id; bl.TIEUDE = txtTieuDe.Text; bl.NOIDUNG = txtNoiDung.Text; bl.TRANGTHAI = bool.Parse(ddlTrangThai.SelectedValue); bus.CapNhatBinhLuan(bl); Session["MaBL"] = null; DataTable dt = new DataTable(); int flag = int.Parse(ddlBinhLuan.SelectedValue); dt = bus.LoadBinhLuan(0, flag); gvBinhLuan.DataSource = dt.DefaultView; gvBinhLuan.SelectedIndex = -1; gvBinhLuan.PageIndex = int.Parse(Session["PageIndex"].ToString()); gvBinhLuan.DataBind(); lblThongBao.Text = ""; } else { lblThongBao.Text = "Chưa chọn bình luận cần cập nhật !"; } }
protected void btnXoa_Click(object sender, EventArgs e) { if (Session["MaBL"] != null) { int id = int.Parse(Session["MaBL"].ToString()); BUS_BinhLuan bus = new BUS_BinhLuan(); bus.XoaBL(id); Session["MaBL"] = null; DataTable dt = new DataTable(); int flag = int.Parse(ddlBinhLuan.SelectedValue); dt = bus.LoadBinhLuan(0, flag); gvBinhLuan.DataSource = dt.DefaultView; gvBinhLuan.SelectedIndex = -1; gvBinhLuan.PageIndex = int.Parse(Session["PageIndex"].ToString()); gvBinhLuan.DataBind(); lblThongBao.Text = ""; txtHoten.Text = ""; txtTieuDe.Text = ""; txtNoiDung.Text = ""; txtTenSP.Text = ""; } else { lblThongBao.Text = "Chưa chọn bình luận cần xóa !"; } }
public void LoadBinhLuan() { int id = (int)Session["MaSP"]; BUS_BinhLuan bus = new BUS_BinhLuan(); DataTable dt = bus.LoadBinhLuan(id, 0); dlBinhLuan.DataSource = dt; dlBinhLuan.DataBind(); }
public void LoadBL() { BUS_BinhLuan busBL = new BUS_BinhLuan(); DataTable dt = new DataTable(); dt = busBL.LoadBinhLuan(0, 2); gvBinhLuan.DataSource = dt.DefaultView; gvBinhLuan.DataBind(); }
protected void btnDuyet_Click(object sender, EventArgs e) { BUS_BinhLuan busBL = new BUS_BinhLuan(); DataTable dt = new DataTable(); int flag = int.Parse(ddlBinhLuan.SelectedValue); dt = busBL.LoadBinhLuan(0, flag); gvBinhLuan.DataSource = dt.DefaultView; gvBinhLuan.DataBind(); }
protected void gvBinhLuan_PageIndexChanging(object sender, GridViewPageEventArgs e) { BUS_BinhLuan busBL = new BUS_BinhLuan(); DataTable dt = new DataTable(); int flag = int.Parse(ddlBinhLuan.SelectedValue); dt = busBL.LoadBinhLuan(0, flag); Session["PageIndex"] = e.NewPageIndex; gvBinhLuan.DataSource = dt.DefaultView; gvBinhLuan.PageIndex = e.NewPageIndex; gvBinhLuan.DataBind(); }
protected void gvBinhLuan_SelectedIndexChanging(object sender, GridViewSelectEventArgs e) { int id = int.Parse(gvBinhLuan.DataKeys[e.NewSelectedIndex].Value.ToString()); Session["MaBL"] = id; BinhLuan bl = new BinhLuan(); BUS_BinhLuan bus = new BUS_BinhLuan(); bl = bus.LayThongTinBinhLuan(id); txtHoten.Text = bl.TENKH; txtTieuDe.Text = bl.TIEUDE; txtNoiDung.Text = bl.NOIDUNG; txtTenSP.Text = bl.TENSP; lblNgayGui.Text = bl.NGAYBL.ToShortDateString(); ddlTrangThai.SelectedValue = bl.TRANGTHAI.ToString(); lblThongBao.Text = ""; }
public void ThemComment() { // nhận các tham số truyền theo method post string tieude = Request["td"]; string noidung = Request["nd"]; int masp = (int)Session["MaSP"]; DateTime date = DateTime.Now; //lay ma khach hang thong qua username string username = (string)Session["Username"]; int makh; BUS_KhachHang bus = new BUS_KhachHang(); if (bus.LayMaKH(username) != -1) { makh = bus.LayMaKH(username); } else { return; } //neu nhap day du tieu de va noi dung if (tieude != null && noidung != null) { BUS_BinhLuan bus_bl = new BUS_BinhLuan(); BinhLuan bl = new BinhLuan(); bl.TIEUDE = tieude; bl.NOIDUNG = noidung; bl.NGAYBL = date; bl.MASP = masp; bl.MAKH = makh; bl.TRANGTHAI = false; bus_bl.ThemBinhLuan(bl); Response.Write("1"); } //truong hop khong nhap tieu de hoac noi dung else { Response.Write("0"); } }