Exemplo n.º 1
0
        private void ProcessSystemRoleResponses( SystemRoleDto systemRoleDto, List<DataErrorInfo> validationErrors, bool isInitializing = false )
        {
            IsLoading = false;

            if ( validationErrors.Count () == 0 )
            {
                SystemRoleDto = systemRoleDto;
                if ( isInitializing )
                {
                    InitializeTaskAndTaskGroupList ();
                }
                else
                {
                    RefreshSystemRoleLists ();
                }
            }
            else
            {
                var errors = new StringBuilder ();
                errors.AppendLine ( "The following errors occurred:" );

                foreach ( var validationError in validationErrors )
                {
                    errors.AppendLine ( validationError.Message );
                }

                _userDialogService.ShowDialog ( errors.ToString (), "Errors", UserDialogServiceOptions.Ok );

                //Wrapper.EditableDto.AddDataErrorInfo(validationError);
            }
        }
Exemplo n.º 2
0
 private void ExecuteRevokeSystemRoleCommand( SystemRoleDto obj )
 {
     var requestDispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher ();
     requestDispatcher.Add (
         new RevokeSystemRoleRequest { SystemRoleKey = SystemRoleDto.Key, SystemRoleKeysToBeRevoked = new List<long> { obj.Key } } );
     IsLoading = true;
     requestDispatcher.ProcessRequests ( HandleRevokeSystemRoleCompleted, HandleRevokeSystemRoleException );
 }
Exemplo n.º 3
0
 private void NavigateToCreateCommand( KeyValuePair<string, string>[] parameters )
 {
     SystemRoleDto = new SystemRoleDto ();
     InitializeTaskAndTaskGroupList ();
 }
        private void ExecuteCreateNewTaskGroupCommand()
        {
            // Execute the command
            var taskGroupList = _taskGroupCollectionView.SourceCollection as IList<SystemRoleDto>;
            var name = GetAvailableRoleName ( "New Task Group", taskGroupList );
            var newTaskGroup = new SystemRoleDto
                {
                    Name = name,
                    SystemRoleType = SystemRoleType.TaskGroup,
                    GrantedSystemPermissions = new ObservableCollection<SystemPermissionDto> (),
                    GrantedSystemRoles = new ObservableCollection<SystemRoleDto> ()
                };
            taskGroupList.Add ( newTaskGroup );
            SelectedItemInTaskGroupList = newTaskGroup;

            BeginEditTaskGroupFlag = false;
            BeginEditTaskGroupFlag = true;
        }
        private void RefreshForTaskGroupChanges( SystemRoleDto newlyChangedTaskGroup )
        {
            // Update GrantedSystemRoles and GrantedSystemPermissions for taskGroup
            foreach ( var task in newlyChangedTaskGroup.GrantedSystemRoles )
            {
                task.IsSelectable = true;
                task.IsSelected = false;

                task.GrantedSystemPermissions =
                    new ObservableCollection<SystemPermissionDto> ( task.GrantedSystemPermissions.OrderBy ( p => p.DisplayName ) );
            }

            newlyChangedTaskGroup.GrantedSystemRoles =
                new ObservableCollection<SystemRoleDto> ( newlyChangedTaskGroup.GrantedSystemRoles.OrderBy ( p => p.Name ) );

            // Update taskGroup collection view
            var taskGroupList = _taskGroupCollectionView.SourceCollection as IList<SystemRoleDto>;

            var taskGroupToBeRemoved = taskGroupList.Where ( p => p.Key == 0 ).FirstOrDefault ();
            if ( taskGroupToBeRemoved != null )
            {
                taskGroupList.Remove ( taskGroupToBeRemoved );
            }
            taskGroupToBeRemoved = taskGroupList.Where ( p => p.Key == newlyChangedTaskGroup.Key ).FirstOrDefault ();
            if ( taskGroupToBeRemoved != null )
            {
                taskGroupList.Remove ( taskGroupToBeRemoved );
            }

            taskGroupList.Add ( newlyChangedTaskGroup );

            _taskGroupCollectionView.SortDescriptions.Add ( new SortDescription ( "Name", ListSortDirection.Ascending ) );
            _taskGroupCollectionView.Refresh ();

            // Update the SelectedItemInTaskGroupList
            SelectedItemInTaskGroupList = newlyChangedTaskGroup;
        }
 private void ExecuteEditTaskOrTaskGroupCommand( SystemRoleDto systemRoleDto )
 {
     _popupService.ShowPopup (
         "EditTaskAndTaskGroupView",
         "Edit",
         "Task/Task Group",
         new[]
             {
                 new KeyValuePair<string, string> ( "SystemRoleKey", systemRoleDto.Key.ToString () ),
                 new KeyValuePair<string, string> ( "SystemRoleType", systemRoleDto.SystemRoleType.ToString () )
             },
         false,
         PopupClosed );
 }
        private void ExecuteDeleteTaskOrTaskGroup( SystemRoleDto systemRoleDto )
        {
            var result = _userDialogService.ShowDialog (
                "Are you sure you want to delete?", "Confirmation", UserDialogServiceOptions.OkCancel );

            if ( result == UserDialogServiceResult.Ok )
            {
                DeleteSystemRole ( systemRoleDto.Key );
            }
        }
Exemplo n.º 8
0
 private void ExecuteEditJobFunctionCommand( SystemRoleDto systemRoleDto )
 {
     _popupService.ShowPopup (
         "EditJobFunctionView",
         "Edit",
         "Job Function",
         new[] { new KeyValuePair<string, string> ( "SystemRoleKey", systemRoleDto.Key.ToString () ) },
         false,
         PopupClosed );
 }