Beispiel #1
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();
        }
        public NomenclatureViewModel(
            IEntityUoWBuilder uowBuilder,
            IUnitOfWorkFactory uowFactory,
            ICommonServices commonServices,
            IEmployeeService employeeService,
            INomenclatureJournalFactory nomenclatureSelectorFactory,
            ICounterpartyJournalFactory counterpartySelectorFactory,
            INomenclatureRepository nomenclatureRepository,
            IUserRepository userRepository) : base(uowBuilder, uowFactory, commonServices
                                                   )
        {
            if (nomenclatureSelectorFactory is null)
            {
                throw new ArgumentNullException(nameof(nomenclatureSelectorFactory));
            }

            _employeeService            = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
            _nomenclatureRepository     = nomenclatureRepository ?? throw new ArgumentNullException(nameof(nomenclatureRepository));
            _userRepository             = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
            NomenclatureSelectorFactory = nomenclatureSelectorFactory.GetDefaultNomenclatureSelectorFactory();
            CounterpartySelectorFactory =
                (counterpartySelectorFactory ?? throw new ArgumentNullException(nameof(counterpartySelectorFactory)))
                .CreateCounterpartyAutocompleteSelectorFactory();
            NomenclaturePurchasePricesViewModel = new NomenclaturePurchasePricesViewModel(Entity, this, UoW, CommonServices);

            ConfigureEntityPropertyChanges();
            ConfigureValidationContext();
            SetPermissions();
        }
        public UserSettingsViewModel(
            IEntityUoWBuilder uowBuilder,
            IUnitOfWorkFactory unitOfWorkFactory,
            ICommonServices commonServices,
            IEmployeeService employeeService,
            ISubdivisionParametersProvider subdivisionParametersProvider,
            ISubdivisionJournalFactory subdivisionJournalFactory,
            ICounterpartyJournalFactory counterpartySelectorFactory,
            ISubdivisionRepository subdivisionRepository,
            INomenclatureFixedPriceRepository nomenclatureFixedPriceRepository)
            : base(uowBuilder, unitOfWorkFactory, commonServices)
        {
            _employeeService = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
            _subdivisionParametersProvider    = subdivisionParametersProvider ?? throw new ArgumentNullException(nameof(subdivisionParametersProvider));
            _subdivisionRepository            = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));
            _nomenclatureFixedPriceRepository =
                nomenclatureFixedPriceRepository ?? throw new ArgumentNullException(nameof(nomenclatureFixedPriceRepository));
            InteractiveService = commonServices.InteractiveService;
            SubdivisionSelectorDefaultFactory =
                (subdivisionJournalFactory ?? throw new ArgumentNullException(nameof(subdivisionJournalFactory)))
                .CreateDefaultSubdivisionAutocompleteSelectorFactory();
            CounterpartySelectorFactory =
                (counterpartySelectorFactory ?? throw new ArgumentNullException(nameof(counterpartySelectorFactory)))
                .CreateCounterpartyAutocompleteSelectorFactory();

            SetPermissions();

            if (UserIsCashier)
            {
                ConfigureCashSorting();
            }
        }
