Beispiel #1
0
        public IEntityAutocompleteSelector CreateAutocompleteSelector(bool multipleSelect = false)
        {
            NomenclatureFilterViewModel nomenclatureFilter = new NomenclatureFilterViewModel();

            nomenclatureFilter.RestrictCategory = NomenclatureCategory.fuel;
            nomenclatureFilter.RestrictArchive  = false;

            var nomenclatureRepository = new NomenclatureRepository(new NomenclatureParametersProvider(new ParametersProvider()));
            var userRepository         = new UserRepository();

            var counterpartySelectorFactory =
                new DefaultEntityAutocompleteSelectorFactory <Counterparty, CounterpartyJournalViewModel, CounterpartyJournalFilterViewModel>(
                    ServicesConfig.CommonServices);

            var nomenclatureSelectorFactory =
                new NomenclatureAutoCompleteSelectorFactory <Nomenclature, NomenclaturesJournalViewModel>(
                    ServicesConfig.CommonServices, nomenclatureFilter, counterpartySelectorFactory, nomenclatureRepository, userRepository);

            WaterJournalViewModel waterJournal = new WaterJournalViewModel(
                UnitOfWorkFactory.GetDefaultFactory,
                ServicesConfig.CommonServices,
                new EmployeeService(),
                nomenclatureSelectorFactory,
                counterpartySelectorFactory,
                nomenclatureRepository,
                userRepository
                );

            waterJournal.SelectionMode = multipleSelect ? JournalSelectionMode.Multiple : JournalSelectionMode.Single;
            return(waterJournal);
        }
Beispiel #2
0
        public IEntitySelector CreateNomenclatureSelectorForFuelSelect()
        {
            NomenclatureFilterViewModel nomenclatureFilter = new NomenclatureFilterViewModel();

            nomenclatureFilter.RestrictCategory = NomenclatureCategory.fuel;
            nomenclatureFilter.RestrictArchive  = false;

            var nomenclatureRepository = new NomenclatureRepository(new NomenclatureParametersProvider());

            var counterpartySelectorFactory =
                new DefaultEntityAutocompleteSelectorFactory <Counterparty, CounterpartyJournalViewModel, CounterpartyJournalFilterViewModel>(
                    ServicesConfig.CommonServices);

            var nomenclatureSelectorFactory =
                new NomenclatureAutoCompleteSelectorFactory <Nomenclature, NomenclaturesJournalViewModel>(
                    ServicesConfig.CommonServices, nomenclatureFilter, counterpartySelectorFactory, nomenclatureRepository,
                    UserSingletonRepository.GetInstance());

            NomenclaturesJournalViewModel vm = new NomenclaturesJournalViewModel(
                nomenclatureFilter,
                UnitOfWorkFactory.GetDefaultFactory,
                ServicesConfig.CommonServices,
                new EmployeeService(),
                nomenclatureSelectorFactory,
                counterpartySelectorFactory,
                nomenclatureRepository,
                UserSingletonRepository.GetInstance()
                );

            vm.SelectionMode = JournalSelectionMode.Multiple;

            return(vm);
        }
Beispiel #3
0
        protected void OnButtonChangeNewClicked(object sender, EventArgs e)
        {
            var filter = new NomenclatureFilterViewModel();

            var userRepository = new UserRepository();

            var employeeService            = VodovozGtkServicesConfig.EmployeeService;
            var counterpartyJournalFactory = new CounterpartyJournalFactory();

            var nomenclatureAutoCompleteSelectorFactory =
                new NomenclatureAutoCompleteSelectorFactory <Nomenclature, NomenclaturesJournalViewModel>(
                    ServicesConfig.CommonServices,
                    filter,
                    counterpartyJournalFactory,
                    _nomenclatureRepository,
                    userRepository
                    );

            var nomenclaturesJournalViewModel =
                new NomenclaturesJournalViewModel(
                    filter,
                    UnitOfWorkFactory.GetDefaultFactory,
                    ServicesConfig.CommonServices,
                    employeeService,
                    new NomenclatureJournalFactory(),
                    counterpartyJournalFactory,
                    _nomenclatureRepository,
                    userRepository
                    );

            nomenclaturesJournalViewModel.SelectionMode           = JournalSelectionMode.Single;
            nomenclaturesJournalViewModel.OnEntitySelectedResult += ChangeNewNomenclature_OnEntitySelectedResult;

            MyTab.TabParent.AddSlaveTab(MyTab, nomenclaturesJournalViewModel);
        }
