/// <summary> /// Initializes a new instance of the <see cref="CurrentUserContext"/> class. /// </summary> /// <param name="agencyContext">The agency context.</param> /// <param name="locationContext">The location context.</param> /// <param name="staffContext">The staff context.</param> /// <param name="accountContext">The account context.</param> public CurrentUserContext( AgencyContext agencyContext, LocationContext locationContext, StaffContext staffContext, AccountContext accountContext ) { Agency = agencyContext; Location = locationContext; Staff = staffContext; Account = accountContext; }
private void InitializeUserInformation( UserInformationDto userInformationDto ) { lock ( _userPermissionsSync ) { lock ( _currentUserContextSync ) { _userPermissions.Clear (); foreach ( var grantedPermission in userInformationDto.GrantedPermissions ) { var permission = new Permission { Name = grantedPermission }; _userPermissions.Add ( permission ); } var agency = new AgencyContext ( userInformationDto.AgencyKey, userInformationDto.AgencyDisplayName ); var location = new LocationContext ( userInformationDto.LocationKey, userInformationDto.LocationDisplayName ); var staff = new StaffContext ( userInformationDto.StaffKey, userInformationDto.StaffFirstName, userInformationDto.StaffMiddleName, userInformationDto.StaffLastName, userInformationDto.DirectEmailAddress ); var account = new AccountContext ( userInformationDto.AccountKey, userInformationDto.AccountIdentifier ); var currentUserContext = new CurrentUserContext ( agency, location, staff, account ); CurrentUserContext = currentUserContext; } } }
/// <summary> /// Initializes a new instance of the <see cref="CreateBillingOfficeViewModel"/> class. /// </summary> /// <param name="accessControlManager">The access control manager.</param> /// <param name="commandFactory">The command factory.</param> /// <param name="currentUserContextService">The current user context service.</param> /// <param name="asyncRequestDispatcherFactory">The async request dispatcher factory.</param> /// <param name="navigationService">The navigation service.</param> /// <param name="userDialogService">The user dialog service.</param> /// <param name="popupService">The popup service.</param> /// <param name="eventAggregator">The event aggregator.</param> public CreateBillingOfficeViewModel( IAccessControlManager accessControlManager, ICommandFactory commandFactory, ICurrentUserContextService currentUserContextService, IAsyncRequestDispatcherFactory asyncRequestDispatcherFactory, INavigationService navigationService, IUserDialogService userDialogService, IPopupService popupService, IEventAggregator eventAggregator ) : base(accessControlManager, commandFactory) { _asyncRequestDispatcherFactory = asyncRequestDispatcherFactory; _navigationService = navigationService; _userDialogService = userDialogService; _popupService = popupService; _eventAggregator = eventAggregator; currentUserContextService.RegisterForContext ( ( u, b ) => { _currentStaff = u.Staff; } ); var commandFactoryHelper = CreateCommandFactoryHelper ( commandFactory ); CreateCommand = commandFactoryHelper.BuildDelegateCommand ( () => CreateCommand, ExecuteCreateCommand ); }