public BusinessTasksJournalViewModel( CallTaskFilterViewModel filterViewModel, BusinessTasksJournalFooterViewModel footerViewModel, IUnitOfWorkFactory unitOfWorkFactory, ICommonServices commonServices, IEmployeeRepository employeeRepository, IBottlesRepository bottleRepository, ICallTaskRepository callTaskRepository, IPhoneRepository phoneRepository, IOrganizationProvider organizationProvider, ICounterpartyContractRepository counterpartyContractRepository, CounterpartyContractFactory counterpartyContractFactory, IRoboAtsCounterpartyJournalFactory roboAtsCounterpartyJournalFactory, IContactsParameters contactsParameters ) : base(filterViewModel, unitOfWorkFactory, commonServices) { TabName = "Журнал задач для обзвона"; this.employeeRepository = employeeRepository; this.bottleRepository = bottleRepository; this.callTaskRepository = callTaskRepository; this.phoneRepository = phoneRepository; this.organizationProvider = organizationProvider ?? throw new ArgumentNullException(nameof(organizationProvider)); this.counterpartyContractRepository = counterpartyContractRepository ?? throw new ArgumentNullException(nameof(counterpartyContractRepository)); this.counterpartyContractFactory = counterpartyContractFactory ?? throw new ArgumentNullException(nameof(counterpartyContractFactory)); this.footerViewModel = footerViewModel; this.commonServices = commonServices ?? throw new ArgumentNullException(nameof(commonServices)); _roboAtsCounterpartyJournalFactory = roboAtsCounterpartyJournalFactory ?? throw new ArgumentNullException(nameof(roboAtsCounterpartyJournalFactory)); _contactsParameters = contactsParameters ?? throw new ArgumentNullException(nameof(contactsParameters)); actionsViewModel = new BusinessTasksJournalActionsViewModel(new EmployeeJournalFactory()); RegisterTasks(); var threadLoader = DataLoader as ThreadDataLoader <BusinessTaskJournalNode>; FinishJournalConfiguration(); UpdateOnChanges( typeof(ClientTask), typeof(PaymentTask) ); DataLoader.ItemsListUpdated += (sender, e) => GetStatistics(); }
public DeliveryPointViewModel( IUserRepository userRepository, IGtkTabsOpener gtkTabsOpener, IPhoneRepository phoneRepository, IContactsParameters contactsParameters, ICitiesDataLoader citiesDataLoader, IStreetsDataLoader streetsDataLoader, IHousesDataLoader housesDataLoader, INomenclatureJournalFactory nomenclatureSelectorFactory, NomenclatureFixedPriceController nomenclatureFixedPriceController, IDeliveryPointRepository deliveryPointRepository, IDeliveryScheduleSelectorFactory deliveryScheduleSelectorFactory, IEntityUoWBuilder uowBuilder, IUnitOfWorkFactory unitOfWorkFactory, ICommonServices commonServices, IRoboAtsCounterpartyJournalFactory roboAtsCounterpartyJournalFactory, Domain.Client.Counterparty client = null) : base(uowBuilder, unitOfWorkFactory, commonServices) { if (client != null && uowBuilder.IsNewEntity) { Entity.Counterparty = client; } else if (client == null && uowBuilder.IsNewEntity) { throw new ArgumentNullException(nameof(client), "Нельзя создать точку доставки без указания клиента"); } if (phoneRepository == null) { throw new ArgumentNullException(nameof(phoneRepository)); } if (contactsParameters == null) { throw new ArgumentNullException(nameof(contactsParameters)); } if (nomenclatureFixedPriceController == null) { throw new ArgumentNullException(nameof(nomenclatureFixedPriceController)); } _deliveryPointRepository = deliveryPointRepository ?? throw new ArgumentNullException(nameof(deliveryPointRepository)); _gtkTabsOpener = gtkTabsOpener ?? throw new ArgumentNullException(nameof(gtkTabsOpener)); _userRepository = userRepository ?? throw new ArgumentNullException(nameof(userRepository)); NomenclatureSelectorFactory = nomenclatureSelectorFactory ?? throw new ArgumentNullException(nameof(nomenclatureSelectorFactory)); _fixedPricesModel = new DeliveryPointFixedPricesModel(UoW, Entity, nomenclatureFixedPriceController); PhonesViewModel = new PhonesViewModel(phoneRepository, UoW, contactsParameters, roboAtsCounterpartyJournalFactory, CommonServices) { PhonesList = Entity.ObservablePhones, DeliveryPoint = Entity, ReadOnly = !CanEdit }; CitiesDataLoader = citiesDataLoader ?? throw new ArgumentNullException(nameof(citiesDataLoader)); StreetsDataLoader = streetsDataLoader ?? throw new ArgumentNullException(nameof(streetsDataLoader)); HousesDataLoader = housesDataLoader ?? throw new ArgumentNullException(nameof(housesDataLoader)); CanArchiveDeliveryPoint = commonServices.CurrentPermissionService.ValidatePresetPermission("can_arc_counterparty_and_deliverypoint"); CanSetFreeDelivery = commonServices.CurrentPermissionService.ValidatePresetPermission("can_set_free_delivery"); CanEditOrderLimits = commonServices.CurrentPermissionService.ValidatePresetPermission("user_can_edit_orders_limits"); CanEditNomenclatureFixedPrice = commonServices.CurrentPermissionService.ValidatePresetPermission("can_edit_delivery_point_fixed_prices"); DeliveryPointCategories = deliveryPointRepository?.GetActiveDeliveryPointCategories(UoW) ?? throw new ArgumentNullException(nameof(deliveryPointRepository)); DeliveryScheduleSelectorFactory = deliveryScheduleSelectorFactory?.CreateDeliveryScheduleAutocompleteSelectorFactory() ?? throw new ArgumentNullException(nameof(deliveryScheduleSelectorFactory)); _roboAtsCounterpartyJournalFactory = roboAtsCounterpartyJournalFactory ?? throw new ArgumentNullException(nameof(roboAtsCounterpartyJournalFactory)); Entity.PropertyChanged += (sender, e) => { switch (e.PropertyName) { // от этого события зависит панель цен доставки, которые в свою очередь зависят от района и, возможно, фиксов case nameof(Entity.District): CurrentObjectChanged?.Invoke(this, new CurrentObjectChangedArgs(Entity)); break; } }; }
static ContactParametersProvider() { parameters = new BaseParametersProvider(new ParametersProvider()); Instance = new ContactParametersProvider(); }
private void ConfigureDlg() { var orderOrganizationProviderFactory = new OrderOrganizationProviderFactory(); _parametersProvider = new ParametersProvider(); _contactsParameters = new ContactParametersProvider(_parametersProvider); _organizationProvider = orderOrganizationProviderFactory.CreateOrderOrganizationProvider(); _counterpartyContractRepository = new CounterpartyContractRepository(_organizationProvider); _counterpartyContractFactory = new CounterpartyContractFactory(_organizationProvider, _counterpartyContractRepository); buttonReportByClient.Sensitive = Entity.Counterparty != null; buttonReportByDP.Sensitive = Entity.DeliveryPoint != null; comboboxImpotanceType.ItemsEnum = typeof(ImportanceDegreeType); comboboxImpotanceType.Binding.AddBinding(Entity, s => s.ImportanceDegree, w => w.SelectedItemOrNull).InitializeFromSource(); TaskStateComboBox.ItemsEnum = typeof(CallTaskStatus); TaskStateComboBox.Binding.AddBinding(Entity, s => s.TaskState, w => w.SelectedItemOrNull).InitializeFromSource(); IsTaskCompleteButton.Binding.AddBinding(Entity, s => s.IsTaskComplete, w => w.Active).InitializeFromSource(); IsTaskCompleteButton.Label += Entity.CompleteDate?.ToString("dd / MM / yyyy HH:mm"); deadlineYdatepicker.Binding.AddBinding(Entity, s => s.EndActivePeriod, w => w.Date).InitializeFromSource(); ytextviewComments.Binding.AddBinding(Entity, s => s.Comment, w => w.Buffer.Text).InitializeFromSource(); yentryTareReturn.ValidationMode = ValidationType.numeric; yentryTareReturn.Binding.AddBinding(Entity, s => s.TareReturn, w => w.Text, new IntToStringConverter()).InitializeFromSource(); textViewCommentAboutClient.Binding .AddFuncBinding(Entity, e => e.Counterparty != null ? e.Counterparty.Comment : "", w => w.Buffer.Text).InitializeFromSource(); vboxOldComments.Visible = true; var employeeFilterViewModel = new EmployeeFilterViewModel { RestrictCategory = EmployeeCategory.office }; var employeeJournalFactory = new EmployeeJournalFactory(employeeFilterViewModel); entryAttachedEmployee.SetEntityAutocompleteSelectorFactory(employeeJournalFactory.CreateEmployeeAutocompleteSelectorFactory()); entryAttachedEmployee.Binding.AddBinding(Entity, e => e.AssignedEmployee, w => w.Subject).InitializeFromSource(); var deliveryPointJournalFactory = new DeliveryPointJournalFactory(_deliveryPointJournalFilterViewModel); entityVMEntryDeliveryPoint .SetEntityAutocompleteSelectorFactory(deliveryPointJournalFactory.CreateDeliveryPointAutocompleteSelectorFactory()); entityVMEntryDeliveryPoint.Binding.AddBinding(Entity, s => s.DeliveryPoint, w => w.Subject).InitializeFromSource(); var counterpartyJournalFactory = new CounterpartyJournalFactory(); entityVMEntryCounterparty .SetEntityAutocompleteSelectorFactory(counterpartyJournalFactory.CreateCounterpartyAutocompleteSelectorFactory()); entityVMEntryCounterparty.Binding.AddBinding(Entity, s => s.Counterparty, w => w.Subject).InitializeFromSource(); ClientPhonesView.ViewModel = new PhonesViewModel(_phoneRepository, UoW, _contactsParameters, _commonServices); ClientPhonesView.ViewModel.ReadOnly = true; DeliveryPointPhonesView.ViewModel = new PhonesViewModel(_phoneRepository, UoW, _contactsParameters, _commonServices); DeliveryPointPhonesView.ViewModel.ReadOnly = true; if (Entity.Counterparty != null) { if (_deliveryPointJournalFilterViewModel != null) { _deliveryPointJournalFilterViewModel.Counterparty = Entity.Counterparty; } } UpdateAddressFields(); }