Beispiel #4
0
        public void CreateComplaint(Order order)
        {
            if (order != null)
            {
                var nomenclatureRepository = new NomenclatureRepository(new NomenclatureParametersProvider());

                IEntityAutocompleteSelectorFactory employeeSelectorFactory =
                    new DefaultEntityAutocompleteSelectorFactory <Employee, EmployeesJournalViewModel, EmployeeFilterViewModel>(
                        ServicesConfig.CommonServices);

                IEntityAutocompleteSelectorFactory counterpartySelectorFactory =
                    new DefaultEntityAutocompleteSelectorFactory <Counterparty, CounterpartyJournalViewModel,
                                                                  CounterpartyJournalFilterViewModel>(ServicesConfig.CommonServices);

                IEntityAutocompleteSelectorFactory nomenclatureSelectorFactory =
                    new NomenclatureAutoCompleteSelectorFactory <Nomenclature, NomenclaturesJournalViewModel>(ServicesConfig
                                                                                                              .CommonServices, new NomenclatureFilterViewModel(), counterpartySelectorFactory,
                                                                                                              nomenclatureRepository, UserSingletonRepository.GetInstance());

                ISubdivisionRepository subdivisionRepository = new SubdivisionRepository();

                var parameters = new Dictionary <string, object> {
                    { "order", order },
                    { "uowBuilder", EntityUoWBuilder.ForCreate() },
                    { "unitOfWorkFactory", UnitOfWorkFactory.GetDefaultFactory },
                    { "employeeSelectorFactory", employeeSelectorFactory },
                    { "counterpartySelectorFactory", counterpartySelectorFactory },
                    { "subdivisionService", subdivisionRepository },
                    { "nomenclatureSelectorFactory", nomenclatureSelectorFactory },
                    { "nomenclatureRepository", nomenclatureRepository },
                    { "phone", "+7" + this.MangoManager.CurrentCall.Phone.Number }
                };
                tdiNavigation.OpenTdiTabOnTdiNamedArgs <CreateComplaintViewModel>(null, parameters);
            }
        }
Beispiel #5
0
    void ActionJournalOfRequestsToSuppliers_Activated(object sender, System.EventArgs e)
    {
        var nomenclatureRepository = new NomenclatureRepository(new NomenclatureParametersProvider());

        IEntityAutocompleteSelectorFactory counterpartySelectorFactory =
            new DefaultEntityAutocompleteSelectorFactory <Counterparty, CounterpartyJournalViewModel,
                                                          CounterpartyJournalFilterViewModel>(ServicesConfig.CommonServices);

        IEntityAutocompleteSelectorFactory nomenclatureSelectorFactory =
            new NomenclatureAutoCompleteSelectorFactory <Nomenclature, NomenclaturesJournalViewModel>(ServicesConfig.CommonServices,
                                                                                                      new NomenclatureFilterViewModel(), counterpartySelectorFactory, nomenclatureRepository,
                                                                                                      UserSingletonRepository.GetInstance());

        RequestsToSuppliersFilterViewModel filter = new RequestsToSuppliersFilterViewModel(nomenclatureSelectorFactory);

        var requestsJournal = new RequestsToSuppliersJournalViewModel(
            filter,
            UnitOfWorkFactory.GetDefaultFactory,
            ServicesConfig.CommonServices,
            VodovozGtkServicesConfig.EmployeeService,
            new SupplierPriceItemsRepository(),
            counterpartySelectorFactory,
            nomenclatureSelectorFactory,
            nomenclatureRepository,
            UserSingletonRepository.GetInstance()
            );

        tdiMain.AddTab(requestsJournal);
    }
