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()
                       ));
        }
示例#2
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()
                                                                                     )
                                                                                 ));
        }
示例#3
0
        public IEntityAutocompleteSelectorFactory CreateDefaultExpenseCategoryAutocompleteSelectorFactory()
        {
            var expenceCategoryfilterViewModel = new ExpenseCategoryJournalFilterViewModel();

            expenceCategoryfilterViewModel.ExcludedIds    = _excludedIds;
            expenceCategoryfilterViewModel.HidenByDefault = true;

            IFileChooserProvider chooserProvider = new FileChooser();
            var employeeFilter = new EmployeeFilterViewModel
            {
                Status = EmployeeStatus.IsWorking
            };
            var commonServices = ServicesConfig.CommonServices;

            var employeeJournalFactory    = new EmployeeJournalFactory(employeeFilter);
            var subdivisionJournalFactory = new SubdivisionJournalFactory();
            var expenseFactory            = new ExpenseCategorySelectorFactory();

            return(new ExpenseCategoryAutoCompleteSelectorFactory(
                       commonServices,
                       expenceCategoryfilterViewModel,
                       chooserProvider,
                       employeeJournalFactory,
                       subdivisionJournalFactory,
                       expenseFactory));
        }
示例#4
0
        public IEntityAutocompleteSelectorFactory CreateSimpleExpenseCategoryAutocompleteSelectorFactory()
        {
            var expenceCategoryfilterViewModel = new ExpenseCategoryJournalFilterViewModel();

            expenceCategoryfilterViewModel.ExcludedIds    = _excludedIds;
            expenceCategoryfilterViewModel.HidenByDefault = true;

            var employeeFilter = new EmployeeFilterViewModel
            {
                Status = EmployeeStatus.IsWorking
            };

            var employeeJournalFactory    = new EmployeeJournalFactory(employeeFilter);
            var subdivisionJournalFactory = new SubdivisionJournalFactory();
            var expenseFactory            = new ExpenseCategorySelectorFactory();

            return(new SimpleEntitySelectorFactory <ExpenseCategory, ExpenseCategoryViewModel>(() =>
            {
                var journal = new SimpleEntityJournalViewModel <ExpenseCategory, ExpenseCategoryViewModel>(
                    x => x.Name,
                    () => new ExpenseCategoryViewModel(
                        EntityUoWBuilder.ForCreate(),
                        UnitOfWorkFactory.GetDefaultFactory,
                        ServicesConfig.CommonServices,
                        employeeJournalFactory,
                        subdivisionJournalFactory,
                        expenseFactory
                        ),
                    node => new ExpenseCategoryViewModel(
                        EntityUoWBuilder.ForOpen(node.Id),
                        UnitOfWorkFactory.GetDefaultFactory,
                        ServicesConfig.CommonServices,
                        employeeJournalFactory,
                        subdivisionJournalFactory,
                        expenseFactory
                        ),
                    UnitOfWorkFactory.GetDefaultFactory,
                    ServicesConfig.CommonServices
                    );
                journal.SelectionMode = JournalSelectionMode.Single;
                journal.SetFilter(expenceCategoryfilterViewModel,
                                  filter =>
                {
                    if (filter.ShowArchive)
                    {
                        return Restrictions.Not(Restrictions.In("Id", filter.ExcludedIds.ToArray()));
                    }

                    return Restrictions.Conjunction()
                    .Add(Restrictions.Not(Restrictions.In("Id", filter.ExcludedIds.ToArray())))
                    .Add(Restrictions.Eq(
                             Projections.Property <ExpenseCategory>(c => c.IsArchive), filter.ShowArchive));
                });
                return journal;
            }));
        }
        public IEntityAutocompleteSelectorFactory CreateDefaultIncomeCategoryAutocompleteSelectorFactory()
        {
            var incomeCategoryFilter = new IncomeCategoryJournalFilterViewModel();
            var commonServices       = ServicesConfig.CommonServices;
            IFileChooserProvider chooserIncomeProvider = new FileChooser();
            var employeeJournalFactory    = new EmployeeJournalFactory();
            var subdivisionJournalFactory = new SubdivisionJournalFactory();
            var incomeFactory             = new IncomeCategorySelectorFactory();

            return(new IncomeCategoryAutoCompleteSelectorFactory(
                       commonServices,
                       incomeCategoryFilter,
                       chooserIncomeProvider,
                       employeeJournalFactory,
                       subdivisionJournalFactory,
                       incomeFactory));
        }
        public IEntityAutocompleteSelectorFactory CreateSimpleIncomeCategoryAutocompleteSelectorFactory()
        {
            var commonServices            = ServicesConfig.CommonServices;
            var employeeJournalFactory    = new EmployeeJournalFactory();
            var subdivisionJournalFactory = new SubdivisionJournalFactory();
            var incomeFactory             = new IncomeCategorySelectorFactory();

            var incomeCategoryAutocompleteSelectorFactory =
                new SimpleEntitySelectorFactory <IncomeCategory, IncomeCategoryViewModel>(
                    () =>
            {
                var incomeCategoryJournalViewModel =
                    new SimpleEntityJournalViewModel <IncomeCategory, IncomeCategoryViewModel>(
                        x => x.Name,
                        () => new IncomeCategoryViewModel(
                            EntityUoWBuilder.ForCreate(),
                            UnitOfWorkFactory.GetDefaultFactory,
                            commonServices,
                            employeeJournalFactory,
                            subdivisionJournalFactory,
                            incomeFactory
                            ),
                        node => new IncomeCategoryViewModel(
                            EntityUoWBuilder.ForOpen(node.Id),
                            UnitOfWorkFactory.GetDefaultFactory,
                            commonServices,
                            employeeJournalFactory,
                            subdivisionJournalFactory,
                            incomeFactory
                            ),
                        UnitOfWorkFactory.GetDefaultFactory,
                        commonServices
                        )
                {
                    SelectionMode = JournalSelectionMode.Single
                };
                return(incomeCategoryJournalViewModel);
            });

            return(incomeCategoryAutocompleteSelectorFactory);
        }
        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());
            }));
        }