protected void btnSua_Click(object sender, EventArgs e) { VideoDTO vd = VideoBUS.LayThongTinVideo(txtMaVideo.Text); vd.MaVideo = txtMaVideo.Text; if (txtTenVideo.Text != "") { vd.TenVideo = txtTenVideo.Text; } vd.ThongTin = txtThongTin.Text; vd.MaLoaiVideo = dropMaLoaiVideo.Text; vd.NgayDang = DateTime.Parse(txtNgayDang.Text); vd.TenTaiKhoan = txtTaiKhoanDang.Text; vd.DuongDanVideo = txtDuongDan.Text; vd.TrangThai = chkTrangThai.Checked; if (VideoBUS.SuaVideo(vd)) { XoaForm(); LoadDSVideo(); GiaoDienThem(true); Response.Write("<script>alert('Sửa thành công');</script>"); } else { Response.Write("<script>alert('Sửa thất bại');</script>"); } }
protected void grvDSVideo_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "ChonVd") { string maVideo = e.CommandArgument.ToString(); VideoDTO vd = VideoBUS.LayThongTinVideo(maVideo); if (vd != null) { txtMaVideo.Text = vd.MaVideo; txtTenVideo.Text = vd.TenVideo; txtThongTin.Text = vd.ThongTin; dropMaLoaiVideo.Text = vd.MaLoaiVideo; txtNgayDang.Text = (vd.NgayDang).ToString(); txtTaiKhoanDang.Text = vd.TenTaiKhoan; txtDuongDan.Text = vd.DuongDanVideo; chkTrangThai.Checked = vd.TrangThai; GiaoDienThem(false); } } if (e.CommandName == "XoaVd") { string maVideo = e.CommandArgument.ToString(); if (VideoBUS.XoaVideo(maVideo)) { XoaForm(); LoadDSVideo(); Response.Write("<script>alert('Xóa thành công ');</script>"); } else { Response.Write("<script>alert('Xóa thất bại');</script>"); } } }