Esempio n. 1
0
        public IEntityAutocompleteSelectorFactory CreateOrderAutocompleteSelectorFactory()
        {
            ISubdivisionJournalFactory subdivisionJournalFactory = new SubdivisionJournalFactory();

            var counterpartyJournalFactory  = new CounterpartyJournalFactory();
            var deliveryPointJournalFactory = new DeliveryPointJournalFactory();
            var nomenclatureRepository      = new NomenclatureRepository(new NomenclatureParametersProvider(new ParametersProvider()));
            var userRepository = new UserRepository();

            var orderJournalFilterViewModel = new OrderJournalFilterViewModel(counterpartyJournalFactory, deliveryPointJournalFactory);

            return(new EntityAutocompleteSelectorFactory <OrderJournalViewModel>(typeof(Order),
                                                                                 () => new OrderJournalViewModel(
                                                                                     orderJournalFilterViewModel,
                                                                                     UnitOfWorkFactory.GetDefaultFactory,
                                                                                     ServicesConfig.CommonServices,
                                                                                     VodovozGtkServicesConfig.EmployeeService,
                                                                                     nomenclatureRepository,
                                                                                     userRepository,
                                                                                     new OrderSelectorFactory(),
                                                                                     new EmployeeJournalFactory(),
                                                                                     counterpartyJournalFactory,
                                                                                     new DeliveryPointJournalFactory(),
                                                                                     subdivisionJournalFactory,
                                                                                     new GtkTabsOpener(),
                                                                                     new UndeliveredOrdersJournalOpener(),
                                                                                     new NomenclatureSelectorFactory(),
                                                                                     new UndeliveredOrdersRepository()
                                                                                     )
                                                                                 ));
        }
        public OrderJournalViewModel CreateOrderJournalViewModel()
        {
            var subdivisionJournalFactory   = new SubdivisionJournalFactory();
            var counterpartyJournalFactory  = new CounterpartyJournalFactory();
            var deliveryPointJournalFactory = new DeliveryPointJournalFactory();
            var nomenclatureRepository      = new NomenclatureRepository(new NomenclatureParametersProvider(new ParametersProvider()));
            var userRepository = new UserRepository();

            return(new OrderJournalViewModel(
                       _orderJournalFilter ?? new OrderJournalFilterViewModel(counterpartyJournalFactory, deliveryPointJournalFactory),
                       UnitOfWorkFactory.GetDefaultFactory,
                       ServicesConfig.CommonServices,
                       VodovozGtkServicesConfig.EmployeeService,
                       nomenclatureRepository,
                       userRepository,
                       new OrderSelectorFactory(),
                       new EmployeeJournalFactory(),
                       counterpartyJournalFactory,
                       new DeliveryPointJournalFactory(),
                       subdivisionJournalFactory,
                       new GtkTabsOpener(),
                       new UndeliveredOrdersJournalOpener(),
                       new NomenclatureJournalFactory(),
                       new UndeliveredOrdersRepository(),
                       new SubdivisionRepository(new ParametersProvider()),
                       new FileDialogService()
                       ));
        }
        public IEntityAutocompleteSelectorFactory CreateCashSelfDeliveryOrderAutocompleteSelector()
        {
            var subdivisionJournalFactory   = new SubdivisionJournalFactory();
            var counterpartyJournalFactory  = new CounterpartyJournalFactory();
            var deliveryPointJournalFactory = new DeliveryPointJournalFactory();
            var nomenclatureRepository      = new NomenclatureRepository(new NomenclatureParametersProvider(new ParametersProvider()));
            var userRepository = new UserRepository();

            return(new EntityAutocompleteSelectorFactory <OrderJournalViewModel>(
                       typeof(Order),
                       () =>
            {
                var filter = new OrderJournalFilterViewModel(counterpartyJournalFactory, deliveryPointJournalFactory);
                filter.SetAndRefilterAtOnce(
                    x => x.RestrictStatus = OrderStatus.WaitForPayment,
                    x => x.AllowPaymentTypes = new[] { PaymentType.cash },
                    x => x.RestrictOnlySelfDelivery = true,
                    x => x.RestrictWithoutSelfDelivery = false,
                    x => x.RestrictHideService = true,
                    x => x.RestrictOnlyService = false);

                return new OrderJournalViewModel(
                    filter,
                    UnitOfWorkFactory.GetDefaultFactory,
                    ServicesConfig.CommonServices,
                    VodovozGtkServicesConfig.EmployeeService,
                    nomenclatureRepository,
                    userRepository,
                    new OrderSelectorFactory(),
                    new EmployeeJournalFactory(),
                    counterpartyJournalFactory,
                    new DeliveryPointJournalFactory(),
                    subdivisionJournalFactory,
                    new GtkTabsOpener(),
                    new UndeliveredOrdersJournalOpener(),
                    new NomenclatureJournalFactory(),
                    new UndeliveredOrdersRepository(),
                    new SubdivisionRepository(new ParametersProvider()),
                    new FileDialogService());
            }));
        }