Esempio n. 1
0
        protected void Button_Delete_Email_Click(object sender, EventArgs e)
        {
            try
            {
                CheckForDangerousInput();

                if (!IsNullOrEmpty(TextboxEmailAddress.Text.Trim()))
                {
                    PartiesEmails.DeleteByPartyEmail(TextboxEmailAddress.Text.Trim());

                    Clear_Email_TextBoxes();

                    PartiesReport();
                    Emails_Report();

                    Msg_Email.Text = Ok("The email address has been deleted.");
                }
                else
                {
                    Msg_Email.Text = Fail("No email address was selected for deletion.");
                }
            }
            catch (Exception ex)
            {
                Msg_Email.Text = Fail(ex.Message);
                LogAdminError(ex);
            }
        }
Esempio n. 2
0
        private void DoDeletions(string address)
        {
            var found = false;

            found |= DeletionCount(States.UpdateEmailByEmail(Empty, address), address,
                                   "States.Email");
            found |= DeletionCount(States.UpdateAltEmailByAltEmail(Empty, address),
                                   address, "States.AltEmail");
            found |= DeletionCount(Counties.UpdateEmailByEmail(Empty, address), address,
                                   "Counties.Email");
            found |= DeletionCount(Counties.UpdateAltEmailByAltEmail(Empty, address),
                                   address, "Counties.AltEmail");
            found |= DeletionCount(LocalDistricts.UpdateEmailByEmail(Empty, address),
                                   address, "LocalDistricts.Email");
            found |= DeletionCount(LocalDistricts.UpdateAltEmailByAltEmail(Empty, address),
                                   address, "LocalDistricts.AltEmail");
            found |= DeletionCount(Politicians.UpdateEmailByEmail(null, address), address,
                                   "Politicians.Email");
            found |= DeletionCount(
                Politicians.UpdateCampaignEmailByCampaignEmail(Empty, address), address,
                "Politicians.CampaignEmail");
            found |= DeletionCount(
                Politicians.UpdateEmailVoteUSAByEmailVoteUSA(Empty, address), address,
                "Politicians.EmailVoteUSA");
            found |= DeletionCount(
                Politicians.UpdateStateEmailByStateEmail(Empty, address), address,
                "Politicians.StateEmail");
            if (Addresses.EmailExists(address))
            {
                Addresses.DeleteByEmail(address);
                found |= DeletionCount(1, address, "Addresses");
            }
            found |= DeletionCount(PartiesEmails.DeleteByPartyEmail(address), address,
                                   "PartiesEmails.PartyEmail");
            found |= DeletionCount(
                OrganizationContacts.UpdateEmailByEmail(Empty, address), address,
                "OrganizationContacts.Email");
            if (!found)
            {
                _Messages.Add($"<p class=\"error\">{address} not found</p>");
            }
        }