Beispiel #4
0
        public CounterpartyOrderViewModel(Counterparty client,
                                          IUnitOfWorkFactory unitOfWorkFactory,
                                          ITdiCompatibilityNavigation tdinavigation,
                                          IRouteListRepository routedListRepository,
                                          MangoManager mangoManager,
                                          IOrderParametersProvider orderParametersProvider,
                                          IEmployeeJournalFactory employeeJournalFactory,
                                          ICounterpartyJournalFactory counterpartyJournalFactory,
                                          INomenclatureRepository nomenclatureRepository,
                                          IParametersProvider parametersProvider,
                                          int count = 5)
        {
            Client                      = client;
            tdiNavigation               = tdinavigation;
            _routedListRepository       = routedListRepository;
            MangoManager                = mangoManager;
            _orderParametersProvider    = orderParametersProvider ?? throw new ArgumentNullException(nameof(orderParametersProvider));
            _employeeJournalFactory     = employeeJournalFactory ?? throw new ArgumentNullException(nameof(employeeJournalFactory));
            _counterpartyJournalFactory = counterpartyJournalFactory ?? throw new ArgumentNullException(nameof(counterpartyJournalFactory));
            _nomenclatureRepository     = nomenclatureRepository ?? throw new ArgumentNullException(nameof(nomenclatureRepository));
            _parametersProvider         = parametersProvider ?? throw new ArgumentNullException(nameof(parametersProvider));
            UoW         = unitOfWorkFactory.CreateWithoutRoot();
            LatestOrder = _orderRepository.GetLatestOrdersForCounterparty(UoW, client, count).ToList();

            RefreshOrders = _RefreshOrders;
            NotifyConfiguration.Instance.BatchSubscribe(_RefreshCounterparty)
            .IfEntity <Counterparty>()
            .AndWhere(c => c.Id == client.Id)
            .Or.IfEntity <DeliveryPoint>()
            .AndWhere(d => client.DeliveryPoints.Any(cd => cd.Id == d.Id));
        }
        public SupplierPricesWidgetViewModel(Counterparty entity,
                                             IUnitOfWork uow,
                                             ITdiTab dialogTab,
                                             ICommonServices commonServices,
                                             IEmployeeService employeeService,
                                             ICounterpartyJournalFactory counterpartySelectorFactory,
                                             INomenclatureJournalFactory nomenclatureSelectorFactory,
                                             INomenclatureRepository nomenclatureRepository,
                                             IUserRepository userRepository)
            : base(entity, commonServices)
        {
            this.dialogTab                   = dialogTab ?? throw new ArgumentNullException(nameof(dialogTab));
            UoW                              = uow ?? throw new ArgumentNullException(nameof(uow));
            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.counterpartySelectorFactory = counterpartySelectorFactory ?? throw new ArgumentNullException(nameof(counterpartySelectorFactory));
            _nomenclatureSelectorFactory     = nomenclatureSelectorFactory ?? throw new ArgumentNullException(nameof(nomenclatureSelectorFactory));

            CreateCommands();
            RefreshPrices();

            Search           = new SearchViewModel();
            Search.OnSearch += (sender, e) => RefreshPrices();
            Entity.ObservableSuplierPriceItems.ElementAdded   += (aList, aIdx) => RefreshPrices();
            Entity.ObservableSuplierPriceItems.ElementRemoved += (aList, aIdx, aObject) => RefreshPrices();
        }
        public PromotionalSetViewModel(
            IEntityUoWBuilder uowBuilder,
            IUnitOfWorkFactory unitOfWorkFactory,
            ICommonServices commonServices,
            IEmployeeService employeeService,
            ICounterpartyJournalFactory counterpartySelectorFactory,
            INomenclatureJournalFactory nomenclatureSelectorFactory,
            INomenclatureRepository nomenclatureRepository,
            IUserRepository userRepository) : base(uowBuilder, unitOfWorkFactory, commonServices)
        {
            _employeeService             = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
            _nomenclatureRepository      = nomenclatureRepository ?? throw new ArgumentNullException(nameof(nomenclatureRepository));
            _userRepository              = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
            _counterpartySelectorFactory = counterpartySelectorFactory ?? throw new ArgumentNullException(nameof(counterpartySelectorFactory));
            _nomenclatureSelectorFactory = nomenclatureSelectorFactory ?? throw new ArgumentNullException(nameof(nomenclatureSelectorFactory));

            if (!CanRead)
            {
                AbortOpening("У вас недостаточно прав для просмотра");
            }

            TabName = "Рекламные наборы";
            UoW     = uowBuilder.CreateUoW <PromotionalSet>(unitOfWorkFactory);
            CreateCommands();
        }
        public CreateComplaintViewModel(Order order,
                                        IEntityUoWBuilder uowBuilder,
                                        IUnitOfWorkFactory unitOfWorkFactory,
                                        IEmployeeService employeeService,
                                        IEntityAutocompleteSelectorFactory counterpartySelectorFactory,
                                        ISubdivisionRepository subdivisionRepository,
                                        ICommonServices commonServices,
                                        INomenclatureRepository nomenclatureRepository,
                                        IUserRepository userRepository,
                                        IFilePickerService filePickerService,
                                        IOrderSelectorFactory orderSelectorFactory,
                                        IEmployeeJournalFactory employeeJournalFactory,
                                        ICounterpartyJournalFactory counterpartyJournalFactory,
                                        IDeliveryPointJournalFactory deliveryPointJournalFactory,
                                        ISubdivisionJournalFactory subdivisionJournalFactory,
                                        IGtkTabsOpener gtkDialogsOpener,
                                        IUndeliveredOrdersJournalOpener undeliveredOrdersJournalOpener,
                                        INomenclatureSelectorFactory nomenclatureSelector,
                                        IUndeliveredOrdersRepository undeliveredOrdersRepository,
                                        string phone = null) : this(uowBuilder, unitOfWorkFactory, employeeService, counterpartySelectorFactory, subdivisionRepository,
                                                                    commonServices, nomenclatureRepository, userRepository, filePickerService, orderSelectorFactory,
                                                                    employeeJournalFactory, counterpartyJournalFactory, deliveryPointJournalFactory, subdivisionJournalFactory, gtkDialogsOpener,
                                                                    undeliveredOrdersJournalOpener, nomenclatureSelector, undeliveredOrdersRepository, phone)
        {
            var currentOrder = UoW.GetById <Order>(order.Id);

            Entity.Order        = currentOrder;
            Entity.Counterparty = currentOrder.Client;
            Entity.Phone        = phone;
        }
