⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 adzones.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
📖 第 1 页 / 共 2 页
字号:
            item.Text = "自定义设置";
            item.Value = "1";
            this.RadlDefaultSetting.Items.Add(item);
            this.RadlDefaultSetting.Items[0].Attributes.Add("OnClick", "ShowZoenTypePanel()");
            this.RadlDefaultSetting.Items[1].Attributes.Add("OnClick", "ShowZoenTypePanel()");
            BasePage.SetSelectedIndexByValue(this.RadlDefaultSetting, selected.ToString());
        }

        private void InitRblADZoneType(int selected)
        {
            for (int i = 1; i <= 7; i++)
            {
                ListItem item = new ListItem();
                item.Value = i.ToString();
                item.Text = BasePage.EnumToHtml<ADZoneType>((ADZoneType) i);
                if (selected == i)
                {
                    item.Selected = true;
                }
                item.Attributes.Add("OnClick", "ShowZoenTypePanel()");
                this.RadlZoneType.Items.Add(item);
            }
        }

        private void InitSetting(string setting, ADZoneType showType)
        {
            string[] strArray = this.SplitZetting(setting + ",,,,,");
            switch (showType)
            {
                case ADZoneType.Banner:
                case ADZoneType.Code:
                    break;

                case ADZoneType.Pop:
                    this.DropPopType.SelectedIndex = this.DropPopType.Items.IndexOf(this.DropPopType.Items.FindByValue(strArray[0]));
                    this.TxtPopLeft.Text = strArray[1];
                    this.TxtPopTop.Text = strArray[2];
                    this.TxtPopCookieHour.Text = strArray[3];
                    this.DropPopPosition.SelectedIndex = this.DropPopPosition.Items.IndexOf(this.DropPopPosition.Items.FindByValue(strArray[4]));
                    return;

                case ADZoneType.Move:
                    this.TxtMoveLeft.Text = strArray[0];
                    this.TxtMoveTop.Text = strArray[1];
                    this.TxtMoveDelay.Text = strArray[2];
                    BasePage.SetSelectedIndexByValue(this.RadlMoveShowCloseAD, strArray[3]);
                    this.TxtMoveCloseFontColor.Text = strArray[4];
                    this.DropMovePosition.SelectedIndex = this.DropMovePosition.Items.IndexOf(this.DropMovePosition.Items.FindByValue(strArray[5]));
                    return;

                case ADZoneType.Fixed:
                    this.TxtFixedLeft.Text = strArray[0];
                    this.TxtFixedTop.Text = strArray[1];
                    BasePage.SetSelectedIndexByValue(this.RadlFixedShowCloseAD, strArray[2]);
                    this.TxtFixedCloseFontColor.Text = strArray[3];
                    this.DropFixedPosition.SelectedIndex = this.DropFixedPosition.Items.IndexOf(this.DropFixedPosition.Items.FindByValue(strArray[4]));
                    return;

                case ADZoneType.Float:
                    this.DropFloatType.SelectedIndex = this.DropFloatType.Items.IndexOf(this.DropFloatType.Items.FindByValue(strArray[0]));
                    this.TxtFloatLeft.Text = strArray[1];
                    this.TxtFloatTop.Text = strArray[2];
                    BasePage.SetSelectedIndexByValue(this.RadlFloatShowCloseAD, strArray[3]);
                    this.TxtFloatCloseFontColor.Text = strArray[4];
                    this.DropFloatPosition.SelectedIndex = this.DropFloatPosition.Items.IndexOf(this.DropFloatPosition.Items.FindByValue(strArray[5]));
                    return;

                case ADZoneType.Couplet:
                    this.TxtCoupletLeft.Text = strArray[0];
                    this.TxtCoupletTop.Text = strArray[1];
                    this.TxtCoupletDelay.Text = strArray[2];
                    BasePage.SetSelectedIndexByValue(this.RadlCoupletShowCloseAD, strArray[3]);
                    this.TxtCoupletCloseFontColor.Text = strArray[4];
                    break;

                default:
                    return;
            }
        }

        private void InitShowPanel(ADZoneType selected)
        {
            switch (selected)
            {
                case ADZoneType.Banner:
                    this.ZoneTypeSetting1.Attributes.Add("style", "display: ");
                    return;

                case ADZoneType.Pop:
                    this.ZoneTypeSetting2.Attributes.Add("style", "display: ");
                    return;

                case ADZoneType.Move:
                    this.ZoneTypeSetting3.Attributes.Add("style", "display: ");
                    return;

                case ADZoneType.Fixed:
                    this.ZoneTypeSetting4.Attributes.Add("style", "display: ");
                    return;

                case ADZoneType.Float:
                    this.ZoneTypeSetting5.Attributes.Add("style", "display: ");
                    return;

                case ADZoneType.Code:
                    this.ZoneTypeSetting6.Attributes.Add("style", "display: ");
                    return;

                case ADZoneType.Couplet:
                    this.ZoneTypeSetting7.Attributes.Add("style", "display: ");
                    return;
            }
        }

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            RolePermissions.BusinessAccessCheck(OperateCode.AdManage);
        }

        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)
                    {
                        this.RadlShowType.Items[2].Enabled = false;
                        if (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";
                }
            }
        }

        private string[] SplitZetting(string setting)
        {
            Regex regex = new Regex(",");
            return regex.Split(setting);
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -