コード例 #1
0
ファイル: BaseLoader.cs プロジェクト: lrasmus/MHGR
 protected void SetEntityValue(result_entities entity, attribute attribute, string value)
 {
     switch (attribute.value_type)
     {
         case "float":
             entity.value_float = float.Parse(value);
             break;
         case "int":
             entity.value_int = int.Parse(value);
             break;
         case "short_text":
             entity.value_short_text = value;
             break;
         case "text":
             entity.value_text = value;
             break;
         case "date_time":
             entity.value_date_time = DateTime.Parse(value);
             break;
         case "binary":
             break;
         default:
             entity.value_text = value;
             break;
     }
 }
コード例 #2
0
ファイル: EntityRepository.cs プロジェクト: lrasmus/MHGR
        public result_entities AddPhenotype(result_files resultFile, patient patient, attribute attribute, DateTime? resultedOn)
        {
            result_entities rootEntity = new result_entities()
            {
                patient_id = patient.id,
                result_file_id = resultFile.id,
                attribute_id = attribute.id,
            };

            result_entities resultedOnEntity = new result_entities()
            {
                patient_id = patient.id,
                result_file_id = resultFile.id,
                attribute_id = GetAttribute(null, null, "Resulted on", null).id,
                parent = rootEntity,
                value_date_time = resultedOn
            };

            entities.result_entities.AddRange(new[] { rootEntity, resultedOnEntity });
            entities.SaveChanges();
            return rootEntity;
        }