Beispiel #8
0
        public NomenclaturesJournalViewModel(
            NomenclatureFilterViewModel filterViewModel,
            IUnitOfWorkFactory unitOfWorkFactory,
            ICommonServices commonServices,
            IEmployeeService employeeService,
            INomenclatureJournalFactory nomenclatureSelectorFactory,
            ICounterpartyJournalFactory counterpartySelectorFactory,
            INomenclatureRepository nomenclatureRepository,
            IUserRepository userRepository
            ) : base(filterViewModel, unitOfWorkFactory, commonServices)
        {
            this.employeeService             = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
            this.nomenclatureSelectorFactory =
                nomenclatureSelectorFactory ?? throw new ArgumentNullException(nameof(nomenclatureSelectorFactory));
            this.counterpartySelectorFactory =
                counterpartySelectorFactory ?? throw new ArgumentNullException(nameof(counterpartySelectorFactory));
            this.nomenclatureRepository = nomenclatureRepository ?? throw new ArgumentNullException(nameof(nomenclatureRepository));
            this.userRepository         = userRepository ?? throw new ArgumentNullException(nameof(userRepository));

            TabName = "Журнал ТМЦ";
            SetOrder(x => x.Name);
            UpdateOnChanges(
                typeof(Nomenclature),
                typeof(MeasurementUnits),
                typeof(WarehouseMovementOperation),
                typeof(VodovozOrder),
                typeof(OrderItem)
                );
        }
 public NomenclatureAutoCompleteSelectorFactory(
     ICommonServices commonServices,
     NomenclatureFilterViewModel filterViewModel,
     ICounterpartyJournalFactory counterpartySelectorFactory,
     INomenclatureRepository nomenclatureRepository,
     IUserRepository userRepository)
     : base(commonServices, filterViewModel, counterpartySelectorFactory, nomenclatureRepository,
            userRepository)
 {
 }
        public CreateComplaintViewModel(
            IEntityUoWBuilder uowBuilder,
            IUnitOfWorkFactory unitOfWorkFactory,
            IEmployeeService employeeService,
            IEntityAutocompleteSelectorFactory counterpartySelectorFactory,
            ISubdivisionRepository subdivisionRepository,
            ICommonServices commonServices,
            INomenclatureRepository nomenclatureRepository,
            IUserRepository userRepository,
            IFilePickerService filePickerService,
            IOrderSelectorFactory orderSelectorFactory,
            IEmployeeJournalFactory employeeJournalFactory,
            ICounterpartyJournalFactory counterpartyJournalFactory,
            IDeliveryPointJournalFactory deliveryPointJournalFactory,
            ISubdivisionJournalFactory subdivisionJournalFactory,
            IGtkTabsOpener gtkDialogsOpener,
            IUndeliveredOrdersJournalOpener undeliveredOrdersJournalOpener,
            INomenclatureSelectorFactory nomenclatureSelector,
            IUndeliveredOrdersRepository undeliveredOrdersRepository,
            string phone = null
            ) : base(uowBuilder, unitOfWorkFactory, commonServices)
        {
            _filePickerService          = filePickerService ?? throw new ArgumentNullException(nameof(filePickerService));
            EmployeeService             = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
            NomenclatureRepository      = nomenclatureRepository ?? throw new ArgumentNullException(nameof(nomenclatureRepository));
            UserRepository              = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
            CounterpartySelectorFactory = counterpartySelectorFactory ?? throw new ArgumentNullException(nameof(counterpartySelectorFactory));
            this.subdivisionRepository  = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));

            OrderSelectorFactory           = orderSelectorFactory ?? throw new ArgumentNullException(nameof(orderSelectorFactory));
            EmployeeJournalFactory         = employeeJournalFactory ?? throw new ArgumentNullException(nameof(employeeJournalFactory));
            _employeeSelectorFactory       = employeeJournalFactory.CreateEmployeeAutocompleteSelectorFactory();
            CounterpartyJournalFactory     = counterpartyJournalFactory ?? throw new ArgumentNullException(nameof(counterpartyJournalFactory));
            DeliveryPointJournalFactory    = deliveryPointJournalFactory ?? throw new ArgumentNullException(nameof(deliveryPointJournalFactory));
            SubdivisionJournalFactory      = subdivisionJournalFactory ?? throw new ArgumentNullException(nameof(subdivisionJournalFactory));
            GtkDialogsOpener               = gtkDialogsOpener ?? throw new ArgumentNullException(nameof(gtkDialogsOpener));
            UndeliveredOrdersJournalOpener =
                undeliveredOrdersJournalOpener ?? throw new ArgumentNullException(nameof(undeliveredOrdersJournalOpener));
            NomenclatureSelector        = nomenclatureSelector ?? throw new ArgumentNullException(nameof(nomenclatureSelector));
            UndeliveredOrdersRepository =
                undeliveredOrdersRepository ?? throw new ArgumentNullException(nameof(undeliveredOrdersRepository));

            Entity.ComplaintType = ComplaintType.Client;
            Entity.SetStatus(ComplaintStatuses.Checking);
            ConfigureEntityPropertyChanges();
            Entity.Phone = phone;

            _complaintKinds = complaintKindSource = UoW.GetAll <ComplaintKind>().Where(k => !k.IsArchive).ToList();

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

            TabName = "Новая клиентская рекламация";
        }
