Beispiel #1
0
 /// <summary>
 /// 修改随访方案
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool Edit(QATestPaper model)
 {
     if (string.IsNullOrEmpty(model.TestPaperID))
     {
         LogService.WriteInfoLog(logTitle, "试图修改为空的QATestPaper实体!");
         throw new KeyNotFoundException();
     }
     using (DbContext db = new CRDatabase())
     {
         db.Entry(ModelToEntity(model)).State = EntityState.Modified;
         return(db.SaveChanges() > 0);
     }
 }
Beispiel #2
0
 /// <summary>
 /// 新增随访方案
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public string Add(QATestPaper model)
 {
     if (model == null)
     {
         return(string.Empty);
     }
     using (DbContext db = new CRDatabase())
     {
         db.Set <CTMS_QA_TESTPAPER>().Add(ModelToEntity(model));
         db.SaveChanges();
         return(model.TestPaperID);
     }
 }
Beispiel #3
0
        public QATestPaper EntityToModel(CTMS_QA_TESTPAPER entity)
        {
            if (entity == null)
            {
                return(null);
            }
            QATestPaper model = new QATestPaper()
            {
                TestPaperID          = entity.TESTPAPERID,
                TestPaperName        = entity.TESTPAPERNAME,
                TestPaperCode        = entity.TESTPAPERCODE,
                TestPaperSource      = entity.TESTPAPERSOURCE,
                TestPaperDescription = entity.TESTPAPERDESCRIPTION,
                DiseaseCode          = entity.DISEASECODE,
                DiseaseName          = entity.DISEASENAME,
                TotalScore           = entity.TOTOLSCORE
            };

            base.EntityToModel <CTMS_QA_TESTPAPER, QATestPaper>(entity, model);
            return(model);
        }
Beispiel #4
0
        public CTMS_QA_TESTPAPER ModelToEntity(QATestPaper model)
        {
            if (model == null)
            {
                return(null);
            }
            CTMS_QA_TESTPAPER entity = new CTMS_QA_TESTPAPER()
            {
                TESTPAPERID          = string.IsNullOrEmpty(model.TestPaperID) ? Guid.NewGuid().ToString() : model.TestPaperID,
                TESTPAPERNAME        = model.TestPaperName,
                TESTPAPERCODE        = model.TestPaperCode,
                TESTPAPERSOURCE      = model.TestPaperSource,
                TESTPAPERDESCRIPTION = model.TestPaperDescription,
                DISEASECODE          = model.DiseaseCode,
                DISEASENAME          = model.DiseaseName,
                TOTOLSCORE           = model.TotalScore
            };

            base.ModelToEntity <QATestPaper, CTMS_QA_TESTPAPER>(model, entity);
            return(entity);
        }