public RequestsToSuppliersJournalViewModel(
            RequestsToSuppliersFilterViewModel filterViewModel,
            IUnitOfWorkFactory unitOfWorkFactory,
            ICommonServices commonServices,
            IEmployeeService employeeService,
            ISupplierPriceItemsRepository supplierPriceItemsRepository,
            ICounterpartyJournalFactory counterpartySelectorFactory,
            INomenclatureJournalFactory nomenclatureSelectorFactory,
            INomenclatureRepository nomenclatureRepository,
            IUserRepository userRepository
            ) : base(filterViewModel, unitOfWorkFactory, commonServices)
        {
            this.employeeService              = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
            this.nomenclatureRepository       = nomenclatureRepository ?? throw new ArgumentNullException(nameof(nomenclatureRepository));
            this.userRepository               = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
            this.supplierPriceItemsRepository = supplierPriceItemsRepository ?? throw new ArgumentNullException(nameof(supplierPriceItemsRepository));
            this.unitOfWorkFactory            = unitOfWorkFactory ?? throw new ArgumentNullException(nameof(unitOfWorkFactory));
            this.counterpartySelectorFactory  = counterpartySelectorFactory ?? throw new ArgumentNullException(nameof(counterpartySelectorFactory));
            this.nomenclatureSelectorFactory  = nomenclatureSelectorFactory ?? throw new ArgumentNullException(nameof(nomenclatureSelectorFactory));

            TabName = "Журнал заявок поставщикам";

            var threadLoader = DataLoader as ThreadDataLoader <RequestToSupplierJournalNode>;

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

            UpdateOnChanges(typeof(RequestToSupplier));
        }
Exemple #2
0
        public RequestToSupplierViewModel(
            IEntityUoWBuilder uoWBuilder,
            IUnitOfWorkFactory unitOfWorkFactory,
            ICommonServices commonServices,
            IEmployeeService employeeService,
            ISupplierPriceItemsRepository supplierPriceItemsRepository,
            ICounterpartyJournalFactory counterpartySelectorFactory,
            INomenclatureJournalFactory nomenclatureSelectorFactory,
            INomenclatureRepository nomenclatureRepository,
            IUserRepository userRepository) : base(uoWBuilder, unitOfWorkFactory, commonServices)
        {
            this.unitOfWorkFactory            = unitOfWorkFactory ?? throw new ArgumentNullException(nameof(unitOfWorkFactory));
            this.commonServices               = commonServices ?? throw new ArgumentNullException(nameof(commonServices));
            this.employeeService              = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
            this.supplierPriceItemsRepository = supplierPriceItemsRepository ?? throw new ArgumentNullException(nameof(supplierPriceItemsRepository));
            this.nomenclatureRepository       = nomenclatureRepository ?? throw new ArgumentNullException(nameof(nomenclatureRepository));
            this.userRepository               = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
            this.counterpartySelectorFactory  = counterpartySelectorFactory ?? throw new ArgumentNullException(nameof(counterpartySelectorFactory));
            this.nomenclatureSelectorFactory  = nomenclatureSelectorFactory ?? throw new ArgumentNullException(nameof(nomenclatureSelectorFactory));

            CreateCommands();
            RefreshSuppliers();
            ConfigureEntityPropertyChanges();

            Entity.ObservableRequestingNomenclatureItems.ElementAdded       += (aList, aIdx) => RefreshSuppliers();
            Entity.ObservableRequestingNomenclatureItems.ListContentChanged += (aList, aIdx) => RefreshSuppliers();
            Entity.ObservableRequestingNomenclatureItems.ElementRemoved     += (aList, aIdx, aObject) => RefreshSuppliers();
            NotifyConfiguration.Instance.BatchSubscribeOnEntity <SupplierPriceItem>(PriceFromSupplierNotifyCriteria);
            NotifyConfiguration.Instance.BatchSubscribeOnEntity <NomenclaturePrice>(NomenclaturePriceNotifyCriteria);
            NotifyConfiguration.Instance.BatchSubscribeOnEntity <Counterparty>(CounterpartyNotifyCriteria);

            SetPermissions();
        }