private void CheckIfActicationIsPossible() { IsActivationPossible = !connectionActivationLocked && !string.IsNullOrWhiteSpace(SelectedIpAddress) && dataCenter.GetAllUsers().Count(user => !user.IsHidden && user.ListOfAccessableMedicalPractices.Any()) > 0 && dataCenter.GetAllMedicalPractices().Any(); }
private async void DoDeleteMedicalPractice() { var dialog = new UserDialogBox("", $"Praxis [{SelectedMedicalPractice.Name}] wirklich löschen?", MessageBoxButton.OKCancel); var result = await dialog.ShowMahAppsDialog(); if (result == MessageDialogResult.Affirmative) { var practiceToDelete = SelectedMedicalPracticeObject; dataCenter.RemoveMedicalPractice(practiceToDelete); MedicalPractices.Remove(SelectedMedicalPractice); foreach (var user in dataCenter.GetAllUsers()) { if (user.ListOfAccessableMedicalPractices.Contains(practiceToDelete.Id)) { var updatedUser = user.UpdateListOfAccessableMedicalPractices( user.ListOfAccessableMedicalPractices.Where(medPracId => medPracId != practiceToDelete.Id) .ToList() ); dataCenter.UpdateUser(updatedUser); } } SelectedMedicalPractice = null; } }
private void OnSelectedPageChanged(MainPage mainPage) { if (mainPage != MainPage.User) { Users.Clear(); dataCenter.GetAllUsers() .Do(Users.Add); SelectedUser = null; } }
public override void Handle(GetUserListRequest request) { if (!IsRequestValid(request.SessionId)) { return; } var userList = dataCenter.GetAllUsers() .Where(user => !user.IsHidden) .Where(user => user.ListOfAccessableMedicalPractices.Count > 0) .Select(user => new ClientUserData(user.ToString(), user.Id, user.ListOfAccessableMedicalPractices)) .ToList(); Socket.SendNetworkMsg(new GetUserListResponse(userList)); }