protected void btCapNhat_Click(object sender, EventArgs e)
        {
            if (KiemTra() == false)
            {
                txtThongTin.Text = "Thời gian không hợp lệ";
                return;
            }

            HOATDONG hoatdong = new HOATDONG();
            hoatdong.MaHoatDong = int.Parse(ddlMaHoatDong.SelectedValue);
            hoatdong.TenHoatDong = txtTenHoatDong.Text;
            hoatdong.MaLoaiHoatDong = int.Parse(ddlMaHoatDong.SelectedValue);

            hoatdong.NgayDienRa = new DateTime(int.Parse(txtNgayDienRa.Text.Substring(6, 4)), int.Parse(txtNgayDienRa.Text.Substring(3, 2)), int.Parse(txtNgayDienRa.Text.Substring(0, 2)));
            hoatdong.ThoiGianBatDauDangKy = new DateTime(int.Parse(txtThoiGianBatDauDK.Text.Substring(6, 4)), int.Parse(txtThoiGianBatDauDK.Text.Substring(3, 2)), int.Parse(txtThoiGianBatDauDK.Text.Substring(0, 2)));
            hoatdong.ThoiGianKetThucDangKy = new DateTime(int.Parse(txtThoiGianKetThucDK.Text.Substring(6, 4)), int.Parse(txtThoiGianKetThucDK.Text.Substring(3, 2)), int.Parse(txtThoiGianKetThucDK.Text.Substring(0, 2)));

            BUSHoatDong bushoatdong = new BUSHoatDong();
            bushoatdong.CapNhat(hoatdong);
        }
        protected void btnCapNhat_Click(object sender, EventArgs e)
        {
            if (KiemTra() == false)
            {
                return;
            }

            try
            {
                //lay thong tin tu textbox
                HOATDONG lpDTO = new HOATDONG();
                lpDTO.MaHoatDong = int.Parse(Request.QueryString["id"]);
                lpDTO.TenHoatDong = txttenhoatdong.Text;
                lpDTO.MaLoaiHoatDong = int.Parse(ddlLoaiHoatDong.SelectedValue);
                //
                IFormatProvider culture = new CultureInfo("vi-VN", true);

                lpDTO.NgayDienRa = DateTime.Parse(txtngaydienra.Text, culture);
                lpDTO.ThoiGianBatDauDangKy = DateTime.Parse(txtthoigianbatdaudangky.Text, culture);
                lpDTO.ThoiGianKetThucDangKy = DateTime.Parse(txtthoigianketthucdangky.Text, culture);

                if (image.ImageUrl == link)
                {
                    lpDTO.HinhAnh = link.Substring(defaultLink.Length);
                }
                else
                {
                    if (image.ImageUrl != "")
                    {
                        lpDTO.HinhAnh = RenameHinhAnh(image.ImageUrl, lpDTO.TenHoatDong).Substring(defaultLink.Length);
                    }
                }

                //Goi ham cap nhat
                BUSHoatDong BUSHoatDong = new BUSHoatDong();
                if (BUSHoatDong.CapNhat(lpDTO) == 0)
                {
                    //Thong bao
                    lbThongBao.Text = "Cập Nhật Thành Công";
                    lbThongBao.Visible = true;
                    link = "";
                    linkTemp = "";
                    Response.Redirect("~/administration/HoatDong.aspx?id=" + Request.QueryString["id"]);
                }
                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;
            }

            DeleteHinhAnh(linkTemp);
            link = "";
            linkTemp = "";
        }