public void DataBind(string key = "") { DataTable dt = new DataTable(); if (!string.IsNullOrEmpty(Request.QueryString["ZoneId"]) && DataConverter.CLng(Request.QueryString["ZoneId"]) > 0) { int type = DataConverter.CLng(Request.QueryString["type"]); int zoneid = DataConverter.CLng(Request.QueryString["ZoneId"]); if (!string.IsNullOrEmpty(Request.QueryString["type"]) && type > 0) { dt = advBll.GetAdvByTypeAndZoneId(type, zoneid); } else { dt = advBll.GetTableADList(zoneid); } } else { if (!string.IsNullOrEmpty(Request.QueryString["type"])) { dt = B_Advertisement.GetAdvByType(Convert.ToInt32(Request.QueryString["type"])); } else { dt = B_Advertisement.GetAllAdvertisementList(); } } Egv.DataSource = dt; Egv.DataBind(); }
protected void Egv_RowCommand(object sender, GridViewCommandEventArgs e) { string Id = e.CommandArgument.ToString(); switch (e.CommandName) { case "Del": if (B_Advertisement.Advertisement_Delete(Convert.ToInt32(Id))) { function.WriteSuccessMsg("删除成功!", "ADManage.aspx"); } break; case "Copy": if (B_Advertisement.Advertisement_Copy(DataConverter.CLng(Id))) { function.WriteSuccessMsg("复制成功!", "ADManage.aspx"); } break; case "Pass": if (!B_Advertisement.Advertisement_GetAdvertisementByid(DataConverter.CLng(Id)).Passed) { B_Advertisement.Advertisement_SetPassed(Id); } else { B_Advertisement.Advertisement_CancelPassed(Id); } break; } DataBind(); }
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(); } }
protected void Page_Load(object sender, EventArgs e) { ZoomLa.Common.function.AccessRulo(); string action = "添加广告内容"; if (!IsPostBack) { B_Admin badmin = new B_Admin(); if (!B_ARoleAuth.Check(ZoomLa.Model.ZLEnum.Auth.other, "ADManage")) { function.WriteErrMsg("没有权限进行此项操作"); } listbind(); txtOverdueDate.Text = DateTime.Now.AddYears(1).ToString("yyyy-MM-dd"); //this.InitJSScript(); string id = base.Request.QueryString["ADId"]; if (string.IsNullOrEmpty(id)) { id = "0"; this.HdnID.Value = id; action = "添加广告内容"; this.Label1.Text = "添加广告内容"; string ZoneIDs = base.Request.QueryString["ZoneId"]; if (!string.IsNullOrEmpty(ZoneIDs)) { this.SetLstZoneNameSelected(ZoneIDs); } } else { this.HdnID.Value = id; this.Label1.Text = "修改广告"; M_Advertisement adv = B_Advertisement.Advertisement_GetAdvertisementByid(DataConverter.CLng(id)); this.TxtADName.Text = adv.ADName; this.TxtPriority.Text = adv.Priority.ToString(); this.txtOverdueDate.Text = adv.OverdueDate.ToString("yyyy-MM-dd"); this.InitRadlAdType(adv.ADType); this.InitShowPanel(adv); this.SetLstZoneNameSelected(B_Advertisement.GetZoneIDByAd(adv.ADID)); this.ChkCountClick.Checked = adv.CountClick; this.ChkCountView.Checked = adv.CountView; this.TxtClicks.Text = adv.Clicks.ToString(); this.TxtViews.Text = adv.Views.ToString(); ChkPasses.Checked = adv.Passed; if (adv.ADType > 0) { this.ChkCountClick.Enabled = false; this.TxtClicks.Enabled = false; } this.Price.Text = Math.Round(adv.Price, 2).ToString(); ADBuy.Checked = adv.ADBuy == 1 ? true : false; action = "<a href='Advertisement.aspx?ADId=" + id + "'>修改广告</a>[" + adv.ADName + "]"; } } Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "I/Main.aspx'>工作台</a></li><li><a href='ADManage.aspx'>广告管理</a></li><li class='active'>" + action + "</li>" + Call.GetHelp(29)); }
// 批量审核 protected void btnsetpassed_Click(object sender, EventArgs e) { string[] chkArr = GetChecked(); if (chkArr != null) { for (int i = 0; i < chkArr.Length; i++) { B_Advertisement.Advertisement_SetPassed(Convert.ToInt32(chkArr[i]).ToString()); } } this.DataBind(); }
/// <summary> /// 批量审核 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnsetpassed_Click(object sender, EventArgs e) { string str = ""; for (int i = 0; i < GridView1.Rows.Count; i++) { CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("chkSel"); if (cbox.Checked) { str = GridView1.DataKeys[i].Value.ToString(); B_Advertisement.Advertisement_SetPassed(str); } } this.RepNodeBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { B_Admin badmin = new B_Admin(); badmin.CheckMulitLogin(); if (!badmin.ChkPermissions("ADManage")) { function.WriteErrMsg("没有权限进行此项操作"); } listbind(); this.InitJSScript(); string id = base.Request.QueryString["ADId"]; if (string.IsNullOrEmpty(id)) { id = "0"; this.HdnID.Value = id; this.Label1.Text = "添加广告"; string ZoneIDs = base.Request.QueryString["ZoneId"]; if (!string.IsNullOrEmpty(ZoneIDs)) { this.SetLstZoneNameSelected(ZoneIDs); } this.txtOverdueDate.Text = DateTime.Now.AddDays(30).ToString("yyyy-MM-dd"); } else { this.HdnID.Value = id; this.Label1.Text = "修改广告"; M_Advertisement adv = B_Advertisement.Advertisement_GetAdvertisementByid(DataConverter.CLng(id)); this.TxtADName.Text = adv.AdName; this.TxtPriority.Text = adv.Priority.ToString(); this.txtOverdueDate.Text = adv.OverdueDate.ToString("yyyy-MM-dd"); this.InitRadlAdType(adv.AdType); this.InitShowPanel(adv); this.SetLstZoneNameSelected(B_Advertisement.GetZoneIDByAd(adv.AdId)); this.ChkCountClick.Checked = adv.CountClick; this.ChkCountView.Checked = adv.CountView; this.TxtClicks.Text = adv.Clicks.ToString(); this.TxtViews.Text = adv.Views.ToString(); if (adv.AdType > 0) { this.ChkCountClick.Enabled = false; this.TxtClicks.Enabled = false; } } } }
protected void Page_Load(object sender, EventArgs e) { M_Advertisement advertisementById = B_Advertisement.Advertisement_GetAdvertisementByid(DataConverter.CLng(base.Request.QueryString["AdId"])); if (!advertisementById.IsNull) { this.LabAdShow.Text = B_Advertisement.GetAdContent(advertisementById); if (advertisementById.CountClick) { advertisementById.Clicks++; } if (advertisementById.CountView) { advertisementById.Views++; } B_Advertisement.Advertisement_Update(advertisementById); } }
protected string getimg(string id) { int sid = DataConverter.CLng(id); string ddd = B_Advertisement.Advertisement_GetAdvertisementByid(sid).ADName; string tempstr = @"ShowADPreview('<a href=\'/idc/ target=\'_blank\' title=\'" + ddd + @"\'><img src=\'"; string tempstr2 = @"\' border=\'0\'></a>')"; string imgurl = B_Advertisement.Advertisement_GetAdvertisementByid(sid).ImgUrl; imageurl = "<img src=\'/" + SiteConfig.SiteOption.UploadDir + "/" + imgurl + "\' width=\'200\' height=\'120\' border=\'0\' />"; if (imgurl != "") { return(tempstr + B_Advertisement.Advertisement_GetAdvertisementByid(sid).ImgUrl + tempstr2); } else { return(""); } }
private void RepNodeBind() { DataTable da = B_Advertisement.GetAllAdvertisementList(); if (da.Rows.Count > 0) { this.nocontent.Style["display"] = "none"; this.GridView1.DataSource = da; this.GridView1.DataKeyNames = new string[] { "ADID" }; this.GridView1.DataBind(); this.GridView1.Visible = true; } else { this.nocontent.Style["display"] = ""; this.GridView1.Visible = false; } }
/// <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); //} } }
protected void Page_Load(object sender, EventArgs e) { string strB = base.Request.QueryString["Action"]; M_Advertisement advertisementById = B_Advertisement.Advertisement_GetAdvertisementByid(DataConverter.CLng(base.Request.QueryString["AdId"])); if (!advertisementById.IsNull) { if (advertisementById.CountView) { advertisementById.Views++; } if (advertisementById.CountClick) { advertisementById.Clicks++; } B_Advertisement.Advertisement_Update(advertisementById); if ((string.Compare("Click", strB, true) == 0) && !string.IsNullOrEmpty(advertisementById.LinkUrl)) { Response.Write("<script language='javascript' type='text/javascript'>window.location='" + advertisementById.LinkUrl + "';</script>"); } } }
protected void Lnk_Click(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Edit") { Page.Response.Redirect("Advertisement.aspx?ADId=" + e.CommandArgument.ToString()); } if (e.CommandName == "Del") { string Id = e.CommandArgument.ToString(); if (B_Advertisement.Advertisement_Delete(Id)) { Response.Write("<script>alert('删除成功!')</script>"); } this.RepNodeBind(); } if (e.CommandName == "Copy") { string Id = e.CommandArgument.ToString(); if (B_Advertisement.Advertisement_Copy(DataConverter.CLng(Id))) { Response.Write("<script>alert('复制成功!')</script>"); } this.RepNodeBind(); } if (e.CommandName == "Pass") { string Id = e.CommandArgument.ToString(); if (!B_Advertisement.Advertisement_GetAdvertisementByid(DataConverter.CLng(Id)).Passed) { B_Advertisement.Advertisement_SetPassed(Id); } else { B_Advertisement.Advertisement_CancelPassed(Id); } this.RepNodeBind(); } }
private void ShowAd() { M_Advertisement advertisementById = B_Advertisement.Advertisement_GetAdvertisementByid(DataConverter.CLng(base.Request.QueryString["AdId"])); this.ShowJS.InnerHtml = B_Advertisement.GetAdContent(advertisementById); }
protected void EBtnSubmit_Click(object sender, EventArgs e) { string adZoneIdList = this.GetAdZoneIdList(); if (this.Page.IsValid) { M_Advertisement adv = new M_Advertisement(); adv.UserId = 0; adv.AdName = DataSecurity.HtmlEncode(this.TxtADName.Text.Trim()); adv.AdType = DataConverter.CLng(this.RadlADType.SelectedValue); adv.Priority = DataConverter.CLng(this.TxtPriority.Text.Trim()); adv.Passed = this.ChkPassed.Checked; adv.CountView = this.ChkCountView.Checked; adv.Views = DataConverter.CLng(this.TxtViews.Text.Trim()); adv.CountClick = this.ChkCountClick.Checked; adv.Clicks = DataConverter.CLng(this.TxtClicks.Text.Trim()); //adv.ZoneID = adZoneIdList; adv.AdId = DataConverter.CLng(this.HdnID.Value.Trim()); adv.OverdueDate = DataConverter.CDate(this.txtOverdueDate.Text); adv.Setting = ""; switch (adv.AdType) { case 1: { adv.ImgUrl = this.txtpic.Text.Trim(); if (string.IsNullOrEmpty(adv.ImgUrl)) { function.WriteErrMsg("图片广告的图片地址不能为空!"); } adv.ImgHeight = DataConverter.CLng(this.TxtImgHeight.Text.Trim()); adv.ImgWidth = DataConverter.CLng(this.TxtImgWidth.Text.Trim()); string str2 = this.TxtLinkUrl.Text.Trim(); adv.LinkUrl = str2; adv.LinkTarget = DataConverter.CLng(this.RadlLinkTarget.SelectedValue); adv.LinkAlt = this.TxtLinkAlt.Text.Trim(); adv.ADIntro = this.TxtADIntro.Text.Trim(); break; } case 2: adv.ImgUrl = this.txtFlashPath.Text.Trim(); if (string.IsNullOrEmpty(adv.ImgUrl)) { function.WriteErrMsg("动画广告的Flash地址不能为空"); } adv.ImgHeight = DataConverter.CLng(this.TxtFlashHeight.Text.Trim()); adv.ImgWidth = DataConverter.CLng(this.TxtFlashWidth.Text.Trim()); adv.FlashWmode = DataConverter.CLng(this.RadlFlashMode.SelectedValue); break; case 3: adv.ADIntro = this.TxtADText.Text.Trim(); break; case 4: adv.ADIntro = this.TxtADCode.Text.Trim(); break; case 5: adv.ADIntro = this.TxtWebFileUrl.Text.Trim(); break; } bool flag = false; if (adv.AdId > 0) { flag = B_Advertisement.Advertisement_Update(adv); } else { adv.AdId = B_Advertisement.MaxID(); flag = B_Advertisement.Advertisement_Add(adv); } if (flag) { int zid = 0; if (!string.IsNullOrEmpty(adZoneIdList)) { string[] arr = adZoneIdList.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); for (int s = 0; s < arr.Length; s++) { zid = DataConverter.CLng(arr[s]); if (!B_Advertisement.IsExistZoneAdv(zid, adv.AdId)) { B_Advertisement.Add_Zone_Advertisement(zid, adv.AdId); } } B_ADZone.CreateJS(adZoneIdList); } Response.Write("<script>alert('广告信息保存成功!');window.document.location.href='ADManage.aspx'</script>"); } else { Response.Write("<script>alert('广告信息保存失败!');</script>"); } } }
protected void EBtnSubmit_Click(object sender, EventArgs e) { string adZoneIdList = LstZoneName.SelectedValue; if (this.Page.IsValid) { int adid = DataConverter.CLng(this.HdnID.Value.Trim()); M_Advertisement adv = new M_Advertisement(); adv.UserID = 0; adv.ADName = Server.HtmlEncode(this.TxtADName.Text.Trim()); adv.ADType = DataConverter.CLng(this.RadlADType.SelectedValue); adv.Priority = DataConverter.CLng(this.TxtPriority.Text.Trim()); adv.Passed = ChkPasses.Checked; adv.CountView = this.ChkCountView.Checked; adv.Views = DataConverter.CLng(this.TxtViews.Text.Trim()); adv.CountClick = this.ChkCountClick.Checked; adv.Clicks = DataConverter.CLng(this.TxtClicks.Text.Trim()); //adv.ZoneID = adZoneIdList; adv.ADID = adid; adv.OverdueDate = DataConverter.CDate(this.txtOverdueDate.Text); adv.Setting = ""; adv.Price = DataConverter.CDecimal(this.Price.Text); adv.ADBuy = this.ADBuy.Checked ? 1 : 0; switch (adv.ADType) { case 1: { adv.ImgUrl = this.txtpic.Text.Trim(); if (string.IsNullOrEmpty(adv.ImgUrl)) { function.WriteErrMsg("图片广告的图片地址不能为空!"); } adv.ImgHeight = DataConverter.CLng(this.TxtImgHeight.Text.Trim()); adv.ImgWidth = DataConverter.CLng(this.TxtImgWidth.Text.Trim()); string str2 = (this.TxtLinkUrl.Text.Trim() == "http://") ? "" : this.TxtLinkUrl.Text.Trim(); adv.LinkUrl = str2; adv.LinkTarget = DataConverter.CLng(this.RadlLinkTarget.SelectedValue); adv.LinkAlt = this.TxtLinkAlt.Text.Trim(); adv.ADIntro = this.TxtADIntro.Text.Trim(); adv.ImgUrl1 = this.txtpic1.Text.Trim(); adv.ImgHeight1 = DataConverter.CLng(this.TxtImgHeight1.Text.Trim()); adv.ImgWidth1 = DataConverter.CLng(this.TxtImgWidth1.Text.Trim()); string str3 = (this.TxtLinkUrl1.Text.Trim() == "http://") ? "" : this.TxtLinkUrl1.Text.Trim(); adv.LinkUrl1 = str3; adv.LinkTarget1 = DataConverter.CLng(this.RadlLinkTarget1.SelectedValue); adv.LinkAlt1 = this.TxtLinkAlt1.Text.Trim(); adv.ADIntro1 = this.TxtADIntro1.Text.Trim(); break; } case 2: adv.ImgUrl = this.txtFlashPath.Text.Trim(); if (string.IsNullOrEmpty(adv.ImgUrl)) { function.WriteErrMsg("动画广告的Flash地址不能为空"); } adv.ImgHeight = DataConverter.CLng(this.TxtFlashHeight.Text.Trim()); adv.ImgWidth = DataConverter.CLng(this.TxtFlashWidth.Text.Trim()); adv.FlashWmode = DataConverter.CLng(this.RadlFlashMode.SelectedValue); adv.ImgUrl1 = this.txtFlashPath1.Text.Trim(); adv.ImgHeight1 = DataConverter.CLng(this.TxtFlashHeight1.Text.Trim()); adv.ImgWidth1 = DataConverter.CLng(this.TxtFlashWidth1.Text.Trim()); adv.FlashWmode1 = DataConverter.CLng(this.RadlFlashMode1.SelectedValue); break; case 3: adv.ADIntro = this.TxtADText.Text.Trim(); adv.ADIntro1 = this.TxtADText1.Text.Trim(); break; case 4: adv.ADIntro = this.TxtADCode.Text.Trim(); adv.ADIntro1 = this.TxtADCode1.Text.Trim(); break; case 5: adv.ADIntro = this.TxtWebFileUrl.Text.Trim(); adv.ADIntro1 = this.TxtWebFileUrl1.Text.Trim(); break; } bool flag = false; if (adv.ADID > 0) { flag = B_Advertisement.Advertisement_Update(adv); } else { adv.ADID = B_Advertisement.MaxID(); flag = B_Advertisement.Advertisement_Add(adv); adv.ADID = B_Advertisement.MaxID() - 1; } if (flag) { int zid = 0; B_ADZone.Delete_ADZone_Ad(adv.ADID.ToString()); if (!string.IsNullOrEmpty(adZoneIdList)) { if (adZoneIdList.IndexOf(',') > -1) { string[] arr = adZoneIdList.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); for (int s = 0; s < arr.Length; s++) { zid = DataConverter.CLng(arr[s]); if (!B_Advertisement.IsExistZoneAdv(zid, adv.ADID)) { B_Advertisement.Add_Zone_Advertisement(zid, adv.ADID); } } B_ADZone.CreateJS(adZoneIdList); } else { zid = DataConverter.CLng(adZoneIdList); bool isadd = false; if (!B_Advertisement.IsExistZoneAdv(zid, adv.ADID)) { isadd = B_Advertisement.Add_Zone_Advertisement(zid, adv.ADID); } B_ADZone.CreateJS(adZoneIdList); } } function.WriteSuccessMsg("广告信息保存成功!", "ADManage.aspx"); } else { function.WriteErrMsg("保存失败!"); } } }