示例#1
0
 public EmployeeWageParametersViewModel(
     Employee entity,
     ITdiTab tab,
     IUnitOfWork uow,
     IPresetPermissionValidator permissionValidator,
     IUserRepository userRepository,
     ICommonServices commonServices,
     INavigationManager navigationManager,
     IEmployeeRepository employeeRepository,
     IWageCalculationRepository wageCalculationRepository) : base(entity, commonServices)
 {
     this.tab                   = tab ?? throw new ArgumentNullException(nameof(tab));
     this.commonServices        = commonServices ?? throw new ArgumentNullException(nameof(commonServices));
     this.navigationManager     = navigationManager;
     _wageCalculationRepository = wageCalculationRepository ?? throw new ArgumentNullException(nameof(wageCalculationRepository));
     UoW = uow ?? throw new ArgumentNullException(nameof(uow));
     Entity.ObservableWageParameters.ElementAdded   += (aList, aIdx) => WageParametersUpdated();
     Entity.ObservableWageParameters.ElementRemoved += (aList, aIdx, aObject) => WageParametersUpdated();
     canChangeWageCalculation      = permissionValidator.Validate("can_edit_wage", userRepository.GetCurrentUser(UoW).Id);
     _canEditWageBySelfSubdivision = userRepository.GetCurrentUser(UoW).IsAdmin ||
                                     (employeeRepository.GetEmployeeForCurrentUser(UoW).Subdivision == Entity.Subdivision &&
                                      permissionValidator.Validate("can_edit_wage_by_self_subdivision", userRepository.GetCurrentUser(UoW).Id)
                                     );
 }
 public EmployeeWageParametersViewModel(
     Employee entity,
     ITdiTab tab,
     IUnitOfWork uow,
     IPresetPermissionValidator permissionValidator,
     IUserRepository userRepository,
     ICommonServices commonServices,
     INavigationManager navigationManager
     ) : base(entity, commonServices)
 {
     this.tab               = tab ?? throw new ArgumentNullException(nameof(tab));
     this.commonServices    = commonServices ?? throw new ArgumentNullException(nameof(commonServices));
     this.navigationManager = navigationManager;
     UoW = uow ?? throw new ArgumentNullException(nameof(uow));
     Entity.ObservableWageParameters.ElementAdded   += (aList, aIdx) => WageParametersUpdated();
     Entity.ObservableWageParameters.ElementRemoved += (aList, aIdx, aObject) => WageParametersUpdated();
     canChangeWageCalculation = permissionValidator.Validate("can_edit_wage", userRepository.GetCurrentUser(UoW).Id);
 }
示例#3
0
 public bool ValidateUserPresetPermission(string permissionName, int userId) => presetPermissionValidator.Validate(permissionName, userId);