private void confirmButton_Click(object sender, RoutedEventArgs e) { var date = birthDayDatePicker.SelectedDate; if (firstNameTextBox.Text == string.Empty || lastNameTextBox.Text == string.Empty) { errorMessageTextBlock.Text = "The name field cannot be empty"; return; } if (date == null) { errorMessageTextBlock.Text = "A valid date must be selected."; return; } if (genderComboBox.SelectedItem == null) { errorMessageTextBlock.Text = "A gender must be selected"; return; } newPatient = new TherapyPatient(firstNameTextBox.Text, lastNameTextBox.Text, genderToString(genderComboBox.SelectedItem as string), (DateTime)birthDayDatePicker.SelectedDate); Workspace.Instance.AddNewPatient(newPatient); homePage?.RefreshPatientButtons(); this.Close(); }
public void AddPatient(TherapyPatient patient) { if (patient == null || string.IsNullOrEmpty(patient.FirstName) || string.IsNullOrEmpty(patient.LastName)) { throw new ArgumentNullException("you must provide a first and last name"); } _patientStore.AddPatient(patient); }
public bool UpdatePatient(TherapyPatient patient) { if (_therapyPatients.ContainsKey(patient.Id)) { _therapyPatients[patient.Id] = patient; return(true); } else { return(false); } }
public bool AddPatient(TherapyPatient patient) { if (!_therapyPatients.ContainsKey(patient.Id)) { _therapyPatients.Add(patient.Id, patient); return(true); } else { return(false); } }
public void It_Throws_On_Null_Last_Name() { var patient = new TherapyPatient() { AppointmentDate = DateTime.Now, Id = Guid.NewGuid(), FirstName = "Matthew", LastName = null }; _SUT.AddPatient(patient); }
public void It_Can_Add_Therapy_Patient() { var patient = new TherapyPatient() { AppointmentDate = DateTime.Now, FirstName = "Matthew", LastName = "Knudsen", Id = Guid.NewGuid() }; _mockStore.Setup(x => x.CreateNewPatient(patient)).Returns(true); _SUT.AddPatient(patient); }
public void UpdatePatient(TherapyPatient patient) { _patientStore.UpdatePatient(patient); }
public void UpdateSeriesPatientBasis(TherapyPatient patient) { if (patient?.GetSessions() == null) { return; } foreach (var series in Series) { series.Values.Clear(); } foreach (var session in patient.GetSessions()) { var emotionData = session.GetEmotionDataList(); if (emotionData.Count == 0) { continue; } double avg = 0; // Anger foreach (var data in emotionData) { avg += data.Anger; } avg /= emotionData.Count; Series.ElementAt(0).Values.Add(avg); avg = 0; // Contempt foreach (var data in emotionData) { avg += data.Contempt; } avg /= emotionData.Count; Series.ElementAt(1).Values.Add(avg); avg = 0; // Disgust foreach (var data in emotionData) { avg += data.Disgust; } avg /= emotionData.Count; Series.ElementAt(2).Values.Add(avg); avg = 0; // Fear foreach (var data in emotionData) { avg += data.Fear; } avg /= emotionData.Count; Series.ElementAt(3).Values.Add(avg); avg = 0; // Happiness foreach (var data in emotionData) { avg += data.Happiness; } avg /= emotionData.Count; Series.ElementAt(4).Values.Add(avg); avg = 0; // Neutral foreach (var data in emotionData) { avg += data.Neutral; } avg /= emotionData.Count; Series.ElementAt(5).Values.Add(avg); avg = 0; // Sadness foreach (var data in emotionData) { avg += data.Sadness; } avg /= emotionData.Count; Series.ElementAt(6).Values.Add(avg); avg = 0; // Surprise foreach (var data in emotionData) { avg += data.Surprise; } avg /= emotionData.Count; Series.ElementAt(7).Values.Add(avg); } }