public CPFlowInstanceTask ReCreateTask( ) { Mapper.Initialize(cfg => { cfg.CreateMap <CPFlowInstanceLog, CPFlowInstanceTask>().ForMember(dest => dest.Id, opt => { opt.Ignore(); });; }); CPFlowInstanceTask task = AutoMapper.Mapper.Map <CPFlowInstanceTask>(this); task.RevTime = DateTime.Now; task.RevUserIsView = false; task.RevUserViewTime = null; return(task); }
public static CPFlowInstanceTask InitFromInstanceAndPhase(CPFlowInstance ins, CPFlowInstanceTask curTask, CPFlowPhase phase, CPFlowPhaseTaskRevUser revUser, List <CPFlowPhaseLink> phaseAllLinkCol) { CPFlowInstanceTask newTask = new CPFlowInstanceTask(); newTask.InsId = ins.InsId; newTask.FlowVerId = ins.FlowVerId; newTask.FlowId = ins.FlowId; newTask.FlowName = ins.FlowName; newTask.InsTitle = ins.InsTitle; //有多条路由进入,则默认设置成不激活,否则设置成激活 if (phaseAllLinkCol.Where(c => c.EndPhaseId.Equals(phase.PhaseId)).ToList().Count > 1) { newTask.TaskState = CPFlowEnum.TaskStateEnum.NotActive; } else { newTask.TaskState = CPFlowEnum.TaskStateEnum.AlreadyActivated; } newTask.TaskMakeType = CPFlowEnum.TaskMakeTypeEnum.Submit; if (phase.PhaseType == CPFlowEnum.PhaseTypeEnum.Circulation) { newTask.TaskType = CPFlowEnum.TaskTypeEnum.MissionTask; } else { newTask.TaskType = CPFlowEnum.TaskTypeEnum.NormalTask; } newTask.SubmitPhaseIds = curTask.RevPhaseId.ToString(); newTask.SubmitPhaseNames = curTask.RevPhaseName; newTask.SubmitTaskIds = curTask.TaskId.ToString(); newTask.SubmitUserIds = curTask.RevUserId.ToString(); newTask.SubmitUserNames = curTask.RevUserName; newTask.RevPhaseId = phase.PhaseId; newTask.RevPhaseName = phase.PhaseName; newTask.RevUserId = revUser.RevUserId; newTask.RevUserName = revUser.RevUserName; newTask.RevSourceUserId = revUser.RevSourceUserId; newTask.RevSourceUserName = revUser.RevSourceUserName; newTask.RevTime = DateTime.Now; newTask.RevUserIsView = false; return(newTask); }
public static CPFlowInstanceLog InitFromTask(CPFlowInstanceTask task) { Mapper.Initialize(cfg => { cfg.CreateMap <CPFlowInstanceTask, CPFlowInstanceLog>().ForMember(dest => dest.Id, opt => { opt.Ignore(); });; }); CPFlowInstanceLog log = AutoMapper.Mapper.Map <CPFlowInstanceLog>(task); if (task.RevUserViewTime.HasValue == false) { log.RevUserViewTime = DateTime.Now; } log.TaskManaTime = DateTime.Now; //默认是提交 log.TaskManaType = CPFlowEnum.TaskMakeTypeEnum.Submit; return(log); }