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

📄 adadd.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
📖 第 1 页 / 共 2 页
字号:
            builder.Append(" }\n");
            builder.Append("function ADTypeChecked(i)\n");
            builder.Append("{\n ");
            builder.Append("document.getElementById('" + this.RadlADType.ClientID + "_'+(i-1)+'').checked=true;");
            builder.Append("Change_ADType();\n");
            builder.Append("}\n");
            builder.Append("function CheckForm()\n");
            builder.Append("{\n");
            builder.Append("if(document.getElementById('" + this.TxtADName.ClientID + "').value==''){");
            builder.Append(" alert('广告名称不能为空!');");
            builder.Append("document.getElementById('" + this.TxtADName.ClientID + "').focus();");
            builder.Append("return false;");
            builder.Append("}\n");
            builder.Append("if(!CheckUploadFile()){return false;}");
            builder.Append("if(document.getElementById('" + this.RadlADType.ClientID + "_2').checked && document.getElementById('" + this.TxtADText.ClientID + "').value==''){");
            builder.Append("alert('广告文本不能为空!');");
            builder.Append("document.getElementById('" + this.TxtADText.ClientID + "').focus();");
            builder.Append(" return false;");
            builder.Append(" }\n");
            builder.Append("if(document.getElementById('" + this.RadlADType.ClientID + "_3').checked && document.getElementById('" + this.TxtADCode.ClientID + "').value==''){");
            builder.Append("alert('广告代码不能为空!');");
            builder.Append("document.getElementById('" + this.TxtADCode.ClientID + "').focus();");
            builder.Append("return false;");
            builder.Append("}\n");
            builder.Append("if(document.getElementById('" + this.TxtPriority.ClientID + "').value==''){");
            builder.Append(" alert('广告权重不能为空!');");
            builder.Append(" document.getElementById('" + this.TxtPriority.ClientID + "').focus();");
            builder.Append("return false;");
            builder.Append("}\n");
            builder.Append("}\n");
            builder.Append("</script>\n");
            if (!base.ClientScript.IsClientScriptBlockRegistered("ClientScript"))
            {
                base.ClientScript.RegisterClientScriptBlock(base.GetType(), "ClientScript", builder.ToString());
            }
            this.EBtnSubmit.Attributes.Add("OnClick", "javascript:return CheckForm();");
        }

        private void InitLstZoneName()
        {
            this.LstZoneName.DataSource = ADZone.GetADZoneList(0, 0);
            this.LstZoneName.DataTextField = "ZoneName";
            this.LstZoneName.DataValueField = "ZoneId";
            this.LstZoneName.DataBind();
        }

        private void InitRadlAdType(int seleced)
        {
            ArrayList aDType = Advertisement.GetADType();
            for (int i = 1; i <= aDType.Count; i++)
            {
                ListItem item = new ListItem();
                item.Value = i.ToString();
                item.Text = aDType[i - 1].ToString();
                item.Attributes.Add("OnClick", "ADTypeChecked(" + i + ")");
                if (seleced == i)
                {
                    item.Selected = true;
                    if (seleced == 1)
                    {
                        this.ADContent_1.Attributes.Add("style", "display: ");
                    }
                }
                this.RadlADType.Items.Add(item);
            }
        }

        private void InitShowPanel(AdvertisementInfo advertisementInfo)
        {
            switch (advertisementInfo.ADType)
            {
                case 1:
                    this.ADContent_1.Attributes.Add("style", "display: ");
                    this.FileUploadControl1.FilePath = advertisementInfo.ImgUrl;
                    this.TxtImgWidth.Text = advertisementInfo.ImgWidth.ToString();
                    this.TxtImgHeight.Text = advertisementInfo.ImgHeight.ToString();
                    this.TxtLinkUrl.Text = advertisementInfo.LinkUrl;
                    this.TxtLinkAlt.Text = advertisementInfo.LinkAlt;
                    BasePage.SetSelectedIndexByValue(this.RadlLinkTarget, advertisementInfo.LinkTarget.ToString());
                    this.TxtADIntro.Text = advertisementInfo.ADIntro;
                    return;

                case 2:
                    this.ADContent_2.Attributes.Add("style", "display: ");
                    this.ExtenFileUpload.FilePath = advertisementInfo.ImgUrl;
                    this.TxtFlashWidth.Text = advertisementInfo.ImgWidth.ToString();
                    this.TxtFlashHeight.Text = advertisementInfo.ImgHeight.ToString();
                    BasePage.SetSelectedIndexByValue(this.RadlFlashMode, advertisementInfo.FlashWmode.ToString());
                    return;

                case 3:
                    this.ADContent_3.Attributes.Add("style", "display: ");
                    this.TxtADText.Text = advertisementInfo.ADIntro;
                    return;

                case 4:
                    this.ADContent_4.Attributes.Add("style", "display: ");
                    this.TxtADCode.Text = advertisementInfo.ADIntro;
                    return;

                case 5:
                    this.ADContent_5.Attributes.Add("style", "display: ");
                    this.TxtWebFileUrl.Text = advertisementInfo.ADIntro;
                    return;
            }
            this.ADContent_1.Attributes.Add("style", "display: ");
        }

        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)
            {
                if (BasePage.RequestString("Action") == "Modify")
                {
                    int id = BasePage.RequestInt32("AdId");
                    AdvertisementInfo advertisementInfo = new AdvertisementInfo();
                    advertisementInfo = Advertisement.GetAdvertisementById(id);
                    this.TxtADName.Text = advertisementInfo.ADName;
                    this.TxtPriority.Text = advertisementInfo.Priority.ToString();
                    this.DpkOverdueDate.Text = advertisementInfo.OverdueDate.ToString("yyyy-MM-dd");
                    this.InitRadlAdType(advertisementInfo.ADType);
                    this.InitShowPanel(advertisementInfo);
                    this.HdnAction.Value = "Modify";
                    this.HdnAdId.Value = advertisementInfo.ADId.ToString();
                    this.InitLstZoneName();
                    this.SetLstZoneNameSelected(advertisementInfo.ZoneId);
                    this.ChkCountClick.Checked = advertisementInfo.CountClick;
                    this.ChkCountView.Checked = advertisementInfo.CountView;
                    this.TxtClicks.Text = advertisementInfo.Clicks.ToString();
                    this.TxtViews.Text = advertisementInfo.Views.ToString();
                    this.InitJSScript();
                    if (advertisementInfo.ADType > 1)
                    {
                        this.ChkCountClick.Enabled = false;
                        this.TxtClicks.Enabled = false;
                    }
                    this.ChkPassed.Checked = advertisementInfo.Passed;
                }
                else
                {
                    this.InitLstZoneName();
                    this.DpkOverdueDate.Text = DateTime.Now.AddMonths(1).ToString("yyyy-MM-dd");
                    if (!string.IsNullOrEmpty(BasePage.RequestString("ZoneId")))
                    {
                        string ids = BasePage.RequestString("ZoneId") + ",";
                        this.SetLstZoneNameSelected(ids);
                    }
                    this.InitJSScript();
                    this.InitRadlAdType(1);
                }
            }
        }

        private void SetLstZoneNameSelected(string Ids)
        {
            string[] strArray = Ids.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < strArray.Length; i++)
            {
                for (int j = 0; j < this.LstZoneName.Items.Count; j++)
                {
                    if (strArray[i] == this.LstZoneName.Items[j].Value)
                    {
                        this.LstZoneName.Items[j].Selected = true;
                    }
                }
            }
        }
    }
}

⌨️ 快捷键说明

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