Beispiel #11
0
 public PromotionalSetActionWidgetResolver(
     IUnitOfWork uow,
     ICounterpartyJournalFactory counterpartySelectorFactory,
     INomenclatureRepository nomenclatureRepository,
     IUserRepository userRepository)
 {
     _uow = uow;
     _counterpartySelectorFactory = counterpartySelectorFactory ?? throw new ArgumentNullException(nameof(counterpartySelectorFactory));
     _nomenclatureRepository      = nomenclatureRepository ?? throw new ArgumentNullException(nameof(nomenclatureRepository));
     _userRepository = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
 }
 public NomenclatureSelectorFactory(ICommonServices commonServices,
                                    NomenclatureFilterViewModel filterViewModel,
                                    ICounterpartyJournalFactory counterpartySelectorFactory,
                                    INomenclatureRepository nomenclatureRepository,
                                    IUserRepository userRepository)
 {
     this.commonServices              = commonServices ?? throw new ArgumentNullException(nameof(commonServices));
     this.nomenclatureRepository      = nomenclatureRepository ?? throw new ArgumentNullException(nameof(nomenclatureRepository));
     this.userRepository              = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
     this.counterpartySelectorFactory = counterpartySelectorFactory ?? throw new ArgumentNullException(nameof(counterpartySelectorFactory));
     filter = filterViewModel;
 }
