public IEntityAutocompleteSelectorFactory CreateSubdivisionAutocompleteSelectorFactory(
            IEntityAutocompleteSelectorFactory employeeSelectorFactory = null)
        {
            CreateNewDependencies();

            return(new EntityAutocompleteSelectorFactory <SubdivisionsJournalViewModel>(
                       typeof(Subdivision),
                       () => new SubdivisionsJournalViewModel(
                           _filterViewModel ?? new SubdivisionFilterViewModel(),
                           UnitOfWorkFactory.GetDefaultFactory,
                           ServicesConfig.CommonServices,
                           employeeSelectorFactory ?? _employeeJournalFactory.CreateEmployeeAutocompleteSelectorFactory(),
                           _salesPlanJournalFactory,
                           _nomenclatureSelectorFactory)));
        }
        public WayBillGeneratorViewModel(
            IUnitOfWorkFactory unitOfWorkFactory,
            IInteractiveService interactiveService,
            INavigationManager navigation,
            IWayBillDocumentRepository wayBillDocumentRepository,
            RouteGeometryCalculator calculator,
            IEmployeeJournalFactory employeeJournalFactory,
            IDocTemplateRepository docTemplateRepository,
            IFileChooserProvider fileChooserProvider) : base(unitOfWorkFactory, interactiveService, navigation)
        {
            EntityAutocompleteSelectorFactory = employeeJournalFactory?.CreateEmployeeAutocompleteSelectorFactory()
                                                ?? throw new ArgumentNullException(nameof(employeeJournalFactory));
            _fileChooser = fileChooserProvider ?? throw new ArgumentNullException(nameof(fileChooserProvider));

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

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

            Entity = new WayBillDocumentGenerator(
                UnitOfWorkFactory.CreateWithoutRoot(), wayBillDocumentRepository, calculator, docTemplateRepository);

            TabName = "Путевые листы для ФО";
            CreateCommands();
        }
예제 #3
0
        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 = "Новая клиентская рекламация";
        }
 public GeneralSalaryInfoReport(
     IEmployeeJournalFactory employeeJournalFactory,
     IInteractiveService interactiveService)
 {
     _interactiveService      = interactiveService ?? throw new ArgumentNullException(nameof(interactiveService));
     _employeeSelectorFactory = employeeJournalFactory?.CreateEmployeeAutocompleteSelectorFactory()
                                ?? throw new ArgumentNullException(nameof(employeeJournalFactory));
     Build();
     UoW = UnitOfWorkFactory.CreateWithoutRoot();
     Configure();
 }
예제 #5
0
        public PremiumViewModel(IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory uowFactory, ICommonServices commonServices,
                                IEmployeeService employeeService, IEmployeeJournalFactory employeeJournalFactory, IPremiumTemplateJournalFactory premiumTemplateJournalFactory)
            : base(uowBuilder, uowFactory, commonServices)
        {
            _employeeService = employeeService ?? throw new ArgumentNullException(nameof(employeeService));

            TabName = Entity.Title;

            CanEdit = (Entity.Id == 0 && PermissionResult.CanCreate) || (Entity.Id != 0 && PermissionResult.CanUpdate);
            Entity.ObservableItems.ListContentChanged += OnObservableItemsListContentChanged;
            EmployeeAutocompleteSelectorFactory        = employeeJournalFactory.CreateEmployeeAutocompleteSelectorFactory();
            PremiumTemplateAutocompleteSelectorFactory = premiumTemplateJournalFactory.CreatePremiumTemplateAutocompleteSelectorFactory();
        }
        public ComplaintFilterViewModel(
            ICommonServices commonServices,
            ISubdivisionRepository subdivisionRepository,
            IEmployeeJournalFactory employeeSelectorFactory,
            ICounterpartyJournalFactory counterpartySelectorFactory
            )
        {
            this.commonServices         = commonServices ?? throw new ArgumentNullException(nameof(commonServices));
            CounterpartySelectorFactory =
                (counterpartySelectorFactory ?? throw new ArgumentNullException(nameof(counterpartySelectorFactory)))
                .CreateCounterpartyAutocompleteSelectorFactory();
            EmployeeSelectorFactory =
                (employeeSelectorFactory ?? throw new ArgumentNullException(nameof(employeeSelectorFactory)))
                .CreateWorkingEmployeeAutocompleteSelectorFactory();
            GuiltyItemVM = new GuiltyItemViewModel(
                new ComplaintGuiltyItem(),
                commonServices,
                subdivisionRepository,
                employeeSelectorFactory.CreateEmployeeAutocompleteSelectorFactory(),
                UoW,
                true
                );

            GuiltyItemVM.Entity.OnGuiltyTypeChange = () => {
                if (GuiltyItemVM.Entity.GuiltyType != ComplaintGuiltyTypes.Employee)
                {
                    GuiltyItemVM.Entity.Employee = null;
                }
                if (GuiltyItemVM.Entity.GuiltyType != ComplaintGuiltyTypes.Subdivision)
                {
                    GuiltyItemVM.Entity.Subdivision = null;
                }
            };
            GuiltyItemVM.OnGuiltyItemReady += (sender, e) => Update();

            _complaintKinds = complaintKindSource = UoW.GetAll <ComplaintKind>().ToList();

            UpdateWith(
                x => x.ComplaintType,
                x => x.ComplaintStatus,
                x => x.Counterparty,
                x => x.Employee,
                x => x.StartDate,
                x => x.EndDate,
                x => x.Subdivision,
                x => x.FilterDateType,
                x => x.ComplaintKind,
                x => x.ComplaintDiscussionStatus,
                x => x.ComplaintObject
                );
        }
