public RetailOrderJournalViewModel(
            OrderJournalFilterViewModel filterViewModel,
            IUnitOfWorkFactory unitOfWorkFactory,
            ICommonServices commonServices,
            IEmployeeService employeeService,
            INomenclatureRepository nomenclatureRepository,
            IUserRepository userRepository,
            IOrderSelectorFactory orderSelectorFactory,
            IEmployeeJournalFactory employeeJournalFactory,
            ICounterpartyJournalFactory counterpartyJournalFactory,
            IDeliveryPointJournalFactory deliveryPointJournalFactory,
            ISubdivisionJournalFactory subdivisionJournalFactory,
            IGtkTabsOpener gtkDialogsOpener,
            IUndeliveredOrdersJournalOpener undeliveredOrdersJournalOpener,
            INomenclatureSelectorFactory nomenclatureSelector,
            IUndeliveredOrdersRepository undeliveredOrdersRepository) : base(filterViewModel, unitOfWorkFactory, commonServices)
        {
            _commonServices         = commonServices ?? throw new ArgumentNullException(nameof(commonServices));
            _employeeService        = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
            _nomenclatureRepository = nomenclatureRepository ?? throw new ArgumentNullException(nameof(nomenclatureRepository));
            _userRepository         = userRepository ?? throw new ArgumentNullException(nameof(userRepository));

            _orderSelectorFactory        = orderSelectorFactory ?? throw new ArgumentNullException(nameof(orderSelectorFactory));
            _employeeJournalFactory      = employeeJournalFactory ?? throw new ArgumentNullException(nameof(employeeJournalFactory));
            _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));

            _nomenclatureSelectorFactory = nomenclatureSelector?.GetDefaultNomenclatureSelectorFactory()
                                           ?? throw new ArgumentNullException(nameof(_nomenclatureSelectorFactory));
            _counterpartySelectorFactory    = counterpartyJournalFactory.CreateCounterpartyAutocompleteSelectorFactory();
            _undeliveredOrdersJournalOpener =
                undeliveredOrdersJournalOpener ?? throw new ArgumentNullException(nameof(undeliveredOrdersJournalOpener));
            _undeliveredOrdersRepository =
                undeliveredOrdersRepository ?? throw new ArgumentNullException(nameof(undeliveredOrdersRepository));

            TabName = "Журнал заказов";

            RegisterOrders();
            RegisterOrdersWithoutShipmentForDebt();
            RegisterOrdersWithoutShipmentForPayment();
            RegisterOrdersWithoutShipmentForAdvancePayment();

            var threadLoader = DataLoader as ThreadDataLoader <RetailOrderJournalNode>;

            threadLoader.MergeInOrderBy(x => x.CreateDate, true);

            FinishJournalConfiguration();

            UpdateOnChanges(
                typeof(VodovozOrder),
                typeof(OrderWithoutShipmentForDebt),
                typeof(OrderWithoutShipmentForPayment),
                typeof(OrderWithoutShipmentForAdvancePayment),
                typeof(OrderWithoutShipmentForPaymentItem),
                typeof(OrderWithoutShipmentForAdvancePaymentItem),
                typeof(OrderItem)
                );
        }
        public UndeliveredOrdersJournalViewModel(UndeliveredOrdersFilterViewModel filterViewModel, IUnitOfWorkFactory unitOfWorkFactory,
                                                 ICommonServices commonServices, IGtkTabsOpener gtkDialogsOpener, IEmployeeJournalFactory driverEmployeeJournalFactory,
                                                 IEmployeeService employeeService, IUndeliveredOrdersJournalOpener undeliveryViewOpener, IOrderSelectorFactory orderSelectorFactory,
                                                 IUndeliveredOrdersRepository undeliveredOrdersRepository, IEmployeeSettings employeeSettings)
            : base(filterViewModel, unitOfWorkFactory, commonServices)
        {
            _gtkDlgOpener = gtkDialogsOpener ?? throw new ArgumentNullException(nameof(gtkDialogsOpener));
            _driverEmployeeJournalFactory = driverEmployeeJournalFactory ?? throw new ArgumentNullException(nameof(driverEmployeeJournalFactory));
            _employeeService             = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
            _undeliveryViewOpener        = undeliveryViewOpener ?? throw new ArgumentNullException(nameof(undeliveryViewOpener));
            _orderSelectorFactory        = orderSelectorFactory ?? throw new ArgumentNullException(nameof(orderSelectorFactory));
            _undeliveredOrdersRepository =
                undeliveredOrdersRepository ?? throw new ArgumentNullException(nameof(undeliveredOrdersRepository));
            _employeeSettings = employeeSettings ?? throw new ArgumentNullException(nameof(employeeSettings));
            _commonServices   = commonServices ?? throw new ArgumentNullException(nameof(commonServices));

            _canCloseUndeliveries = commonServices.CurrentPermissionService.ValidatePresetPermission("can_close_undeliveries");

            TabName = "Журнал недовозов";

            UpdateOnChanges(
                typeof(UndeliveredOrder)
                );

            RegisterUndeliveredOrders();

            DataLoader.ItemsListUpdated      += (sender, e) => CurrentObjectChanged?.Invoke(this, new CurrentObjectChangedArgs(null));
            DataLoader.PostLoadProcessingFunc = BeforeItemsUpdated;

            FinishJournalConfiguration();
        }
