public FirstClientsReport(
            IEntityAutocompleteSelectorFactory districtAutocompleteSelectorFactory,
            IDiscountReasonRepository discountReasonRepository)
        {
            var districtSelector = districtAutocompleteSelectorFactory ??
                                   throw new ArgumentNullException(nameof(districtAutocompleteSelectorFactory));

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

            Build();
            UoW = UnitOfWorkFactory.CreateWithoutRoot();

            var reasons = discountReasonRepository.GetActiveDiscountReasons(UoW);

            yCpecCmbDiscountReason.ItemsList    = reasons;
            yCpecCmbDiscountReason.SelectedItem = reasons?.OrderByDescending(r => r.Id).First() ?? null;

            yChooseOrderStatus.ItemsEnum           = typeof(OrderStatus);
            yChooseOrderStatus.ShowSpecialStateAll = true;

            yChooseThePaymentTypeForTheOrder.ItemsEnum           = typeof(PaymentType);
            yChooseThePaymentTypeForTheOrder.ShowSpecialStateAll = true;

            datePeriodPicker.StartDate = datePeriodPicker.EndDate = DateTime.Today;
            entryDistrict.SetEntityAutocompleteSelectorFactory(districtSelector);
            entryDistrict.CanEditReference = false;
        }
        public DiscountReasonJournalViewModel(
            IUnitOfWorkFactory unitOfWorkFactory,
            ICommonServices commonServices,
            IDiscountReasonRepository discountReasonRepository,
            IProductGroupJournalFactory productGroupJournalFactory,
            INomenclatureJournalFactory nomenclatureSelectorFactory,
            bool hideJournalForOpenDialog   = false,
            bool hideJournalForCreateDialog = false)
            : base(unitOfWorkFactory, commonServices, hideJournalForOpenDialog, hideJournalForCreateDialog)
        {
            _discountReasonRepository    = discountReasonRepository ?? throw new ArgumentNullException(nameof(discountReasonRepository));
            _productGroupJournalFactory  = productGroupJournalFactory ?? throw new ArgumentNullException(nameof(productGroupJournalFactory));
            _nomenclatureSelectorFactory = nomenclatureSelectorFactory ?? throw new ArgumentNullException(nameof(nomenclatureSelectorFactory));

            TabName = "Журнал оснований для скидки";

            UpdateOnChanges(typeof(DiscountReason));
        }
Ejemplo n.º 3
0
        public DiscountReasonViewModel(
            IEntityUoWBuilder uowBuilder,
            IUnitOfWorkFactory unitOfWorkFactory,
            ICommonServices commonServices,
            IDiscountReasonRepository discountReasonRepository,
            IProductGroupJournalFactory productGroupJournalFactory,
            INomenclatureJournalFactory nomenclatureSelectorFactory)
            : base(uowBuilder, unitOfWorkFactory, commonServices)
        {
            _discountReasonRepository   = discountReasonRepository ?? throw new ArgumentNullException(nameof(discountReasonRepository));
            _productGroupJournalFactory = productGroupJournalFactory ?? throw new ArgumentNullException(nameof(productGroupJournalFactory));
            _nomenclatureAutocompleteSelectorFactory =
                (nomenclatureSelectorFactory ?? throw new ArgumentNullException(nameof(nomenclatureSelectorFactory)))
                .GetDefaultNomenclatureSelectorFactory();
            TabName = UoWGeneric.IsNew ? "Новое основание для скидки" : $"Основание для скидки \"{Entity.Name}\"";

            InitializeNomenclatureCategoriesList();
        }
        public FirstSecondClientReport(IDiscountReasonRepository discountReasonRepository)
        {
            if (discountReasonRepository == null)
            {
                throw new ArgumentNullException(nameof(discountReasonRepository));
            }

            Build();
            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            var reasons = discountReasonRepository.GetDiscountReasons(UoW);

            yCpecCmbDiscountReason.ItemsList = reasons;
            daterangepicker.StartDate        = DateTime.Now.AddDays(-7);
            daterangepicker.EndDate          = DateTime.Now.AddDays(1);

            var employeeFactory = new EmployeeJournalFactory();

            evmeAuthor.SetEntityAutocompleteSelectorFactory(employeeFactory.CreateWorkingOfficeEmployeeAutocompleteSelectorFactory());
            buttonCreateReport.Clicked += (sender, e) => OnUpdate(true);
        }