예제 #1
0
        private void InitializeConfigs()
        {
            csw = Container.Resolve<ICountryService>();
            lsw = Container.Resolve<ILocalService>();
            ssw = Container.Resolve<ISubdivisionService>();

            ConfigUser = new DefaultMapConfig();
                ConfigUserFullInfo = new DefaultMapConfig();
                ConfigUser.ConvertUsing((UserFullInfo usr) =>
                    new User
                    {
                        Id = usr.Id,
                        FirstName = usr.FirstName,
                        SecondName = usr.SecondName,
                        CountryId = usr.Country.Id,
                        LocationId = usr.Location.Id,
                        SubdivisionId = usr.Subdivision.Id
                    });

                ConfigUserFullInfo.ConvertUsing((User usr) =>
                    new UserFullInfo
                    {
                        Id = usr.Id,
                        FirstName = usr.FirstName,
                        SecondName = usr.SecondName,
                        Country = csw.GetCountryById(usr.CountryId),
                        Subdivision = usr.SubdivisionId != null ? ssw.GetSubdivisionById((int)usr.SubdivisionId) : null,
                        Location = usr.LocationId != null ? lsw.GetLocationById((int)usr.LocationId) : null

                    });
        }
예제 #2
0
 public UserSettingsViewModel(IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory unitOfWorkFactory, ICommonServices commonServices,
                              IEmployeeService employeeService, ISubdivisionService subdivisionService, EntityAutocompleteSelectorFactory <SubdivisionsJournalViewModel> subdivisionAutocompleteSelectorFactory)
     : base(uowBuilder, unitOfWorkFactory, commonServices)
 {
     this.employeeService    = employeeService ?? throw new ArgumentNullException(nameof(employeeService));;
     this.subdivisionService = subdivisionService ?? throw new ArgumentNullException(nameof(subdivisionService));
     SubdivisionAutocompleteSelectorFactory = subdivisionAutocompleteSelectorFactory;
 }
예제 #3
0
 public UserSettingsViewModel(IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory unitOfWorkFactory, ICommonServices commonServices,
                              IEmployeeService employeeService, ISubdivisionService subdivisionService,
                              ISubdivisionJournalFactory subdivisionJournalFactory,
                              IEntityAutocompleteSelectorFactory counterpartySelectorFactory)
     : base(uowBuilder, unitOfWorkFactory, commonServices)
 {
     _employeeService          = employeeService ?? throw new ArgumentNullException(nameof(employeeService));;
     _subdivisionService       = subdivisionService ?? throw new ArgumentNullException(nameof(subdivisionService));
     SubdivisionJournalFactory = subdivisionJournalFactory ?? throw new ArgumentNullException(nameof(subdivisionJournalFactory));
     CounterpartyAutocompleteSelectorFactory =
         counterpartySelectorFactory ?? throw new ArgumentNullException(nameof(counterpartySelectorFactory));
 }
        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));
        }
예제 #5
0
        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()));
        }
