private void Configure() { AuthorEntityviewmodelentry.SetEntityAutocompleteSelectorFactory( ViewModel.EmployeeJournalFactory.CreateWorkingOfficeEmployeeAutocompleteSelectorFactory()); daterangepicker.Binding.AddBinding(ViewModel, vm => vm.StartDate, w => w.StartDateOrNull); daterangepicker.Binding.AddBinding(ViewModel, vm => vm.EndDate, w => w.EndDateOrNull); AuthorEntityviewmodelentry.Binding.AddBinding( ViewModel, vm => vm.Author, w => w.Subject ).InitializeFromSource(); AccountableEntityviewmodelentry.SetEntityAutocompleteSelectorFactory( ViewModel.EmployeeJournalFactory.CreateEmployeeAutocompleteSelectorFactory()); AccountableEntityviewmodelentry.Binding.AddBinding( ViewModel, vm => vm.AccountableEmployee, w => w.Subject ).InitializeFromSource(); yenumcomboStatus.ItemsEnum = typeof(CashRequest.States); yenumcomboStatus.Binding.AddBinding( ViewModel, e => e.State, w => w.SelectedItemOrNull); yenumcomboStatus.ShowSpecialStateAll = true; CashRequestUserRole?userRole = ViewModel.GetUserRole(); //Для Роли Согласователя по-умолчанию Создана Подана, //для Роли Финансиста - Согласована, //для Кассира - Передана на Выдачу, //Иные роли - только видят только свои заявки, поэтому нужно скрытиь фильтр по авторам if (userRole == CashRequestUserRole.Coordinator) { yenumcomboStatus.SelectedItem = CashRequest.States.Submited; } else if (userRole == CashRequestUserRole.Financier) { yenumcomboStatus.SelectedItem = CashRequest.States.Agreed; } else if (userRole == CashRequestUserRole.Cashier) { yenumcomboStatus.SelectedItem = CashRequest.States.GivenForTake; } else if (userRole == CashRequestUserRole.Other) { AuthorEntityviewmodelentry.Visible = false; label3.Visible = false; } }
private void Configure() { AuthorEntityviewmodelentry.SetEntityAutocompleteSelectorFactory( new EntityAutocompleteSelectorFactory <EmployeesJournalViewModel>(typeof(Employee), () => { var employeeFilter = new EmployeeFilterViewModel { Status = EmployeeStatus.IsWorking, Category = EmployeeCategory.office }; return(new EmployeesJournalViewModel( employeeFilter, UnitOfWorkFactory.GetDefaultFactory, ServicesConfig.CommonServices)); }) ); daterangepicker.Binding.AddBinding(ViewModel, vm => vm.StartDate, w => w.StartDateOrNull); daterangepicker.Binding.AddBinding(ViewModel, vm => vm.EndDate, w => w.EndDateOrNull); AuthorEntityviewmodelentry.Binding.AddBinding( ViewModel, vm => vm.Author, w => w.Subject ).InitializeFromSource(); AccountableEntityviewmodelentry.SetEntityAutocompleteSelectorFactory( new DefaultEntityAutocompleteSelectorFactory <Employee, EmployeesJournalViewModel, EmployeeFilterViewModel> (ServicesConfig.CommonServices) ); AccountableEntityviewmodelentry.Binding.AddBinding( ViewModel, vm => vm.AccountableEmployee, w => w.Subject ).InitializeFromSource(); yenumcomboStatus.ItemsEnum = typeof(CashRequest.States); yenumcomboStatus.Binding.AddBinding( ViewModel, e => e.State, w => w.SelectedItemOrNull); yenumcomboStatus.ShowSpecialStateAll = true; UserRole?userRole = ViewModel.GetUserRole(); //Для Роли Согласователя по-умолчанию Создана Подана, //для Роли Финансиста - Согласована, //для Кассира - Передана на Выдачу, //Иные роли - только видят только свои заявки, поэтому нужно скрытиь фильтр по авторам if (userRole == UserRole.Coordinator) { yenumcomboStatus.SelectedItem = CashRequest.States.Submited; } else if (userRole == UserRole.Financier) { yenumcomboStatus.SelectedItem = CashRequest.States.Agreed; } else if (userRole == UserRole.Cashier) { yenumcomboStatus.SelectedItem = CashRequest.States.GivenForTake; } else if (userRole == UserRole.Other) { AuthorEntityviewmodelentry.Visible = false; label3.Visible = false; } }