protected void EBtnAdZone_Click(object sender, EventArgs e) { if (this.Page.IsValid) { adzone.ZoneName = this.TxtZoneName.Text; adzone.ZoneType = DataConverter.CLng(this.radlZonetype.SelectedValue); adzone.ShowType = DataConverter.CLng(this.RadlShowType.SelectedValue); adzone.DefaultSetting = DataConverter.CBool(this.RBLDefaultSetting.SelectedValue); adzone.ZoneSetting = this.GetZoneSetting(DataConverter.CBool(this.RBLDefaultSetting.SelectedValue)); adzone.Active = this.ChkActive.Checked; adzone.UpdateTime = DateTime.Now; adzone.ZoneHeight = DataConverter.CLng(this.TxtZoneHeight.Text.Trim()); adzone.ZoneWidth = DataConverter.CLng(this.TxtZoneWidth.Text.Trim()); adzone.UpdateTime = DateTime.Now; adzone.ZoneJSName = this.TxtZoneJSName.Text; adzone.ZoneIntro = this.TxtZoneIntro.Text; adzone.ZoneID = DataConverter.CLng(this.HdnZoneId.Value); if (adzone.ZoneID > 0) { if (B_ADZone.ADZone_Update(adzone)) { Response.Write("<script>alert('修改成功');window.document.location.href='ADZoneManage.aspx'</script>"); } } else { adzone.ZoneID = B_ADZone.ADZone_MaxID(); if (B_ADZone.ADZone_Add(adzone)) { Response.Write("<script>alert('添加成功');window.document.location.href='ADZoneManage.aspx'</script>"); } } } }
protected void EBtnAdZone_Click(object sender, EventArgs e) { if (this.Page.IsValid) { adzone.ZoneName = this.TxtZoneName.Text; adzone.ZoneType = DataConverter.CLng(this.radlZonetype.SelectedValue); adzone.ShowType = DataConverter.CLng(this.RadlShowType.SelectedValue); adzone.DefaultSetting = DataConverter.CBool(this.RBLDefaultSetting.SelectedValue); adzone.ZoneSetting = this.GetZoneSetting(DataConverter.CBool(this.RBLDefaultSetting.SelectedValue)); adzone.Active = this.ChkActive.Checked; adzone.UpdateTime = DateTime.Now; adzone.ZoneHeight = DataConverter.CLng(this.TxtZoneHeight.Text.Trim()); adzone.ZoneWidth = DataConverter.CLng(this.TxtZoneWidth.Text.Trim()); adzone.UpdateTime = DateTime.Now; adzone.ZoneJSName = this.TxtZoneJSName.Text; adzone.ZoneIntro = this.TxtZoneIntro.Text; adzone.ZoneID = DataConverter.CLng(this.HdnZoneId.Value); if (this.CheckApply.Checked == true) { adzone.Sales = 1; } else { adzone.Sales = 0; } if (adzone.ZoneID > 0) { if (B_ADZone.ADZone_Update(adzone)) { function.WriteSuccessMsg("修改成功", "ADZoneManage.aspx"); } } else { adzone.ZoneID = B_ADZone.ADZone_MaxID(); if (B_ADZone.ADZone_Add(adzone)) { function.WriteSuccessMsg("添加成功", "ADZoneManage.aspx"); } } } }
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(); }