Exemplo n.º 3
0
        public CreateComplaintViewModel(Order order,
                                        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) : this(uowBuilder, unitOfWorkFactory, employeeService, counterpartySelectorFactory, subdivisionRepository,
                                                                    commonServices, nomenclatureRepository, userRepository, filePickerService, orderSelectorFactory,
                                                                    employeeJournalFactory, counterpartyJournalFactory, deliveryPointJournalFactory, subdivisionJournalFactory, gtkDialogsOpener,
                                                                    undeliveredOrdersJournalOpener, nomenclatureSelector, undeliveredOrdersRepository, phone)
        {
            var currentOrder = UoW.GetById <Order>(order.Id);

            Entity.Order        = currentOrder;
            Entity.Counterparty = currentOrder.Client;
            Entity.Phone        = phone;
        }
Exemplo n.º 4
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 = "Новая клиентская рекламация";
        }
Exemplo n.º 5
0
        public RouteListAnalysisViewModel(
            IEntityUoWBuilder uowBuilder,
            IUnitOfWorkFactory unitOfWorkFactory,
            ICommonServices commonServices,
            IOrderSelectorFactory orderSelectorFactory,
            IEmployeeJournalFactory employeeJournalFactory,
            ICounterpartyJournalFactory counterpartyJournalFactory,
            IDeliveryPointJournalFactory deliveryPointJournalFactory,
            ISubdivisionJournalFactory subdivisionJournalFactory,
            IGtkTabsOpener gtkDialogsOpener,
            IUndeliveredOrdersJournalOpener undeliveredOrdersJournalOpener,
            IDeliveryShiftRepository deliveryShiftRepository,
            IEmployeeSettings employeeSettings,
            IUndeliveredOrdersRepository undeliveredOrdersRepository) : base(uowBuilder, unitOfWorkFactory, commonServices)
        {
            _orderSelectorFactory           = orderSelectorFactory ?? throw new ArgumentNullException(nameof(orderSelectorFactory));
            _employeeJournalFactory         = employeeJournalFactory ?? throw new ArgumentNullException(nameof(employeeJournalFactory));
            _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));
            _employeeSettings               = employeeSettings ?? throw new ArgumentNullException(nameof(employeeSettings));
            UndeliveredOrdersRepository     =
                undeliveredOrdersRepository ?? throw new ArgumentNullException(nameof(undeliveredOrdersRepository));
            _commonServices = commonServices ?? throw new ArgumentNullException(nameof(commonServices));

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

            DeliveryShifts = deliveryShiftRepository.ActiveShifts(UoW);
            Entity.ObservableAddresses.PropertyOfElementChanged += ObservableAddressesOnPropertyOfElementChanged;

            undeliveryViewOpener = new UndeliveredOrdersJournalOpener();
            employeeService      = VodovozGtkServicesConfig.EmployeeService;
            CurrentEmployee      = employeeService.GetEmployeeForUser(UoW, CurrentUser.Id);

            if (CurrentEmployee == null)
            {
                AbortOpening("Ваш пользователь не привязан к действующему сотруднику, вы не можете открыть " +
                             "диалог разбора МЛ, так как некого указывать в качестве логиста.", "Невозможно открыть разбор МЛ");
            }

            LogisticanSelectorFactory = _employeeJournalFactory.CreateWorkingOfficeEmployeeAutocompleteSelectorFactory();
            DriverSelectorFactory     = _employeeJournalFactory.CreateWorkingDriverEmployeeAutocompleteSelectorFactory();
            ForwarderSelectorFactory  = _employeeJournalFactory.CreateWorkingForwarderEmployeeAutocompleteSelectorFactory();

            TabName = $"Диалог разбора {Entity.Title}";
        }
        public RouteListJournalViewModel(
            RouteListJournalFilterViewModel filterViewModel,
            IRouteListRepository routeListRepository,
            IFuelRepository fuelRepository,
            ISubdivisionRepository subdivisionRepository,
            ICategoryRepository categoryRepository,
            ITrackRepository trackRepository,
            IUndeliveredOrdersRepository undeliveredOrdersRepository,
            IDeliveryShiftRepository deliveryShiftRepository,
            IUnitOfWorkFactory unitOfWorkFactory,
            IRouteListParametersProvider routeListParametersProvider,
            ICallTaskWorker callTaskWorker,
            IWarehouseRepository warehouseRepository,
            ICarJournalFactory carJournalFactory,
            IEmployeeJournalFactory employeeJournalFactory,
            IEmployeeRepository employeeRepository,
            IGtkTabsOpener gtkTabsOpener,
            IOrderSelectorFactory orderSelectorFactory,
            ICounterpartyJournalFactory counterpartyJournalFactory,
            IDeliveryPointJournalFactory deliveryPointJournalFactory,
            ISubdivisionJournalFactory subdivisionJournalFactory,
            IUndeliveredOrdersJournalOpener undeliveredOrdersJournalOpener,
            IStockRepository stockRepository,
            IReportPrinter reportPrinter,
            ITerminalNomenclatureProvider terminalNomenclatureProvider,
            IEmployeeSettings employeeSettings,
            ICommonServices commonServices)
            : base(filterViewModel, unitOfWorkFactory, commonServices)
        {
            _routeListRepository         = routeListRepository ?? throw new ArgumentNullException(nameof(routeListRepository));
            _fuelRepository              = fuelRepository ?? throw new ArgumentNullException(nameof(fuelRepository));
            _subdivisionRepository       = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));
            _categoryRepository          = categoryRepository ?? throw new ArgumentNullException(nameof(categoryRepository));
            _trackRepository             = trackRepository ?? throw new ArgumentNullException(nameof(trackRepository));
            _undeliveredOrdersRepository =
                undeliveredOrdersRepository ?? throw new ArgumentNullException(nameof(undeliveredOrdersRepository));
            _deliveryShiftRepository     = deliveryShiftRepository ?? throw new ArgumentNullException(nameof(deliveryShiftRepository));
            _routeListParametersProvider =
                routeListParametersProvider ?? throw new ArgumentNullException(nameof(routeListParametersProvider));
            _callTaskWorker              = callTaskWorker ?? throw new ArgumentNullException(nameof(callTaskWorker));
            _warehouseRepository         = warehouseRepository ?? throw new ArgumentNullException(nameof(warehouseRepository));
            _carJournalFactory           = carJournalFactory ?? throw new ArgumentNullException(nameof(carJournalFactory));
            _employeeJournalFactory      = employeeJournalFactory ?? throw new ArgumentNullException(nameof(employeeJournalFactory));
            _employeeRepository          = employeeRepository ?? throw new ArgumentNullException(nameof(employeeRepository));
            _gtkTabsOpener               = gtkTabsOpener ?? throw new ArgumentNullException(nameof(gtkTabsOpener));
            _orderSelectorFactory        = orderSelectorFactory ?? throw new ArgumentNullException(nameof(orderSelectorFactory));
            _counterpartyJournalFactory  = counterpartyJournalFactory ?? throw new ArgumentNullException(nameof(counterpartyJournalFactory));
            _deliveryPointJournalFactory =
                deliveryPointJournalFactory ?? throw new ArgumentNullException(nameof(deliveryPointJournalFactory));
            _subdivisionJournalFactory      = subdivisionJournalFactory ?? throw new ArgumentNullException(nameof(subdivisionJournalFactory));
            _undeliveredOrdersJournalOpener =
                undeliveredOrdersJournalOpener ?? throw new ArgumentNullException(nameof(undeliveredOrdersJournalOpener));
            _stockRepository = stockRepository ?? throw new ArgumentNullException(nameof(stockRepository));
            _reportPrinter   = reportPrinter ?? throw new ArgumentNullException(nameof(reportPrinter));
            _terminalNomenclatureProvider = terminalNomenclatureProvider ?? throw new ArgumentNullException(nameof(terminalNomenclatureProvider));
            _employeeSettings             = employeeSettings ?? throw new ArgumentNullException(nameof(employeeSettings));
            TabName = "Журнал МЛ";

            NotifyConfiguration.Enable();
            NotifyConfiguration.Instance.BatchSubscribeOnEntity <RouteList>(changeEvents => Refresh());

            InitPopupActions();
        }
