static void Main(string[] args)
        {
            Tag     html  = new HtmlTag();
            Tag     body  = new BodyTag();
            Tag     head  = new HeadTag();
            Tag     title = new TitleTag();
            Tag     div   = new DivTag();
            Element elem1 = new Element();
            Element elem2 = new Element();
            Element elem3 = new Element();
            Tag     brr   = new BrTag();

            Tag h1 = new H1Tag();

            elem1.SetContent("titlu");
            elem2.SetContent("giele");
            elem3.SetContent("gielesss");
            html.AddTag(head);
            html.AddTag(body);
            head.AddElement(elem1);
            head.AddTag(brr);
            head.AddTag(title);
            head.AddElement(elem2);
            head.AddTag(title);
            head.AddElement(elem3);
            body.AddTag(div);
            div.AddTag(h1);
            div.AddAttribute("color", "blue");
            div.AddAttribute("color1", "red");
            //title.SetContent("Gigi 4 the WIN!!");
            //head.SetContent("gigel");
            //html.Render();
            Parser.ParseFile("index.html");
        }
Beispiel #2
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);
        }
Beispiel #3
0
        private static string GetCampaignXml(int contactID)
        {
            var xml            = new HtmlTag("request");
            var campaignMember = new HtmlTag("campaignmember");

            campaignMember.AddTag("contactid", contactID.ToString());
            campaignMember.AddTag("contactdate", Fmt.DateTimeISOZ(DateTime.Now));
            xml.AddTag(campaignMember);
            string data = "<?xml version=\"1.0\"?>\n" + xml.ToString();

            return(data);
        }
Beispiel #4
0
        private static string GetBrandProfileXml(int contactID)
        {
            var xml          = new HtmlTag("request");
            var entityrecord = new HtmlTag("entityrecord");
            var ext          = new HtmlTag("extensionattributes");    //extention attributes

            ext.AddTag("brandcode", "steinlager");
            ext.AddTag("contactid", contactID.ToString());
            ext.AddTag("lastlogindate", Fmt.DateTimeISOZ(DateTime.Now));
            ext.AddTag("lastinteractiondate", Fmt.DateTimeISOZ(DateTime.Now));
            entityrecord.AddTag(ext);
            xml.AddTag(entityrecord);
            string data = "<?xml version=\"1.0\"?>\n" + xml.ToString();

            return(data);
        }
Beispiel #5
0
        private static void AddSiteMapXmlLink(string url, HtmlTag xml)
        {
            var urlTag = new HtmlTag("url");
            var locTag = new HtmlTag("loc");

            locTag.SetInnerText(Fmt.UTF8Encode(Web.ResolveUrlFull(url)));
            urlTag.AddTag(locTag);
            var changefreqTag = new HtmlTag("changefreq");

            changefreqTag.SetInnerText("daily");
            urlTag.AddTag(changefreqTag);
            var priorityTag = new HtmlTag("priority");

            priorityTag.SetInnerText("0.5");
            urlTag.AddTag(priorityTag);
            xml.AddTag(urlTag);
        }
Beispiel #6
0
 /// <summary>
 /// Add a Non TextTag to Tag List
 /// </summary>
 internal void addTag(HtmlTag aTag)
 {
     if (previousTag == null)
     {
         previousTag = parentHtml.masterTag;
     }
     previousTag = previousTag.AddTag(aTag);
 }
Beispiel #7
0
        /// <summary>
        /// Authenticate user against Touchpoint Lion member database with email and password.
        /// Password is not necessarily stored in our local database, and does not come back from API calls so we call this method to check login.
        /// </summary>
        public static TouchpointResponse LoginUser(string email, string password)
        {
            var xml = new HtmlTag("request");

            xml.AddTag("token", "");
            xml.AddTag("matchkey", "email");
            xml.AddTag("matchvalue", email.Trim());
            xml.AddTag("password", password.Trim());
            string data = "<?xml version=\"1.0\"?>\n" + xml.ToString();
            //Web.Write(bwbXml.PrettyPrintXml(data));
            var response = SendTouchpointRequest(Http.POST, "contacts/authenticator", data);

            if (response.ContactID != null)
            {
                var fan = FindUserByContactID(response.ContactID.Value);
                response.FirstName = fan.FirstName;
                response.LastName  = fan.LastName;
            }
            return(response);
        }
Beispiel #8
0
        public void RebuildTagTreeList()
        {
            HtmlTag currentTag = masterTag;

            currentTag.childTags.Clear();
            foreach (HtmlTag item in tagPositionList)
            {
                item.childTags.Clear();
                currentTag = currentTag.AddTag(item);
            }
        }
