protected void XoaTapTin(int maTapTin) { try { //xac nhan truoc khi xoa BUSTapTinBaiViet bus = new BUSTapTinBaiViet(); TAPTINBAIVIET ttbv = bus.TimKiemMaTapTin(maTapTin); XoaFile(ttbv.DuongDan); if (bus.Xoa(maTapTin) == 0) { //Thong bao Response.Redirect("TapTinBaiViet.aspx"); } } catch { } }
protected void Page_Load(object sender, EventArgs e) { //Thong tin nguoi dung NGUOIDUNG a = new NGUOIDUNG(); a.MaNguoiDung = 1; Session["NGUOIDUNG"] = a; if (Request.QueryString["id"] != null) { //lay ma int mataptin = int.Parse(Request.QueryString["id"]); //lay thong tin va load len cac textbox BUSTapTinBaiViet BUSTapTinBaiViet = new BUSTapTinBaiViet(); TAPTINBAIVIET lpDTO = BUSTapTinBaiViet.TimKiemMaTapTin(mataptin); this.txtmataptin.Text = Convert.ToString(lpDTO.MaTapTin ); this.txttentaptin.Text = lpDTO.TenTapTin ; this.txtmabaiviet.Text = Convert.ToString(lpDTO.MaBaiViet ); this.txtduongdan.Text = lpDTO.DuongDan ; } }