Beispiel #6
0
    void ActionOrdersTableActivated(object sender, System.EventArgs e)
    {
        var nomenclatureRepository = new NomenclatureRepository(new NomenclatureParametersProvider());

        IEntityAutocompleteSelectorFactory counterpartySelectorFactory =
            new DefaultEntityAutocompleteSelectorFactory <Counterparty, CounterpartyJournalViewModel,
                                                          CounterpartyJournalFilterViewModel>(ServicesConfig.CommonServices);

        IEntityAutocompleteSelectorFactory nomenclatureSelectorFactory =
            new NomenclatureAutoCompleteSelectorFactory <Nomenclature, NomenclaturesJournalViewModel>(ServicesConfig.CommonServices,
                                                                                                      new NomenclatureFilterViewModel(), counterpartySelectorFactory, nomenclatureRepository,
                                                                                                      UserSingletonRepository.GetInstance());

        OrderJournalFilterViewModel filter = new OrderJournalFilterViewModel()
        {
            IsForRetail = false
        };
        var ordersJournal = new OrderJournalViewModel(filter,
                                                      UnitOfWorkFactory.GetDefaultFactory,
                                                      ServicesConfig.CommonServices,
                                                      VodovozGtkServicesConfig.EmployeeService,
                                                      nomenclatureSelectorFactory,
                                                      counterpartySelectorFactory,
                                                      nomenclatureRepository,
                                                      UserSingletonRepository.GetInstance());

        tdiMain.AddTab(ordersJournal);
    }
Beispiel #7
0
    void ActionNewRequestToSupplier_Activated(object sender, System.EventArgs e)
    {
        var nomenclatureRepository = new NomenclatureRepository(new NomenclatureParametersProvider());

        IEntityAutocompleteSelectorFactory counterpartySelectorFactory =
            new DefaultEntityAutocompleteSelectorFactory <Counterparty, CounterpartyJournalViewModel,
                                                          CounterpartyJournalFilterViewModel>(ServicesConfig.CommonServices);

        IEntityAutocompleteSelectorFactory nomenclatureSelectorFactory =
            new NomenclatureAutoCompleteSelectorFactory <Nomenclature, NomenclaturesJournalViewModel>(ServicesConfig.CommonServices,
                                                                                                      new NomenclatureFilterViewModel(), counterpartySelectorFactory, nomenclatureRepository,
                                                                                                      UserSingletonRepository.GetInstance());

        tdiMain.OpenTab(
            DialogHelper.GenerateDialogHashName <RequestToSupplier>(0),
            () => new RequestToSupplierViewModel(
                EntityUoWBuilder.ForCreate(),
                UnitOfWorkFactory.GetDefaultFactory,
                ServicesConfig.CommonServices,
                VodovozGtkServicesConfig.EmployeeService,
                new SupplierPriceItemsRepository(),
                counterpartySelectorFactory,
                nomenclatureSelectorFactory,
                nomenclatureRepository,
                UserSingletonRepository.GetInstance()
                )
            );
    }
