public string Start(BridgeCommandDto dto) { Category category = new CategoryService().Query() .FirstOrDefault(cate => cate.NID == dto.CategoryCode); WorkflowStructure workflowStructure = _abstractService.WorkflowStructureService.Query() .FirstOrDefault(e => e.CategoryCode == category.NID && e.Status == 1); var model = EmitCore.Convert <BridgeCommandDto, Bridge>(dto); string instanceID = WorkflowEngine.Instance.Start(workflowStructure.Resource); model.InstanceID = instanceID; model.Comment = String.IsNullOrEmpty(model.Comment) ? category.Name : model.Comment; model.CreateTime = DateTime.Now; CommandBus.Dispatch(new CreateBridge(), model); var b = _bridgeService.Query(instanceID); WorkflowInstance Instance = WorkflowInstance.GetInstance(instanceID); var current = GetCurrent(Instance, model.Creator); string serialObject = GetAuditNext(current, model.CategoryCode, b.Creator, b.Name, out string selectTransitionID); WorkflowEngine.Instance.Jump(new WorkflowContext() { Instance = Instance, ActorID = model.Creator, Message = "提交", TransitionID = selectTransitionID, Data = Newtonsoft.Json.JsonConvert.DeserializeObject(serialObject), Current = current }); return(instanceID); }
public ResultData Query(Paging paging) { List <WorkflowStructure> structures = _abstractService.WorkflowStructureService.Query(paging.Page, paging.Limit, out int total, paging.Get()); var w = EmitCore.Convert <List <WorkflowStructure>, List <WorkflowStructureDto> >(structures); return(CommonMethods.Response(w, total)); }
public string Post(VacationDto vacation) { vacation.CreateTime = DateTime.Now; vacation.NID = Guid.NewGuid().ToString(); var model = EmitCore.Convert <VacationDto, Vacation>(vacation); vacationService.Insert(model); return(CommonMethods.Start(vacation.NID, "001001", vacation.UID, String.Format("{0}请假{1}天", vacation.Name, vacation.Day))); }
public void Post(WorkflowStructureCommandDto dto) { dto.Resource = Uri.UnescapeDataString(dto.Resource); if (!String.IsNullOrEmpty(dto.NID)) { WorkflowStructure model = _abstractService.WorkflowStructureService .Query(dto.NID).FirstOrDefault(); if (model != null) { if (dto.CategoryCode != model.CategoryCode) { dto.Status = 0; } } } var w = EmitCore.Convert <WorkflowStructureCommandDto, WorkflowStructure>(dto); w.CreateTime = DateTime.Now; _abstractService.WorkflowStructureService.Persistent(w); }
public BridgeDto GetBridge(string id) { return(EmitCore.Convert <Bridge, BridgeDto>(_bridgeService.GetBridge(id))); }
public void Delete(SummaryDeleteDto dto) { var r = EmitCore.Convert <SummaryDeleteDto, Script>(dto); CommandBus.Dispatch(new DeleteAllRecord(), r); }
public ResultData PagingSupervise([FromBody] Paging info) { List <Summary> list = _summaryService.QuerySupervise(info, out int total).ToList(); return(CommonMethods.Response(EmitCore.Convert <List <Summary>, List <SummaryDto> >(list), total)); }
public VacationDto Get(string id) { return(EmitCore.Convert <Vacation, VacationDto>(vacationService.Get(id))); }
public WorkflowStructureDto Get(string id) { return(EmitCore.Convert <WorkflowStructure, WorkflowStructureDto>( _abstractService.WorkflowStructureService.Query(id).FirstOrDefault())); }
public IEnumerable <RecordDto> Get(string id) { return(EmitCore.Convert <List <Record>, List <RecordDto> >(_recordService.Query(id))); }
public ResultData Query(Dictionary <string, string> queryArg) { IList <Summary> list = _summaryService.Query(queryArg); return(CommonMethods.Response(EmitCore.Convert <IList <Summary>, List <SummaryDto> >(list), list.Count)); }