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(); } }
private void GetAdzoneParameter(M_Adzone adzone, ref SqlParameter[] parameter) { parameter = new SqlParameter[] { new SqlParameter("@ZoneId", SqlDbType.Int), new SqlParameter("@ZoneName", SqlDbType.NVarChar, 100), new SqlParameter("@ZoneJSName", SqlDbType.NVarChar, 100), new SqlParameter("@ZoneIntro", SqlDbType.NVarChar, 255), new SqlParameter("@ZoneType", SqlDbType.Int, 4), new SqlParameter("@DefaultSetting", SqlDbType.Bit), new SqlParameter("@ZoneSetting", SqlDbType.NVarChar, 255), new SqlParameter("@ZoneWidth", SqlDbType.Int), new SqlParameter("@ZoneHeight", SqlDbType.Int), new SqlParameter("@Active", SqlDbType.Bit), new SqlParameter("@ShowType", SqlDbType.Int), new SqlParameter("@UpdateTime", SqlDbType.DateTime) }; parameter[0].Value = adzone.ZoneID; parameter[1].Value = adzone.ZoneName; parameter[2].Value = adzone.ZoneJSName; parameter[3].Value = adzone.ZoneIntro; parameter[4].Value = adzone.ZoneType; parameter[5].Value = adzone.DefaultSetting; parameter[6].Value = adzone.ZoneSetting; parameter[7].Value = adzone.ZoneWidth; parameter[8].Value = adzone.ZoneHeight; parameter[9].Value = adzone.Active; parameter[10].Value = adzone.ShowType; parameter[11].Value = adzone.UpdateTime; }
/// <summary> /// 激活版位 /// </summary> /// <param name="strZoneId"></param> /// <returns></returns> public static bool ADZone_Active(int ID) { M_Adzone initMod = new M_Adzone(); string sql = "Update " + initMod.TbName + " Set Active=1 Where ZoneID=" + ID; return(SqlHelper.ExecuteSql(sql)); }
/// <summary> /// 创建广告版位JS /// </summary> /// <param name="adZoneInfo"></param> /// <param name="advertisementInfoList"></param> public void CreateJS(M_Adzone adZoneInfo, IList <M_Advertisement> advertisementInfoList) { //将当前版位对象设置为要操作的版位对象 this.zoneInfo = adZoneInfo; //读取模板基本代码 StringBuilder builder = new StringBuilder(this.GetZoneJSTemplate()); if (this.zoneInfo.Active == false) { builder.Insert(0, "var jsshow=0;if (jsshow==1 ){"); } //定义版位对象 builder.Append("var ZoneAD_" + adZoneInfo.ZoneID + "=new "); builder.Append(string.Concat(new object[] { this.zoneConfig[adZoneInfo.ZoneType], "ZoneAD(\"ZoneAD_", adZoneInfo.ZoneID, "\");" })); //将广告对象定义加入到JS代码中 for (int i = 0; i < advertisementInfoList.Count; i++) { this.advertisementInfo = advertisementInfoList[i]; this.advertisementInfo.ZoneID = adZoneInfo.ZoneID; if (this.advertisementInfo.Passed && (this.advertisementInfo.Days >= 0)) { builder.Append(this.CreatAdvertisementJS()); } } //加入版位属性定义 builder.Append(this.CreateADZoneJS()); FileSystemObject.WriteFile(VirtualPathUtility.AppendTrailingSlash(HttpContext.Current.Server.MapPath("~/" + SiteConfig.SiteOption.AdvertisementDir)) + adZoneInfo.ZoneJSName, builder.ToString()); }
/// <summary> /// 修改版位 /// </summary> /// <param name="adZone"></param> /// <returns></returns> public static bool ADZone_Update(M_Adzone adZone) { if (!ADZone_Updates(adZone)) { return(false); } else { CreateJS(adZone.ZoneID.ToString()); } return(true); }
/// <summary> /// 获取某个广告所属第一个版位 /// </summary> public static M_Adzone getAdzones(int adverseId) { M_Adzone model = new M_Adzone(); string sql = "select * from ZL_AdZone where ZoneID=(select top 1 ZoneID from ZL_Zone_Advertisement where ADID=" + adverseId + " order by ZoneID desc)"; using (DbDataReader drd = SqlHelper.ExecuteReader(CommandType.Text, sql)) { if (drd.Read()) { return(model.GetModelFromReader(drd)); } else { return(new M_Adzone(true)); } } }
/// <summary> /// 实例化 /// </summary> /// <param name="rdr"></param> /// <returns></returns> private M_Adzone GetInfoFromReader(SqlDataReader rdr) { M_Adzone info = new M_Adzone(); info.ZoneID = DataConverter.CLng(rdr["ZoneID"]); info.ZoneName = rdr["ZoneName"].ToString(); info.ZoneJSName = rdr["ZoneJSName"].ToString(); info.ZoneIntro = rdr["ZoneIntro"].ToString(); info.ZoneType = DataConverter.CLng(rdr["ZoneType"]); info.DefaultSetting = DataConverter.CBool(rdr["DefaultSetting"].ToString()); info.ZoneSetting = rdr["ZoneSetting"].ToString(); info.ZoneHeight = DataConverter.CLng(rdr["ZoneHeight"]); info.ZoneWidth = DataConverter.CLng(rdr["ZoneWidth"]); info.Active = DataConverter.CBool(rdr["Active"].ToString()); info.ShowType = DataConverter.CLng(rdr["ShowType"]); info.UpdateTime = DataConverter.CDate(rdr["UpdateTime"]); return(info); }
/// <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); //} } }
/// <summary> /// 获取某个广告所属第一个版位 /// </summary> /// <param name="adverseId"></param> /// <returns></returns> public static M_Adzone getAdzones(int adverseId) { M_Adzone model = new M_Adzone(); string sql = "select * from ZL_AdZone where ZoneID=(select top 1 ZoneID from ZL_Zone_Advertisement where ADID=@ADID order by ZoneID desc)"; SqlParameter[] parameter = new SqlParameter[1]; parameter[0] = new SqlParameter("@ADId", SqlDbType.Int); parameter[0].Value = adverseId; using (SqlDataReader drd = SqlHelper.ExecuteReader(CommandType.Text, sql, parameter)) { if (drd.Read()) { return(model.GetModelFromReader(drd)); } else { return(new M_Adzone(true)); } } }
/// <summary> /// 获取指定版位的详细信息 /// </summary> /// <param name="adzoneid"></param> /// <returns></returns> public static M_Adzone getAdzoneByZoneId(int adzoneid) { M_Adzone model = new M_Adzone(); string sql = "select * from ZL_AdZone where ZoneId=@zoneid"; SqlParameter[] parameter = new SqlParameter[1]; parameter[0] = new SqlParameter("@zoneid", SqlDbType.Int); parameter[0].Value = adzoneid; using (SqlDataReader drd = SqlHelper.ExecuteReader(CommandType.Text, sql, parameter)) { if (drd.Read()) { return(model.GetModelFromReader(drd)); } else { return(new M_Adzone(true)); } } }
/// <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); } //} } } }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { B_Admin badmin = new B_Admin(); badmin.CheckMulitLogin(); if (!badmin.ChkPermissions("ADManage")) { function.WriteErrMsg("没有权限进行此项操作"); } M_Adzone adZoneById = B_ADZone.getAdzoneByZoneId(DataConverter.CLng(base.Request.QueryString["ZoneId"])); if ((adZoneById.IsNull) || string.IsNullOrEmpty(adZoneById.ZoneJSName)) { this.TxtZoneCode.Text = "版位调用代码不存在!"; } else { this.TxtZoneCode.Text = "<script type=\"text/javascript\" src=\"{$AdDir/}/" + adZoneById.ZoneJSName + "\"></script>"; } } }
protected void Page_Load(object sender, EventArgs e) { ZoomLa.Common.function.AccessRulo(); if (!this.Page.IsPostBack) { B_Admin badmin = new B_Admin(); if (!B_ARoleAuth.Check(ZLEnum.Auth.other, "ADManage")) { function.WriteErrMsg("没有权限进行此项操作"); } M_Adzone adZoneById = B_ADZone.getAdzoneByZoneId(DataConverter.CLng(base.Request.QueryString["ZoneId"])); if ((adZoneById.IsNull) || string.IsNullOrEmpty(adZoneById.ZoneJSName)) { this.TxtZoneCode.Text = "版位调用代码不存在!"; } else { this.TxtZoneCode.Text = "<script src=\"{$AdDir/}/" + adZoneById.ZoneJSName.Trim() + "\"></script>"; } } Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "I/Main.aspx'>工作台</a></li><li><a href='ADManage.aspx'>广告管理</a></li><li class='active'>获取广告代码</li>"); }
/// <summary> /// 添加版位 /// </summary> /// <param name="adZone"></param> /// <returns></returns> bool ID_Adzone.ADZone_Add(M_Adzone adZone) { SqlParameter[] parameter = null; this.GetAdzoneParameter(adZone, ref parameter); return(SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure, "dt_ADZone_Add", parameter) > 0); }
public int insert(M_Adzone model) { return(Sql.insertID(TbName, model.GetParameters(), BLLCommon.GetParas(model), BLLCommon.GetFields(model))); }
public bool UpdateByID(M_Adzone model) { return(Sql.UpdateByIDs(TbName, PK, model.ZoneID.ToString(), BLLCommon.GetFieldAndPara(model), model.GetParameters())); }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { B_Admin badmin = new B_Admin(); badmin.CheckMulitLogin(); if (!badmin.ChkPermissions("ADManage")) { function.WriteErrMsg("没有权限进行此项操作"); } this.DropFixedPosition.Attributes.Add("onchange", "ChangePositonShow(this)"); this.DropFloatPosition.Attributes.Add("onchange", "ChangePositonShow(this)"); this.DropMovePosition.Attributes.Add("onchange", "ChangePositonShow(this)"); this.DropPopPosition.Attributes.Add("onchange", "ChangePositonShow(this)"); foreach (ListItem lit in this.radlZonetype.Items) { lit.Attributes.Add("onclick", "ShowZoenTypePanel()"); } foreach (ListItem li2 in this.RBLDefaultSetting.Items) { li2.Attributes.Add("onclick", "ShowZoenTypePanel()"); } this.DropAdZoneSize.Attributes.Add("onchange", "Zone_SelectSize(this)"); string zoneid = base.Request.QueryString["ZoneId"]; if (string.IsNullOrEmpty(zoneid)) { this.TxtZoneJSName.Text = this.GetJSFileName(); zoneid = "0"; this.HdnZoneId.Value = zoneid; this.Label1.Text = "添加广告版位"; } else { this.HdnZoneId.Value = zoneid; this.Label1.Text = "修改广告版位"; adzone = B_ADZone.getAdzoneByZoneId(DataConverter.CLng(zoneid)); this.TxtZoneName.Text = adzone.ZoneName; this.TxtZoneJSName.Text = adzone.ZoneJSName; this.TxtZoneIntro.Text = adzone.ZoneIntro; this.TxtZoneHeight.Text = adzone.ZoneHeight.ToString(); this.TxtZoneWidth.Text = adzone.ZoneWidth.ToString(); this.radlZonetype.SelectedValue = adzone.ZoneType.ToString(); if (!adzone.DefaultSetting) { this.RBLDefaultSetting.SelectedValue = "0"; } else { this.RBLDefaultSetting.SelectedValue = "1"; } InitShowPanel(adzone.ZoneType); InitSetting(adzone.ZoneSetting, adzone.ZoneType); this.RadlShowType.SelectedValue = adzone.ShowType.ToString(); if (adzone.Active) { this.ChkActive.Checked = true; } else { this.ChkActive.Checked = false; } } } }
/// <summary> /// 删除版位 /// </summary> /// <param name="strZoneId"></param> /// <returns></returns> public static bool ADZone_Remove(string ID) { M_Adzone model = new M_Adzone(); return(Sql.Del(model.TbName, model.PK + "=" + Convert.ToInt32(ID))); }
//------------------------------------------------------------- /// <summary> /// 添加版位,并生成JS /// </summary> public static bool ADZone_Add(M_Adzone model) { model.ZoneID = DBCenter.Insert(model); CreateJS(model.ZoneID.ToString()); return(true); }
/// <summary> /// 修改版位 /// </summary> /// <param name="adZone"></param> /// <returns></returns> public static bool ADZone_Updates(M_Adzone model) { return(Sql.UpdateByIDs(model.TbName, model.PK, model.ZoneID.ToString(), BLLCommon.GetFieldAndPara(model), model.GetParameters())); }
/// <summary> /// 修改版位,并生成JS /// </summary> public static bool ADZone_Update(M_Adzone model) { DBCenter.UpdateByID(model, model.ZoneID); CreateJS(model.ZoneID.ToString()); return(true); }
public bool UpdateByID(M_Adzone model) { return(DBCenter.UpdateByID(model, model.ZoneID)); }
/// <summary> /// 添加版位 /// </summary> /// <param name="adZone"></param> /// <returns></returns> static bool ADZone_Adds(M_Adzone model) { Sql.insert(model.TbName, model.GetParameters(), BLLCommon.GetParas(model), BLLCommon.GetFields(model)); return(true); }
/// <summary> /// 创建广告版位JS /// </summary> /// <param name="adZoneInfo"></param> /// <param name="advertisementInfoList"></param> public void CreateJS(M_Adzone adZoneInfo, DataTable dt) { }
public int Insert(M_Adzone model) { return(DBCenter.Insert(model)); }
protected void Page_Load(object sender, EventArgs e) { Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "I/Main.aspx'>工作台</a></li><li><a href='ADZoneManage.aspx'>扩展功能</a></li><li><a href='ADZoneManage.aspx'>版位管理</a></li><li class='active'><a href='ADZone.aspx'>版位编辑</a></li>" + Call.GetHelp(28)); ZoomLa.Common.function.AccessRulo(); if (!this.Page.IsPostBack) { B_Admin badmin = new B_Admin(); if (!B_ARoleAuth.Check(ZoomLa.Model.ZLEnum.Auth.other, "ADManage")) { function.WriteErrMsg("没有权限进行此项操作"); } this.DropFixedPosition.Attributes.Add("onchange", "ChangePositonShow(this)"); this.DropFloatPosition.Attributes.Add("onchange", "ChangePositonShow(this)"); this.DropMovePosition.Attributes.Add("onchange", "ChangePositonShow(this)"); this.DropPopPosition.Attributes.Add("onchange", "ChangePositonShow(this)"); foreach (ListItem lit in this.radlZonetype.Items) { lit.Attributes.Add("onclick", "ShowZoenTypePanel()"); } foreach (ListItem li2 in this.RBLDefaultSetting.Items) { li2.Attributes.Add("onclick", "ShowZoenTypePanel()"); } this.DropAdZoneSize.Attributes.Add("onchange", "Zone_SelectSize(this)"); string zoneid = base.Request.QueryString["ZoneId"]; if (string.IsNullOrEmpty(zoneid)) { this.TxtZoneJSName.Text = this.GetJSFileName().Trim(); zoneid = "0"; this.HdnZoneId.Value = zoneid; this.Label1.Text = "添加广告版位"; } else { this.HdnZoneId.Value = zoneid; this.Label1.Text = "修改广告版位"; adzone = B_ADZone.getAdzoneByZoneId(DataConverter.CLng(zoneid)); this.TxtZoneName.Text = adzone.ZoneName; this.TxtZoneJSName.Text = adzone.ZoneJSName.Trim(); this.TxtZoneIntro.Text = adzone.ZoneIntro; this.TxtZoneHeight.Text = adzone.ZoneHeight.ToString(); this.TxtZoneWidth.Text = adzone.ZoneWidth.ToString(); this.radlZonetype.SelectedValue = adzone.ZoneType.ToString(); if (adzone.Sales == 1) { this.CheckApply.Checked = true; } else { this.CheckApply.Checked = false; } if (!adzone.DefaultSetting) { this.RBLDefaultSetting.SelectedValue = "0"; } else { this.RBLDefaultSetting.SelectedValue = "1"; } InitShowPanel(adzone.ZoneType); InitSetting(adzone.ZoneSetting, adzone.ZoneType); this.RadlShowType.SelectedValue = adzone.ShowType.ToString(); if (adzone.Active) { this.ChkActive.Checked = true; } else { this.ChkActive.Checked = false; } } } }
protected void Egv_RowCommand(object sender, GridViewCommandEventArgs e) { string Id = e.CommandArgument.ToString(); switch (e.CommandName) { case "Del": M_Adzone Old = B_ADZone.getAdzoneByZoneId(DataConverter.CLng(Id)); string jssource = Old.ZoneJSName; jssource = VirtualPathUtility.AppendTrailingSlash(Request.PhysicalApplicationPath + "/" + SiteConfig.SiteOption.AdvertisementDir) + jssource; if (B_ADZone.ADZone_Remove(Id)) { FileSystemObject.Delete(jssource, FsoMethod.File); function.Script(Page, "alert('删除成功!');"); } break; case "Copy": int NewID = B_ADZone.ADZone_Copy(DataConverter.CLng(Id)); if (NewID > 0) { M_Adzone mzone = B_ADZone.getAdzoneByZoneId(NewID); string ZoneJSName = mzone.ZoneJSName; ZoneJSName = ZoneJSName.Split(new string[] { "/" }, StringSplitOptions.None)[0].ToString(); if (ZoneJSName.Length == 5) { mzone.ZoneJSName = mzone.ZoneJSName.Insert(4, "0"); } B_ADZone.ADZone_Update(mzone); B_ADZone.CreateJS(NewID.ToString()); function.Script(Page, "alert('复制成功!" + NewID.ToString() + "');"); } break; case "Clear": if (B_ADZone.ADZone_Clear(DataConverter.CLng(Id))) { function.Script(Page, "alert('清除成功!');"); } break; case "SetAct": if (!B_ADZone.getAdzoneByZoneId(DataConverter.CLng(Id)).Active) { B_ADZone.ADZone_Active(DataConverter.CLng(Id)); } else { B_ADZone.ADZone_Pause(Id); } B_ADZone.CreateJS(Id); break; case "Refresh": B_ADZone.CreateJS(e.CommandArgument.ToString()); function.WriteSuccessMsg("刷新版位成功"); break; case "PreView": Page.Response.Redirect("PreviewAD.aspx?ZoneID=" + e.CommandArgument.ToString() + "&Type=Zone"); break; case "JS": Page.Response.Redirect("ShowJSCode.aspx?ZoneID=" + e.CommandArgument.ToString()); break; } DataBind(); }