protected void btnThem_Click(object sender, EventArgs e)
        {
            string sql  = "";
            string drAn = drl.SelectedValue;

            if (drl.SelectedValue == "")
            {
                drAn = "1";
            }
            if (GetSelectedRecord() == "")
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Thông Báo", "alert('Chưa chọn bài viết')", true);
            }
            else
            {
                if (Request.QueryString["id"] == null)
                {
                    sql = "insert into tbl_baiviethot values('" + GetSelectedRecord() + "','" + drAn + "','" + DateTime.Now.ToString() + "')";
                }
                else
                {
                    string sqlA = "select id from tbl_baiviethot where id_baiviet = " + Request.QueryString["id"];
                    int    ann  = Connection.AExcuteSQL(sqlA);
                    sql = "update tbl_baiviethot set id_baiviet = '" + GetSelectedRecord() + "', announcements = '" + drAn + "', inup = '" + DateTime.Now.ToString() + "' where id = " + ann;
                }

                if (Connection.ExcuteSQL(sql))
                {
                    string sqlcount = "select count(*) from tbl_baiviethot";
                    int    count    = Connection.AExcuteSQL(sqlcount);
                    if (count > 10)
                    {
                        string d = "delete from tbl_baiviethot where id = (select top 1 id from tbl_baiviethot order by inup asc)";
                        Connection.ExcuteSQL(d);
                    }
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Thông Báo", "alert('Thành công!')", true);
                    Response.Redirect("frmBaiVietHot.aspx");
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Thông Báo", "alert('Đã xảy ra lỗi!')", true);
                }
            }
        }
 private void getLoaiHienThi()
 {
     if (drl.SelectedItem == null)
     {
         List <ListItem> items = new List <ListItem>();
         drl.Items.Clear();
         items.Add(new ListItem("Chọn Loại Hiển Thị", ""));
         for (int i = 0; i < LoaiBaiVietHot.loaiBVH.Count(); i++)
         {
             items.Add(new ListItem(LoaiBaiVietHot.loaiBVH[i], (i + 1).ToString()));
         }
         drl.Items.AddRange(items.ToArray());
         if (Request.QueryString["id"] != null)
         {
             string sqlA = "select announcements from tbl_baiviethot where id_baiviet = " + Request.QueryString["id"];
             int    ann  = Connection.AExcuteSQL(sqlA);
             drl.SelectedValue = ann.ToString();
         }
     }
 }