Ejemplo n.º 1
0
    protected void btnAddRule_Click(object sender, EventArgs e)
    {
        if (!rbtnAllow.Checked && !rbtnBlock.Checked)
        {
            AddError("Please specify rule mode!");
            return;
        }
        if (cmbAddCountry.SelectedIndex < 0)
        {
            AddError("Please select a country.");
            return;
        }
        string countryCode = cmbAddCountry.SelectedValue;

        if (rbtnAllow.Checked)
        {
            if (BlockedCountries.AllowedList.IndexOf(countryCode) == -1)
            {
                BlockedCountries.AllowedList.Add(countryCode);
            }
        }
        else if (rbtnBlock.Checked)
        {
            if (BlockedCountries.BlockedList.IndexOf(countryCode) == -1)
            {
                BlockedCountries.BlockedList.Add(countryCode);
            }
        }

        BlockedCountries.SaveCountries();
        ReadListBoxes();
    }
Ejemplo n.º 2
0
    protected void btnDeleteBlocked_Click(object sender, EventArgs e)
    {
        if (chkDeleteBlockedSure.Checked == false)
        {
            AddError("Please check the \"Are you sure?\" checkbox.");
            return;
        }
        if (lstBlockedCountries.SelectedIndex < 0)
        {
            AddError("Please select a country to delete.");
            return;
        }
        string countryCode = lstBlockedCountries.SelectedValue;

        BlockedCountries.BlockedList.Remove(countryCode);
        BlockedCountries.SaveCountries();
        ReadListBoxes();
    }