Example #1
0
        /// <summary>
        /// 绑定数据
        /// </summary>
        private void BindData()
        {
            @Template.DataSource = Enum.GetValues(typeof(SiteTemplate));
            @Template.DataBind();
            @TableName.Text = tableName;

            //权限资源
            actiontype.DataSource     = ActionTypeHelper.ActionList();
            actiontype.DataTextField  = "value";
            actiontype.DataValueField = "key";
            actiontype.DataBind();
            actiontype.SelectedIndex = 0;

            //绑定字段数据
            var table = SiteTable.Tables.Find(a => { return(a.TableName == tableName); });

            foreach (var item in table.Columns)
            {
                String _name = String.IsNullOrEmpty(item.Description) ? item.FieldName : item.Description;
                @Field.Items.Add(new ListItem(_name, item.FieldName));
            }

            //绑定树形分类
            foreach (var item in TreeNodes)
            {
                ListItem node = new ListItem(item.GroupName, item.ID.ToString());
                node.Attributes.Add("pid", item.ParentID.ToString());
                ParentID.Items.Add(node);
            }
            var root = new ListItem("顶级分类", "0");

            root.Selected = true;
            ParentID.Items.Insert(0, root);
        }
Example #2
0
        /// <summary>
        /// 绑定数据
        /// </summary>
        protected void BindData()
        {
            ActionTypeNames  = ActionTypeHelper.ActionList();
            ActionTypeValues = Enum.GetValues(typeof(ActionType));

            //角色已分配权限
            String strSql = "SELECT * FROM [T_AccessControl] WHERE role=" + EditID;

            ActionTypeList = db.ExecuteObject <List <T_AccessControlEntity> >(strSql);

            //功能权限
            strSql = "SELECT id,parentid,layer,title,actiontype,link_url FROM [T_SiteMenu] ORDER BY sortid";
            DataTable dt = db.ExecuteDataTable(strSql);
            DataTable ds = dt.Clone();

            dt.SortTable(ds, 0);
            Repeater1.DataSource = ds;
            Repeater1.DataBind();

            //新闻权限
            strSql = "SELECT id,parentid,layer,groupname,actiontype FROM [T_Group] WHERE tablename='t_news' ORDER BY id";
            dt     = db.ExecuteDataTable(strSql);
            ds     = dt.Clone();
            dt.SortTable(ds, 0);
            Repeater2.DataSource = ds;
            Repeater2.DataBind();
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                String strSql = String.Format("SELECT id,title FROM [T_SiteMenu] WHERE ParentID=0 AND id<>{0} ORDER BY id", EditID);
                parentid.DataSource     = db.ExecuteDataTable(strSql);
                parentid.DataTextField  = "title";
                parentid.DataValueField = "id";
                parentid.DataBind();
                parentid.Items.Insert(0, new ListItem("顶级分类", "0"));

                actiontype.DataSource     = ActionTypeHelper.ActionList();
                actiontype.DataTextField  = "value";
                actiontype.DataValueField = "key";
                actiontype.DataBind();

                if (IsEdit)
                {
                    LoadData();
                }
            }
        }