예제 #1
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);
        }
예제 #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);
        }
예제 #3
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);
        }
예제 #4
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 counterpartyJournalFactory = new CounterpartyJournalFactory();

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

            return(journal);
        }
            );
예제 #5
0
        public IEntityAutocompleteSelectorFactory GetDefaultWaterSelectorFactory()
        {
            var nomenclatureFilter = new NomenclatureFilterViewModel {
                HidenByDefault = true
            };

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

            var counterpartyJournalFactory = new CounterpartyJournalFactory();
            var nomRep         = new NomenclatureRepository(new NomenclatureParametersProvider(new ParametersProvider()));
            var userRepository = new UserRepository();

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

            return(new EntityAutocompleteSelectorFactory <NomenclaturesJournalViewModel>(typeof(Nomenclature), () => journalViewModel));
        }
예제 #6
0
        public IEntitySelector CreateNomenclatureSelectorForFuelSelect()
        {
            NomenclatureFilterViewModel nomenclatureFilter = new NomenclatureFilterViewModel();

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

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

            var counterpartyJournalFactory = new CounterpartyJournalFactory();

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

            vm.SelectionMode = JournalSelectionMode.Multiple;

            return(vm);
        }
예제 #7
0
        public NomenclaturesJournalViewModel CreateNomenclaturesJournalViewModel(bool multiselect = false)
        {
            NomenclatureFilterViewModel nomenclatureFilter = new NomenclatureFilterViewModel();

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

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

            vm.SelectionMode = multiselect ? JournalSelectionMode.Multiple : JournalSelectionMode.Single;
            return(vm);
        }
예제 #8
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);
        }