Ejemplo n.º 1
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            //Fill commands
            lstCommands.Items.Clear();

            if (!CurrentUser.IsSuperAdmin)
            {
                CommandController.FillToListBox(lstCommands.Items, CommandController.GetCommandsForUserByPortalID(CurrentUser.UserID, ConvertUtility.ToInt32(dropPortal.SelectedValue)), 0, CurrentUser.IsSuperAdmin);
            }
            else
            {
                CommandController.FillToListBox(lstCommands.Items, CommandController.GetCommands(), 0, CurrentUser.IsSuperAdmin);
            }

            DataTable dtUserCommands = CommandController.GetCommandsForUserNotGroup(userId, ConvertUtility.ToInt32(dropPortal.SelectedValue));

            foreach (DataRow row in dtUserCommands.Rows)
            {
                if (lstCommands.Items.FindByValue(row["CommandID"].ToString()) != null)
                {
                    lstCommands.Items.FindByValue(row["CommandID"].ToString()).Selected = true;
                }
            }

            DataTable dtReturnCommand = new DataTable();

            dtReturnCommand.Columns.Add("CommandID", typeof(String));
            dtReturnCommand.Columns.Add("PortalID", typeof(String));
            dtReturnCommand.Columns.Add("UserID", typeof(String));
            dtReturnCommand.Columns.Add("CommandParentID", typeof(String));
            dtReturnCommand.Columns.Add("CommandName", typeof(String));
            dtReturnCommand.Columns.Add("Level", typeof(String));
            dtReturnCommand.Columns.Add("Role_View", typeof(String));
            dtReturnCommand.Columns.Add("Role_Add", typeof(String));
            dtReturnCommand.Columns.Add("Role_Update", typeof(String));
            dtReturnCommand.Columns.Add("Role_Delete", typeof(String));
            dtReturnCommand.Columns.Add("UseForWeb", typeof(String));
            dtReturnCommand.Columns.Add("UseForWap", typeof(String));
            dtReturnCommand.Columns.Add("UseForSMS", typeof(String));
            dtReturnCommand.Columns.Add("UseForXzone", typeof(String));

            dtCommand = dtUserCommands;
            DataTable _dtReturnCommand = UserController.BuildRecursiveUserPermission(dtUserCommands, dtReturnCommand, userId, ConvertUtility.ToInt32(dropPortal.SelectedValue));

            dgrUserRole.DataSource = _dtReturnCommand;
            dgrUserRole.DataBind();
        }
Ejemplo n.º 2
0
        public void BindData()
        {
            int       roleId          = ConvertUtility.ToInt32(dropRole.SelectedValue);
            DataTable dtRoleCommands  = CommandController.GetCommandsForRoleByPortalID(roleId, ConvertUtility.ToInt32(dropPortal.SelectedValue));
            DataTable dtReturnCommand = new DataTable();

            dtReturnCommand.Columns.Add("CommandID", typeof(String));
            dtReturnCommand.Columns.Add("PortalID", typeof(String));
            dtReturnCommand.Columns.Add("RoleID", typeof(String));
            dtReturnCommand.Columns.Add("CommandParentID", typeof(String));
            dtReturnCommand.Columns.Add("CommandName", typeof(String));
            dtReturnCommand.Columns.Add("Level", typeof(String));
            dtReturnCommand.Columns.Add("Role_View", typeof(String));
            dtReturnCommand.Columns.Add("Role_Add", typeof(String));
            dtReturnCommand.Columns.Add("Role_Update", typeof(String));
            dtReturnCommand.Columns.Add("Role_Delete", typeof(String));
            //dtReturnCommand.Columns.Add("UseForWeb", typeof(String));
            //dtReturnCommand.Columns.Add("UseForWap", typeof(String));
            //dtReturnCommand.Columns.Add("UseForSMS", typeof(String));
            //dtReturnCommand.Columns.Add("UseForXzone", typeof(String));

            dtCommand = dtRoleCommands;
            DataTable _dtReturnCommand = RoleController.BuildRecursiveRolePermission(dtRoleCommands, dtReturnCommand, roleId, ConvertUtility.ToInt32(dropPortal.SelectedValue));

            dgrRolePermission.DataSource = _dtReturnCommand;
            dgrRolePermission.DataBind();

            //Fill commands
            lstCommands.Items.Clear();
            if (!CurrentUser.IsSuperAdmin)
            {
                CommandController.FillToListBox(lstCommands.Items, CommandController.GetCommandsForUserByPortalID(CurrentUser.UserID, ConvertUtility.ToInt32(dropPortal.SelectedValue)), 0, CurrentUser.IsSuperAdmin);
            }
            else
            {
                CommandController.FillToListBox(lstCommands.Items, CommandController.GetCommands(), 0, CurrentUser.IsSuperAdmin);
            }
            CommandSelected();
        }
Ejemplo n.º 3
0
 private void LoadForParentItems(DataTable dtCommands)
 {
     dropParent.Items.Clear();
     CommandController.FillToListBox(dropParent.Items, dtCommands, 0, CurrentUser.IsSuperAdmin);
 }