public IEnumerable <RoleMedia> GetRoleMediaDetails()
        {
            Role role = GetSelectedRole();
            var  selectedPermissions = PermissionsSelector.GetSelectedPermissions();
            var  RoleMediaDetails    = new List <RoleMedia>();

            foreach (Permission permission in selectedPermissions)
            {
                var RoleMediaDetail = new RoleMedia();
                RoleMediaDetail.DateCreated = RoleMediaDetail.DateLastModified = DateTime.Now;
                RoleMediaDetail.RoleID      = role.ID;
                //RoleMediaDetail.PermissionID = permission.ID;
                RoleMediaDetail.MediaID = AdminBasePage.SelectedMedia.ID;

                RoleMediaDetails.Add(RoleMediaDetail);
            }

            return(RoleMediaDetails);
        }
        public IEnumerable <UserMedia> GetUserMediaDetails()
        {
            User User = GetSelectedUser();
            var  selectedPermissions = PermissionsSelector.GetSelectedPermissions();
            var  UserMediaDetails    = new List <UserMedia>();

            foreach (Permission permission in selectedPermissions)
            {
                var UserMediaDetail = new UserMedia();
                UserMediaDetail.DateCreated  = UserMediaDetail.DateLastModified = DateTime.Now;
                UserMediaDetail.UserID       = User.ID;
                UserMediaDetail.PermissionID = permission.ID;
                UserMediaDetail.MediaID      = AdminBasePage.SelectedMedia.ID;

                UserMediaDetails.Add(UserMediaDetail);
            }

            return(UserMediaDetails);
        }
        private void Bind()
        {
            if (UserSelector.ComboBox.SelectedValue != "")
            {
                OnUserSelectPanel.Visible = true;
                User User = UsersMapper.GetByID(long.Parse(UserSelector.ComboBox.SelectedValue));

                if (User == null)
                {
                    return;
                }

                SetUser(User);

                if (AdminBasePage.SelectedMediaDetail != null)
                {
                    PermissionsSelector.SetSelectedPermissions(UsersMediasMapper.GetUserPermissions(User, AdminBasePage.SelectedMediaDetail));
                }
            }
        }
        private void Bind()
        {
            if (RoleSelector.ComboBox.SelectedValue != "")
            {
                OnRoleSelectPanel.Visible = true;
                Role role = RolesMapper.GetByID(long.Parse(RoleSelector.ComboBox.SelectedValue));

                if (role == null)
                {
                    return;
                }

                PermissionsSelector.ShowPermissions(role.Permissions);

                if (AdminBasePage.SelectedMediaDetail != null)
                {
                    PermissionsSelector.SetSelectedPermissions(RolesMediasMapper.GetRolePermissions(role, AdminBasePage.SelectedMediaDetail));
                }
            }
        }
 public void ShowPermissions(IEnumerable <Permission> permissions)
 {
     PermissionsSelector.SetSelectedPermissions(permissions);
 }
 public void SetUser(User user)
 {
     UserSelector.SetSelectedUser(user);
     PermissionsSelector.ShowPermissions(UsersPermissions.Where(i => i.Key.ID == user.ID).Single().Value);
 }
 public IEnumerable <Permission> GetSelectedPermissions()
 {
     return(PermissionsSelector.GetSelectedPermissions());
 }