예제 #1
0
        /// <summary>
        /// 绑定权限及美化列表
        /// </summary>
        /// <param name="rtpItem"></param>
        /// <param name="tablename"></param>
        private void BindItemPower(RepeaterItem rtpItem, String tablename)
        {
            DataRowView           dv        = rtpItem.DataItem as DataRowView;
            Int32                 id        = Convert.ToInt32(dv["id"].ToString());
            Int32                 layer     = Convert.ToInt32(dv["layer"].ToString());
            ActionType            action    = (ActionType)dv["actiontype"];
            CheckBoxList          chkaction = (CheckBoxList)rtpItem.FindControl("cbaction");
            T_AccessControlEntity acl       = ActionTypeList.Find(a => { return(a.Node == id && a.TableName == tablename); });

            rtpItem.SetStyleLayer(layer);

            //绑定权限
            foreach (ActionType item in ActionTypeValues)
            {
                if (!action.HasFlag(item) || item == ActionType.None || item == ActionType.ALL)
                {
                    continue;
                }

                String   text = item.ToString();
                ListItem node = new ListItem(ActionTypeNames[text], text);
                if (acl != null && acl.ActionType.HasFlag(item))
                {
                    node.Selected = true;
                }
                chkaction.Items.Add(node);
            }
        }