Beispiel #1
0
        public static void UpdateLocalFan(Fan fan, TouchpointResponse response)
        {
            var xml = response.ResponseXml;

            if (xml.Contains("<contactid>"))
            {
                fan.TouchpointContactID = xml.ExtractTextBetween("<contactid>", "</contactid>").ToInt();
                if (xml.Contains("<firstname>"))
                {
                    fan.FirstName = xml.ExtractTextBetween("<firstname>", "</firstname>");
                }
                if (xml.Contains("<lastname>"))
                {
                    fan.LastName = xml.ExtractTextBetween("<lastname>", "</lastname>");
                }
                if (xml.Contains("<gender>"))
                {
                    fan.Gender = xml.ExtractTextBetween("<gender>", "</gender>");
                }
                if (xml.Contains("<email>"))
                {
                    fan.Email = xml.ExtractTextBetween("<email>", "</email>");
                }
                if (xml.Contains("<mobile>"))
                {
                    fan.Mobile = xml.ExtractTextBetween("<mobile>", "</mobile>");
                }
                if (xml.Contains("<city>"))
                {
                    fan.City = xml.ExtractTextBetween("<city>", "</city>");
                }
                if (xml.Contains("<postcode>"))
                {
                    fan.PostCode = xml.ExtractTextBetween("<postcode>", "</postcode>");
                }
                if (xml.Contains("<country>"))
                {
                    fan.Country = xml.ExtractTextBetween("<country>", "</country>");
                }
                if (xml.Contains("<birthdate>"))
                {
                    fan.DateOfBirth = xml.ExtractTextBetween("<birthdate>", "</birthdate>").ConvertToDate(null);
                }
                if (xml.Contains("<mobilepermission>"))
                {
                    fan.MobilePermission = xml.ExtractTextBetween("<mobilepermission>", "</mobilepermission>").ToBool();
                }
                if (xml.Contains("<emailpermission>"))
                {
                    fan.EmailPermission = xml.ExtractTextBetween("<emailpermission>", "</emailpermission>").ToBool();
                }
                fan.LastSyncDate = DateTime.Now;
                fan.Save();
            }
        }