예제 #6
0
        private void ConfigureDlg()
        {
            if (Entity.Id == 0)
            {
                Entity.OrganisationForSalary = commonOrganisationProvider.GetCommonOrganisation(UoW);
            }

            canManageDriversAndForwarders = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_manage_drivers_and_forwarders");
            canManageOfficeWorkers        = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_manage_office_workers");
            canEditOrganisationForSalary  = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_edit_organisation_for_salary");

            ConfigureCategory();
            ConfigureSubdivision();
            OnRussianCitizenToggled(null, EventArgs.Empty);
            dataentryDrivingNumber.MaxLength = 20;
            dataentryDrivingNumber.Binding.AddBinding(Entity, e => e.DrivingLicense, w => w.Text).InitializeFromSource();
            UoWGeneric.Root.PropertyChanged += OnPropertyChanged;
            notebookMain.Page        = 0;
            notebookMain.ShowTabs    = false;
            GenderComboBox.ItemsEnum = typeof(Gender);
            GenderComboBox.Binding.AddBinding(Entity, e => e.Gender, w => w.SelectedItemOrNull).InitializeFromSource();

            subdivisionService = SubdivisionParametersProvider.Instance;

            yenumcomboStatus.ItemsEnum = typeof(EmployeeStatus);
            yenumcomboStatus.Binding.AddBinding(Entity, e => e.Status, w => w.SelectedItem).InitializeFromSource();

            chkDriverForOneDay.Binding.AddBinding(Entity, e => e.IsDriverForOneDay, w => w.Active).InitializeFromSource();
            cmbDriverOf.ItemsEnum = typeof(CarTypeOfUse);
            cmbDriverOf.Binding.AddBinding(Entity, e => e.DriverOf, w => w.SelectedItemOrNull).InitializeFromSource();

            dataentryLastName.Binding.AddBinding(Entity, e => e.LastName, w => w.Text).InitializeFromSource();
            dataentryName.Binding.AddBinding(Entity, e => e.Name, w => w.Text).InitializeFromSource();
            dataentryPatronymic.Binding.AddBinding(Entity, e => e.Patronymic, w => w.Text).InitializeFromSource();
            dataentryInnerPhone.Binding.AddBinding(Entity, e => e.InnerPhone, w => w.Text, new Gamma.Binding.Converters.NumbersToStringConverter()).InitializeFromSource();

            entryAddressCurrent.Binding.AddBinding(Entity, e => e.AddressCurrent, w => w.Text).InitializeFromSource();
            entryAddressRegistration.Binding.AddBinding(Entity, e => e.AddressRegistration, w => w.Text).InitializeFromSource();
            entryInn.Binding.AddBinding(Entity, e => e.INN, w => w.Text).InitializeFromSource();

            dataentryAndroidLogin.Binding.AddBinding(Entity, e => e.AndroidLogin, w => w.Text).InitializeFromSource();
            dataentryAndroidPassword.Binding.AddBinding(Entity, e => e.AndroidPassword, w => w.Text).InitializeFromSource();

            var filterDefaultForwarder = new EmployeeFilterViewModel();

            filterDefaultForwarder.SetAndRefilterAtOnce(
                x => x.Category = EmployeeCategory.forwarder,
                x => x.Status   = EmployeeStatus.IsWorking
                );
            repEntDefaultForwarder.RepresentationModel = new EmployeesVM(filterDefaultForwarder);
            repEntDefaultForwarder.Binding.AddBinding(Entity, e => e.DefaultForwarder, w => w.Subject).InitializeFromSource();

            referenceNationality.SubjectType = typeof(Nationality);
            referenceNationality.Binding.AddBinding(Entity, e => e.Nationality, w => w.Subject).InitializeFromSource();
            referenceCitizenship.SubjectType = typeof(Citizenship);
            referenceCitizenship.Binding.AddBinding(Entity, e => e.Citizenship, w => w.Subject).InitializeFromSource();

            referenceUser.SubjectType      = typeof(User);
            referenceUser.CanEditReference = false;
            referenceUser.Binding.AddBinding(Entity, e => e.User, w => w.Subject).InitializeFromSource();
            referenceUser.Sensitive = ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("can_manage_users");

            yenumcombobox13.ItemsEnum = typeof(RegistrationType);
            yenumcombobox13.Binding.AddBinding(Entity, e => e.Registration, w => w.SelectedItemOrNull).InitializeFromSource();

            comboDriverType.ItemsEnum = typeof(DriverType);
            comboDriverType.Binding.AddBinding(Entity, e => e.DriverType, w => w.SelectedItemOrNull).InitializeFromSource();

            ydatepicker1.Binding.AddBinding(Entity, e => e.BirthdayDate, w => w.DateOrNull).InitializeFromSource();
            dateFired.Binding.AddBinding(Entity, e => e.DateFired, w => w.DateOrNull).InitializeFromSource();
            dateHired.Binding.AddBinding(Entity, e => e.DateHired, w => w.DateOrNull).InitializeFromSource();
            dateCalculated.Binding.AddBinding(Entity, e => e.DateCalculated, w => w.DateOrNull).InitializeFromSource();

            photoviewEmployee.Binding.AddBinding(Entity, e => e.Photo, w => w.ImageFile).InitializeFromSource();
            photoviewEmployee.GetSaveFileName = () => Entity.FullName;

            attachmentFiles.AttachToTable = OrmConfig.GetDBTableName(typeof(Employee));
            if (Entity.Id != 0)
            {
                attachmentFiles.ItemId = UoWGeneric.Root.Id;
                attachmentFiles.UpdateFileList();
            }
            phonesView.UoW = UoWGeneric;
            if (UoWGeneric.Root.Phones == null)
            {
                UoWGeneric.Root.Phones = new List <Phone>();
            }
            phonesView.Phones            = UoWGeneric.Root.Phones;
            accountsView.ParentReference = new ParentReferenceGeneric <Employee, Account>(UoWGeneric, o => o.Accounts);
            accountsView.SetTitle("Банковские счета сотрудника");
            ydateFirstWorkDay.Binding.AddBinding(Entity, e => e.FirstWorkDay, w => w.DateOrNull).InitializeFromSource();
            yspinTripsPriority.Binding.AddBinding(Entity, e => e.TripPriority, w => w.ValueAsShort).InitializeFromSource();
            yspinDriverSpeed.Binding.AddBinding(Entity, e => e.DriverSpeed, w => w.Value, new MultiplierToPercentConverter()).InitializeFromSource();
            minAddressesSpin.Binding.AddBinding(Entity, e => e.MinRouteAddresses, w => w.ValueAsInt).InitializeFromSource();
            maxAddressesSpin.Binding.AddBinding(Entity, e => e.MaxRouteAddresses, w => w.ValueAsInt).InitializeFromSource();
            checkbuttonRussianCitizen.Binding.AddBinding(Entity, e => e.IsRussianCitizen, w => w.Active).InitializeFromSource();
            checkVisitingMaster.Binding.AddBinding(Entity, e => e.VisitingMaster, w => w.Active).InitializeFromSource();
            checkChainStoreDriver.Binding.AddBinding(Entity, e => e.IsChainStoreDriver, w => w.Active).InitializeFromSource();

            ylblUserLogin.TooltipText = "При сохранении сотрудника создаёт нового пользователя с введённым логином и отправляет сотруднику SMS с сгенерированным паролем";
            yentryUserLogin.Binding.AddBinding(Entity, e => e.LoginForNewUser, w => w.Text);
            yentryUserLogin.Sensitive = CanCreateNewUser;

            specialListCmbOrganisation.ItemsList = UoW.GetAll <Organization>();
            specialListCmbOrganisation.Binding.AddBinding(Entity, e => e.OrganisationForSalary, w => w.SelectedItem).InitializeFromSource();
            specialListCmbOrganisation.Sensitive = canEditOrganisationForSalary;

            ConfigureWorkSchedules();
            ConfigureDistrictPriorities();

            ytreeviewEmployeeDocument.ColumnsConfig = FluentColumnsConfig <EmployeeDocument> .Create()
                                                      .AddColumn("Документ").AddTextRenderer(x => x.Document.GetEnumTitle())
                                                      .AddColumn("Доп. название").AddTextRenderer(x => x.Name)
                                                      .Finish();

            ytreeviewEmployeeDocument.SetItemsSource(Entity.ObservableDocuments);

            ytreeviewEmployeeContract.ColumnsConfig = FluentColumnsConfig <EmployeeContract> .Create()
                                                      .AddColumn("Договор").AddTextRenderer(x => x.EmployeeContractTemplate.TemplateType.GetEnumTitle())
                                                      .AddColumn("Название").AddTextRenderer(x => x.Name)
                                                      .AddColumn("Дата начала").AddTextRenderer(x => x.FirstDay.ToString("dd/MM/yyyy"))
                                                      .AddColumn("Дата конца").AddTextRenderer(x => x.LastDay.ToString("dd/MM/yyyy"))
                                                      .Finish();

            ytreeviewEmployeeContract.SetItemsSource(Entity.ObservableContracts);

            wageParametersView.ViewModel = new EmployeeWageParametersViewModel
                                           (
                Entity,
                this,
                UoW,
                new HierarchicalPresetPermissionValidator(EmployeeSingletonRepository.GetInstance(), new PermissionRepository()),
                UserSingletonRepository.GetInstance(),
                ServicesConfig.CommonServices,
                NavigationManagerProvider.NavigationManager
                                           );

            logger.Info("Ok");
        }
        public ComplaintsJournalViewModel(
            IUnitOfWorkFactory unitOfWorkFactory,
            ICommonServices commonServices,
            IUndeliveriesViewOpener undeliveriesViewOpener,
            IEmployeeService employeeService,
            IEntityAutocompleteSelectorFactory employeeSelectorFactory,
            IEntityAutocompleteSelectorFactory counterpartySelectorFactory,
            IEntityAutocompleteSelectorFactory nomenclatureSelectorFactory,
            IRouteListItemRepository routeListItemRepository,
            ISubdivisionService subdivisionService,
            ComplaintFilterViewModel filterViewModel,
            IFilePickerService filePickerService,
            ISubdivisionRepository subdivisionRepository,
            IReportViewOpener reportViewOpener,
            IGtkTabsOpenerForRouteListViewAndOrderView gtkDialogsOpener,
            INomenclatureRepository nomenclatureRepository,
            IUserRepository userRepository
            ) : base(filterViewModel, unitOfWorkFactory, commonServices)
        {
            this.unitOfWorkFactory           = unitOfWorkFactory ?? throw new ArgumentNullException(nameof(unitOfWorkFactory));
            this.commonServices              = commonServices ?? throw new ArgumentNullException(nameof(commonServices));
            this.undeliveriesViewOpener      = undeliveriesViewOpener ?? throw new ArgumentNullException(nameof(undeliveriesViewOpener));
            this.employeeService             = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
            this.employeeSelectorFactory     = employeeSelectorFactory ?? throw new ArgumentNullException(nameof(employeeSelectorFactory));
            this.counterpartySelectorFactory = counterpartySelectorFactory ?? throw new ArgumentNullException(nameof(counterpartySelectorFactory));
            this.nomenclatureSelectorFactory = nomenclatureSelectorFactory ?? throw new ArgumentNullException(nameof(nomenclatureSelectorFactory));
            this.filePickerService           = filePickerService ?? throw new ArgumentNullException(nameof(filePickerService));
            this.subdivisionRepository       = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));
            this.routeListItemRepository     = routeListItemRepository ?? throw new ArgumentNullException(nameof(routeListItemRepository));
            this.subdivisionService          = subdivisionService ?? throw new ArgumentNullException(nameof(subdivisionService));
            this.reportViewOpener            = reportViewOpener ?? throw new ArgumentNullException(nameof(reportViewOpener));
            this.gtkDlgOpener           = gtkDialogsOpener ?? throw new ArgumentNullException(nameof(gtkDialogsOpener));
            this.nomenclatureRepository = nomenclatureRepository ?? throw new ArgumentNullException(nameof(nomenclatureRepository));
            this.userRepository         = userRepository ?? throw new ArgumentNullException(nameof(userRepository));

            TabName = "Журнал рекламаций";

            RegisterComplaints();

            var threadLoader = DataLoader as ThreadDataLoader <ComplaintJournalNode>;

            threadLoader.MergeInOrderBy(x => x.Id, true);

            FinishJournalConfiguration();

            FilterViewModel.SubdivisionService = subdivisionService;
            FilterViewModel.EmployeeService    = employeeService;

            var currentUserSettings        = userRepository.GetUserSettings(UoW, commonServices.UserService.CurrentUserId);
            var defaultSubdivision         = currentUserSettings.DefaultSubdivision;
            var currentEmployeeSubdivision = employeeService.GetEmployeeForUser(UoW, commonServices.UserService.CurrentUserId).Subdivision;

            FilterViewModel.CurrentUserSubdivision = currentEmployeeSubdivision;

            if (FilterViewModel.SubdivisionService.GetOkkId() == currentEmployeeSubdivision.Id)
            {
                FilterViewModel.ComplaintStatus = ComplaintStatuses.Checking;
            }
            else
            {
                if (currentUserSettings.UseEmployeeSubdivision)
                {
                    FilterViewModel.Subdivision = currentEmployeeSubdivision;
                }
                else
                {
                    FilterViewModel.Subdivision = defaultSubdivision;
                }

                FilterViewModel.ComplaintStatus = currentUserSettings.DefaultComplaintStatus;
            }

            UpdateOnChanges(
                typeof(Complaint),
                typeof(ComplaintGuiltyItem),
                typeof(ComplaintResult),
                typeof(Subdivision),
                typeof(ComplaintDiscussion),
                typeof(DeliveryPoint),
                typeof(Fine),
                typeof(Order),
                typeof(RouteList),
                typeof(RouteListItem)
                );
            this.DataLoader.ItemsListUpdated += (sender, e) => CurrentObjectChanged?.Invoke(this, new CurrentObjectChangedArgs(null));

            DataLoader.PostLoadProcessingFunc = BeforeItemsUpdated;
        }
예제 #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)));
            }
        }
예제 #9
0
 public SubdivisionController(ISubdivisionService service, IMapper mapper)
 {
     _service = service;
     _mapper  = mapper;
 }
 public CachingSubdivisionService(ISubdivisionService subdivisionService)
 {
     this.subdivisionService = subdivisionService;
     // Pre-load data to cache
     GetSubdivisions();
 }