コード例 #1
0
ファイル: EditRole.aspx.cs プロジェクト: sjyanxin/JiaJiao
        //移除权限
        protected void RemovePermissionButton_Click(object sender, System.EventArgs e)
        {
            //if(this.PermissionList.SelectedIndex>-1)
            //{
            //    int currentRole = Convert.ToInt32(Request["RoleID"]);
            //    Role bizRole = new Role(currentRole);
            //    bizRole.RemovePermission( Convert.ToInt32(this.PermissionList.SelectedValue) );
            //    CategoryDownList_SelectedIndexChanged(sender,e);
            //}

            int[] items = PermissionList.GetSelectedIndices();
            if (items.Length > 0)
            {
                int currentRole = Convert.ToInt32(Request["RoleID"]);
                Role bizRole = new Role(currentRole);
                foreach (int i in items)
                {
                    int permid = Convert.ToInt32(this.PermissionList.Items[i].Value);
                    bizRole.RemovePermission(permid);
                }
            }
            CategoryDownList_SelectedIndexChanged(sender, e);
        }