public CounterpartyContractDlg(Counterparty counterparty, PaymentType paymentType, Organization organizetion, DateTime?date) : this(counterparty, organizetion) { var orderOrganizationProviderFactory = new OrderOrganizationProviderFactory(); var orderOrganizationProvider = orderOrganizationProviderFactory.CreateOrderOrganizationProvider(); var counterpartyContractRepository = new CounterpartyContractRepository(orderOrganizationProvider); var contractType = counterpartyContractRepository.GetContractTypeForPaymentType(counterparty.PersonType, paymentType); Entity.ContractType = contractType; if (date.HasValue) { UoWGeneric.Root.IssueDate = date.Value; } }
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(); }
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(); }