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

📄 specialbatchset.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
字号:
namespace PowerEasy.WebSite.Admin.Contents
{
    using PowerEasy.AccessManage;
    using PowerEasy.Common;
    using PowerEasy.Contents;
    using PowerEasy.Controls;
    using PowerEasy.Enumerations;
    using PowerEasy.Model.Contents;
    using PowerEasy.ModelControls;
    using PowerEasy.Templates;
    using PowerEasy.Web.UI;
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Web.UI.WebControls;

    public class SpecialBatchSet : AdminPage
    {
        protected Button BtnCancel;
        protected CheckBox ChkIsElite;
        protected CheckBox ChkOpenType;
        protected CheckBox ChKSpecialTemplatePath;
        protected Button EBtnBacthSet;
        protected TemplateSelectControl FileCSpecialTemplatePath;
        protected ListBox LstSpecial;
        protected RadioButtonList RadlIsElite;
        protected RadioButtonList RadlOpenType;
        protected ExtendedSiteMapPath SmpNavigator;

        protected void BtnCancel_Click(object sender, EventArgs e)
        {
            BasePage.ResponseRedirect("SpecialManage.aspx");
        }

        protected void EBtnBacthSet_Click(object sender, EventArgs e)
        {
            if (this.Page.IsValid)
            {
                StringBuilder sb = new StringBuilder();
                foreach (ListItem item in this.LstSpecial.Items)
                {
                    if (item.Selected)
                    {
                        StringHelper.AppendString(sb, item.Value);
                    }
                }
                if (sb.Length <= 0)
                {
                    AdminPage.WriteErrMsg("请先指定要批量设置的专题!", "SpecialBatchSet.aspx");
                }
                if (Special.SpecialBatchSet(this.GetSpecialInfo(), sb.ToString(), this.GetCheckItem()))
                {
                    IncludeFile.CreateIncludeFileByAssociateType(AssociateType.Special);
                    AdminPage.WriteSuccessMsg("专题批量设置成功!", "SpecialManage.aspx");
                }
                else
                {
                    AdminPage.WriteErrMsg("专题批量设置失败!", "SpecialBatchSet.aspx");
                }
            }
        }

        private Dictionary<string, bool> GetCheckItem()
        {
            Dictionary<string, bool> dictionary = new Dictionary<string, bool>();
            dictionary.Add("OpenType", this.ChkOpenType.Checked);
            dictionary.Add("IsElite", this.ChkIsElite.Checked);
            dictionary.Add("SpecialTemplatePath", this.ChKSpecialTemplatePath.Checked);
            return dictionary;
        }

        private SpecialInfo GetSpecialInfo()
        {
            SpecialInfo info = new SpecialInfo();
            info.OpenType = DataConverter.CLng(this.RadlOpenType.SelectedValue);
            info.IsElite = DataConverter.CBool(this.RadlIsElite.SelectedValue);
            info.SpecialTemplatePath = this.FileCSpecialTemplatePath.Text;
            return info;
        }

        private void Initial()
        {
            if (!this.Page.IsPostBack)
            {
                IList<SpecialInfo> specialList = Special.GetSpecialList();
                this.LstSpecial.DataSource = specialList;
                this.LstSpecial.DataTextField = "SpecialName";
                this.LstSpecial.DataValueField = "SpecialId";
                this.LstSpecial.DataBind();
            }
            StringBuilder builder = new StringBuilder();
            builder.Append("<script type=\"text/javascript\">");
            builder.Append("function SelectAll(){");
            builder.Append("for(var i=0;i<document.getElementById('");
            builder.Append(this.LstSpecial.ClientID);
            builder.Append("').length;i++){");
            builder.Append("document.getElementById('");
            builder.Append(this.LstSpecial.ClientID);
            builder.Append("').options[i].selected=true;}}");
            builder.Append("function UnSelectAll(){");
            builder.Append("for(var i=0;i<document.getElementById('");
            builder.Append(this.LstSpecial.ClientID);
            builder.Append("').length;i++){");
            builder.Append("document.getElementById('");
            builder.Append(this.LstSpecial.ClientID);
            builder.Append("').options[i].selected=false;}}");
            builder.Append("</script>");
            base.ClientScript.RegisterClientScriptBlock(base.GetType(), "Select", builder.ToString());
        }

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

        protected void Page_Load(object sender, EventArgs e)
        {
            this.Initial();
        }
    }
}

⌨️ 快捷键说明

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