Пример #1
0
 protected void EBtnSubmit_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(this.TxtExportMdb.Text))
     {
         AdminPage.WriteErrMsg("<li>导出的数据库链接不能为空!</li>");
     }
     else
     {
         StringBuilder sb = new StringBuilder("");
         for (int i = 0; i < this.LstZoneID.Items.Count; i++)
         {
             if (this.LstZoneID.Items[i].Selected)
             {
                 StringHelper.AppendString(sb, this.LstZoneID.Items[i].Value);
             }
         }
         if (sb.Length < 1)
         {
             AdminPage.WriteErrMsg("请选择要导出的项目!");
         }
         else if (ADZone.ExportData(sb.ToString(), base.Server.MapPath(this.TxtExportMdb.Text), this.ChkFormatConn.Checked))
         {
             AdminPage.WriteSuccessMsg("<li>已经成功将所选中的版位设置导出到指定的数据库中!</li>", "ADZoneManage.aspx");
         }
         else
         {
             AdminPage.WriteErrMsg("<li>导出失败!</li>", "ADZoneManage.aspx");
         }
     }
 }
Пример #2
0
        private void SaveImportData()
        {
            string selectedValue = this.LstImportZoneId.SelectedValue;
            string text          = this.TxtImportMdb.Text;

            if (string.IsNullOrEmpty(selectedValue))
            {
                AdminPage.WriteErrMsg("<li>请选择要导入的广告版位列表!</li>");
            }
            if (string.IsNullOrEmpty(text))
            {
                AdminPage.WriteErrMsg("<li>导入的数据库链接不能为空!</li>");
            }
            StringBuilder sb = new StringBuilder("");

            for (int i = 0; i < this.LstImportZoneId.Items.Count; i++)
            {
                if (this.LstImportZoneId.Items[i].Selected)
                {
                    StringHelper.AppendString(sb, this.LstImportZoneId.Items[i].Value);
                }
            }
            if (sb.Length < 1)
            {
                AdminPage.WriteErrMsg("请选择要导入的项目!");
            }
            else if (ADZone.ImportData(sb.ToString(), base.Server.MapPath(text)))
            {
                BasePage.ResponseRedirect("ADZoneImport.aspx?Step=1&ImportPath=" + base.Server.HtmlEncode(this.TxtImportMdb.Text) + "&ModelType=" + BasePage.RequestInt32("ModelType").ToString());
            }
        }
Пример #3
0
        private static ADFilter FilterBuilder(GroupItemResolved resolvedGroup, ADZone zone)
        {
            var filter = new ADFilter(zone);

            filter.RegisterResolvedGroupHandler(resolvedGroup);
            return(filter);
        }
Пример #4
0
 private void InitLstZoneName()
 {
     this.LstZoneName.DataSource     = ADZone.GetADZoneList(0, 0);
     this.LstZoneName.DataTextField  = "ZoneName";
     this.LstZoneName.DataValueField = "ZoneId";
     this.LstZoneName.DataBind();
 }
Пример #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         this.TxtZoneJSName.Text = this.GetJSFileName();
         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)");
         if (BasePage.RequestString("Action") == "Modify")
         {
             int        id         = BasePage.RequestInt32("ZoneId");
             ADZoneInfo adZoneById = ADZone.GetAdZoneById(id);
             this.TxtZoneName.Text   = adZoneById.ZoneName;
             this.TxtZoneJSName.Text = adZoneById.ZoneJSName;
             this.TxtZoneIntro.Text  = adZoneById.ZoneIntro;
             this.InitRblADZoneType((int)adZoneById.ZoneType);
             if (adZoneById.DefaultSetting)
             {
                 this.InitRblADZoneDefaultSetting(0);
             }
             else
             {
                 this.InitRblADZoneDefaultSetting(1);
             }
             BasePage.SetSelectedIndexByValue(this.RadlShowType, adZoneById.ShowType.ToString());
             string flag = adZoneById.ZoneWidth.ToString() + "x" + adZoneById.ZoneHeight.ToString();
             this.InitDropADZoneSize(flag);
             this.TxtZoneWidth.Text  = adZoneById.ZoneWidth.ToString();
             this.TxtZoneHeight.Text = adZoneById.ZoneHeight.ToString();
             this.InitSetting(adZoneById.Setting, adZoneById.ZoneType);
             if (this.RadlDefaultSetting.SelectedValue == "1")
             {
                 this.InitShowPanel(adZoneById.ZoneType);
             }
             this.ChkActive.Checked = adZoneById.Active;
             this.EBtnAdZone.Text   = "修 改";
             this.HdnAction.Value   = "Modify";
             this.HdnZoneId.Value   = id.ToString();
             if ((adZoneById.ZoneType > ADZoneType.Banner) && (adZoneById.ZoneType == ADZoneType.Code))
             {
                 this.DropAdZoneSize.Enabled = false;
                 this.TxtZoneHeight.Enabled  = false;
                 this.TxtZoneWidth.Enabled   = false;
             }
         }
         else
         {
             this.InitRblADZoneType(1);
             this.InitRblADZoneDefaultSetting(0);
             this.InitDropADZoneSize(null);
             this.EBtnAdZone.Text = "添 加";
             this.HdnAction.Value = "Add";
         }
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            string str = BasePage.RequestString("Action");

            if (!string.IsNullOrEmpty(str))
            {
                string id        = BasePage.RequestString("ZoneId");
                string returnurl = "ADZoneManage.aspx";
                switch (str)
                {
                case "Delete":
                    ADZone.Delete(id);
                    ADZone.DeleteJS(id);
                    return;

                case "Copy":
                    if (!ADZone.CopyADZone(id))
                    {
                        AdminPage.WriteErrMsg("复制广告版位失败!", returnurl);
                        return;
                    }
                    AdminPage.WriteSuccessMsg("复制广告版位成功!", returnurl);
                    ADZone.CreateJS(id);
                    return;

                case "Pause":
                    ADZone.PauseADZone(id);
                    ADZone.DeleteJS(id);
                    BasePage.ResponseRedirect(returnurl);
                    return;

                case "Active":
                    ADZone.ActiveADZone(id);
                    ADZone.CreateJS(id);
                    BasePage.ResponseRedirect(returnurl);
                    return;

                case "Clear":
                    ADZone.ClearADZone(id);
                    ADZone.DeleteJS(id);
                    BasePage.ResponseRedirect(returnurl);
                    return;

                case "Refurbish":
                    ADZone.CreateJS(id);
                    AdminPage.WriteSuccessMsg("刷新成功!", "AdZoneManage.aspx");
                    return;

                default:
                    return;
                }
            }
        }
