protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            string err=  ValidateNull();
              if (err == "")
              {
                  spamBUS = new SpamRuleBUS();
                  SpamRuleDTO spamDTO = new SpamRuleDTO();
                  spamDTO.Keyword = txtKeyword.Text;
                  spamDTO.Score = float.Parse(txtScore.Text);
                  spamDTO.SameWord = txtSameWord.Text;
                  int i = 0;
                  if (spamBUS.tblSpamRule_GetByID(txtKeyword.Text).Rows.Count > 0)
                  {
                      spamBUS.tblSpamRule_Update(spamDTO);
                      i = 1;
                  }
                  else
                  {
                      spamBUS.tblSpamRule_insert(spamDTO);
                  }
                  if (i == 1)
                  {
                      pnError.Visible = false;
                      pnSuccess.Visible = true;
                      lblSuccess.Text = "Bạn đã cập nhật thành công ";
                  }
                  else
                  {
                      pnError.Visible = false;
                      pnSuccess.Visible = true;
                      lblSuccess.Text = "Bạn đã thêm thành công ";
                  }
                  LoadData();
                  txtKeyword.Text = "";
                  txtScore.Text = "";
                  txtSameWord.Text = "";
              }
              else
              {
                  pnError.Visible = true;
                  pnSuccess.Visible = false;
                  lblError.Text =err;
              }
        }
        catch (Exception)
        {

            pnError.Visible = true;
            pnSuccess.Visible = false;
            lblError.Text = "Lỗi trong quá trình nhập";
        }
    }
    protected void btnEdit_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
                  string Keyword = ((ImageButton)sender).CommandArgument;
                spamBUS = new SpamRuleBUS();
                DataTable table = spamBUS.tblSpamRule_GetByID(Keyword);
                if (table.Rows.Count > 0)
                {
                    txtKeyword.Text = Keyword;
                    txtScore.Text = table.Rows[0]["Score"].ToString();
                    txtSameWord.Text = table.Rows[0]["SameWord"].ToString();
                }

        }
        catch (Exception)
        {

            pnError.Visible = true;
            pnSuccess.Visible = false;
            lblError.Text = "Lỗi trong quá trình sửa";
        }
        LoadData();
    }