Ejemplo n.º 1
0
        private void AnalyzeDeletions(string address)
        {
            var found = false;

            found |= AnalyzeCount(States.CountByEmail(address), address, "States.Email");
            found |= AnalyzeCount(States.CountByAltEmail(address), address, "States.AltEmail");
            found |= AnalyzeCount(Counties.CountByEmail(address), address, "Counties.Email");
            found |= AnalyzeCount(Counties.CountByAltEmail(address), address, "Counties.AltEmail");
            found |= AnalyzeCount(LocalDistricts.CountByEmail(address), address, "LocalDistricts.Email");
            found |= AnalyzeCount(LocalDistricts.CountByAltEmail(address), address,
                                  "LocalDistricts.AltEmail");
            found |= AnalyzeCount(Politicians.CountByEmail(address), address, "Politicians.Email");
            found |= AnalyzeCount(Politicians.CountByCampaignEmail(address), address,
                                  "Politicians.CampaignEmail");
            found |= AnalyzeCount(Politicians.CountByEmailVoteUSA(address), address,
                                  "Politicians.EmailVoteUSA");
            found |= AnalyzeCount(Politicians.CountByStateEmail(address), address,
                                  "Politicians.StateEmail");
            //found |= AnalyzeCount(Politicians.CountByLDSEmail(address), address, "Politicians.LDSEmail");
            found |= AnalyzeCount(Addresses.EmailExists(address) ? 1 : 0, address, "Addresses.Email");
            found |= AnalyzeCount(PartiesEmails.PartyEmailExists(address) ? 1 : 0, address,
                                  "PartiesEmails.PartyEmail");
            if (!found)
            {
                _Messages.Add($"<p class=\"error\">{address} not found</p>");
            }
        }
Ejemplo n.º 2
0
        protected void Button_Add_Email_Click1(object sender, EventArgs e)
        {
            try
            {
                CheckForDangerousInput();

                if (IsNullOrEmpty(_PartyKey))
                {
                    Msg_Email.Text = Fail("You need to select a party before you can add an email address.");
                }
                else
                {
                    var emailAddress = TextboxEmailAddress_Add.Text.Trim().RemoveMailTo().ToLower();
                    if (Validation.IsValidEmailAddress(emailAddress))
                    {
                        if (PartiesEmails.PartyEmailExists(emailAddress))
                        {
                            Msg_Email.Text = Fail("The email address already exists.");
                        }
                        else
                        {
                            PartiesEmails.Insert(emailAddress, MakeUniquePassword(), _PartyKey,
                                                 Empty, Empty, Empty, Empty, false,
                                                 DateTime.UtcNow, false);

                            LogAdminData.Insert(DateTime.Now, UserSecurityClass, UserName, "PartyEmail",
                                                Empty, emailAddress);

                            ViewState["EmailAddress"]    = _EmailAddress = emailAddress;
                            TextboxEmailAddress_Add.Text = Empty;
                            Load_Email_Data(_EmailAddress);

                            PartiesReport();

                            Msg_Email.Text = Ok("The email address has been added.");
                        }
                    }
                    else
                    {
                        Msg_Email.Text = Fail("The email address is not valid.");
                    }
                }
            }
            catch (Exception ex)
            {
                Msg_Email.Text = Fail(ex.Message);
                LogAdminError(ex);
            }
        }
Ejemplo n.º 3
0
            private static bool ValidateUniqueEmail(DataItemBase item)
            {
                var success = ValidateRequired(item);

                if (success)
                {
                    var newValue = item.DataControl.GetValue();
                    var oldValue = GetCurrentValue(item);
                    if (newValue.IsNeIgnoreCase(oldValue) &&
                        PartiesEmails.PartyEmailExists(item.DataControl.GetValue()))
                    {
                        item.Feedback.PostValidationError(item.DataControl,
                                                          "The new email address already exists.");
                        success = false;
                    }
                }
                return(success);
            }