Ejemplo n.º 1
0
 /// <summary>Set a Yes/No (coded) value on a DeathRecord.</summary>
 private static void SetYesNoValueDeathRecordCode(DeathRecord deathRecord, string property, string value)
 {
     if (String.IsNullOrWhiteSpace(value))
     {
         return;
     }
     if (value.Trim().ToLower() == "yes")
     {
         Dictionary <string, string> mserv = new Dictionary <string, string>();
         mserv.Add("code", "Y");
         mserv.Add("system", "http://terminology.hl7.org/CodeSystem/v2-0136");
         mserv.Add("display", "Yes");
         Type         type = deathRecord.GetType();
         PropertyInfo prop = type.GetProperty(property);
         prop.SetValue(deathRecord, mserv, null);
     }
     else if (value.Trim().ToLower() == "no")
     {
         Dictionary <string, string> mserv = new Dictionary <string, string>();
         mserv.Add("code", "N");
         mserv.Add("system", "http://terminology.hl7.org/CodeSystem/v2-0136");
         mserv.Add("display", "No");
         Type         type = deathRecord.GetType();
         PropertyInfo prop = type.GetProperty(property);
         prop.SetValue(deathRecord, mserv, null);
     }
 }
Ejemplo n.º 2
0
 /// <summary>Set a Yes/No (coded) value on a DeathRecord.</summary>
 private static void SetYesNoValueDeathRecordBool(DeathRecord deathRecord, string property, string value)
 {
     if (String.IsNullOrWhiteSpace(value))
     {
         return;
     }
     if (value.Trim().ToLower() == "yes")
     {
         Type         type = deathRecord.GetType();
         PropertyInfo prop = type.GetProperty(property);
         prop.SetValue(deathRecord, true, null);
     }
     else if (value.Trim().ToLower() == "no")
     {
         Type         type = deathRecord.GetType();
         PropertyInfo prop = type.GetProperty(property);
         prop.SetValue(deathRecord, false, null);
     }
 }
Ejemplo n.º 3
0
        /// <summary>Set a String value on a DeathRecord.</summary>
        private static void SetStringValueDeathRecordString(DeathRecord deathRecord, string property, string value)
        {
            if (String.IsNullOrWhiteSpace(value))
            {
                return;
            }
            Type         type = deathRecord.GetType();
            PropertyInfo prop = type.GetProperty(property);

            prop.SetValue(deathRecord, value, null);
        }
Ejemplo n.º 4
0
        /// <summary>Set a Yes/No (coded) value on a Dictionary.</summary>
        private static void SetYesNoValueDictionary(Dictionary <string, string> dict, string key, DeathRecord deathRecord, string property)
        {
            Type         type = deathRecord.GetType();
            PropertyInfo prop = type.GetProperty(property);
            Dictionary <string, string> value = (Dictionary <string, string>)prop.GetValue(deathRecord);

            if (value.ContainsKey("display"))
            {
                dict[key] = value["display"];
            }
        }
Ejemplo n.º 5
0
        /// <summary>Set a String value on a DeathRecord.</summary>
        private static void SetStringValueDeathRecordDictionary(DeathRecord deathRecord, string property, string key, string value)
        {
            if (String.IsNullOrWhiteSpace(value))
            {
                return;
            }
            Type         type = deathRecord.GetType();
            PropertyInfo prop = type.GetProperty(property);
            Dictionary <string, string> dict = (Dictionary <string, string>)prop.GetValue(deathRecord);

            if (dict == null)
            {
                dict = new Dictionary <string, string>();
            }
            dict[key] = value;
            prop.SetValue(deathRecord, dict, null);
        }