Example #1
0
 /// <summary>
 /// Remove all html tags from given string and return plain string
 /// </summary>
 /// <param name="HTMLString"></param>
 /// <returns></returns>
 private string RemoveUnwantedHTMLTags(string HTMLString)
 {
     try
     {
         SEOHelper seoHelper = new SEOHelper();
         return seoHelper.RemoveUnwantedHTMLTAG(HTMLString);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 private string RemoveUnwantedSearchText(string SearchKey)
 {
     try
     {
         SEOHelper seoHelper = new SEOHelper();
         return seoHelper.RemoveUnwantedHTMLTAG(SearchKey);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
    public void GetBannerImages(int BannerID, int UserModuleID, int PortalID, string CultureCode)
    {
        try
        {
            List<SageBannerInfo> objSageBannerLst = new List<SageBannerInfo>();
            SageBannerController obj = new SageBannerController();
            objSageBannerLst = obj.GetBannerImages(BannerID, UserModuleID, PortalID, CultureCode);
            StringBuilder elem = new StringBuilder();
            elem.Append("<ul id=\"sfSlider\">");
            if (objSageBannerLst.Count > 0)
            {
                foreach (SageBannerInfo banner in objSageBannerLst)
                {
                    if (banner.ImagePath.Length == 0)
                    {
                        elem.Append("<li>");
                        elem.Append(banner.HTMLBodyText);
                        elem.Append("</li>");
                    }
                    else
                    {
                        string target = "#";
                        string readmoreLink = "#";
                        if (banner.LinkToImage != string.Empty)
                        {
                            readmoreLink = banner.LinkToImage;
                            target = "_blank";
                        }
                        else if (banner.ReadMorePage != string.Empty)
                        {
                            readmoreLink = Fullpath + banner.ReadMorePage + Extension;
                        }
                        else
                        {
                            readmoreLink = Fullpath + banner.ReadMorePage + Extension;
                        }
                        elem.Append("<li style=\"position:relative; display:none;\">");
                        elem.Append("<div class='bannerImageWrapper'>");
                        elem.Append("<div class='sfImageholder'>");

                        //Responsive Images

                        elem.Append("<div data-alt=\"SageFrame Banner Images\" data-picture=\"\">");

                        elem.Append("<div data-media=\"(min-width: 0px)\" data-src=");
                        elem.Append(ResolveUrl(modulePath));
                        elem.Append("images/ThumbNail/Small/");
                        elem.Append(banner.ImagePath);
                        elem.Append("></div>");

                        elem.Append("<div data-media=\"(min-width: 320px)\" data-src=");
                        elem.Append(ResolveUrl(modulePath));
                        elem.Append("images/ThumbNail/Medium/");
                        elem.Append(banner.ImagePath);
                        elem.Append("></div>");

                        elem.Append("<div data-media=\"(min-width: 768px)\" data-src=");
                        elem.Append(ResolveUrl(modulePath));
                        elem.Append("images/ThumbNail/Large/");
                        elem.Append(banner.ImagePath);
                        elem.Append("></div>");

                        elem.Append("<div data-media=\"(min-width: 960px)\" data-src=");
                        elem.Append(ResolveUrl(modulePath));
                        elem.Append("images/ThumbNail/Default/");
                        elem.Append(banner.ImagePath);
                        elem.Append("></div>");

                        //elem.Append("<noscript><img alt=\"Sageframe Bannner Images\" src=\"");
                        //elem.Append(ResolveUrl(modulePath));
                        //elem.Append("images/ThumbNail/Default/");
                        //elem.Append(banner.ImagePath);
                        //elem.Append("/></noscript>");
                        elem.Append("</div>");
                        elem.Append("</div>");
                        SEOHelper seoHelper = new SEOHelper();
                        string unwantedTag = seoHelper.RemoveUnwantedHTMLTAG(banner.Description);
                        if (banner.Description != null && banner.Description.Trim() != string.Empty && banner.Description.Trim() != "" && unwantedTag.Trim().Length > 0)
                        {
                            elem.Append("<div  class='sfBannerDesc'><p>");
                            elem.Append(banner.Description + "</p>");
                            elem.Append("<a target=\" " + target + " \" class='sfReadmore' href=\"");
                            elem.Append(readmoreLink);
                            elem.Append("\">");
                            elem.Append("<span>");
                            elem.Append(banner.ReadButtonText);
                            elem.Append("</span></a></div></div></li>");
                        }
                        else
                        {
                            elem.Append("</li>");
                        }
                    }
                }
                bannerCount++;
            }
            else
            {
                bannerCount = 0;
                elem.Append("No Banner To Display");
            }
            elem.Append("</ul>");
            sageSlider.Text = elem.ToString();
        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }
    }