Beispiel #13
0
        public FuelDocumentsJournalViewModel(
            IUnitOfWorkFactory unitOfWorkFactory,
            ICommonServices commonServices,
            IEmployeeService employeeService,
            ISubdivisionRepository subdivisionRepository,
            IFuelRepository fuelRepository,
            ICounterpartyJournalFactory counterpartyJournalFactory,
            INomenclatureSelectorFactory nomenclatureSelectorFactory,
            IEmployeeJournalFactory employeeJournalFactory,
            ISubdivisionJournalFactory subdivisionJournalFactory,
            ICarJournalFactory carJournalFactory,
            IReportViewOpener reportViewOpener,
            IFileChooserProvider fileChooserProvider,
            ExpenseCategoryJournalFilterViewModel expenseCategoryJournalFilterViewModel
            ) :
            base(unitOfWorkFactory, commonServices)
        {
            this.commonServices                        = commonServices ?? throw new ArgumentNullException(nameof(commonServices));
            this.employeeService                       = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
            this.subdivisionRepository                 = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));
            this.fuelRepository                        = fuelRepository ?? throw new ArgumentNullException(nameof(fuelRepository));
            this.counterpartyJournalFactory            = counterpartyJournalFactory ?? throw new ArgumentNullException(nameof(counterpartyJournalFactory));
            this.nomenclatureSelectorFactory           = nomenclatureSelectorFactory ?? throw new ArgumentNullException(nameof(nomenclatureSelectorFactory));
            this.employeeJournalFactory                = employeeJournalFactory ?? throw new ArgumentNullException(nameof(employeeJournalFactory));
            _subdivisionJournalFactory                 = subdivisionJournalFactory ?? throw new ArgumentNullException(nameof(subdivisionJournalFactory));
            this.carJournalFactory                     = carJournalFactory ?? throw new ArgumentNullException(nameof(carJournalFactory));
            this.reportViewOpener                      = reportViewOpener ?? throw new ArgumentNullException(nameof(reportViewOpener));
            this.fileChooserProvider                   = fileChooserProvider ?? throw new ArgumentNullException(nameof(fileChooserProvider));
            this.expenseCategoryJournalFilterViewModel = expenseCategoryJournalFilterViewModel ?? throw new ArgumentNullException(nameof(expenseCategoryJournalFilterViewModel));


            TabName = "Журнал учета топлива";

            var loader = new ThreadDataLoader <FuelDocumentJournalNode>(unitOfWorkFactory);

            loader.MergeInOrderBy(x => x.CreationDate, true);
            DataLoader = loader;

            RegisterIncomeInvoice();
            RegisterTransferDocument();
            RegisterWriteoffDocument();

            FinishJournalConfiguration();

            UpdateOnChanges(
                typeof(FuelIncomeInvoice),
                typeof(FuelIncomeInvoiceItem),
                typeof(FuelTransferDocument),
                typeof(FuelWriteoffDocument),
                typeof(FuelWriteoffDocumentItem)
                );
        }
