Exemplo n.º 1
0
        /// <summary>
        /// Find a matching Contact in CRM based on the first name, last name, home phone, mobile phone, email address
        /// </summary>
        private Contact MatchContact(Membership membership, MatchController mc)
        {
            this._tracer.Trace("Method: MembershipController.MatchContact");

            string firstName    = membership.Member.FirstName;
            string lastName     = membership.Member.LastName;
            string homePhone    = membership.Member.HomePhone;
            string mobilePhone  = membership.Member.MobilePhone;
            string emailAddress = membership.Member.EmailAddress;

            this._tracer.Trace("firstName={0}, lastName={1}, homePhone={2}, mobilePhone={3}, emailAddress={4}",
                               firstName, lastName, homePhone, mobilePhone, emailAddress);

            List <Contact> contacts = base.GetContactsByName(firstName, lastName);
            Contact        match    = mc.MatchToExistingContact(contacts, mobilePhone, homePhone, emailAddress);

            membership.Member.ContactId = match.ContactId; // need this, otherwise the update fails!
            membership.Member.MatchCode = match.MatchCode; // set the match code

            this._tracer.Trace("MatchCode={0}", membership.Member.MatchCode);

            // create or update contact
            membership.Member.ContactId = base.CreateOrUpdateContact(membership.Member, false);
            return(membership.Member);
        }
Exemplo n.º 2
0
        private Guid MatchContact(Donation donation, Guid contactId, MatchController matcher)
        {
            List <Contact> contacts     = base.GetContactsByName(donation.Donor.FirstName, donation.Donor.LastName);
            Contact        contactMatch = matcher.MatchToExistingContact(contacts, donation.Donor.MobilePhone, donation.Donor.HomePhone, donation.Donor.EmailAddress);

            // copy the values from the matched contact
            donation.Donor.ContactId = contactMatch.ContactId;
            donation.Donor.MatchCode = contactMatch.MatchCode;
            donation.Donor.IsDonor   = true;

            contactId = base.CreateOrUpdateContact(donation.Donor, true);
            return(contactId);
        }