public EmployeeJournalFactory(
            EmployeeFilterViewModel employeeJournalFilter = null)
        {
            var cs = new ConfigurationSection(new ConfigurationRoot(new List <IConfigurationProvider> {
                new MemoryConfigurationProvider(new MemoryConfigurationSource())
            }), "");

            cs["BaseUri"] = "https://driverapi.vod.qsolution.ru:7090/api/";

            var apiHelper = new ApiClientProvider.ApiClientProvider(cs);

            var driverApiRegisterEndpoint = new DriverApiUserRegisterEndpoint(apiHelper);

            _driverApiUserRegisterEndpoint = driverApiRegisterEndpoint;
            _employeeJournalFilter         = employeeJournalFilter;

            _authorizationServiceFactory   = new AuthorizationServiceFactory();
            _employeeWageParametersFactory = new EmployeeWageParametersFactory();
            _employeeJournalFactory        = this;
            _subdivisionJournalFactory     = new SubdivisionJournalFactory();
            _employeePostsJournalFactory   = new EmployeePostsJournalFactory();
            _validationContextFactory      = new ValidationContextFactory();
            _phonesViewModelFactory        = new PhonesViewModelFactory(new PhoneRepository());
            _attachmentsViewModelFactory   = new AttachmentsViewModelFactory();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ValidationDPActor"/> class.
 /// </summary>
 /// <param name="actorService">The Microsoft.ServiceFabric.Actors.Runtime.ActorService that will host this actor instance.</param>
 /// <param name="actorId">The Microsoft.ServiceFabric.Actors.ActorId for this actor instance.</param>
 /// <param name="parentLifeTimeScope">Autofac Parent Lifetime Scope</param>
 /// <param name="executionContext">The logger execution context.</param>
 /// <param name="jsonSerializationService">JSON serialiser.</param>
 public ValidationDPActor(ActorService actorService, ActorId actorId, ILifetimeScope parentLifeTimeScope, IExecutionContext executionContext, IJsonSerializationService jsonSerializationService, IValidationContextFactory <ValidationDPActorModel> validationContextFactory)
     : base(actorService, actorId)
 {
     _parentLifeTimeScope      = parentLifeTimeScope;
     _executionContext         = executionContext;
     _jsonSerializationService = jsonSerializationService;
     _validationContextFactory = validationContextFactory;
     _actorId = actorId;
 }
 public override void SetUp()
 {
     this.context                = this.Stub <IValidationContext>();
     this.clientValidator        = this.Stub <IClientValidator>();
     this.contextFactory         = this.Stub <IValidationContextFactory>();
     this.target                 = new ValidationFacade();
     this.target.ClientValidator = this.clientValidator;
     this.target.ContextFactory  = this.contextFactory;
 }
 public ProjectManagerViewModelFactory(IBurningViewModelFactory BurningViewModelFactory, IFirmwareProjectFactory FirmwareProjectFactory,
                                       IProjectViewModelProvider ProjectViewModelProvider, IValidationContextFactory ValidationContextFactory,
                                       IEventAggregator EventAggregator)
 {
     _burningViewModelFactory = BurningViewModelFactory;
     _firmwareProjectFactory = FirmwareProjectFactory;
     _projectViewModelProvider = ProjectViewModelProvider;
     _validationContextFactory = ValidationContextFactory;
     _eventAggregator = EventAggregator;
 }
        public EmployeesJournalViewModel(
            EmployeeFilterViewModel filterViewModel,
            IAuthorizationServiceFactory authorizationServiceFactory,
            IEmployeeWageParametersFactory employeeWageParametersFactory,
            IEmployeeJournalFactory employeeJournalFactory,
            ISubdivisionJournalFactory subdivisionJournalFactory,
            IEmployeePostsJournalFactory employeePostsJournalFactory,
            ICashDistributionCommonOrganisationProvider cashDistributionCommonOrganisationProvider,
            ISubdivisionService subdivisionService,
            IEmailServiceSettingAdapter emailServiceSettingAdapter,
            IWageCalculationRepository wageCalculationRepository,
            IEmployeeRepository employeeRepository,
            IWarehouseRepository warehouseRepository,
            IRouteListRepository routeListRepository,
            UserSettings userSettings,
            IValidationContextFactory validationContextFactory,
            IPhonesViewModelFactory phonesViewModelFactory,
            DriverApiUserRegisterEndpoint driverApiUserRegisterEndpoint,
            ICommonServices commonServices,
            IUnitOfWorkFactory unitOfWorkFactory) : base(filterViewModel, unitOfWorkFactory, commonServices)
        {
            TabName = "Журнал сотрудников";

            _authorizationServiceFactory =
                authorizationServiceFactory ?? throw new ArgumentNullException(nameof(authorizationServiceFactory));
            _authorizationService          = _authorizationServiceFactory.CreateNewAuthorizationService();
            _employeeWageParametersFactory =
                employeeWageParametersFactory ?? throw new ArgumentNullException(nameof(employeeWageParametersFactory));
            _employeeJournalFactory      = employeeJournalFactory ?? throw new ArgumentNullException(nameof(employeeJournalFactory));
            _subdivisionJournalFactory   = subdivisionJournalFactory ?? throw new ArgumentNullException(nameof(subdivisionJournalFactory));
            _employeePostsJournalFactory =
                employeePostsJournalFactory ?? throw new ArgumentNullException(nameof(employeePostsJournalFactory));
            _cashDistributionCommonOrganisationProvider =
                cashDistributionCommonOrganisationProvider ??
                throw new ArgumentNullException(nameof(cashDistributionCommonOrganisationProvider));
            _subdivisionService            = subdivisionService ?? throw new ArgumentNullException(nameof(subdivisionService));
            _emailServiceSettingAdapter    = emailServiceSettingAdapter ?? throw new ArgumentNullException(nameof(emailServiceSettingAdapter));
            _wageCalculationRepository     = wageCalculationRepository ?? throw new ArgumentNullException(nameof(wageCalculationRepository));
            _employeeRepository            = employeeRepository ?? throw new ArgumentNullException(nameof(employeeRepository));
            _validationContextFactory      = validationContextFactory ?? throw new ArgumentNullException(nameof(validationContextFactory));
            _phonesViewModelFactory        = phonesViewModelFactory ?? throw new ArgumentNullException(nameof(phonesViewModelFactory));
            _driverApiUserRegisterEndpoint = driverApiUserRegisterEndpoint ?? throw new ArgumentNullException(nameof(driverApiUserRegisterEndpoint));
            _warehouseRepository           = warehouseRepository ?? throw new ArgumentNullException(nameof(warehouseRepository));
            _routeListRepository           = routeListRepository ?? throw new ArgumentNullException(nameof(routeListRepository));
            _userSettings = userSettings ?? throw new ArgumentNullException(nameof(userSettings));

            UpdateOnChanges(typeof(Employee));
        }
        private void CreateNewDependencies()
        {
            _authorizationServiceFactory   = new AuthorizationServiceFactory();
            _employeeWageParametersFactory = new EmployeeWageParametersFactory();
            _employeeJournalFactory        = this;
            _subdivisionJournalFactory     = new SubdivisionJournalFactory();
            _employeePostsJournalFactory   = new EmployeePostsJournalFactory();

            _cashDistributionCommonOrganisationProvider =
                new CashDistributionCommonOrganisationProvider(new OrganizationParametersProvider(new ParametersProvider()));

            _subdivisionService         = SubdivisionParametersProvider.Instance;
            _emailServiceSettingAdapter = new EmailServiceSettingAdapter();
            _wageCalculationRepository  = new WageCalculationRepository();
            _employeeRepository         = new EmployeeRepository();
            _validationContextFactory   = new ValidationContextFactory();
            _phonesViewModelFactory     = new PhonesViewModelFactory(new PhoneRepository());
            _warehouseRepository        = new WarehouseRepository();
            _routeListRepository        = new RouteListRepository(new StockRepository(), new BaseParametersProvider(new ParametersProvider()));
        }
 private ValidationServiceDesktopTask NewTask(ILifetimeScope lifeTimeScope, IValidationContextFactory <IDesktopContext> validationContextFactory = null)
 {
     return(new ValidationServiceDesktopTask(lifeTimeScope, validationContextFactory));
 }
Beispiel #8
0
        public EmployeeViewModel(
            IAuthorizationService authorizationService,
            IEmployeeWageParametersFactory employeeWageParametersFactory,
            IEmployeeJournalFactory employeeJournalFactory,
            ISubdivisionJournalFactory subdivisionJournalFactory,
            IEmployeePostsJournalFactory employeePostsJournalFactory,
            ICashDistributionCommonOrganisationProvider commonOrganisationProvider,
            ISubdivisionService subdivisionService,
            IEmailServiceSettingAdapter emailServiceSettingAdapter,
            IWageCalculationRepository wageCalculationRepository,
            IEmployeeRepository employeeRepository,
            IUnitOfWorkGeneric <Employee> uowGeneric,
            ICommonServices commonServices,
            IValidationContextFactory validationContextFactory,
            IPhonesViewModelFactory phonesViewModelFactory,
            IWarehouseRepository warehouseRepository,
            IRouteListRepository routeListRepository,
            DriverApiUserRegisterEndpoint driverApiUserRegisterEndpoint,
            UserSettings userSettings,
            IUserRepository userRepository,
            BaseParametersProvider baseParametersProvider,
            bool traineeToEmployee = false,
            INavigationManager navigationManager = null
            ) : base(commonServices?.InteractiveService, navigationManager)
        {
            _authorizationService         = authorizationService ?? throw new ArgumentNullException(nameof(authorizationService));
            EmployeeWageParametersFactory =
                employeeWageParametersFactory ?? throw new ArgumentNullException(nameof(employeeWageParametersFactory));
            EmployeeJournalFactory      = employeeJournalFactory ?? throw new ArgumentNullException(nameof(employeeJournalFactory));
            EmployeePostsJournalFactory = employeePostsJournalFactory ?? throw new ArgumentNullException(nameof(employeePostsJournalFactory));
            SubdivisionJournalFactory   = subdivisionJournalFactory ?? throw new ArgumentNullException(nameof(subdivisionJournalFactory));

            if (commonOrganisationProvider == null)
            {
                throw new ArgumentNullException(nameof(commonOrganisationProvider));
            }

            _subdivisionService            = subdivisionService ?? throw new ArgumentNullException(nameof(subdivisionService));
            _emailServiceSettingAdapter    = emailServiceSettingAdapter ?? throw new ArgumentNullException(nameof(emailServiceSettingAdapter));
            _wageCalculationRepository     = wageCalculationRepository ?? throw new ArgumentNullException(nameof(wageCalculationRepository));
            _employeeRepository            = employeeRepository ?? throw new ArgumentNullException(nameof(employeeRepository));
            _warehouseRepository           = warehouseRepository ?? throw new ArgumentNullException(nameof(warehouseRepository));
            _routeListRepository           = routeListRepository ?? throw new ArgumentNullException(nameof(routeListRepository));
            _driverApiUserRegisterEndpoint = driverApiUserRegisterEndpoint ?? throw new ArgumentNullException(nameof(driverApiUserRegisterEndpoint));
            _userSettings           = userSettings ?? throw new ArgumentNullException(nameof(userSettings));
            UoWGeneric              = uowGeneric ?? throw new ArgumentNullException(nameof(uowGeneric));
            _commonServices         = commonServices ?? throw new ArgumentNullException(nameof(commonServices));
            _userRepository         = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
            _baseParametersProvider = baseParametersProvider ?? throw new ArgumentNullException(nameof(baseParametersProvider));

            if (validationContextFactory == null)
            {
                throw new ArgumentNullException(nameof(validationContextFactory));
            }

            ConfigureValidationContext(validationContextFactory);

            if (phonesViewModelFactory == null)
            {
                throw new ArgumentNullException(nameof(phonesViewModelFactory));
            }

            PhonesViewModel = phonesViewModelFactory.CreateNewPhonesViewModel(UoW);

            if (Entity.Id == 0)
            {
                Entity.OrganisationForSalary = commonOrganisationProvider.GetCommonOrganisation(UoW);
                TabName = "Новый сотрудник";
            }
            else
            {
                TabName = Entity.GetPersonNameWithInitials();
            }

            if (Entity.Phones == null)
            {
                Entity.Phones = new List <Phone>();
            }

            SetPermissions();

            Entity.PropertyChanged += OnEntityPropertyChanged;

            organizations = UoW.GetAll <Organization>().ToList();
            FillHiddenCategories(traineeToEmployee);

            CanRegisterMobileUser = string.IsNullOrWhiteSpace(Entity.AndroidLogin) && string.IsNullOrWhiteSpace(Entity.AndroidPassword);

            var permissionResult =
                _commonServices.PermissionService.ValidateUserPermission(typeof(Employee), _commonServices.UserService.CurrentUserId);

            if (!permissionResult.CanRead)
            {
                AbortOpening(PermissionsSettings.GetEntityReadValidateResult(typeof(Employee)));
            }
        }
 public ValidationServiceDesktopTask(ILifetimeScope parentLifetimeScope, IValidationContextFactory <IDesktopContext> validationContextFactory)
 {
     _parentLifetimeScope      = parentLifetimeScope;
     _validationContextFactory = validationContextFactory;
 }
Beispiel #10
0
 public MessageHandler(ILifetimeScope parentLifeTimeScope, IValidationContextFactory <IJobContextMessage> validationContextFactory, StatelessServiceContext context)
 {
     _parentLifeTimeScope      = parentLifeTimeScope;
     _validationContextFactory = validationContextFactory;
     _context = context;
 }