Beispiel #1
0
        /// <summary>
        /// Retrieves the description of an ineligible status.
        /// </summary>
        /// <param name="eligibility">The eligibility status to describe.</param>
        /// <returns>The <see cref="String"/> description of <paramref name="eligibility"/>.</returns>
        public static string GetDescription(this AccountEligibility eligibility)
        {
            switch (eligibility)
            {
            case AccountEligibility.Eligible:
                return(string.Empty);

            case AccountEligibility.IneligibleDuplicateEmail:
                return("Duplicate e-mail address");

            case AccountEligibility.IneligibleDuplicateAccount:
            case AccountEligibility.IneligibleExists:
                return("Account already exists");

            case AccountEligibility.IneligibleNoEmail:
                return("No e-mail address");

            case AccountEligibility.IneligibleNoFirstName:
                return("No first name");

            case AccountEligibility.IneligibleNoLastName:
                return("No last name");

            case AccountEligibility.IneligibleNull:
                return("Contact could not be retrieved");

            default:
                return("Unknown");
            }
        }
Beispiel #2
0
        /// <summary>
        /// Analyzes a contact to determine its eligibility for a new C-Access account.
        /// </summary>
        /// <param name="entity">The <see cref="Entity"/> to analyze.</param>
        /// <param name="id">The ID of the <paramref name="entity"/> to analyze.</param>
        private void AnalyzeEntity(Entity entity, string id)
        {
            if (entity == null)
            {
                return;
            }
            CPUser             conflict;
            AccountEligibility eligibility = DetermineEligibility(entity, _candidate.ID, id, out conflict);

            switch (eligibility)
            {
            case AccountEligibility.Eligible:
                _results.EligibleContacts.Add(id, entity);
                break;

            case AccountEligibility.IneligibleNoEmail:
            case AccountEligibility.IneligibleNoFirstName:
            case AccountEligibility.IneligibleNoLastName:
            case AccountEligibility.IneligibleDuplicateEmail:
                _results.IneligibleContacts.Add(new AccountEligibilityStatus(entity, eligibility, contactID: id));
                break;

            case AccountEligibility.IneligibleExists:
                _results.CurrentUsers.Add(conflict);
                break;

            case AccountEligibility.IneligibleDuplicateAccount:
                _results.OtherCampaignUsers.Add(new AccountEligibilityStatus(entity, eligibility, conflict, id));
                break;
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="AccountEligibilityStatus"/> class.
 /// </summary>
 /// <param name="entity">The entity attributed with status <paramref name="eligibility"/>.</param>
 /// <param name="eligibility">The eligiblity status of <paramref name="entity"/>.</param>
 /// <param name="user">The user that matches <paramref name="entity"/>.</param>
 /// <param name="contactID">The contact ID of <paramref name="entity"/>.</param>
 public AccountEligibilityStatus(Entity entity, AccountEligibility eligibility, CPUser user = null, string contactID = null)
 {
     this.Entity      = entity;
     this.Status      = eligibility;
     this.MatchedUser = user;
     this.ContactID   = contactID;
 }