Beispiel #14
0
        public RouteListAnalysisViewModel(
            IEntityUoWBuilder uowBuilder,
            IUnitOfWorkFactory unitOfWorkFactory,
            ICommonServices commonServices,
            IOrderSelectorFactory orderSelectorFactory,
            IEmployeeJournalFactory employeeJournalFactory,
            ICounterpartyJournalFactory counterpartyJournalFactory,
            IDeliveryPointJournalFactory deliveryPointJournalFactory,
            ISubdivisionJournalFactory subdivisionJournalFactory,
            IGtkTabsOpener gtkDialogsOpener,
            IUndeliveredOrdersJournalOpener undeliveredOrdersJournalOpener,
            IDeliveryShiftRepository deliveryShiftRepository,
            IEmployeeSettings employeeSettings,
            IUndeliveredOrdersRepository undeliveredOrdersRepository) : base(uowBuilder, unitOfWorkFactory, commonServices)
        {
            _orderSelectorFactory           = orderSelectorFactory ?? throw new ArgumentNullException(nameof(orderSelectorFactory));
            _employeeJournalFactory         = employeeJournalFactory ?? throw new ArgumentNullException(nameof(employeeJournalFactory));
            _counterpartyJournalFactory     = counterpartyJournalFactory ?? throw new ArgumentNullException(nameof(counterpartyJournalFactory));
            _deliveryPointJournalFactory    = deliveryPointJournalFactory ?? throw new ArgumentNullException(nameof(deliveryPointJournalFactory));
            _subdivisionJournalFactory      = subdivisionJournalFactory ?? throw new ArgumentNullException(nameof(subdivisionJournalFactory));
            _gtkDialogsOpener               = gtkDialogsOpener ?? throw new ArgumentNullException(nameof(gtkDialogsOpener));
            _undeliveredOrdersJournalOpener = undeliveredOrdersJournalOpener ?? throw new ArgumentNullException(nameof(undeliveredOrdersJournalOpener));
            _employeeSettings               = employeeSettings ?? throw new ArgumentNullException(nameof(employeeSettings));
            UndeliveredOrdersRepository     =
                undeliveredOrdersRepository ?? throw new ArgumentNullException(nameof(undeliveredOrdersRepository));
            _commonServices = commonServices ?? throw new ArgumentNullException(nameof(commonServices));

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

            DeliveryShifts = deliveryShiftRepository.ActiveShifts(UoW);
            Entity.ObservableAddresses.PropertyOfElementChanged += ObservableAddressesOnPropertyOfElementChanged;

            undeliveryViewOpener = new UndeliveredOrdersJournalOpener();
            employeeService      = VodovozGtkServicesConfig.EmployeeService;
            CurrentEmployee      = employeeService.GetEmployeeForUser(UoW, CurrentUser.Id);

            if (CurrentEmployee == null)
            {
                AbortOpening("Ваш пользователь не привязан к действующему сотруднику, вы не можете открыть " +
                             "диалог разбора МЛ, так как некого указывать в качестве логиста.", "Невозможно открыть разбор МЛ");
            }

            LogisticanSelectorFactory = _employeeJournalFactory.CreateWorkingOfficeEmployeeAutocompleteSelectorFactory();
            DriverSelectorFactory     = _employeeJournalFactory.CreateWorkingDriverEmployeeAutocompleteSelectorFactory();
            ForwarderSelectorFactory  = _employeeJournalFactory.CreateWorkingForwarderEmployeeAutocompleteSelectorFactory();

            TabName = $"Диалог разбора {Entity.Title}";
        }
Beispiel #15
0
 public CounterpartyCashlessDebtsReport(
     IDeliveryScheduleParametersProvider deliveryScheduleParametersProvider,
     IInteractiveService interactiveService,
     ICounterpartyJournalFactory counterpartyJournalFactory,
     IUnitOfWorkFactory unitOfWorkFactory)
 {
     _deliveryScheduleParametersProvider = deliveryScheduleParametersProvider
                                           ?? throw new ArgumentNullException(nameof(deliveryScheduleParametersProvider));
     _interactiveService         = interactiveService ?? throw new ArgumentNullException(nameof(interactiveService));
     _counterpartyJournalFactory = counterpartyJournalFactory ?? throw new ArgumentNullException(nameof(counterpartyJournalFactory));
     UoW = (unitOfWorkFactory ?? throw new ArgumentNullException(nameof(unitOfWorkFactory))).CreateWithoutRoot();
     Build();
     Configure();
 }
Beispiel #16
0
 public OrderJournalFilterViewModel(
     ICounterpartyJournalFactory counterpartyJournalFactory,
     IDeliveryPointJournalFactory deliveryPointJournalFactory)
 {
     Organisations = UoW.GetAll <Organization>();
     PaymentsFrom  = UoW.GetAll <PaymentFrom>();
     _deliveryPointJournalFilterViewModel = new DeliveryPointJournalFilterViewModel();
     deliveryPointJournalFactory?.SetDeliveryPointJournalFilterViewModel(_deliveryPointJournalFilterViewModel);
     DeliveryPointSelectorFactory = deliveryPointJournalFactory?.CreateDeliveryPointByClientAutocompleteSelectorFactory()
                                    ?? throw new ArgumentNullException(nameof(deliveryPointJournalFactory));
     CounterpartySelectorFactory = counterpartyJournalFactory?.CreateCounterpartyAutocompleteSelectorFactory()
                                   ?? throw new ArgumentNullException(nameof(counterpartyJournalFactory));
     GeographicGroups = UoW.Session.QueryOver <GeographicGroup>().List <GeographicGroup>().ToList();
 }
 public UnknowTalkViewModel(IUnitOfWorkFactory unitOfWorkFactory,
                            ITdiCompatibilityNavigation navigation,
                            IInteractiveQuestion interactive,
                            MangoManager manager,
                            IEmployeeJournalFactory employeeJournalFactory,
                            ICounterpartyJournalFactory counterpartyJournalFactory,
                            INomenclatureRepository nomenclatureRepository) : base(navigation, manager)
 {
     _tdiNavigation              = navigation ?? throw new ArgumentNullException(nameof(navigation));
     _interactive                = interactive ?? throw new ArgumentNullException(nameof(interactive));
     _employeeJournalFactory     = employeeJournalFactory ?? throw new ArgumentNullException(nameof(employeeJournalFactory));
     _counterpartyJournalFactory = counterpartyJournalFactory ?? throw new ArgumentNullException(nameof(counterpartyJournalFactory));
     _nomenclatureRepository     = nomenclatureRepository ?? throw new ArgumentNullException(nameof(nomenclatureRepository));
     _uow = unitOfWorkFactory.CreateWithoutRoot();
 }
