Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     int loadm = 0;
     if (int.TryParse(Request.Form["LoadMoreFrom"], out loadm))
     {
         WriteMoreEvents(loadm);
         return;
     }
     List<Entities.Banners> BannersList = HttpContext.Current.Cache.Data("SiteBanner", () =>
     {
         return (from p in (new SiteDbContext()).Banners select p).ToList();
     });
     ban1 = (from p in BannersList where p.Location == "MainPageTop" select p).FirstOrDefault();
     ban2 = (from p in BannersList where p.Location == "MainPageBottom" select p).FirstOrDefault();
 }
Exemplo n.º 2
0
 public string GetBanner(Banners Banner)
 {
     string str = "";
     switch (Banner.Type.ToLower())
     {
         case "image":
             str = "<img src=\"images/" + Banner.Pic+(Width>-1?"?width="+Width:"") + "\" width=\"" + (Width == -1 ? "100%" : Width.ToString()) + "\" border=\"0\" />";
             break;
         case "flash":
             str = "<script type=\"text/javascript\">swfobject.embedSWF('images/" + Banner.Pic + "', 'banner_placeholder_" + Banner.BannersId.ToString() + "', \"" + Width + "\", \"" + Height + "\", '9.0.0', 'swf/expressInstall.swf', {}, { wmode: 'transparent' }, {});</script><div id=\"banner_placeholder_" + Banner.BannersId.ToString() + "\"></div>";
             break;
         case "text":
             str = Banner.Content1;
             break;
     }
     if (!string.IsNullOrEmpty(Banner.Link) && Banner.Type.ToLower() != "flash")
     {
         str = "<a href=\"" + Banner.Link + "\">" + str + "</a>";
     }
     return str;
 }