Пример #1
0
        /// <summary>
        /// Assign system role.
        /// </summary>
        /// <param name="systemRole">
        /// The system role.
        /// </param>
        /// <param name="systemRoleType">
        /// The system role type.
        /// </param>
        private void AssignSystemRole( SystemRole systemRole, SystemRoleType systemRoleType )
        {
            CheckRoleAssignment ( systemRole, systemRoleType );

            var staffSystemRole = new StaffSystemRole ( systemRole ) { Staff = this };
            _systemRoles.Add ( staffSystemRole );

            NotifyItemAdded ( () => SystemRoles, staffSystemRole );
        }
Пример #2
0
        /// <summary>
        /// Revise job function role.
        /// </summary>
        /// <param name="jobFunctionRole">
        /// The job function role.
        /// </param>
        public virtual void ReviseJobFunctionRole( SystemRole jobFunctionRole )
        {
            CheckRoleAssignment ( jobFunctionRole, SystemRoleType.JobFunction );

            var existingJobFunctionRoles =
                ( from sr in _systemRoles where sr.SystemRole.SystemRoleType == SystemRoleType.JobFunction select sr ).ToList ();

            foreach ( var existingJobFunctionRole in existingJobFunctionRoles )
            {
                _systemRoles.Remove ( existingJobFunctionRole );
            }

            var staffSystemRole = new StaffSystemRole ( jobFunctionRole ) { Staff = this };
            _systemRoles.Add ( staffSystemRole );

            NotifyItemAdded ( () => SystemRoles, staffSystemRole );
        }