protected override void Render(HtmlTextWriter writer) { string strB = BasePage.RequestString("Action"); AdvertisementInfo advertisementById = Advertisement.GetAdvertisementById(BasePage.RequestInt32("AdId")); if (!advertisementById.IsNull) { if (advertisementById.CountView) { advertisementById.Views++; } if (string.Compare("Click", strB, StringComparison.OrdinalIgnoreCase) == 0) { if (advertisementById.CountClick) { advertisementById.Clicks++; } if (!string.IsNullOrEmpty(advertisementById.LinkUrl)) { this.srcript = "<script language='javascript' type='text/javascript'>window.location='" + advertisementById.LinkUrl + "';</script>"; } } Advertisement.Update(advertisementById); writer.Write(this.srcript); } }
protected void Page_Load(object sender, EventArgs e) { AdvertisementInfo advertisementById = Advertisement.GetAdvertisementById(BasePage.RequestInt32("AdId")); if (!advertisementById.IsNull) { this.LabAdShow.Text = Advertisement.GetAdContent(advertisementById); if (advertisementById.CountClick) { advertisementById.Clicks++; } if (advertisementById.CountView) { advertisementById.Views++; } Advertisement.Update(advertisementById); } }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { if (BasePage.RequestString("Action") == "Modify") { int id = BasePage.RequestInt32("AdId"); AdvertisementInfo advertisementInfo = new AdvertisementInfo(); advertisementInfo = Advertisement.GetAdvertisementById(id); this.TxtADName.Text = advertisementInfo.ADName; this.TxtPriority.Text = advertisementInfo.Priority.ToString(); this.DpkOverdueDate.Text = advertisementInfo.OverdueDate.ToString("yyyy-MM-dd"); this.InitRadlAdType(advertisementInfo.ADType); this.InitShowPanel(advertisementInfo); this.HdnAction.Value = "Modify"; this.HdnAdId.Value = advertisementInfo.ADId.ToString(); this.InitLstZoneName(); this.SetLstZoneNameSelected(advertisementInfo.ZoneId); this.ChkCountClick.Checked = advertisementInfo.CountClick; this.ChkCountView.Checked = advertisementInfo.CountView; this.TxtClicks.Text = advertisementInfo.Clicks.ToString(); this.TxtViews.Text = advertisementInfo.Views.ToString(); this.InitJSScript(); if (advertisementInfo.ADType > 1) { this.ChkCountClick.Enabled = false; this.TxtClicks.Enabled = false; } this.ChkPassed.Checked = advertisementInfo.Passed; } else { this.InitLstZoneName(); this.DpkOverdueDate.Text = DateTime.Now.AddMonths(1).ToString("yyyy-MM-dd"); if (!string.IsNullOrEmpty(BasePage.RequestString("ZoneId"))) { string ids = BasePage.RequestString("ZoneId") + ","; this.SetLstZoneNameSelected(ids); } this.InitJSScript(); this.InitRadlAdType(1); } } }
private void ShowAd() { AdvertisementInfo advertisementById = Advertisement.GetAdvertisementById(BasePage.RequestInt32("AdId")); this.ShowJS.InnerHtml = Advertisement.GetAdContent(advertisementById); }