Пример #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ADZoneInfo adZoneById = ADZone.GetAdZoneById(BasePage.RequestInt32("ZoneId"));

            if ((adZoneById == null) || string.IsNullOrEmpty(adZoneById.ZoneJSName))
            {
                this.TxtZoneCode.Text = "找不到指定的版位!";
            }
            else
            {
                this.TxtZoneCode.Text = "<script  type=\"text/javascript\" src='{PE.SiteConfig.adpath/}/" + adZoneById.ZoneJSName + "'></script>";
            }
        }
Пример #8
0
        public void ListDataBind(ListControl dropName)
        {
            IList <ADZoneInfo> aDZoneList = ADZone.GetADZoneList(0, 0);

            if (aDZoneList.Count > 0)
            {
                dropName.Items.Clear();
                dropName.DataSource = aDZoneList;
                dropName.DataBind();
            }
            else
            {
                dropName.Items.Clear();
            }
        }
Пример #9
0
        public void ImportDataBind(ListControl dropName, string importDatabase)
        {
            IList <ADZoneInfo> importList = ADZone.GetImportList(importDatabase);

            if (importList.Count > 0)
            {
                dropName.Items.Clear();
                dropName.DataSource = importList;
                dropName.DataBind();
            }
            else
            {
                dropName.Items.Clear();
            }
        }
Пример #10
0
 protected void EBtnAdZone_Click(object sender, EventArgs e)
 {
     if (this.Page.IsValid)
     {
         ADZoneInfo adZoneInfo = new ADZoneInfo();
         adZoneInfo.ZoneName       = this.TxtZoneName.Text.Trim();
         adZoneInfo.ZoneJSName     = this.TxtZoneJSName.Text.Trim();
         adZoneInfo.ZoneIntro      = this.TxtZoneIntro.Text.Trim();
         adZoneInfo.ZoneType       = (ADZoneType)DataConverter.CLng(this.RadlZoneType.SelectedValue);
         adZoneInfo.DefaultSetting = this.GetDefaultSetting(this.RadlDefaultSetting.SelectedValue);
         adZoneInfo.Setting        = this.GetZoneSetting(adZoneInfo.DefaultSetting);
         adZoneInfo.ZoneWidth      = DataConverter.CLng(this.TxtZoneWidth.Text.Trim());
         adZoneInfo.ZoneHeight     = DataConverter.CLng(this.TxtZoneHeight.Text.Trim());
         adZoneInfo.ShowType       = DataConverter.CLng(this.RadlShowType.SelectedValue);
         adZoneInfo.Active         = this.ChkActive.Checked;
         adZoneInfo.UpdateTime     = DateTime.Now;
         if (this.HdnAction.Value.Trim() == "Modify")
         {
             adZoneInfo.ZoneId = DataConverter.CLng(this.HdnZoneId.Value.Trim());
             if (ADZone.Update(adZoneInfo))
             {
                 BasePage.ResponseRedirect("ADZoneManage.aspx");
             }
             else
             {
                 AdminPage.WriteErrMsg("更新出错!", "ADZone.aspx?ZoneId=" + adZoneInfo.ZoneId);
             }
         }
         else if (ADZone.Add(adZoneInfo) == DataActionState.Successed)
         {
             BasePage.ResponseRedirect("ADZoneManage.aspx");
         }
         else
         {
             AdminPage.WriteErrMsg("添加出错!", "ADZone.aspx");
         }
     }
 }