Exemplo n.º 7
0
        public ComplaintsJournalViewModel(
            IUnitOfWorkFactory unitOfWorkFactory,
            ICommonServices commonServices,
            IUndeliveredOrdersJournalOpener undeliveredOrdersJournalOpener,
            IEmployeeService employeeService,
            IEntityAutocompleteSelectorFactory counterpartySelectorFactory,
            IRouteListItemRepository routeListItemRepository,
            ISubdivisionService subdivisionService,
            ComplaintFilterViewModel filterViewModel,
            IFilePickerService filePickerService,
            ISubdivisionRepository subdivisionRepository,
            IReportViewOpener reportViewOpener,
            IGtkTabsOpener gtkDialogsOpener,
            INomenclatureRepository nomenclatureRepository,
            IUserRepository userRepository,
            IOrderSelectorFactory orderSelectorFactory,
            IEmployeeJournalFactory employeeJournalFactory,
            ICounterpartyJournalFactory counterpartyJournalFactory,
            IDeliveryPointJournalFactory deliveryPointJournalFactory,
            ISubdivisionJournalFactory subdivisionJournalFactory,
            ISalesPlanJournalFactory salesPlanJournalFactory,
            INomenclatureSelectorFactory nomenclatureSelector,
            IUndeliveredOrdersRepository undeliveredOrdersRepository) : base(filterViewModel, unitOfWorkFactory, commonServices)
        {
            this._unitOfWorkFactory         = unitOfWorkFactory ?? throw new ArgumentNullException(nameof(unitOfWorkFactory));
            this._commonServices            = commonServices ?? throw new ArgumentNullException(nameof(commonServices));
            _undeliveredOrdersJournalOpener = undeliveredOrdersJournalOpener ?? throw new ArgumentNullException(nameof(undeliveredOrdersJournalOpener));
            _employeeService             = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
            _counterpartySelectorFactory = counterpartySelectorFactory ?? throw new ArgumentNullException(nameof(counterpartySelectorFactory));
            _filePickerService           = filePickerService ?? throw new ArgumentNullException(nameof(filePickerService));
            _subdivisionRepository       = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));
            _routeListItemRepository     = routeListItemRepository ?? throw new ArgumentNullException(nameof(routeListItemRepository));
            _subdivisionService          = subdivisionService ?? throw new ArgumentNullException(nameof(subdivisionService));
            _reportViewOpener            = reportViewOpener ?? throw new ArgumentNullException(nameof(reportViewOpener));
            _gtkDlgOpener                = gtkDialogsOpener ?? throw new ArgumentNullException(nameof(gtkDialogsOpener));
            _nomenclatureRepository      = nomenclatureRepository ?? throw new ArgumentNullException(nameof(nomenclatureRepository));
            _userRepository              = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
            _orderSelectorFactory        = orderSelectorFactory ?? throw new ArgumentNullException(nameof(orderSelectorFactory));
            _employeeJournalFactory      = employeeJournalFactory ?? throw new ArgumentNullException(nameof(employeeJournalFactory));
            _counterpartyJournalFactory  = counterpartyJournalFactory ?? throw new ArgumentNullException(nameof(counterpartyJournalFactory));
            _deliveryPointJournalFactory = deliveryPointJournalFactory ?? throw new ArgumentNullException(nameof(deliveryPointJournalFactory));
            _subdivisionJournalFactory   = subdivisionJournalFactory ?? throw new ArgumentNullException(nameof(subdivisionJournalFactory));
            _salesPlanJournalFactory     = salesPlanJournalFactory ?? throw new ArgumentNullException(nameof(salesPlanJournalFactory));
            _nomenclatureSelector        = nomenclatureSelector ?? throw new ArgumentNullException(nameof(nomenclatureSelector));
            _undeliveredOrdersRepository =
                undeliveredOrdersRepository ?? throw new ArgumentNullException(nameof(undeliveredOrdersRepository));

            TabName = "Журнал рекламаций";

            RegisterComplaints();

            var threadLoader = DataLoader as ThreadDataLoader <ComplaintJournalNode>;

            threadLoader.MergeInOrderBy(x => x.Id, true);

            FinishJournalConfiguration();

            FilterViewModel.SubdivisionService = subdivisionService;
            FilterViewModel.EmployeeService    = employeeService;

            var currentUserSettings        = userRepository.GetUserSettings(UoW, commonServices.UserService.CurrentUserId);
            var defaultSubdivision         = currentUserSettings.DefaultSubdivision;
            var currentEmployeeSubdivision = employeeService.GetEmployeeForUser(UoW, commonServices.UserService.CurrentUserId).Subdivision;

            FilterViewModel.CurrentUserSubdivision = currentEmployeeSubdivision;

            if (FilterViewModel.SubdivisionService.GetOkkId() == currentEmployeeSubdivision.Id)
            {
                FilterViewModel.ComplaintStatus = ComplaintStatuses.Checking;
            }
            else
            {
                if (currentUserSettings.UseEmployeeSubdivision)
                {
                    FilterViewModel.Subdivision = currentEmployeeSubdivision;
                }
                else
                {
                    FilterViewModel.Subdivision = defaultSubdivision;
                }

                FilterViewModel.ComplaintStatus = currentUserSettings.DefaultComplaintStatus;
            }

            UpdateOnChanges(
                typeof(Complaint),
                typeof(ComplaintGuiltyItem),
                typeof(ComplaintResult),
                typeof(Subdivision),
                typeof(ComplaintDiscussion),
                typeof(DeliveryPoint),
                typeof(Fine),
                typeof(Order),
                typeof(RouteList),
                typeof(RouteListItem),
                typeof(ComplaintObject)
                );
            this.DataLoader.ItemsListUpdated += (sender, e) => CurrentObjectChanged?.Invoke(this, new CurrentObjectChangedArgs(null));

            DataLoader.PostLoadProcessingFunc = BeforeItemsUpdated;
        }