예제 #7
0
 private void ConfigureDlg()
 {
     representationentryEmployee.RepresentationModel = new EmployeesVM(UoW);
     taskStatusComboBox.ItemsEnum = typeof(CallTaskStatus);
     representationtreeviewTask.Selection.Mode = SelectionMode.Multiple;
     _callTasksVm                   = new CallTasksVM(new BaseParametersProvider(new ParametersProvider()));
     _callTasksVm.NeedUpdate        = ycheckbuttonAutoUpdate.Active;
     _callTasksVm.ItemsListUpdated += (sender, e) => UpdateStatistics();
     _callTasksVm.Filter            =
         new CallTaskFilterViewModel(_employeeJournalFactory.CreateEmployeeAutocompleteSelectorFactory(), _deliveryPointRepository);
     _callTasksVm.PropertyChanged += CreateCallTaskFilterView;
     representationtreeviewTask.RepresentationModel = _callTasksVm;
     CreateCallTaskFilterView(_callTasksVm.Filter, EventArgs.Empty);
     UpdateStatistics();
 }
        public MastersVisitReport(IEmployeeJournalFactory employeeJournalFactory)
        {
            if (employeeJournalFactory == null)
            {
                throw new ArgumentNullException(nameof(employeeJournalFactory));
            }

            Build();
            UoW = UnitOfWorkFactory.CreateWithoutRoot();
            var driversFilter = new EmployeeFilterViewModel();

            driversFilter.SetAndRefilterAtOnce(
                x => x.Category = EmployeeCategory.driver,
                x => x.Status   = null);
            employeeJournalFactory.SetEmployeeFilterViewModel(driversFilter);
            evmeEmployee.SetEntityAutocompleteSelectorFactory(employeeJournalFactory.CreateEmployeeAutocompleteSelectorFactory());
        }
예제 #9
0
 private void ConfigureDlg()
 {
     evmeEmployee.SetEntityAutocompleteSelectorFactory(_employeeJournalFactory.CreateWorkingEmployeeAutocompleteSelectorFactory());
     evmeEmployee.ChangedByUser  += OnEvmeEmployeeChangedByUser;
     taskStatusComboBox.ItemsEnum = typeof(CallTaskStatus);
     representationtreeviewTask.Selection.Mode = SelectionMode.Multiple;
     _callTasksVm                   = new CallTasksVM(new BaseParametersProvider(new ParametersProvider()), new FileDialogService());
     _callTasksVm.NeedUpdate        = ycheckbuttonAutoUpdate.Active;
     _callTasksVm.ItemsListUpdated += (sender, e) => UpdateStatistics();
     _callTasksVm.Filter            =
         new CallTaskFilterViewModel(_employeeJournalFactory.CreateEmployeeAutocompleteSelectorFactory(), _deliveryPointRepository);
     _callTasksVm.PropertyChanged += CreateCallTaskFilterView;
     representationtreeviewTask.RepresentationModel = _callTasksVm;
     buttonExport.Clicked += (sender, args) => Export();
     CreateCallTaskFilterView(_callTasksVm.Filter, EventArgs.Empty);
     UpdateStatistics();
 }
예제 #10
0
        public void CreateComplaintCommand()
        {
            var employeeSelectorFactory = _employeeJournalFactory.CreateEmployeeAutocompleteSelectorFactory();

            var counterpartySelectorFactory = _counterpartyJournalFactory.CreateCounterpartyAutocompleteSelectorFactory();

            var parameters = new Dictionary <string, object> {
                { "uowBuilder", EntityUoWBuilder.ForCreate() },
                { "unitOfWorkFactory", UnitOfWorkFactory.GetDefaultFactory },
                //Autofac: IEmployeeService
                { "employeeSelectorFactory", employeeSelectorFactory },
                { "counterpartySelectorFactory", counterpartySelectorFactory },
                //Autofac: ICommonServices
                //Autofac: IUserRepository
                { "phone", "+7" + ActiveCall.Phone.Number }
            };

            _tdiNavigation.OpenTdiTabOnTdiNamedArgs <CreateComplaintViewModel>(null, parameters);
        }