Пример #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int zoneId = BasePage.RequestInt32("ZoneId");

            if (string.Compare(BasePage.RequestString("Type"), "Zone", StringComparison.OrdinalIgnoreCase) == 0)
            {
                if (Advertisement.GetADList(zoneId).Count == 0)
                {
                    this.ShowJS.InnerHtml = "版位中暂时还未添加广告,请添加后再进行预览!";
                }
                else
                {
                    ADZoneInfo adZoneById = ADZone.GetAdZoneById(zoneId);
                    if (adZoneById != null)
                    {
                        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 EBtnRefurbish_Click(object sender, EventArgs e)
 {
     ADZone.CreateJS(this.GdvADZone.SelectList.ToString());
 }
Пример #13
0
 public ADFilter(ADZone zone)
 {
     _zone = zone;
 }
Пример #14
0
 private string GetJSFileName()
 {
     return(ADZone.GetNewJSName());
 }
Пример #15
0
        protected void EBtnSubmit_Click(object sender, EventArgs e)
        {
            string adZoneIdList = this.GetAdZoneIdList();

            if (this.Page.IsValid)
            {
                DataActionState   state;
                AdvertisementInfo advertisementInfo = new AdvertisementInfo();
                advertisementInfo.UserId      = 0;
                advertisementInfo.ADName      = this.TxtADName.Text.Trim();
                advertisementInfo.ADType      = DataConverter.CLng(this.RadlADType.SelectedValue);
                advertisementInfo.Priority    = DataConverter.CLng(this.TxtPriority.Text.Trim());
                advertisementInfo.Passed      = this.ChkPassed.Checked;
                advertisementInfo.CountView   = this.ChkCountView.Checked;
                advertisementInfo.Views       = DataConverter.CLng(this.TxtViews.Text.Trim());
                advertisementInfo.CountClick  = this.ChkCountClick.Checked;
                advertisementInfo.Clicks      = DataConverter.CLng(this.TxtClicks.Text.Trim());
                advertisementInfo.ZoneId      = adZoneIdList;
                advertisementInfo.ADId        = DataConverter.CLng(this.HdnAdId.Value.Trim());
                advertisementInfo.OverdueDate = this.DpkOverdueDate.Date;
                switch (advertisementInfo.ADType)
                {
                case 1:
                {
                    advertisementInfo.ImgUrl = this.FileUploadControl1.FilePath;
                    if (string.IsNullOrEmpty(advertisementInfo.ImgUrl))
                    {
                        AdminPage.WriteErrMsg("图片广告请上传图片!");
                    }
                    advertisementInfo.ImgHeight = DataConverter.CLng(this.TxtImgHeight.Text.Trim());
                    advertisementInfo.ImgWidth  = DataConverter.CLng(this.TxtImgWidth.Text.Trim());
                    string str2 = this.TxtLinkUrl.Text.Trim();
                    advertisementInfo.LinkUrl    = str2;
                    advertisementInfo.LinkTarget = DataConverter.CLng(this.RadlLinkTarget.SelectedValue);
                    advertisementInfo.LinkAlt    = this.TxtLinkAlt.Text.Trim();
                    advertisementInfo.ADIntro    = this.TxtADIntro.Text.Trim();
                    break;
                }

                case 2:
                    advertisementInfo.ImgUrl = this.ExtenFileUpload.FilePath;
                    if (string.IsNullOrEmpty(advertisementInfo.ImgUrl))
                    {
                        AdminPage.WriteErrMsg("Flash广告请上传Flash!");
                    }
                    advertisementInfo.ImgHeight  = DataConverter.CLng(this.TxtFlashHeight.Text.Trim());
                    advertisementInfo.ImgWidth   = DataConverter.CLng(this.TxtFlashWidth.Text.Trim());
                    advertisementInfo.FlashWmode = DataConverter.CLng(this.RadlFlashMode.SelectedValue);
                    break;

                case 3:
                    advertisementInfo.ADIntro = this.TxtADText.Text.Trim();
                    break;

                case 4:
                    advertisementInfo.ADIntro = this.TxtADCode.Text.Trim();
                    break;

                case 5:
                    advertisementInfo.ADIntro = this.TxtWebFileUrl.Text.Trim();
                    break;
                }
                if (this.HdnAction.Value.Trim() == "Modify")
                {
                    state = Advertisement.Update(advertisementInfo);
                }
                else
                {
                    state = Advertisement.Add(advertisementInfo);
                }
                switch (state)
                {
                case DataActionState.Successed:
                    if (!string.IsNullOrEmpty(adZoneIdList))
                    {
                        ADZone.CreateJS(adZoneIdList);
                    }
                    AdminPage.WriteSuccessMsg("保存操作广告成功!", "AdManage.aspx");
                    return;

                case DataActionState.Unknown:
                    AdminPage.WriteErrMsg("操作失败!", "Advertisement.aspx?AdId=" + advertisementInfo.ADId + "&Action=Modify");
                    return;
                }
                BasePage.ResponseRedirect("AdManage.aspx");
            }
        }