/// <summary>
 /// 根据ID获取随访方案
 /// </summary>
 /// <param name="keyWord"></param>
 /// <returns></returns>
 public QATestSolution Get(string id)
 {
     using (DbContext db = new CRDatabase())
     {
         CTMS_QA_TESTSOLUTION entity = db.Set <CTMS_QA_TESTSOLUTION>().Find(id);
         if (entity == null)
         {
             return(null);
         }
         return(EntityToModel(entity));
     }
 }
 /// <summary>
 /// 删除随访方案
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool Delete(string id)
 {
     if (string.IsNullOrEmpty(id))
     {
         LogService.WriteInfoLog(logTitle, "试图删除为空的QATestSolution实体!");
         throw new KeyNotFoundException();
     }
     using (DbContext db = new CRDatabase())
     {
         CTMS_QA_TESTSOLUTION entity = db.Set <CTMS_QA_TESTSOLUTION>().Find(id);
         if (entity != null)
         {
             db.Set <CTMS_QA_TESTSOLUTION>().Remove(entity);
         }
         return(db.SaveChanges() > 0);
     }
 }
        public QATestSolution EntityToModel(CTMS_QA_TESTSOLUTION entity)
        {
            if (entity == null)
            {
                return(null);
            }
            QATestSolution model = new QATestSolution()
            {
                SolutionID          = entity.SOLUTIONID,
                SolutionCode        = entity.SOLUTIONCODE,
                SolutionName        = entity.SOLUTIONNAME,
                SolutionSource      = entity.SOLUTIONSOURCE,
                SolutionDescription = entity.SOLUTIONDESCRIPTION,
                DiseaseCode         = entity.DISEASECODE,
                DiseaseName         = entity.DISEASENAME,
            };

            base.EntityToModel <CTMS_QA_TESTSOLUTION, QATestSolution>(entity, model);
            return(model);
        }
        public CTMS_QA_TESTSOLUTION ModelToEntity(QATestSolution model)
        {
            if (model == null)
            {
                return(null);
            }
            CTMS_QA_TESTSOLUTION entity = new CTMS_QA_TESTSOLUTION()
            {
                SOLUTIONID          = string.IsNullOrEmpty(model.SolutionID) ? Guid.NewGuid().ToString() : model.SolutionID,
                SOLUTIONCODE        = model.SolutionCode,
                SOLUTIONNAME        = model.SolutionName,
                SOLUTIONSOURCE      = model.SolutionSource,
                SOLUTIONDESCRIPTION = model.SolutionDescription,
                DISEASECODE         = model.DiseaseCode,
                DISEASENAME         = model.DiseaseName,
            };

            base.ModelToEntity <QATestSolution, CTMS_QA_TESTSOLUTION>(model, entity);
            return(entity);
        }