예제 #11
0
        public void CreateComplaint(Order order)
        {
            if (order != null)
            {
                var employeeSelectorFactory = _employeeJournalFactory.CreateEmployeeAutocompleteSelectorFactory();

                var counterpartySelectorFactory = _counterpartyJournalFactory.CreateCounterpartyAutocompleteSelectorFactory();

                var parameters = new Dictionary <string, object> {
                    { "order", order },
                    { "uowBuilder", EntityUoWBuilder.ForCreate() },
                    { "unitOfWorkFactory", UnitOfWorkFactory.GetDefaultFactory },
                    { "employeeSelectorFactory", employeeSelectorFactory },
                    { "counterpartySelectorFactory", counterpartySelectorFactory },
                    { "phone", "+7" + this.MangoManager.CurrentCall.Phone.Number }
                };
                tdiNavigation.OpenTdiTabOnTdiNamedArgs <CreateComplaintViewModel>(null, parameters);
            }
        }
        public PremiumViewModel(IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory uowFactory, ICommonServices commonServices,
                                IEmployeeService employeeService, IEmployeeJournalFactory employeeJournalFactory, IPremiumTemplateJournalFactory premiumTemplateJournalFactory)
            : base(uowBuilder, uowFactory, commonServices)
        {
            TabName = Entity.Title;

            if (UoW.IsNew)
            {
                Entity.Author = employeeService.GetEmployeeForUser(UoW, CurrentUser.Id);
                if (Entity.Author == null)
                {
                    AbortOpening("Ваш пользователь не привязан к действующему сотруднику. Невозможно создать премию"
                                 + ", т.к. некого указать в качестве автора");
                }
            }

            CanEdit = (Entity.Id == 0 && PermissionResult.CanCreate) || (Entity.Id != 0 && PermissionResult.CanUpdate);
            Entity.ObservableItems.ListContentChanged += OnObservableItemsListContentChanged;
            EmployeeAutocompleteSelectorFactory        = employeeJournalFactory.CreateEmployeeAutocompleteSelectorFactory();
            PremiumTemplateAutocompleteSelectorFactory = premiumTemplateJournalFactory.CreatePremiumTemplateAutocompleteSelectorFactory();
        }
예제 #13
0
        public ExpenseCategoryViewModel(
            IEntityUoWBuilder uowBuilder,
            IUnitOfWorkFactory unitOfWorkFactory,
            ICommonServices commonServices,
            IFileChooserProvider fileChooserProvider,
            ExpenseCategoryJournalFilterViewModel journalFilterViewModel,
            IEmployeeJournalFactory employeeJournalFactory,
            ISubdivisionJournalFactory subdivisionJournalFactory
            ) : base(uowBuilder, unitOfWorkFactory, commonServices)
        {
            if (employeeJournalFactory == null)
            {
                throw new ArgumentNullException(nameof(employeeJournalFactory));
            }

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

            ExpenseCategoryAutocompleteSelectorFactory =
                new ExpenseCategoryAutoCompleteSelectorFactory(
                    commonServices, journalFilterViewModel, fileChooserProvider, employeeJournalFactory, subdivisionJournalFactory);

            SubdivisionAutocompleteSelectorFactory =
                subdivisionJournalFactory.CreateDefaultSubdivisionAutocompleteSelectorFactory(
                    employeeJournalFactory.CreateEmployeeAutocompleteSelectorFactory());

            if (uowBuilder.IsNewEntity)
            {
                TabName = "Создание новой категории расхода";
            }
            else
            {
                TabName = $"{Entity.Title}";
            }
        }
 private void ConfigureEntries()
 {
     EmployeeAutocompleteSelectorFactory = employeeJournalFactory.CreateEmployeeAutocompleteSelectorFactory();
 }
