Пример #1
0
        private static string GetFanXml(Fan fan, bool updatePassword)
        {
            var xml     = new HtmlTag("request");
            var contact = new HtmlTag("contact");

            //contact.AddTag("name", fan.FirstName+" "+fan.LastName); -- not needed will generate from firstname and last name attributes in extention attributes
            //contact.AddTag("userid", fan.Email); -- not needed
            if (updatePassword)
            {
                contact.AddTag("userpassword", Security.DecryptPassword(fan.Password));                 //decrypt before sending to Touchpoint
            }
            contact.AddTag("emailpermission", fan.EmailPermission.ToStringLower());
            contact.AddTag("mobilepermission", fan.MobilePermission.ToStringLower());
            var ext = new HtmlTag("extensionattributes");             //extention attributes

            ext.AddTag("firstname", fan.FirstName);
            ext.AddTag("lastname", fan.LastName);
            ext.AddTag("email", fan.Email);
            ext.AddTag("mobile", fan.Mobile);
            ext.AddTag("city", fan.City);
            ext.AddTag("postcode", fan.PostCode);
            ext.AddTag("country", fan.Country);
            ext.AddTag("gender", fan.Gender);
            ext.AddTag("birthdate", Fmt.DateTimeISOZ(fan.DateOfBirth));
            contact.AddTag(ext);
            contact.AddRawHtml("<lists><list><alphaid>Steinlager</alphaid><status>S</status></list></lists>");
            xml.AddTag(contact);
            string data = "<?xml version=\"1.0\"?>\n" + xml.ToString();

            return(data);
        }