protected void btnCapNhat_Click(object sender, EventArgs e)
        {
            try
            {
                //lay thong tin tu textbox
                BAIVIET lpDTO = new BAIVIET();
                lpDTO.MaBaiViet = int.Parse(Request.QueryString["id"]);
                lpDTO.MaLoaiBaiViet = int.Parse(ddlLoaiBaiViet.SelectedValue);
                lpDTO.NgayDang = Convert.ToDateTime(lblNgayDang.Text);
                lpDTO.CapNhat = Convert.ToDateTime(System.DateTime.Now);
                lpDTO.NoiDung = this.txtnoidung.Value;
                lpDTO.TieuDe = this.txttieude.Text;
                lpDTO.TomTat = this.txtTomTat.Text;
                BaiVietTemp = (BAIVIET)Session["BaiVietTemp"];
                BUSBaiViet BUSBaiViet = new BUSBaiViet();
                if (this.fulImage.HasFile)
                {
                   // if (BaiVietTemp.HinhAnh != null && BaiVietTemp.HinhAnh != "")
                   //     System.IO.File.Delete(Server.MapPath("~/Uploads/") + BaiVietTemp.HinhAnh);
                    String currentPath = Server.MapPath("~/Uploads/");
                    String tempPath = Server.MapPath("~/Temp/");
                    String fileName = "anh_dai_dien" + lpDTO.NgayDang.Value.Day.ToString()
                        + lpDTO.NgayDang.Value.Month.ToString() + lpDTO.NgayDang.Value.Year.ToString()
                        + lpDTO.NgayDang.Value.Hour.ToString() + lpDTO.NgayDang.Value.Minute.ToString() + lpDTO.NgayDang.Value.Second.ToString() + ".jpg";
                    lpDTO.HinhAnh = fileName;
                   this.fulImage.SaveAs(tempPath + fileName);
                   SaveImageThumbnail(tempPath + fileName, currentPath + fileName, true);
                }
                else
                {
                    lpDTO.HinhAnh = BaiVietTemp.HinhAnh;
                }
                //Goi ham cap nhat

                if (BUSBaiViet.CapNhat(lpDTO) == 0)
                {
                    //Thong bao
                    lbThongBao.Text = "Cập Nhật Thành Công";
            //                     //Upload tập tin
            //                     List<TAPTINBAIVIET> lTapTinDTO = new List<TAPTINBAIVIET>();
            //                     string savePath = Server.MapPath("~/Uploads\\");
            //
            //                     //string fileName;
            //                     lTapTinDTO = (List<TAPTINBAIVIET>)Session["FileUploadTemp"];
            //                     List<HttpPostedFile> lFile = (List<HttpPostedFile>)Session["FileClientTemp"];
            //                     BUSTapTinBaiViet BUSTapTinBaiViet = new BUSTapTinBaiViet();
            //                     for (int i = 0; i < lTapTinDTO.Count && i < lFile.Count; i++)
            //                     {
            //                         lFile[i].SaveAs(savePath + lTapTinDTO[i].TenTapTin);
            //                         if (BUSTapTinBaiViet.Them(lTapTinDTO[i]) == 0)
            //                         {
            //                             MessageBox.Show("Upload tập tin " + lTapTinDTO[i].TenTapTin + " thất bại.");
            //
            //                         }
               //         }
                    lbThongBao.Visible = true;
                    Response.Redirect("~/administration/BaiViet.aspx?id=" + lpDTO.MaBaiViet.ToString());
                }
                else
                {
                    lbThongBao.Text = "Cập Nhật Không Thành Công";
                    lbThongBao.Visible = true;
                }
            }

            catch
            {
                lbThongBao.Text = "Cập nhật Không Thành Công";
                lbThongBao.Visible = true;
            }
        }
 protected void onchecked_changed(object sender, EventArgs e)
 {
     System.Web.UI.WebControls.CheckBox chkStatus = (System.Web.UI.WebControls.CheckBox)sender;
     GridViewRow row = (GridViewRow)chkStatus.NamingContainer;
     int id = Int32.Parse(row.Cells[1].Text) ;
     bool status = chkStatus.Checked;
     BUSBaiViet bus = new BUSBaiViet();
     BAIVIET bv = bus.TimKiem(id);
     bv.TinNoiBat = status;
     bus.CapNhat(bv);
 }