private void GetKol_ShareAd() { try { DBEntity.Tab_Advertisement ent = AdHelper.GetAd("Kol_ShareAd"); string str = string.Format(" <a href='{0}'><img src='upload/Advertisement/{1}' width='108' height='147' alt='' /></a>", ent.Links, ent.AdImg); this.ltlKol_Share.Text = str.ToString(); } catch { } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { try { DBEntity.Tab_Advertisement ent = AdHelper.GetAd("Ad_rule1"); DBEntity.Tab_Advertisement ent2 = AdHelper.GetAd("Ad_rule2"); this.Ad_rule1.Text = string.Format(" <a href='{0}' target='_blank'><img src='upload/Advertisement/{1}' width='448' height='254' /></a>", ent.Links, ent.AdImg); this.Ad_rule2.Text = string.Format(" <a href='{0}' target='_blank'><img src='upload/Advertisement/{1}' width='448' height='254' /></a>", ent2.Links, ent2.AdImg); } catch (Exception ex) { Cmn.Log.Write(ex.ToString()); } } }
private BllPost GetAd(ref int imagesOnPage) { BllPost ad; AdHelper.Initialize(_postService.GetAllWithAd()); if (User.Identity.IsAuthenticated) { var user = _accountService.GetUserByLogin(User.Identity.Name); var disabledAds = _postService.GetDisabledAds(user.UserId).ToList(); ad = AdHelper.GetAd(disabledAds, user.AgeId, user.SexId, user.CountryId, user.LanguageId); imagesOnPage -= 1; } else { ad = AdHelper.GetRandomAd(); } return(ad); }