Beispiel #8
0
        public IEntitySelector CreateNomenclatureOfGoodsWithoutEmptyBottlesSelector(IEnumerable <int> excludedNomenclatures = null)
        {
            NomenclatureFilterViewModel nomenclatureFilter = new NomenclatureFilterViewModel();

            nomenclatureFilter.RestrictArchive     = true;
            nomenclatureFilter.AvailableCategories = Nomenclature.GetCategoriesForGoodsWithoutEmptyBottles();

            var nomenclatureRepository = new NomenclatureRepository(new NomenclatureParametersProvider(new ParametersProvider()));
            var userRepository         = new UserRepository();

            var counterpartySelectorFactory =
                new DefaultEntityAutocompleteSelectorFactory <Counterparty, CounterpartyJournalViewModel, CounterpartyJournalFilterViewModel>(
                    ServicesConfig.CommonServices);

            var nomenclatureSelectorFactory =
                new NomenclatureAutoCompleteSelectorFactory <Nomenclature, NomenclaturesJournalViewModel>(
                    ServicesConfig.CommonServices, nomenclatureFilter, counterpartySelectorFactory, nomenclatureRepository,
                    userRepository);

            NomenclaturesJournalViewModel vm = new NomenclaturesJournalViewModel(
                nomenclatureFilter,
                UnitOfWorkFactory.GetDefaultFactory,
                ServicesConfig.CommonServices,
                new EmployeeService(),
                nomenclatureSelectorFactory,
                counterpartySelectorFactory,
                nomenclatureRepository,
                userRepository
                );

            vm.SelectionMode = JournalSelectionMode.Single;

            return(vm);
        }
        public WidgetViewModelBase Resolve(PromotionalSet promotionalSet, PromotionalSetActionType setActionType)
        {
            switch (setActionType)
            {
            case PromotionalSetActionType.FixedPrice:
                var filter = new NomenclatureFilterViewModel();
                filter.RestrictCategory = NomenclatureCategory.water;

                var nomenclatureSelectorFactory =
                    new NomenclatureAutoCompleteSelectorFactory <Nomenclature, NomenclaturesJournalViewModel>(
                        ServicesConfig.CommonServices, filter, counterpartySelectorFactory,
                        nomenclatureRepository, userRepository);

                return(new AddFixPriceActionViewModel(uow, promotionalSet, ServicesConfig.CommonServices, nomenclatureSelectorFactory));

            default:
                throw new ArgumentException();
            }
        }
Beispiel #10
0
        public IEntityAutocompleteSelectorFactory CreateNomenclatureForFlyerJournalFactory() =>
        new EntityAutocompleteSelectorFactory <NomenclaturesJournalViewModel>(
            typeof(Nomenclature),
            () =>
        {
            var filter = new NomenclatureFilterViewModel
            {
                RestrictCategory = NomenclatureCategory.additional, RestrictArchive = false
            };

            var nomenclatureRepository = new NomenclatureRepository(new NomenclatureParametersProvider(new ParametersProvider()));
            var userRepository         = new UserRepository();

            var counterpartySelectorFactory =
                new DefaultEntityAutocompleteSelectorFactory <Counterparty, CounterpartyJournalViewModel, CounterpartyJournalFilterViewModel>(
                    ServicesConfig.CommonServices);

            var nomenclatureSelectorFactory =
                new NomenclatureAutoCompleteSelectorFactory <Nomenclature, NomenclaturesJournalViewModel>(
                    ServicesConfig.CommonServices, filter, counterpartySelectorFactory, nomenclatureRepository, userRepository);

            var journal = new NomenclaturesJournalViewModel(
                filter,
                UnitOfWorkFactory.GetDefaultFactory,
                ServicesConfig.CommonServices,
                new EmployeeService(),
                nomenclatureSelectorFactory,
                counterpartySelectorFactory,
                nomenclatureRepository,
                userRepository)
            {
                SelectionMode = JournalSelectionMode.Single
            };

            return(journal);
        }
            );