Exemplo n.º 8
0
        public ComplaintViewModel(
            IEntityUoWBuilder uowBuilder,
            IUnitOfWorkFactory uowFactory,
            ICommonServices commonServices,
            IUndeliveredOrdersJournalOpener undeliveryViewOpener,
            IEmployeeService employeeService,
            IEntityAutocompleteSelectorFactory counterpartySelectorFactory,
            IFilePickerService filePickerService,
            ISubdivisionRepository subdivisionRepository,
            INomenclatureRepository nomenclatureRepository,
            IUserRepository userRepository,
            IOrderSelectorFactory orderSelectorFactory,
            IEmployeeJournalFactory driverJournalFactory,
            ICounterpartyJournalFactory counterpartyJournalFactory,
            IDeliveryPointJournalFactory deliveryPointJournalFactory,
            ISubdivisionJournalFactory subdivisionJournalFactory,
            IGtkTabsOpener gtkDialogsOpener,
            IUndeliveredOrdersJournalOpener undeliveredOrdersJournalOpener,
            ISalesPlanJournalFactory salesPlanJournalFactory,
            INomenclatureSelectorFactory nomenclatureSelector,
            IUndeliveredOrdersRepository undeliveredOrdersRepository) : base(uowBuilder, uowFactory, commonServices)
        {
            _filePickerService          = filePickerService ?? throw new ArgumentNullException(nameof(filePickerService));
            _subdivisionRepository      = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));
            CounterpartySelectorFactory = counterpartySelectorFactory ?? throw new ArgumentNullException(nameof(counterpartySelectorFactory));
            _undeliveryViewOpener       = undeliveryViewOpener ?? throw new ArgumentNullException(nameof(undeliveryViewOpener));
            EmployeeService             = employeeService ?? throw new ArgumentNullException(nameof(employeeService));
            NomenclatureRepository      = nomenclatureRepository ?? throw new ArgumentNullException(nameof(nomenclatureRepository));
            UserRepository              = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
            _salesPlanJournalFactory    = salesPlanJournalFactory ?? throw new ArgumentNullException(nameof(salesPlanJournalFactory));
            NomenclatureSelector        = nomenclatureSelector ?? throw new ArgumentNullException(nameof(nomenclatureSelector));
            UndeliveredOrdersRepository =
                undeliveredOrdersRepository ?? throw new ArgumentNullException(nameof(undeliveredOrdersRepository));

            OrderSelectorFactory           = orderSelectorFactory ?? throw new ArgumentNullException(nameof(orderSelectorFactory));
            EmployeeJournalFactory         = driverJournalFactory ?? throw new ArgumentNullException(nameof(driverJournalFactory));
            _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));

            Entity.ObservableComplaintDiscussions.ElementChanged     += ObservableComplaintDiscussions_ElementChanged;
            Entity.ObservableComplaintDiscussions.ListContentChanged += ObservableComplaintDiscussions_ListContentChanged;
            Entity.ObservableFines.ListContentChanged += ObservableFines_ListContentChanged;

            if (uowBuilder.IsNewEntity)
            {
                AbortOpening("Невозможно создать новую рекламацию из текущего диалога, необходимо использовать диалоги создания");
            }

            if (CurrentEmployee == null)
            {
                AbortOpening("Невозможно открыть рекламацию так как к вашему пользователю не привязан сотрудник");
            }

            ConfigureEntityChangingRelations();

            CreateCommands();

            _complaintKinds = complaintKindSource = UoW.GetAll <ComplaintKind>().Where(k => !k.IsArchive).ToList();

            ComplaintObject = Entity.ComplaintKind?.ComplaintObject;

            TabName = $"Рекламация №{Entity.Id} от {Entity.CreationDate.ToShortDateString()}";
        }