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 ); }
public ComplaintFilterViewModel( ICommonServices commonServices, ISubdivisionRepository subdivisionRepository, IEntityAutocompleteSelectorFactory employeeSelectorFactory ) { this.commonServices = commonServices ?? throw new ArgumentNullException(nameof(commonServices)); GuiltyItemVM = new GuiltyItemViewModel( new ComplaintGuiltyItem(), commonServices, subdivisionRepository, employeeSelectorFactory, UoW ); 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(); UpdateWith( x => x.ComplaintType, x => x.ComplaintStatus, x => x.Employee, x => x.StartDate, x => x.EndDate, x => x.Subdivision, x => x.FilterDateType, x => x.ComplaintKind, x => x.ComplaintDiscussionStatus ); }