/// <summary> /// 更新GuideLineFlow /// </summary> /// <param name="model"></param> /// <returns></returns> public bool EditGuideLineFlow(GuideLineFlow model) { using (CRDatabase _context = new CRDatabase()) { var entity = _context.CTMS_GUIDELINEFLOW.FirstOrDefault(p => p.ID == model.ID); if (entity != null) { //1.将原先流程状态设置成删除 entity.ISDELETED = true; GuideLineFlow addModel = new GuideLineFlow(); addModel.ID = Guid.NewGuid().ToString(); addModel.GUIDELINENAME = entity.GUIDELINENAME; addModel.GUIDELINEINFO = model.GUIDELINEINFO; addModel.CreateUserID = model.CreateUserID; addModel.CreateDateTime = model.CreateDateTime; addModel.EditTime = model.EditTime; addModel.EditUserID = model.EditUserID; addModel.IsDeleted = false; addModel.OwnerID = model.OwnerID; _context.CTMS_GUIDELINEFLOW.Add(ModelToEntity(addModel)); return(_context.SaveChanges() > 0); } return(false); } }
/// <summary> /// 添加GuideLineFlow /// </summary> /// <param name="model"></param> /// <returns></returns> public bool AddGuideLineFlow(GuideLineFlow model) { using (CRDatabase _context = new CRDatabase()) { _context.CTMS_GUIDELINEFLOW.Add(ModelToEntity(model)); return(_context.SaveChanges() > 0); } }
public CTMS_GUIDELINEFLOW ModelToEntity(GuideLineFlow model) { if (model != null) { var entity = new CTMS_GUIDELINEFLOW() { ID = model.ID, GUIDELINENAME = model.GUIDELINENAME, GUIDELINEINFO = model.GUIDELINEINFO, CREATEUSERID = model.CreateUserID, CREATEDATETIME = model.CreateDateTime, EDITUSERID = model.EditUserID, EDITDATETIME = model.EditTime, ISDELETED = model.IsDeleted, OWNERID = model.OwnerID }; return(entity); } return(null); }
public GuideLineFlow EntityToModel(CTMS_GUIDELINEFLOW entity) { if (entity != null) { var model = new GuideLineFlow() { ID = entity.ID, GUIDELINENAME = entity.GUIDELINENAME, GUIDELINEINFO = entity.GUIDELINEINFO, CreateUserID = entity.CREATEUSERID, CreateDateTime = entity.CREATEDATETIME, EditUserID = entity.EDITUSERID, EditTime = entity.EDITDATETIME, IsDeleted = entity.ISDELETED, OwnerID = entity.OWNERID }; return(model); } return(null); }