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> /// Changes the context. /// </summary> /// <param name="locationContext">The location context.</param> public void ChangeContext( LocationContext locationContext ) { throw new NotImplementedException (); }
/// <summary> /// Changes the context. /// </summary> /// <param name="locationContext">The location context.</param> public void ChangeContext( LocationContext locationContext ) { if ( locationContext.Key != CurrentUserContext.Location.Key ) { ChangeContext ( new CurrentUserContext ( CurrentUserContext.Agency, locationContext, CurrentUserContext.Staff, CurrentUserContext.Account ) ); } }