public void WhenSameDatePassedToEqualsWithLocalDateTime_ThenTrueReturned() { HealthServiceDate date = new HealthServiceDate(2017, 1, 12); HealthServiceDateTime healthServiceDateTime = new HealthServiceDateTime(date); LocalDateTime localDateTime = new LocalDateTime(2017, 1, 12, 2, 40, 17); Assert.IsTrue(healthServiceDateTime.Equals(localDateTime), "The equals should return true."); }
public void WhenSameDatePassedToEquals_ThenTrueReturned() { HealthServiceDate date = new HealthServiceDate(2017, 1, 12); HealthServiceDateTime dateTime1 = new HealthServiceDateTime(date); HealthServiceDateTime dateTime2 = new HealthServiceDateTime(date); Assert.IsTrue(dateTime1.Equals(dateTime2), "The equals should return true."); }
protected void addResultsToHV() { for (int i = 0; i < 8; i++) { if (m_surveyQuestionResults[i].surveyValue != -1) { QuestionAnswer qa = new QuestionAnswer(); qa.Answer.Add(new CodableValue(m_surveyQuestionResults[i].surveyValue.ToString())); qa.Question = new CodableValue(m_surveyQuestionResults[i].surveyCategory); qa.Tags.Add(m_surveyQuestionResults[i].surveyText); qa.CommonData.Note = m_surveyQuestionResults[i].surveyComment; qa.CommonData.Source = PersonInfo.Name; //qa.When = new HealthServiceDateTime(DateTime.Today); HealthServiceDate dt = new HealthServiceDate(Int32.Parse(yr.Text), Int32.Parse(month.Text), Int32.Parse(day.Text)); qa.When = new HealthServiceDateTime(dt); PersonInfo.SelectedRecord.NewItem(qa); } else { // prompt user to select answer for that question } } }
protected void msgSendBtn_Click(object sender, EventArgs e) { if (MessageSendPanel1.MessageContentText.Length > 0) { if (MessageSendPanel1.ParentCB || MessageSendPanel1.TherapistCB) { Message msg = new Message(); msg.Size = 1; msg.Subject = MessageSendPanel1.MessageContentText; if (rel.Equals("Therapist")) msg.From = PersonInfo.Name; else msg.From = rel; //msg.When = new HealthServiceDateTime(DateTime.Today); HealthServiceDate dt = new HealthServiceDate(Int32.Parse(yr.Text), Int32.Parse(month.Text), Int32.Parse(day.Text)); msg.When = new HealthServiceDateTime(dt); if (MessageSendPanel1.ParentCB) msg.Tags.Add("Parent"); if (MessageSendPanel1.TherapistCB) msg.Tags.Add("Therapists"); PersonInfo.SelectedRecord.NewItem(msg); TextBox p = (TextBox)MessageSendPanel1.FindControl("txtMessageField"); p.BackColor = System.Drawing.Color.Transparent; } else { TextBox p = (TextBox)MessageSendPanel1.FindControl("txtMessageField"); p.BackColor = System.Drawing.Color.Yellow; MessageSendPanel1.MessageContentText = "Please select recepient of msg"; //handle this properly } } else { TextBox p = (TextBox)MessageSendPanel1.FindControl("txtMessageField"); p.BackColor = System.Drawing.Color.Yellow; MessageSendPanel1.MessageContentText = "Please enter text to send"; //handle this properly } }
/// <summary> /// Creates a new instance of the <see cref="DailyMedicationUsage"/> class /// specifying the mandatory values. /// </summary> /// /// <param name="when"> /// The date when the medication/supplement was consumed. /// </param> /// /// <param name="drugName"> /// The name of the drug. /// </param> /// /// <param name="dosesConsumed"> /// The number of doses consumed by the person. /// </param> /// /// <exception cref="ArgumentNullException"> /// The <paramref name="when"/> or <paramref name="drugName"/> parameter is <b>null</b>. /// </exception> /// public DailyMedicationUsage( HealthServiceDate when, CodableValue drugName, int dosesConsumed) : base(TypeId) { this.When = when; this.DrugName = drugName; this.DosesConsumed = dosesConsumed; }
/// <summary> /// Populates this <see cref="DailyMedicationUsage"/> instance from the /// data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the medication usage data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// The first node in <paramref name="typeSpecificXml"/> is not /// a <see cref="DailyMedicationUsage"/> node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator itemNav = typeSpecificXml.CreateNavigator().SelectSingleNode( "daily-medication-usage"); Validator.ThrowInvalidIfNull(itemNav, "DailyMedicationUsageUnexpectedNode"); _when = new HealthServiceDate(); _when.ParseXml(itemNav.SelectSingleNode("when")); _drugName = new CodableValue(); _drugName.ParseXml(itemNav.SelectSingleNode("drug-name")); _dosesConsumed = itemNav.SelectSingleNode("number-doses-consumed-in-day").ValueAsInt; _purposeOfUse = XPathHelper.GetOptNavValue<CodableValue>(itemNav, "purpose-of-use"); _intendedDoses = XPathHelper.GetOptNavValueAsInt(itemNav, "number-doses-intended-in-day"); _usageSchedule = XPathHelper.GetOptNavValue<CodableValue>(itemNav, "medication-usage-schedule"); _drugForm = XPathHelper.GetOptNavValue<CodableValue>(itemNav, "drug-form"); _prescriptionType = XPathHelper.GetOptNavValue<CodableValue>(itemNav, "prescription-type"); _singleDoseDescription = XPathHelper.GetOptNavValue<CodableValue>(itemNav, "single-dose-description"); }
internal static FhirDateTime ToFhirInternal(HealthServiceDate healthservicedate) { return(new FhirDateTime(healthservicedate.Year, healthservicedate.Month, healthservicedate.Day)); }
// Register the type on the generic ItemBaseToFhir partial class public static FhirDateTime ToFhir(this HealthServiceDate healthservicedate) { return(HealthServiceDateToFhir.ToFhirInternal(healthservicedate)); }
/// <summary> /// Creates a new instance of the <see cref="DietaryDailyIntake"/> class /// specifying the mandatory values. /// </summary> /// /// <param name="when"> /// The date when the food was consumed. /// </param> /// /// <exception cref="ArgumentNullException"> /// The <paramref name="when"/> parameter is <b>null</b>. /// </exception> /// public DietaryDailyIntake(HealthServiceDate when) : base(TypeId) { this.When = when; }
/// <summary> /// Populates this <see cref="DietaryDailyIntake"/> instance from the /// data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the dietary intake data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// The first node in <paramref name="typeSpecificXml"/> is not /// a <see cref="DietaryDailyIntake"/> node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator intakeNav = typeSpecificXml.CreateNavigator().SelectSingleNode( "dietary-intake-daily"); Validator.ThrowInvalidIfNull(intakeNav, "DietaryDailyIntakeUnexpectedNode"); _when = new HealthServiceDate(); _when.ParseXml(intakeNav.SelectSingleNode("when")); XPathNavigator caloriesNav = intakeNav.SelectSingleNode("calories"); if (caloriesNav != null) { _calories = caloriesNav.ValueAsInt; } XPathNavigator totalFatNav = intakeNav.SelectSingleNode("total-fat"); if (totalFatNav != null) { _totalFat = new WeightValue(); _totalFat.ParseXml(totalFatNav); } XPathNavigator satFatNav = intakeNav.SelectSingleNode("saturated-fat"); if (satFatNav != null) { _saturatedFat = new WeightValue(); _saturatedFat.ParseXml(satFatNav); } XPathNavigator transFatNav = intakeNav.SelectSingleNode("trans-fat"); if (transFatNav != null) { _transFat = new WeightValue(); _transFat.ParseXml(transFatNav); } XPathNavigator proteinNav = intakeNav.SelectSingleNode("protein"); if (proteinNav != null) { _protein = new WeightValue(); _protein.ParseXml(proteinNav); } XPathNavigator totalCarbsNav = intakeNav.SelectSingleNode("total-carbohydrates"); if (totalCarbsNav != null) { _totalCarbs = new WeightValue(); _totalCarbs.ParseXml(totalCarbsNav); } XPathNavigator fiberNav = intakeNav.SelectSingleNode("dietary-fiber"); if (fiberNav != null) { _fiber = new WeightValue(); _fiber.ParseXml(fiberNav); } XPathNavigator sugarsNav = intakeNav.SelectSingleNode("sugars"); if (sugarsNav != null) { _sugars = new WeightValue(); _sugars.ParseXml(sugarsNav); } XPathNavigator sodiumNav = intakeNav.SelectSingleNode("sodium"); if (sodiumNav != null) { _sodium = new WeightValue(); _sodium.ParseXml(sodiumNav); } XPathNavigator cholesterolNav = intakeNav.SelectSingleNode("cholesterol"); if (cholesterolNav != null) { _cholesterol = new WeightValue(); _cholesterol.ParseXml(cholesterolNav); } }
/// <summary> /// Creates a new instance of the <see cref="CholesterolProfile"/> class /// with the specified date. /// </summary> /// /// <param name="when"> /// The date when the cholesterol profile was take. /// </param> /// /// <exception cref="ArgumentNullException"> /// The <paramref name="when"/> parameter is <b>null</b>. /// </exception> /// public CholesterolProfile(HealthServiceDate when) : base(TypeId) { this.When = when; }
/// <summary> /// Populates this <see cref="CholesterolProfile"/> instance from the data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the cholesterol profile data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// The first node in <paramref name="typeSpecificXml"/> is not /// a cholesterol-profile node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator itemNav = typeSpecificXml.CreateNavigator().SelectSingleNode( "cholesterol-profile"); Validator.ThrowInvalidIfNull(itemNav, "CholesterolProfileUnexpectedNode"); _when = new HealthServiceDate(); _when.ParseXml(itemNav.SelectSingleNode("when")); _ldl = XPathHelper.GetOptNavValueAsInt(itemNav, "ldl"); _hdl = XPathHelper.GetOptNavValueAsInt(itemNav, "hdl"); _totalCholesterol = XPathHelper.GetOptNavValueAsInt(itemNav, "total-cholesterol"); _triglyceride = XPathHelper.GetOptNavValueAsInt(itemNav, "triglyceride"); }
/// <summary> /// Information related to a pregnancy. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the pregnancy data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// If the first node in <paramref name="typeSpecificXml"/> is not /// a pregnancy node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator itemNav = typeSpecificXml.CreateNavigator().SelectSingleNode("pregnancy"); Validator.ThrowInvalidIfNull(itemNav, "PregnancyUnexpectedNode"); _dueDate = XPathHelper.GetOptNavValue<ApproximateDate>(itemNav, "due-date"); _lastMenstrualPeriod = XPathHelper.GetOptNavValue<HealthServiceDate>(itemNav, "last-menstrual-period"); _conceptionMethod = XPathHelper.GetOptNavValue<CodableValue>(itemNav, "conception-method"); _fetusCount = XPathHelper.GetOptNavValueAsInt(itemNav, "fetus-count"); _gestationalAge = XPathHelper.GetOptNavValueAsInt(itemNav, "gestational-age"); _delivery.Clear(); foreach (XPathNavigator deliveryNav in itemNav.Select("delivery")) { Delivery delivery = new Delivery(); delivery.ParseXml(deliveryNav); _delivery.Add(delivery); } }
/// <summary> /// Populates this medication fill instance from the data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the medication fill data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// If the first node in <paramref name="typeSpecificXml"/> is not /// a medication-fill node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator itemNav = typeSpecificXml.CreateNavigator().SelectSingleNode("medication-fill"); Validator.ThrowInvalidIfNull(itemNav, "MedicationFillUnexpectedNode"); _name = new CodableValue(); _name.ParseXml(itemNav.SelectSingleNode("name")); _dateFilled = XPathHelper.GetOptNavValue<ApproximateDateTime>(itemNav, "date-filled"); _daysSupply = XPathHelper.GetOptNavValueAsInt(itemNav, "days-supply"); _nextRefillDate = XPathHelper.GetOptNavValue<HealthServiceDate>(itemNav, "next-refill-date"); _refillsLeft = XPathHelper.GetOptNavValueAsInt(itemNav, "refills-left"); _pharmacy = XPathHelper.GetOptNavValue<Organization>(itemNav, "pharmacy"); _prescriptionNumber = XPathHelper.GetOptNavValue(itemNav, "prescription-number"); _lotNumber = XPathHelper.GetOptNavValue(itemNav, "lot-number"); }
/// <summary> /// Populates this Prescription instance from the data in the XML. /// </summary> /// /// <param name="navigator"> /// The XML containing the prescription information. /// </param> /// /// <exception cref="InvalidOperationException"> /// The first node in <paramref name="typeSpecificXml"/> is not /// a prescription node. /// </exception> /// public override void ParseXml(XPathNavigator navigator) { Validator.ThrowIfNavigatorNull(navigator); // <prescribed-by> _prescribedBy = new PersonItem(); _prescribedBy.ParseXml(navigator.SelectSingleNode("prescribed-by")); // <date-prescribed> _datePrescribed = XPathHelper.GetOptNavValue<ApproximateDateTime>(navigator, "date-prescribed"); // <amount-prescribed> _amountPrescribed = XPathHelper.GetOptNavValue<GeneralMeasurement>(navigator, "amount-prescribed"); // <substitution> _substitution = XPathHelper.GetOptNavValue<CodableValue>(navigator, "substitution"); // <refills> _refills = XPathHelper.GetOptNavValueAsInt(navigator, "refills"); // <days-supply> _daysSupply = XPathHelper.GetOptNavValueAsInt(navigator, "days-supply"); // <prescription-expiration> _expiration = XPathHelper.GetOptNavValue<HealthServiceDate>(navigator, "prescription-expiration"); // <instructions> _instructions = XPathHelper.GetOptNavValue<CodableValue>(navigator, "instructions"); }