public virtual DEF_TestJobsDetailItemModel GetById(string id) { if (IsExists(id)) { DEF_TestJobsDetailItem entity = m_Rep.GetById(id); DEF_TestJobsDetailItemModel model = new DEF_TestJobsDetailItemModel(); model.VerCode = entity.VerCode; model.Code = entity.Code; model.Name = entity.Name; model.Description = entity.Description; model.Result = entity.Result; model.Sort = entity.Sort; model.ExSort = entity.ExSort; model.Lock = entity.Lock; model.Developer = entity.Developer; model.Tester = entity.Tester; model.FinDt = entity.FinDt; model.TestRequestFlag = entity.TestRequestFlag; model.DevFinFlag = entity.DevFinFlag; return(model); } else { return(null); } }
//新增 public override bool Create(ref ValidationErrors errors, DEF_TestJobsDetailStepsModel model) { try { //测试关键数值是否有效 DEF_TestJobsDetailItem testItem = testItemRep.GetById(model.VerCode, model.Code); if (testItem == null) { errors.Add("测试项目不存在"); return(false); } //新建对象 DEF_TestJobsDetailSteps entity = new DEF_TestJobsDetailSteps(); //实现从模型到对象设置值 entity.ItemID = model.ItemID; entity.VerCode = model.VerCode; entity.Code = model.Code; entity.Title = model.Title; entity.TestContent = model.TestContent; entity.Result = model.Result; entity.Sort = model.Sort; entity.ResultContent = model.ResultContent; entity.StepType = model.StepType; entity.TestDt = model.TestDt; entity.Tester = model.Tester; entity.Developer = model.Developer; entity.PlanStartDt = model.PlanStartDt; entity.PlanEndDt = model.PlanEndDt; entity.FinDt = model.FinDt; entity.DevFinFlag = model.DevFinFlag; entity.TestRequestFlag = model.TestRequestFlag; if (repository.Create(entity)) { return(true); } else { return(false); } } catch (Exception ex) { errors.Add(ex.Message); ExceptionHander.WriteException(ex); } return(false); }
public virtual bool Create(ref ValidationErrors errors, DEF_TestJobsDetailItemModel model) { try { DEF_TestJobsDetailItem entity = m_Rep.GetById(model.VerCode); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return(false); } entity = new DEF_TestJobsDetailItem(); entity.VerCode = model.VerCode; entity.Code = model.Code; entity.Name = model.Name; entity.Description = model.Description; entity.Result = model.Result; entity.Sort = model.Sort; entity.ExSort = model.ExSort; entity.Lock = model.Lock; entity.Developer = model.Developer; entity.Tester = model.Tester; entity.FinDt = model.FinDt; entity.TestRequestFlag = model.TestRequestFlag; entity.DevFinFlag = model.DevFinFlag; if (m_Rep.Create(entity)) { return(true); } else { errors.Add(Resource.InsertFail); return(false); } } catch (Exception ex) { errors.Add(ex.Message); ExceptionHander.WriteException(ex); return(false); } }
//添加 public override bool Create(DEF_TestJobsDetailItem entity) { Context.DEF_TestJobsDetailItem.Add(entity); //增加测试步骤 var caseSteps = Context.DEF_TestCaseSteps.Where(a => a.Code == entity.Code); foreach (var caseStep in caseSteps) { var step = new DEF_TestJobsDetailSteps(); step.ItemID = caseStep.ItemID; step.VerCode = entity.VerCode; step.Code = caseStep.Code; step.Title = caseStep.Title; step.TestContent = caseStep.TestContent; step.Sort = caseStep.sort; step.StepType = 0; step.TestRequestFlag = false; Context.DEF_TestJobsDetailSteps.Add(step); } return(this.SaveChanges() > 0); }