Ejemplo n.º 1
0
        private void CreateEnumItem(CohortEnumLinkAPI linkAPI)
        {
            // enum item defined within link item. Must be created and used instead linkAPI.EnumItemId
            string newEnumItemId = Guid.NewGuid().ToString("B");

            // owerwrite id anyway
            linkAPI.EnumItemId = newEnumItemId;
            switch (linkAPI.CohortEnumId)
            {
            case CohortEnumsDictionary.DiseaseStates:
                DiseaseStates dsItem = new DiseaseStates();
                DirtyCopyEnumItem <DiseaseStates>(linkAPI.enumItem, dsItem, newEnumItemId);
                Program.MedialynxData.diseaseStatesDBAPI.Add(dsItem);
                break;

            case CohortEnumsDictionary.GeneticMatches:
                GeneticMatches gmItem = new GeneticMatches();
                DirtyCopyEnumItem <GeneticMatches>(linkAPI.enumItem, gmItem, newEnumItemId);
                Program.MedialynxData.geneticMatchesDBAPI.Add(gmItem);
                break;

            case CohortEnumsDictionary.Biomarkers:
                Biomarkers bmItem = new Biomarkers();
                DirtyCopyEnumItem <Biomarkers>(linkAPI.enumItem, bmItem, newEnumItemId);
                Program.MedialynxData.biomarkersDBAPI.Add(bmItem);
                break;

            case CohortEnumsDictionary.Demographics:
                Demographics dmItem = new Demographics();
                DirtyCopyEnumItem <Demographics>(linkAPI.enumItem, dmItem, newEnumItemId);
                Program.MedialynxData.demographicsDBAPI.Add(dmItem);
                break;

            case CohortEnumsDictionary.Ethnicitys:
                Ethnicitys eItem = new Ethnicitys();
                DirtyCopyEnumItem <Ethnicitys>(linkAPI.enumItem, eItem, newEnumItemId);
                Program.MedialynxData.ethnicitysDBAPI.Add(eItem);
                break;

            case CohortEnumsDictionary.StageOfDiseases:
                StageOfDiseases sdItem = new StageOfDiseases();
                DirtyCopyEnumItem <StageOfDiseases>(linkAPI.enumItem, sdItem, newEnumItemId);
                Program.MedialynxData.stageOfDiseasesDBAPI.Add(sdItem);
                break;

            case CohortEnumsDictionary.Prognosis:
                Prognosis pItem = new Prognosis();
                DirtyCopyEnumItem <Prognosis>(linkAPI.enumItem, pItem, newEnumItemId);
                Program.MedialynxData.prognosisDBAPI.Add(pItem);
                break;

            case CohortEnumsDictionary.PreviousTreatments:
                PreviousTreatments ptItem = new PreviousTreatments();
                DirtyCopyEnumItem <PreviousTreatments>(linkAPI.enumItem, ptItem, newEnumItemId);
                Program.MedialynxData.previousTreatmentsDBAPI.Add(ptItem);
                break;
            }
        }
Ejemplo n.º 2
0
        public void Add(object enumItemObject)
        {
            DiseaseStates enumItem = (DiseaseStates)enumItemObject;

            using (var dbContext = new MedialynxDbDiseaseStatesContext()) {
                dbContext.DiseaseStates.Add(enumItem);
                dbContext.SaveChanges();
            }
        }
Ejemplo n.º 3
0
 public void Update(DiseaseStates enumItem)
 {
     using (var dbContext = new MedialynxDbDiseaseStatesContext()) {
         var existsItem = dbContext.DiseaseStates.FirstOrDefault(u => u != null && u.Id == enumItem.Id);
         if (existsItem != null)
         {
             if (Utils.CopyPropertyValues <DiseaseStates>(enumItem, existsItem))
             {
                 dbContext.DiseaseStates.Update(existsItem);
                 dbContext.SaveChanges();
             }
         }
     }
 }