Beispiel #11
0
        public IEntityAutocompleteSelectorFactory GetDefaultWaterSelectorFactory()
        {
            var nomenclatureFilter = new NomenclatureFilterViewModel {
                HidenByDefault = true
            };

            nomenclatureFilter.SetAndRefilterAtOnce(
                x => x.RestrictCategory = NomenclatureCategory.water,
                x => x.RestrictDilers   = true
                );

            var counterpartySelectorFactory =
                new DefaultEntityAutocompleteSelectorFactory <Counterparty, CounterpartyJournalViewModel, CounterpartyJournalFilterViewModel>(
                    ServicesConfig.CommonServices);
            var nomRep         = new NomenclatureRepository(new NomenclatureParametersProvider(new ParametersProvider()));
            var userRepository = new UserRepository();

            var nomenclatureSelectorFactory =
                new NomenclatureAutoCompleteSelectorFactory <Nomenclature, NomenclaturesJournalViewModel>(
                    ServicesConfig.CommonServices, nomenclatureFilter, counterpartySelectorFactory, nomRep, userRepository);

            var journalViewModel = new NomenclaturesJournalViewModel(
                nomenclatureFilter,
                UnitOfWorkFactory.GetDefaultFactory,
                ServicesConfig.CommonServices,
                new EmployeeService(),
                nomenclatureSelectorFactory,
                counterpartySelectorFactory,
                nomRep,
                userRepository)
            {
                SelectionMode = JournalSelectionMode.Single,
            };

            return(new EntityAutocompleteSelectorFactory <NomenclaturesJournalViewModel>(typeof(Nomenclature), () => journalViewModel));
        }
Beispiel #12
0
        protected void OnButtonAddClicked(object sender, EventArgs e)
        {
            NomenclatureStockFilterViewModel filter = new NomenclatureStockFilterViewModel(new WarehouseSelectorFactory());

            filter.RestrictWarehouse = DocumentUoW.Root.Warehouse;

            NomenclatureStockBalanceJournalViewModel vm = new NomenclatureStockBalanceJournalViewModel(
                filter,
                UnitOfWorkFactory.GetDefaultFactory,
                ServicesConfig.CommonServices
                );

            vm.SelectionMode           = JournalSelectionMode.Single;
            vm.TabName                 = "Выберите номенклатуру на замену";
            vm.OnEntitySelectedResult += (s, ea) => {
                var selectedNode = ea.SelectedNodes.Cast <NomenclatureStockJournalNode>().FirstOrDefault();
                if (selectedNode == null)
                {
                    return;
                }
                var nomenclature = DocumentUoW.GetById <Nomenclature>(selectedNode.Id);

                newRow = new RegradingOfGoodsDocumentItem()
                {
                    NomenclatureOld = nomenclature,
                    AmountInStock   = selectedNode.StockAmount
                };

                var nomenclatureFilter = new NomenclatureFilterViewModel();

                var userRepository = new UserRepository();

                var employeeService = VodovozGtkServicesConfig.EmployeeService;

                var counterpartySelectorFactory = new CounterpartyJournalFactory();

                var nomenclatureAutoCompleteSelectorFactory =
                    new NomenclatureAutoCompleteSelectorFactory <Nomenclature, NomenclaturesJournalViewModel>(
                        ServicesConfig.CommonServices,
                        nomenclatureFilter,
                        counterpartySelectorFactory,
                        _nomenclatureRepository,
                        userRepository
                        );

                var nomenclaturesJournalViewModel =
                    new NomenclaturesJournalViewModel(
                        nomenclatureFilter,
                        UnitOfWorkFactory.GetDefaultFactory,
                        ServicesConfig.CommonServices,
                        employeeService,
                        new NomenclatureJournalFactory(),
                        counterpartySelectorFactory,
                        _nomenclatureRepository,
                        userRepository
                        );

                nomenclaturesJournalViewModel.SelectionMode           = JournalSelectionMode.Single;
                nomenclaturesJournalViewModel.OnEntitySelectedResult += SelectNewNomenclature_ObjectSelected;

                MyTab.TabParent.AddSlaveTab(MyTab, nomenclaturesJournalViewModel);
            };
            MyTab.TabParent.AddSlaveTab(MyTab, vm);
        }
