protected void btnXoa_Click(object sender, EventArgs e) { try { //lay thong tin tu textbox int mabaiviet = int.Parse(Request.QueryString["id"]); //xac nhan truoc khi xoa BUSBaiViet BUSBaiViet = new BUSBaiViet(); if (BUSBaiViet.Xoa(mabaiviet) == 0) { //Thong bao lbThongBao.Text = "Xóa Thành Công"; lbThongBao.Visible = true; Response.Redirect("BaiViet.aspx"); } else { lbThongBao.Text = "Xóa Không Thành Công"; lbThongBao.Visible = true; } } catch { lbThongBao.Text = "Xoa Không Thành Công"; lbThongBao.Visible = true; } }
protected void XoaChuyenMuc(int maChuyenMuc) { try { //xac nhan truoc khi xoa BUSBaiViet busBaiViet = new BUSBaiViet(); List<BAIVIET> lstBaiViet = busBaiViet.LayDSBaiVietTheoChuyenMuc(maChuyenMuc); if (lstBaiViet != null) { foreach (BAIVIET bv in lstBaiViet) { BUSTapTinBaiViet busTapTin = new BUSTapTinBaiViet(); List<TAPTINBAIVIET> lstTapTin = busTapTin.TimKiemMaBaiViet(bv.MaBaiViet); if (lstTapTin != null) { foreach (TAPTINBAIVIET taptin in lstTapTin) { busTapTin.Xoa(taptin.MaTapTin); } } busBaiViet.Xoa(bv.MaBaiViet); } } BUSChuyenMuc busChuyenMuc = new BUSChuyenMuc(); if (busChuyenMuc.Xoa(maChuyenMuc) == 0) { //Thong bao Response.Redirect("ChuyenMuc.aspx"); } } catch { } }
protected void XoaBai(int maloai) { try { //xac nhan truoc khi xoa BUSBaiViet busBaiViet = new BUSBaiViet(); List<BAIVIET> lstBaiViet = busBaiViet.TimKiemTheoLoaiBaiViet(maloai); if (lstBaiViet != null) { foreach (BAIVIET bv in lstBaiViet) { BUSTapTinBaiViet busTapTin = new BUSTapTinBaiViet(); List<TAPTINBAIVIET> lstTapTin = busTapTin.TimKiemMaBaiViet(bv.MaBaiViet); if (lstTapTin != null) { foreach (TAPTINBAIVIET taptin in lstTapTin) { busTapTin.Xoa(taptin.MaTapTin); } } busBaiViet.Xoa(bv.MaBaiViet); } } BUSLoaiBaiViet bus = new BUSLoaiBaiViet(); if (bus.Xoa(maloai) == 0) { //Thong bao Response.Redirect("LoaiBaiViet.aspx"); } } catch { } }
protected void btnXoa_Click(object sender, EventArgs e) { try { //lay thong tin tu textbox int machuyenmuc = int.Parse(Request.QueryString["id"]); BUSBaiViet busBaiViet = new BUSBaiViet(); List<BAIVIET> lstBaiViet = busBaiViet.LayDSBaiVietTheoChuyenMuc(machuyenmuc); if (lstBaiViet != null) { foreach (BAIVIET bv in lstBaiViet) { BUSTapTinBaiViet busTapTin = new BUSTapTinBaiViet(); List<TAPTINBAIVIET> lstTapTin = busTapTin.TimKiemMaBaiViet(bv.MaBaiViet); if (lstTapTin != null) { foreach (TAPTINBAIVIET taptin in lstTapTin) { busTapTin.Xoa(taptin.MaTapTin); } } busBaiViet.Xoa(bv.MaBaiViet); } } //xac nhan truoc khi xoa //Goi ham xoa BUSChuyenMuc BUSChuyenMuc = new BUSChuyenMuc(); if (BUSChuyenMuc.Xoa(machuyenmuc) == 0) { //Thong bao lbThongBao.Text = "Xóa Thành Công"; lbThongBao.Visible = true; Response.Redirect("HoatDong.aspx"); } } catch { lbThongBao.Text = "Xoa Không Thành Công"; lbThongBao.Visible = true; } }
protected void XoaBaiViet(int mabaiviet) { try { //xac nhan truoc khi xoa //Goi ham xoa BUSBaiViet BUSBaiViet = new BUSBaiViet(); if (BUSBaiViet.Xoa(mabaiviet) == 0) { //Thong bao Response.Redirect("BaiViet.aspx"); } } catch { } }