private async void FetchMatchingPatients() { List <string> queryParamsList = new List <string>(); if (!string.IsNullOrEmpty(FirstNameTextBox.Text)) { queryParamsList.Add("firstName=" + FirstNameTextBox.Text); } if (!string.IsNullOrEmpty(MiddleNameTextBox.Text)) { queryParamsList.Add("middleName=" + MiddleNameTextBox.Text); } if (!string.IsNullOrEmpty(LastNameTextBox.Text)) { queryParamsList.Add("lastName=" + LastNameTextBox.Text); } if (!string.IsNullOrEmpty(SocialSecurityIDTextBox.Text)) { queryParamsList.Add("socialSecurityId=" + SocialSecurityIDTextBox.Text); } try { SearchResultPatientsListBox.ItemsSource = await _apiService.GetAllAsync <Patient>("patients", queryParamsList.ToArray()); } catch (Flurl.Http.FlurlHttpException ex) { MessageBox.Show("Could not retrieve patients: " + ex.Message, "Error Retrieving Patients", MessageBoxButton.OK, MessageBoxImage.Warning); //SetupDebugPatientList(); } }
private async void OpenMedicalHistoryButton_Click(object sender, RoutedEventArgs e) { //TODO: Implement this function and window. try { List <HistoryEntry> entries = await _apiService.GetAllAsync <HistoryEntry>("patients/" + CheckIn.Patient.Id + "/medical-history"); new MedicalHistoryWindow(entries).Show(); } catch (Flurl.Http.FlurlHttpException ex) { Console.WriteLine(ex.GetResponseStringAsync()); } }
public async Task <bool> IsPatientDataValid() { bool result = true; if (!_validName.IsMatch(FirstNameTextBox.Text)) { FirstNameTextBox.BorderBrush = new SolidColorBrush(Colors.Red); result = false; } else { FirstNameTextBox.BorderBrush = new SolidColorBrush(Colors.Green); } if (!_validName.IsMatch(MiddleNameTextBox.Text) && !string.IsNullOrEmpty(MiddleNameTextBox.Text)) { MiddleNameTextBox.BorderBrush = new SolidColorBrush(Colors.Red); result = false; } else { MiddleNameTextBox.BorderBrush = new SolidColorBrush(Colors.Green); } if (!_validName.IsMatch(LastNameTextBox.Text)) { LastNameTextBox.BorderBrush = new SolidColorBrush(Colors.Red); result = false; } else { LastNameTextBox.BorderBrush = new SolidColorBrush(Colors.Green); } if (string.IsNullOrEmpty(AddressCityTextBox.Text)) { AddressCityTextBox.BorderBrush = new SolidColorBrush(Colors.Red); result = false; } else { AddressCityTextBox.BorderBrush = new SolidColorBrush(Colors.Green); } if (string.IsNullOrEmpty(AddressZIPTextBox.Text)) { AddressZIPTextBox.BorderBrush = new SolidColorBrush(Colors.Red); result = false; } else { AddressZIPTextBox.BorderBrush = new SolidColorBrush(Colors.Green); } if (string.IsNullOrEmpty(AddressStreetTextBox.Text)) { AddressStreetTextBox.BorderBrush = new SolidColorBrush(Colors.Red); result = false; } else { AddressStreetTextBox.BorderBrush = new SolidColorBrush(Colors.Green); } if (string.IsNullOrEmpty(AddressNumberTextBox.Text)) { AddressNumberTextBox.BorderBrush = new SolidColorBrush(Colors.Red); result = false; } else { AddressNumberTextBox.BorderBrush = new SolidColorBrush(Colors.Green); } if (!_validSSN.IsMatch(SocialSecurityIDTextBox.Text)) { SocialSecurityIDTextBox.BorderBrush = new SolidColorBrush(Colors.Red); result = false; } else { try { var dummy = await _apiService.GetAllAsync <Patient>("patients", "socialSecurityId=" + SocialSecurityIDTextBox.Text); Console.WriteLine("Patients count: " + dummy.Count); if (dummy.Count > 0) { SocialSecurityIDTextBox.BorderBrush = new SolidColorBrush(Colors.Red); TakenSSNLabel.Visibility = Visibility.Visible; result = false; } else { SocialSecurityIDTextBox.BorderBrush = new SolidColorBrush(Colors.Green); TakenSSNLabel.Visibility = Visibility.Collapsed; } } catch (Flurl.Http.FlurlHttpException ex) { //Unsure tbh } } if (!DateOfBirthPicker.SelectedDate.HasValue) { result = false; DateOfBirthPicker.BorderBrush = new SolidColorBrush(Colors.Red); } else { DateOfBirthPicker.BorderBrush = new SolidColorBrush(Colors.Green); } return(result); }