private void AddPatientPhone(PatientPhoneDto patientPhoneDto, Patient patient) { var patientPhoneType = _mappingHelper.MapLookupField <PatientPhoneType> (patientPhoneDto.PatientPhoneType); var patientPhone = new PatientPhone( patientPhoneType, patientPhoneDto.PhoneNumber, patientPhoneDto.PhoneExtensionNumber, patientPhoneDto.ConfidentialIndicator); patient.AddPhoneNumber(patientPhone); }
public static List <PatientPhone> DataTableToPatientPhon(DataTable dt) { List <PatientPhone> result = new List <PatientPhone>(); foreach (DataRow row in dt.Rows) { foreach (DataColumn col in dt.Columns) { PatientPhone ptPhone = new PatientPhone(); if (col.ColumnName == "MobPhone") { if (!string.IsNullOrEmpty(row["MobPhone"].ToString())) { ptPhone.PhoneCategory = "Mobile"; ptPhone.PhoneNumber = row["MobPhone"].ToString(); result.Add(ptPhone); } } if (col.ColumnName == "Home") { if (!string.IsNullOrEmpty(row["Home"].ToString())) { ptPhone.PhoneCategory = "Home"; ptPhone.PhoneNumber = row["Home"].ToString(); result.Add(ptPhone); } } if (col.ColumnName == "SecondPhone") { if (!string.IsNullOrEmpty(row["SecondPhone"].ToString())) { ptPhone.PhoneCategory = "SecondPhone"; ptPhone.PhoneNumber = row["SecondPhone"].ToString(); result.Add(ptPhone); } } if (col.ColumnName == "Office") { if (!string.IsNullOrEmpty(row["Office"].ToString())) { ptPhone.PhoneCategory = "Office"; ptPhone.PhoneNumber = row["Office"].ToString(); result.Add(ptPhone); } } } } return(result); }
public void Translate_PatientPhoneIsNull_ReturnsNullPatientAccountPhone() { // Setup var fixture = new Fixture().Customize(new AutoMoqCustomization()); var sut = fixture.CreateAnonymous <PatientAccountPhoneTranslator>(); PatientPhone patientPhone = null; // Exercise var patientAccountPhone = sut.Translate(patientPhone); // Verify Assert.IsNull(patientAccountPhone); }
/// <summary> /// Translates the specified patient phone. /// </summary> /// <param name="patientPhone">The patient phone.</param> /// <returns>A PatientAccountPhone.</returns> public PatientAccountPhone Translate(PatientPhone patientPhone) { if (patientPhone == null) { return(null); } var patientAccountPhoneTypeWellKnownName = WellKnownNames.PatientAccountModule.PatientAccountPhoneType.Home; if (patientPhone.PatientPhoneType.WellKnownName == WellKnownNames.PatientModule.PatientPhoneType.Cell) { patientAccountPhoneTypeWellKnownName = WellKnownNames.PatientAccountModule.PatientAccountPhoneType.Cell; } var patientAccountPhoneType = _lookupValueRepository.GetLookupByWellKnownName <PatientAccountPhoneType>(patientAccountPhoneTypeWellKnownName); var patientAccountPhone = new PatientAccountPhone(patientAccountPhoneType, new Phone(patientPhone.PhoneNumber, patientPhone.PhoneExtensionNumber)); return(patientAccountPhone); }
private void ChangePatientPhone(PatientPhoneDto patientPhoneDto, Patient patient, PatientPhone patientPhone) { RemovePatientPhone(patientPhoneDto, patient, patientPhone); AddPatientPhone(patientPhoneDto, patient); }
private static void RemovePatientPhone(PatientPhoneDto patientPhoneDto, Patient patient, PatientPhone patientPhone) { patient.RemovePhoneNumber(patientPhone); }