예제 #15
0
        private void RegisterComplaints()
        {
            var complaintConfig = RegisterEntity <Complaint>(GetComplaintQuery)
                                  .AddDocumentConfiguration(
                //функция диалога создания документа
                () => new CreateComplaintViewModel(
                    EntityUoWBuilder.ForCreate(),
                    _unitOfWorkFactory,
                    _employeeService,
                    _counterpartySelectorFactory,
                    _subdivisionRepository,
                    _commonServices,
                    _nomenclatureRepository,
                    _userRepository,
                    _filePickerService,
                    _orderSelectorFactory,
                    _employeeJournalFactory,
                    _counterpartyJournalFactory,
                    _deliveryPointJournalFactory,
                    _subdivisionJournalFactory,
                    _gtkDlgOpener,
                    _undeliveredOrdersJournalOpener,
                    _nomenclatureSelector,
                    _undeliveredOrdersRepository
                    ),
                //функция диалога открытия документа
                (ComplaintJournalNode node) => new ComplaintViewModel(
                    EntityUoWBuilder.ForOpen(node.Id),
                    _unitOfWorkFactory,
                    _commonServices,
                    _undeliveredOrdersJournalOpener,
                    _employeeService,
                    _counterpartySelectorFactory,
                    _filePickerService,
                    _subdivisionRepository,
                    _nomenclatureRepository,
                    _userRepository,
                    _orderSelectorFactory,
                    _employeeJournalFactory,
                    _counterpartyJournalFactory,
                    _deliveryPointJournalFactory,
                    _subdivisionJournalFactory,
                    _gtkDlgOpener,
                    _undeliveredOrdersJournalOpener,
                    _salesPlanJournalFactory,
                    _nomenclatureSelector,
                    _undeliveredOrdersRepository
                    ),
                //функция идентификации документа
                (ComplaintJournalNode node) => {
                return(node.EntityType == typeof(Complaint));
            },
                "Клиентская рекламация",
                new JournalParametersForDocument()
            {
                HideJournalForCreateDialog = false, HideJournalForOpenDialog = true
            }
                )
                                  .AddDocumentConfiguration(
                //функция диалога создания документа
                () => new CreateInnerComplaintViewModel(
                    EntityUoWBuilder.ForCreate(),
                    _unitOfWorkFactory,
                    _employeeService,
                    _subdivisionRepository,
                    _commonServices,
                    _employeeJournalFactory.CreateEmployeeAutocompleteSelectorFactory(),
                    _filePickerService,
                    new UserRepository()
                    ),
                //функция диалога открытия документа
                (ComplaintJournalNode node) => new ComplaintViewModel(
                    EntityUoWBuilder.ForOpen(node.Id),
                    _unitOfWorkFactory,
                    _commonServices,
                    _undeliveredOrdersJournalOpener,
                    _employeeService,
                    _counterpartySelectorFactory,
                    _filePickerService,
                    _subdivisionRepository,
                    _nomenclatureRepository,
                    _userRepository,
                    _orderSelectorFactory,
                    _employeeJournalFactory,
                    _counterpartyJournalFactory,
                    _deliveryPointJournalFactory,
                    _subdivisionJournalFactory,
                    _gtkDlgOpener,
                    _undeliveredOrdersJournalOpener,
                    _salesPlanJournalFactory,
                    _nomenclatureSelector,
                    _undeliveredOrdersRepository
                    ),
                //функция идентификации документа
                (ComplaintJournalNode node) => {
                return(node.EntityType == typeof(Complaint));
            },
                "Внутренняя рекламация",
                new JournalParametersForDocument()
            {
                HideJournalForCreateDialog = false, HideJournalForOpenDialog = true
            }
                );

            //завершение конфигурации
            complaintConfig.FinishConfiguration();
        }
        public UndeliveredOrdersFilterViewModel(ICommonServices commonServices, IOrderSelectorFactory orderSelectorFactory,
                                                IEmployeeJournalFactory employeeJournalFactory, ICounterpartyJournalFactory counterpartyJournalFactory,
                                                IDeliveryPointJournalFactory deliveryPointJournalFactory, ISubdivisionJournalFactory subdivisionJournalFactory)
        {
            OrderSelectorFactory = (orderSelectorFactory ?? throw new ArgumentNullException(nameof(orderSelectorFactory)))
                                   .CreateOrderAutocompleteSelectorFactory();

            DriverEmployeeSelectorFactory = (employeeJournalFactory ?? throw new ArgumentNullException(nameof(employeeJournalFactory)))
                                            .CreateWorkingDriverEmployeeAutocompleteSelectorFactory();

            OfficeEmployeeSelectorFactory = employeeJournalFactory.CreateWorkingOfficeEmployeeAutocompleteSelectorFactory();

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

            DeliveryPointSelectorFactory = (deliveryPointJournalFactory ?? throw new ArgumentNullException(nameof(deliveryPointJournalFactory)))
                                           .CreateDeliveryPointAutocompleteSelectorFactory();

            AuthorSubdivisionSelectorFactory = (subdivisionJournalFactory ?? throw new ArgumentNullException(nameof(subdivisionJournalFactory)))
                                               .CreateDefaultSubdivisionAutocompleteSelectorFactory(employeeJournalFactory.CreateEmployeeAutocompleteSelectorFactory());

            Subdivisions = UoW.GetAll <Subdivision>();
            RestrictOldOrderStartDate = DateTime.Today.AddMonths(-1);
            RestrictOldOrderEndDate   = DateTime.Today.AddMonths(1);
        }
 private void ConfigureEntries()
 {
     DriverSelectorFactory = employeeJournalFactory.CreateEmployeeAutocompleteSelectorFactory();
     CarSelectorFactory    = carJournalFactory.CreateCarAutocompleteSelectorFactory();
 }