protected void Page_Load(object sender, EventArgs e) { int zoneId = DataConverter.CLng(base.Request.QueryString["ZoneID"]); if (string.Compare(base.Request.QueryString["Type"], "Zone", true) == 0) { if (B_Advertisement.GetADList(zoneId).Count == 0) { this.ShowJS.InnerHtml = "广告版位中暂无广告信息"; } else { M_Adzone adZoneById = B_ADZone.getAdzoneByZoneId(zoneId); string adpath = SiteConfig.SiteOption.AdvertisementDir + "/" + adZoneById.ZoneJSName.Replace(" ", "") + "?temp=" + function.GetRandomString(6); if (!adZoneById.IsNull) { this.ShowJS.InnerHtml = "<script type=\"text/javascript\" src='" + adpath + "'></script>"; } } } else { this.ShowAd(); } Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "I/Main.aspx'>工作台</a></li><li><a href='ADManage.aspx'>广告管理</a></li><li class='active'>预览版位JS效果</li>"); }
protected void Page_Load(object sender, EventArgs e) { int zoneId = DataConverter.CLng(base.Request.QueryString["ZoneID"]); if (string.Compare(base.Request.QueryString["Type"], "Zone", true) == 0) { if (B_Advertisement.GetADList(zoneId).Count == 0) { this.ShowJS.InnerHtml = "广告版位中暂无广告信息"; } else { M_Adzone adZoneById = B_ADZone.getAdzoneByZoneId(zoneId); if (!adZoneById.IsNull) { this.ShowJS.InnerHtml = "<script type=\"text/javascript\" src='" + base.ResolveUrl("~/" + VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.AdvertisementDir) + adZoneById.ZoneJSName) + "?temp=" + DataSecurity.RandomNum() + "'></script>"; } } } else { this.ShowAd(); } }
/// <summary> /// 创建JS文件 /// </summary> /// <param name="id"></param> public static void CreateJS(string id) { if (!string.IsNullOrEmpty(id)) { string[] strArray = id.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); B_ADZoneJs adjs = new B_ADZoneJs(); for (int i = 0; i < strArray.Length; i++) { M_Adzone adZoneById = getAdzoneByZoneId(DataConverter.CLng(strArray[i])); //if (adZoneById.Active) //{ IList <M_Advertisement> aDList = B_Advertisement.GetADList(adZoneById.ZoneID); if (aDList.Count >= 0) { adjs.CreateJS(adZoneById, aDList); } //} } } }
/// <summary> /// 添加版位信息时,创建对应的JS文件 /// </summary> public static void CreateJS(string ids) { if (string.IsNullOrEmpty(ids)) { return; } B_ADZone zoneBll = new B_ADZone(); B_ADZoneJs jsBll = new B_ADZoneJs(); string[] idArr = ids.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < idArr.Length; i++) { M_Adzone zoneMod = zoneBll.SelReturnModel(Convert.ToInt32(idArr[i])); DataTable dt = B_Advertisement.GetADList(zoneMod.ZoneID); //if (dt.Rows.Count > 0) //{ jsBll.CreateJS(zoneMod, dt); //} } }