Beispiel #9
0
        /// <summary>
        /// Returns html for a standard admin menu item (TR).
        /// </summary>
        /// <param name="htmlHelper"></param>
        /// <param name="controllerName"></param>
        /// <param name="title"></param>
        /// <param name="descriptionText"></param>
        /// <returns></returns>
        public static MvcHtmlString AdminMenuItem(this HtmlHelper htmlHelper, string controllerName, string title = null, string descriptionText = null, string actionName = null)
        {
            if (SavvyMVC.Util.MvcUtil.ControllerExists(controllerName + "Admin"))                   // MN 20130131 - fixed bug
            {
                controllerName += "Admin";
            }
            if (SavvyMVC.Util.MvcUtil.ControllerExists(controllerName) && SecurityRoles.Roles.IsAllowedAdminController(controllerName))
            {
                if (title.IsBlank())
                {
                    string items = controllerName.RemoveSuffix("Admin").Plural().SplitTitleCase();
                    if (descriptionText.IsBlank())
                    {
                        descriptionText = "View and edit " + items.ToLower();
                    }
                    title = "Manage " + items;
                }
                else
                {
                    if (descriptionText.IsBlank())
                    {
                        descriptionText = "View and edit " + title;
                    }
                }

                // add section title if needed
                var    sectionHtml  = "";
                string sectionTitle = Beweb.Web.PageGlobals["AdminMenu_SectionTitle"] + "";
                if (sectionTitle != "")
                {
                    string sectionDescription = Beweb.Web.PageGlobals["AdminMenu_SectionDescription"] + "";
                    sectionHtml += "<tr>";
                    sectionHtml += "<td class=\"label section\"><strong>" + sectionTitle + "</strong></td>";
                    sectionHtml += "<td class=\"section\">" + sectionDescription + "</td>";
                    sectionHtml += "</tr>";
                    // dont do it again
                    Beweb.Web.PageGlobals["AdminMenu_SectionTitle"]       = null;
                    Beweb.Web.PageGlobals["AdminMenu_SectionDescription"] = null;
                }

                // construct TR
                var tr  = new HtmlTag("tr");
                var td  = new HtmlTag("td").Add("class", "label");
                var a   = new HtmlTag("a").Add("href", controllerName + ((actionName != null)?"/" + actionName:"")).SetInnerHtml(title);
                var td2 = new HtmlTag("td").SetInnerHtml(descriptionText);
                td.AddTag(a);
                tr.AddTag(td).AddTag(td2);

                return(MvcHtmlString.Create(sectionHtml + tr));
            }
            return(null);
        }
Beispiel #10
0
        /// <summary>
        /// Sends a password reminder via Touchpoint
        /// </summary>
        public static TouchpointResponse ForgotPassword(string email)
        {
            var response = FindUser(email);

            if (response.ContactID != null)
            {
                var xml = new HtmlTag("request");
                xml.AddTag("messagesubmitteralphaid", "steinlager-password");
                string data = "<?xml version=\"1.0\"?>\n" + xml.ToString();
                response = SendTouchpointRequest(Http.POST, "contacts/" + response.ContactID + "/sentmessages", data);
            }
            else
            {
                response.ErrorMessage = "There is no existing Lion account with the email you entered.";
            }
            return(response);
        }
Beispiel #11
0
        public static MvcHtmlString AdminMenuLink(this HtmlHelper htmlHelper, string url, string title, string descriptionText = null, string actionName = null)
        {
            if (descriptionText.IsBlank())
            {
                descriptionText = "View and edit " + title;
            }

            // add section title if needed
            var    sectionHtml  = "";
            string sectionTitle = Beweb.Web.PageGlobals["AdminMenu_SectionTitle"] + "";

            if (sectionTitle != "")
            {
                string sectionDescription = Beweb.Web.PageGlobals["AdminMenu_SectionDescription"] + "";
                sectionHtml += "<tr>";
                sectionHtml += "<td class=\"label section\"><strong>" + sectionTitle + "</strong></td>";
                sectionHtml += "<td class=\"section\">" + sectionDescription + "</td>";
                sectionHtml += "</tr>";
                // dont do it again
                Beweb.Web.PageGlobals["AdminMenu_SectionTitle"]       = null;
                Beweb.Web.PageGlobals["AdminMenu_SectionDescription"] = null;
            }

            // construct TR
            var tr  = new HtmlTag("tr");
            var td  = new HtmlTag("td").Add("class", "label");
            var a   = new HtmlTag("a").Add("href", url).SetInnerHtml(title);
            var td2 = new HtmlTag("td").SetInnerHtml(descriptionText);

            td.AddTag(a);
            tr.AddTag(td).AddTag(td2);

            return(MvcHtmlString.Create(sectionHtml + tr));

            return(null);
        }