private async void executeShowPersonViewCommand(object obj) { if (this.selectedPerson != null) { this.isPersonViewShowed = true; bool showPersonHistory = false; if (this.appUserPermissions["SeePersonHistory"]) { showPersonHistory = true; } bool useOperDB = this.settings.UseOperDB; PersonView view = null; List <Person> personList = null; List <Person> personListOperDB = null; List <Person> personListDwDB = null; CancellationTokenSource CTS = new CancellationTokenSource(); CancellationToken token = CTS.Token; try { personListDwDB = await das.GetPersonAsync(token, this.selectedPerson.PersonKey, this.selectedPerson.Id, this.selectedPerson.Guid, new DateTime(9999, 1, 1), showPersonHistory, use_oper_db : false); if (useOperDB) { personListOperDB = await das.GetPersonAsync(token, this.selectedPerson.PersonKey, this.selectedPerson.Id, this.selectedPerson.Guid, new DateTime(9999, 1, 1), show_person_history : false, use_oper_db : true); } } catch (Exception ex) { CTS.Cancel(); if (view != null) { view.Close(); } Message.ShowError(ex.Message, ex.GetType().ToString(), this.view); } if (personListDwDB != null) { personListDwDB = personListDwDB.OrderBy(p => p.ValidFrom).ToList(); personList = personListDwDB; } if (personListOperDB != null) { if (personList != null) { personList.AddRange(personListOperDB); } else { personList = personListOperDB; } } if (personList != null) { if (this.appUserPermissions["SeeLevels"]) { try { foreach (Person person in personList) { if (this.settings.UseOperDB == true && person.PersonKey == 0) { useOperDB = true; } else { useOperDB = false; } MainQueryParams levelsParams = new MainQueryParams(); levelsParams.UseOperDB = useOperDB; levelsParams.ShowFullAccessLevel = this.settings.ShowFullAccessLevel; levelsParams.Levels = person.LevelId; levelsParams.StartDate = person.ValidFrom; //person.Levels = await das.GetLevelsAsync(CancellationToken.None, useOperDB, null, this.settings.ShowFullAccessLevel, person.LevelId, person.ValidFrom); person.Levels = await das.GetLevelsAsync(CancellationToken.None, levelsParams); if (person.Levels != null) { person.Levels.Sort((x, y) => x.Num.CompareTo(y.Num)); } levelsParams.Levels = person.DepartmentLevelId; levelsParams.IsDepartmentLevels = true; //person.DepartmentLevels = await das.GetLevelsAsync(CancellationToken.None, useOperDB, null, this.settings.ShowFullAccessLevel, person.DepartmentLevelId, person.ValidFrom,true); person.DepartmentLevels = await das.GetLevelsAsync(CancellationToken.None, levelsParams); if (person.DepartmentLevels != null) { person.DepartmentLevels.Sort((x, y) => x.Num.CompareTo(y.Num)); } } } catch (Exception ex) { Message.ShowError(ex.Message, ex.GetType().ToString(), this.view); } } view = new PersonView(); view.ViewModel = new PersonViewModel(view, this.das, this.settings, this.appUserPermissions, personList); if (showPersonHistory) { view.ViewModel.IsPersonHistoryAvailable = true; } view.ViewModel.IsExtendedMode = true; view.Owner = this.view; view.WindowStartupLocation = WindowStartupLocation.CenterOwner; //view.ShowInTaskbar = false; view.Show(); } this.isPersonViewShowed = false; } }