public void Add(object enumItemObject)
        {
            PreviousTreatments enumItem = (PreviousTreatments)enumItemObject;

            using (var dbContext = new MedialynxDbPreviousTreatmentsContext()) {
                dbContext.PreviousTreatments.Add(enumItem);
                dbContext.SaveChanges();
            }
        }
 public void Update(PreviousTreatments enumItem)
 {
     using (var dbContext = new MedialynxDbPreviousTreatmentsContext()) {
         var existsItem = dbContext.PreviousTreatments.FirstOrDefault(u => u != null && u.Id == enumItem.Id);
         if (existsItem != null)
         {
             if (Utils.CopyPropertyValues <PreviousTreatments>(enumItem, existsItem))
             {
                 dbContext.PreviousTreatments.Update(existsItem);
                 dbContext.SaveChanges();
             }
         }
     }
 }
 public List <PreviousTreatments> Get(string filter = "", string enumItemId = "")
 {
     using (var dbContext = new MedialynxDbPreviousTreatmentsContext()) {
         return(dbContext.PreviousTreatments.Where(enumItem => enumItemId == "" || enumItem.Id == enumItemId).Where(enumItem => filter == "" || enumItem.Keyword.Contains(filter)).ToList());
     }
 }
예제 #4
0
        public void Generate(string cohortId)
        {
            List <CohortEnumLink> links = new List <CohortEnumLink>();

            using (var dbCohortContext = new MedialynxDbCohortEnumsContext()) {
                foreach (CohortEnums enumItem in dbCohortContext.CohortEnums)
                {
                    switch (enumItem.Id)
                    {
                    case CohortEnumsDictionary.DiseaseStates:
                        using (var dbDiseaseStatesContext = new MedialynxDbDiseaseStatesContext()) {
                            links.AddRange(ExistingOptionsAsLink <DiseaseStates>(new List <DiseaseStates>(dbDiseaseStatesContext.DiseaseStates), cohortId, enumItem.Id));
                        }
                        break;

                    case CohortEnumsDictionary.GeneticMatches:
                        using (var dbGeneticMatchesContext = new MedialynxDbGeneticMatchesContext()) {
                            links.AddRange(ExistingOptionsAsLink <GeneticMatches>(new List <GeneticMatches>(dbGeneticMatchesContext.GeneticMatches), cohortId, enumItem.Id));
                        }
                        break;

                    case CohortEnumsDictionary.Biomarkers:
                        using (var dbBiomarkersContext = new MedialynxDbBiomarkersContext()) {
                            links.AddRange(ExistingOptionsAsLink <Biomarkers>(new List <Biomarkers>(dbBiomarkersContext.Biomarkers), cohortId, enumItem.Id));
                        }
                        break;

                    case CohortEnumsDictionary.Demographics:
                        using (var dbDemographicsContext = new MedialynxDbDemographicsContext()) {
                            links.AddRange(ExistingOptionsAsLink <Demographics>(new List <Demographics>(dbDemographicsContext.Demographics), cohortId, enumItem.Id));
                        }
                        break;

                    case CohortEnumsDictionary.Ethnicitys:
                        using (var dbEthnicitysContext = new MedialynxDbEthnicitysContext()) {
                            links.AddRange(ExistingOptionsAsLink <Ethnicitys>(new List <Ethnicitys>(dbEthnicitysContext.Ethnicitys), cohortId, enumItem.Id));
                        }
                        break;

                    case CohortEnumsDictionary.StageOfDiseases:
                        using (var dbStageOfDiseasesContext = new MedialynxDbStageOfDiseasesContext()) {
                            links.AddRange(ExistingOptionsAsLink <StageOfDiseases>(new List <StageOfDiseases>(dbStageOfDiseasesContext.StageOfDiseases), cohortId, enumItem.Id));
                        }
                        break;

                    case CohortEnumsDictionary.Prognosis:
                        using (var dbPrognosisContext = new MedialynxDbPrognosisContext()) {
                            links.AddRange(ExistingOptionsAsLink <Prognosis>(new List <Prognosis>(dbPrognosisContext.Prognosis), cohortId, enumItem.Id));
                        }
                        break;

                    case CohortEnumsDictionary.PreviousTreatments:
                        using (var dbPreviousTreatmentsContext = new MedialynxDbPreviousTreatmentsContext()) {
                            links.AddRange(ExistingOptionsAsLink <PreviousTreatments>(new List <PreviousTreatments>(dbPreviousTreatmentsContext.PreviousTreatments), cohortId, enumItem.Id));
                        }
                        break;
                    }
                }

                using (var dbContext = new MedialynxDbCohortEnumLinkContext()) {
                    dbContext.CohortEnumLink.AddRange(links);
                    dbContext.SaveChanges();
                }
            }
        }