Beispiel #13
0
        void ConfigureDlg()
        {
            if (StoreDocumentHelper.CheckAllPermissions(UoW.IsNew, WarehousePermissions.IncomingWaterEdit, Entity.IncomingWarehouse, Entity.WriteOffWarehouse))
            {
                FailInitialize = true;
                return;
            }

            var editing = StoreDocumentHelper.CanEditDocument(WarehousePermissions.IncomingWaterEdit, Entity.IncomingWarehouse, Entity.WriteOffWarehouse);

            buttonFill.Sensitive = yentryProduct.IsEditable = spinAmount.Sensitive
                                                                  = referenceSrcWarehouse.IsEditable = referenceDstWarehouse.IsEditable = editing;
            incomingwatermaterialview1.Sensitive = editing;

            labelTimeStamp.Binding.AddBinding(Entity, e => e.DateString, w => w.LabelProp).InitializeFromSource();
            spinAmount.Binding.AddBinding(Entity, e => e.Amount, w => w.ValueAsInt).InitializeFromSource();

            referenceSrcWarehouse.ItemsQuery = StoreDocumentHelper.GetRestrictedWarehouseQuery(WarehousePermissions.IncomingWaterEdit);
            referenceSrcWarehouse.Binding.AddBinding(Entity, e => e.WriteOffWarehouse, w => w.Subject).InitializeFromSource();
            referenceDstWarehouse.ItemsQuery = StoreDocumentHelper.GetRestrictedWarehouseQuery(WarehousePermissions.IncomingWaterEdit);
            referenceDstWarehouse.Binding.AddBinding(Entity, e => e.IncomingWarehouse, w => w.Subject).InitializeFromSource();

            incomingwatermaterialview1.DocumentUoW = UoWGeneric;

            var permmissionValidator = new EntityExtendedPermissionValidator(PermissionExtensionSingletonStore.GetInstance(), EmployeeSingletonRepository.GetInstance());

            Entity.CanEdit = permmissionValidator.Validate(typeof(IncomingWater), UserSingletonRepository.GetInstance().GetCurrentUser(UoW).Id, nameof(RetroactivelyClosePermission));
            if (!Entity.CanEdit && Entity.TimeStamp.Date != DateTime.Now.Date)
            {
                spinAmount.Binding.AddFuncBinding(Entity, e => e.CanEdit, w => w.Sensitive).InitializeFromSource();
                yentryProduct.Sensitive              = false;
                referenceDstWarehouse.Sensitive      = false;
                referenceSrcWarehouse.Sensitive      = false;
                buttonFill.Sensitive                 = false;
                incomingwatermaterialview1.Sensitive = false;
                buttonSave.Sensitive                 = false;
            }
            else
            {
                Entity.CanEdit = true;
            }

            var nomenclatureFilter = new NomenclatureFilterViewModel()
            {
                HidenByDefault = true
            };
            var nomenclatureRepository = new EntityRepositories.Goods.NomenclatureRepository(new NomenclatureParametersProvider());

            var counterpartySelectorFactory =
                new DefaultEntityAutocompleteSelectorFactory <Counterparty, CounterpartyJournalViewModel, CounterpartyJournalFilterViewModel>(
                    ServicesConfig.CommonServices);

            var nomenclatureAutoCompleteSelectorFactory =
                new NomenclatureAutoCompleteSelectorFactory <Nomenclature, NomenclaturesJournalViewModel>(
                    ServicesConfig.CommonServices,
                    nomenclatureFilter,
                    counterpartySelectorFactory,
                    nomenclatureRepository,
                    UserSingletonRepository.GetInstance()
                    );

            yentryProduct.SetEntityAutocompleteSelectorFactory(nomenclatureAutoCompleteSelectorFactory);
            yentryProduct.Binding.AddBinding(Entity, e => e.Product, w => w.Subject).InitializeFromSource();
        }
        void ConfigureDlg()
        {
            if (StoreDocumentHelper.CheckAllPermissions(UoW.IsNew, WarehousePermissions.IncomingWaterEdit, Entity.IncomingWarehouse, Entity.WriteOffWarehouse))
            {
                FailInitialize = true;
                return;
            }

            var editing = StoreDocumentHelper.CanEditDocument(WarehousePermissions.IncomingWaterEdit, Entity.IncomingWarehouse, Entity.WriteOffWarehouse);

            buttonFill.Sensitive = yentryProduct.IsEditable = spinAmount.Sensitive = editing;
            incomingwatermaterialview1.Sensitive = editing;

            labelTimeStamp.Binding.AddBinding(Entity, e => e.DateString, w => w.LabelProp).InitializeFromSource();
            spinAmount.Binding.AddBinding(Entity, e => e.Amount, w => w.ValueAsInt).InitializeFromSource();

            var userHasOnlyAccessToWarehouseAndComplaints =
                ServicesConfig.CommonServices.CurrentPermissionService.ValidatePresetPermission("user_have_access_only_to_warehouse_and_complaints") &&
                !ServicesConfig.CommonServices.UserService.GetCurrentUser(UoW).IsAdmin;

            if (userHasOnlyAccessToWarehouseAndComplaints)
            {
                sourceWarehouseEntry.CanEditReference = destinationWarehouseEntry.CanEditReference = false;
            }
            else
            {
                sourceWarehouseEntry.CanEditReference = destinationWarehouseEntry.CanEditReference = true;
            }

            var availableWarehousesIds = StoreDocumentHelper.GetRestrictedWarehousesIds(UoW, WarehousePermissions.IncomingWaterEdit);
            var warehouseFilter        = new WarehouseJournalFilterViewModel
            {
                IncludeWarehouseIds = availableWarehousesIds
            };
            var warehouseAutocompleteSelectorFactory = new WarehouseSelectorFactory(warehouseFilter);

            sourceWarehouseEntry.SetEntityAutocompleteSelectorFactory(warehouseAutocompleteSelectorFactory);
            sourceWarehouseEntry.Binding.AddBinding(Entity, e => e.WriteOffWarehouse, w => w.Subject).InitializeFromSource();
            destinationWarehouseEntry.SetEntityAutocompleteSelectorFactory(warehouseAutocompleteSelectorFactory);
            destinationWarehouseEntry.Binding.AddBinding(Entity, e => e.IncomingWarehouse, w => w.Subject).InitializeFromSource();

            incomingwatermaterialview1.DocumentUoW = UoWGeneric;

            var permmissionValidator =
                new EntityExtendedPermissionValidator(PermissionExtensionSingletonStore.GetInstance(), _employeeRepository);

            Entity.CanEdit =
                permmissionValidator.Validate(
                    typeof(IncomingWater), _userRepository.GetCurrentUser(UoW).Id, nameof(RetroactivelyClosePermission));

            if (!Entity.CanEdit && Entity.TimeStamp.Date != DateTime.Now.Date)
            {
                spinAmount.Binding.AddFuncBinding(Entity, e => e.CanEdit, w => w.Sensitive).InitializeFromSource();
                yentryProduct.Sensitive             = false;
                destinationWarehouseEntry.Sensitive = false;
                sourceWarehouseEntry.Sensitive      = false;
                buttonFill.Sensitive = false;
                incomingwatermaterialview1.Sensitive = false;
                buttonSave.Sensitive = false;
            }
            else
            {
                Entity.CanEdit = true;
            }

            var nomenclatureFilter = new NomenclatureFilterViewModel()
            {
                HidenByDefault = true
            };
            var nomenclatureRepository =
                new EntityRepositories.Goods.NomenclatureRepository(new NomenclatureParametersProvider(new ParametersProvider()));
            var counterpartyJournalFactory = new CounterpartyJournalFactory();

            var nomenclatureAutoCompleteSelectorFactory =
                new NomenclatureAutoCompleteSelectorFactory <Nomenclature, NomenclaturesJournalViewModel>(
                    ServicesConfig.CommonServices,
                    nomenclatureFilter,
                    counterpartyJournalFactory,
                    nomenclatureRepository,
                    _userRepository
                    );

            yentryProduct.SetEntityAutocompleteSelectorFactory(nomenclatureAutoCompleteSelectorFactory);
            yentryProduct.Binding.AddBinding(Entity, e => e.Product, w => w.Subject).InitializeFromSource();
        }