Beispiel #18
0
        public ReportForBigClient()
        {
            this.Build();
            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            _counterpartyJournalFactory          = new CounterpartyJournalFactory();
            _deliveryPointJournalFilterViewModel = new DeliveryPointJournalFilterViewModel();
            _deliveryPointJournalFactory         = new DeliveryPointJournalFactory(_deliveryPointJournalFilterViewModel);

            evmeCounterparty
            .SetEntityAutocompleteSelectorFactory(_counterpartyJournalFactory.CreateCounterpartyAutocompleteSelectorFactory());
            evmeCounterparty.Changed += OnCounterpartyChanged;

            evmeDeliveryPoint
            .SetEntityAutocompleteSelectorFactory(_deliveryPointJournalFactory
                                                  .CreateDeliveryPointByClientAutocompleteSelectorFactory());
        }
Beispiel #19
0
        public PayoutRequestsJournalViewModel(
            PayoutRequestJournalFilterViewModel filterViewModel,
            IUnitOfWorkFactory unitOfWorkFactory,
            ICommonServices commonServices,
            IEmployeeRepository employeeRepository,
            ICashRepository cashRepository,
            IEmployeeJournalFactory employeeJournalFactory,
            ISubdivisionJournalFactory subdivisionJournalFactory,
            ICounterpartyJournalFactory counterpartyJournalFactory,
            IExpenseCategorySelectorFactory expenseCategorySelectorFactory,
            IFileDialogService fileDialogService,
            bool createSelectAction = true) : base(filterViewModel, unitOfWorkFactory, commonServices)
        {
            _unitOfWorkFactory              = unitOfWorkFactory ?? throw new ArgumentNullException(nameof(unitOfWorkFactory));
            _employeeRepository             = employeeRepository ?? throw new ArgumentNullException(nameof(employeeRepository));
            _cashRepository                 = cashRepository ?? throw new ArgumentNullException(nameof(cashRepository));
            _employeeJournalFactory         = employeeJournalFactory ?? throw new ArgumentNullException(nameof(employeeJournalFactory));
            _subdivisionJournalFactory      = subdivisionJournalFactory ?? throw new ArgumentNullException(nameof(subdivisionJournalFactory));
            _commonServices                 = commonServices ?? throw new ArgumentNullException(nameof(commonServices));
            _counterpartyJournalFactory     = counterpartyJournalFactory ?? throw new ArgumentNullException(nameof(counterpartyJournalFactory));
            _expenseCategorySelectorFactory = expenseCategorySelectorFactory
                                              ?? throw new ArgumentNullException(nameof(expenseCategorySelectorFactory));
            _fileDialogService  = fileDialogService ?? throw new ArgumentNullException(nameof(fileDialogService));
            _createSelectAction = createSelectAction;

            TabName = "Журнал заявок ДС";

            UpdateOnChanges(
                typeof(CashRequest),
                typeof(CashlessRequest),
                typeof(CashRequestSumItem),
                typeof(Subdivision),
                typeof(Employee)
                );

            RegisterCashRequest();
            RegisterCashlessRequest();

            var threadLoader = DataLoader as ThreadDataLoader <PayoutRequestJournalNode>;

            threadLoader?.MergeInOrderBy(x => x.Date, @descending: true);
            DataLoader.ItemsListUpdated += OnDataLoaderItemsListUpdated;

            FinishJournalConfiguration();
            AccessRequest();
        }
