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(); }
private void ConfigureDlg() { var orderOrganizationProviderFactory = new OrderOrganizationProviderFactory(); _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, ContactParametersProvider.Instance); ClientPhonesView.ViewModel.ReadOnly = true; DeliveryPointPhonesView.ViewModel = new PhonesViewModel(_phoneRepository, UoW, ContactParametersProvider.Instance); DeliveryPointPhonesView.ViewModel.ReadOnly = true; if (Entity.Counterparty != null) { if (_deliveryPointJournalFilterViewModel != null) { _deliveryPointJournalFilterViewModel.Counterparty = Entity.Counterparty; } } UpdateAddressFields(); }
public CounterpartyContractFactory(IOrganizationProvider organizationProvider, ICounterpartyContractRepository counterpartyContractRepository) { this.organizationProvider = organizationProvider ?? throw new ArgumentNullException(nameof(organizationProvider)); this.counterpartyContractRepository = counterpartyContractRepository ?? throw new ArgumentNullException(nameof(counterpartyContractRepository)); }
private void ConfigureDlg() { var orderOrganizationProviderFactory = new OrderOrganizationProviderFactory(); 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(); EmployeeFilterViewModel employeeFilterViewModel = new EmployeeFilterViewModel(); employeeFilterViewModel.SetAndRefilterAtOnce(x => x.RestrictCategory = EmployeeCategory.office); EmployeesVM employeeVM = new EmployeesVM(employeeFilterViewModel); EmployeeyEntryreferencevm.RepresentationModel = employeeVM; EmployeeyEntryreferencevm.Binding.AddBinding(Entity, s => s.AssignedEmployee, w => w.Subject).InitializeFromSource(); entityVMEntryDeliveryPoint.SetEntityAutocompleteSelectorFactory(new EntityAutocompleteSelectorFactory <DeliveryPointJournalViewModel>(typeof(DeliveryPoint), () => new DeliveryPointJournalViewModel(DeliveryPointJournalFilterViewModel, UnitOfWorkFactory.GetDefaultFactory, ServicesConfig.CommonServices) { SelectionMode = JournalSelectionMode.Single })); entityVMEntryDeliveryPoint.Binding.AddBinding(Entity, s => s.DeliveryPoint, w => w.Subject).InitializeFromSource(); entityVMEntryCounterparty.SetEntityAutocompleteSelectorFactory( new DefaultEntityAutocompleteSelectorFactory <Counterparty, CounterpartyJournalViewModel, CounterpartyJournalFilterViewModel>(ServicesConfig.CommonServices)); entityVMEntryCounterparty.Binding.AddBinding(Entity, s => s.Counterparty, w => w.Subject).InitializeFromSource(); employee = employeeRepository.GetEmployeeForCurrentUser(UoW); ClientPhonesView.ViewModel = new PhonesViewModel(phoneRepository, UoW, ContactParametersProvider.Instance); ClientPhonesView.ViewModel.ReadOnly = true; DeliveryPointPhonesView.ViewModel = new PhonesViewModel(phoneRepository, UoW, ContactParametersProvider.Instance); DeliveryPointPhonesView.ViewModel.ReadOnly = true; if (Entity.Counterparty != null) { if (DeliveryPointJournalFilterViewModel != null) { DeliveryPointJournalFilterViewModel.Counterparty = Entity.Counterparty; } } UpdateAddressFields(); }