Esempio n. 1
0
        /// <summary>
        /// Find user based on email address, and save into our local database (just as a backup - not really necessary)
        /// </summary>
        public static TouchpointResponse FindUser(string email)
        {
            var response = SendTouchpointRequest(Http.GET, "contacts?matchkey=email&matchvalue=" + email.Trim().UrlEncode() + "&attributes=*", null);

            if (response.ContactID == null)
            {
                response = SendTouchpointRequest(Http.GET, "contacts?matchkey=email&matchvalue=" + email.Trim().ToLower().UrlEncode() + "&attributes=*", null);
            }
            if (response.ContactID != null)
            {
                var fan = Fan.LoadByEmail(email);
                if (fan == null)
                {
                    fan = new Fan();
                    UpdateLocalFan(fan, response);
                }
            }
            return(response);
        }