Beispiel #20
0
        public RevisionBottlesAndDeposits(IOrderRepository orderRepository,
                                          ICounterpartyJournalFactory counterpartyJournalFactory,
                                          IDeliveryPointJournalFactory deliveryPointJournalFactory)
        {
            _orderRepository = orderRepository ?? throw new ArgumentNullException(nameof(orderRepository));

            Build();
            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            entityViewModelEntryCounterparty
            .SetEntityAutocompleteSelectorFactory(
                (counterpartyJournalFactory ?? throw new ArgumentNullException(nameof(counterpartyJournalFactory)))
                .CreateCounterpartyAutocompleteSelectorFactory());
            (deliveryPointJournalFactory ?? throw new ArgumentNullException(nameof(deliveryPointJournalFactory)))
            .SetDeliveryPointJournalFilterViewModel(_deliveryPointJournalFilter);
            evmeDeliveryPoint
            .SetEntityAutocompleteSelectorFactory(deliveryPointJournalFactory.CreateDeliveryPointByClientAutocompleteSelectorFactory());
        }
Beispiel #21
0
        public FuelIncomeInvoiceViewModel
        (
            IEntityUoWBuilder uowBuilder,
            IUnitOfWorkFactory unitOfWorkFactory,
            IEmployeeService employeeService,
            INomenclatureSelectorFactory nomenclatureSelectorFactory,
            ISubdivisionRepository subdivisionRepository,
            IFuelRepository fuelRepository,
            ICounterpartyJournalFactory counterpartyJournalFactory,
            ICommonServices commonServices
        ) : base(uowBuilder, unitOfWorkFactory, commonServices)
        {
            this.employeeService             = employeeService;
            this.nomenclatureSelectorFactory = nomenclatureSelectorFactory ?? throw new ArgumentNullException(nameof(nomenclatureSelectorFactory));
            this.subdivisionRepository       = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));
            this.fuelRepository             = fuelRepository ?? throw new ArgumentNullException(nameof(fuelRepository));
            this.counterpartyJournalFactory = counterpartyJournalFactory ?? throw new ArgumentNullException(nameof(counterpartyJournalFactory));
            TabName = "Входящая накладная по топливу";

            if (CurrentEmployee == null)
            {
                AbortOpening("К вашему пользователю не привязан сотрудник, невозможно открыть документ");
            }

            if (uowBuilder.IsNewEntity)
            {
                Entity.СreationTime = DateTime.Now;
                Entity.Author       = CurrentEmployee;
            }

            FuelBalanceViewModel = new FuelBalanceViewModel(subdivisionRepository, fuelRepository);

            CreateCommands();
            ConfigEntityUpdateSubscribes();
            ConfigureEntityPropertyChanges();
            UpdateCashSubdivisions();
            UpdateBalanceCache();
            ValidationContext.ServiceContainer.AddService(typeof(IFuelRepository), fuelRepository);

            ConfigureEntries();
        }
Beispiel #22
0
        public FastDeliveryAvailabilityFilterViewModel(
            ICounterpartyJournalFactory counterpartyJournalFactory,
            IEmployeeJournalFactory employeeJournalFactory,
            IDistrictJournalFactory districtJournalFactory)
        {
            EmployeeSelectorFactory =
                (employeeJournalFactory ?? throw new ArgumentNullException(nameof(employeeJournalFactory)))
                .CreateWorkingEmployeeAutocompleteSelectorFactory();

            var districtFilter = new DistrictJournalFilterViewModel()
            {
                Status = DistrictsSetStatus.Active
            };

            DistrictSelectorFactory =
                (districtJournalFactory ?? throw new ArgumentNullException(nameof(districtJournalFactory)))
                .CreateDistrictAutocompleteSelectorFactory(districtFilter);

            CounterpartySelectorFactory =
                (counterpartyJournalFactory ?? throw new ArgumentNullException(nameof(counterpartyJournalFactory)))
                .CreateCounterpartyAutocompleteSelectorFactory();
        }