public async Task <RoutineDTO> AddRoutineAsync(RoutineDTO routineDTO) { var result = await _routineRepository .AddAsync(new Routine { Title = routineDTO.Title, Description = routineDTO.Description }); return(_mapper.Map <RoutineDTO>(result)); }
public List <RoutineDTO> _StartRoutine(string id) { var userAccount = Request.RequestUri.ParseQueryString().Get("UserAccount"); FormulaHelper.ContextSet("AgentUserLoginName", userAccount); List <ButtonInfo> buttonInfoList = flowService.JsonGetFlowButtons("", ""); FormulaHelper.ContextRemoveByKey("AgentUserLoginName"); var list = new List <RoutineDTO>(); foreach (var btn in buttonInfoList) { if (btn.routingParams != null) { var routine = new RoutineDTO(); routine.ID = btn.id; if (btn.routingParams.selectMode == "SelectOneUser" || btn.routingParams.selectMode == "SelectOneUserInScope") { routine.OwnerType = OwnerType.Single; } else if (btn.routingParams.selectMode == "SelectMultiUser" || btn.routingParams.selectMode == "SelectMultiUserInScope" || btn.routingParams.selectMode == "SelectOneOrg" || btn.routingParams.selectMode == "SelectMultiOrg") { routine.OwnerType = OwnerType.Multi; } else { routine.OwnerType = OwnerType.None; } routine.OwnerUserIDs = btn.routingParams.userIDs; routine.RoutineName = btn.text; routine.MustInputComment = btn.routingParams.mustInputComment; list.Add(routine); } } return(list); }
private List <RoutineDTO> GetRountineList(string formInstanceID, string id, StringDictionary formDic) { List <ButtonInfo> buttonInfoList = flowService.JsonGetFlowButtons(formInstanceID, id, true); List <RoutineDTO> Routines = new List <RoutineDTO>(); List <RoutineDTO> staticRoutines = new List <RoutineDTO>(); for (var i = 0; i < buttonInfoList.Count; i++) { RoutineDTO routine; var item = buttonInfoList[i]; if (item.id == "btnDoBack" || item.id == "btnDoBackFirst" || item.id == "btnDoBackFirstReturn") { routine = new RoutineDTO { ID = item.id, RoutineName = item.text, }; routine.OwnerType = OwnerType.None; routine.OwnerUserIDs = ""; staticRoutines.Add(routine); continue; } else if (item.id == "btnDelegate" || item.id == "btnAsk") { routine = new RoutineDTO { ID = item.id, RoutineName = item.text, }; routine.OwnerType = OwnerType.Single; routine.OwnerUserIDs = ""; staticRoutines.Add(routine); continue; } else if (item.id == "btnCirculate") { routine = new RoutineDTO { ID = item.id, RoutineName = item.text, }; routine.OwnerType = OwnerType.Multi; routine.OwnerUserIDs = ""; staticRoutines.Add(routine); continue; } else if (item.id == "btnView" || item.id == "btnReply" || item.id == "btnWithdrawAsk" || item.id == "btnWithdraw" || item.id == "btnDelete") { routine = new RoutineDTO { ID = item.id, RoutineName = item.text, }; routine.OwnerType = OwnerType.None; routine.OwnerUserIDs = ""; staticRoutines.Add(routine); continue; } else if (item.id.StartsWith("btn")) { //buttonInfoList.Remove(item); //这句注释掉,否则循环都乱了 continue; } routine = new RoutineDTO { ID = item.id, RoutineName = item.text, MustInputComment = item.routingParams.mustInputComment, SelectAgain = item.routingParams.selectAgain, DefaultComment = item.routingParams.defaultComment }; Routines.Add(routine); routine.OwnerType = OwnerType.None; routine.OwnerUserIDs = item.routingParams.userIDs; if (item.routingParams.flowComplete == true) //移动端在流程结束时不再选人 { routine.OwnerType = OwnerType.None; routine.OwnerUserIDs = ""; continue; } if (item.routingParams.routingID.Contains(','))//分支路由不用选人 { routine.OwnerType = OwnerType.None; continue; } if (item.routingParams.userIDs == "") { if (item.routingParams.selectMode == "SelectOneUser") { routine.OwnerType = OwnerType.Single; } else if (item.routingParams.selectMode == "SelectMultiUser") { routine.OwnerType = OwnerType.Multi; } else if (!string.IsNullOrEmpty(item.routingParams.userIDsFromField) || !string.IsNullOrEmpty(item.routingParams.orgIDFromField) || !string.IsNullOrEmpty(item.routingParams.roleIDsFromField)) { routine.OwnerType = OwnerType.None; } else { routine.OwnerType = OwnerType.None; } } else { if (item.routingParams.selectMode == "SelectOneUserInScope" || item.routingParams.selectMode == "SelectOnePrjUser") { routine.OwnerType = OwnerType.Single; } else if (item.routingParams.selectMode == "SelectMultiUserInScope" || item.routingParams.selectMode == "SelectMultiPrjUser") { routine.OwnerType = OwnerType.Multi; } else { routine.OwnerType = OwnerType.Special; } if (item.routingParams.selectAgain) { if (item.routingParams.selectMode == "SelectOneUserInScope" || item.routingParams.selectMode == "SelectOnePrjUser" || item.routingParams.selectMode == "SelectOneUser") { routine.OwnerType = OwnerType.Single; if (item.routingParams.selectMode == "SelectOneUser") { routine.OwnerUserIDs = ""; } } else if (item.routingParams.selectMode == "SelectMultiUserInScope" || item.routingParams.selectMode == "SelectMultiPrjUser" || item.routingParams.selectMode == "SelectMultiUser") { routine.OwnerType = OwnerType.Multi; if (item.routingParams.selectMode == "SelectMultiUser") { routine.OwnerUserIDs = ""; } } } } } //排序需要与PC端一致,故反过来 for (int i = 0; i < staticRoutines.Count; i++) { Routines.Add(staticRoutines[i]); } return(Routines); }
public List <RoutineDTO> GetRountineLists(string formInstanceID, string id, [FromBody] PostSubmitTaskDTO taskDto) { var userAccount = Request.RequestUri.ParseQueryString().Get("UserAccount"); FormulaHelper.ContextSet("AgentUserLoginName", userAccount); string formdata = JsonHelper.ToJson(taskDto.FormDic); FlowService flowservice = new FlowService(this, taskDto.FormDic, "", id); List <ButtonInfo> buttonInfoList = new List <ButtonInfo>(); if (string.IsNullOrEmpty(id)) { buttonInfoList = flowservice.JsonGetFlowButtons("", ""); var list = new List <RoutineDTO>(); foreach (var btn in buttonInfoList) { if (btn.routingParams != null) { var routine = new RoutineDTO(); routine.ID = btn.id; if (btn.routingParams.userIDs == "") { if (btn.routingParams.selectMode == "SelectOneUser") { routine.OwnerType = OwnerType.Single; } else if (btn.routingParams.selectMode == "SelectMultiUser") { routine.OwnerType = OwnerType.Multi; } else if (!string.IsNullOrEmpty(btn.routingParams.userIDsFromField) || !string.IsNullOrEmpty(btn.routingParams.orgIDFromField) || !string.IsNullOrEmpty(btn.routingParams.roleIDsFromField)) { routine.OwnerType = OwnerType.None; } else { routine.OwnerType = OwnerType.None; } } else { if (btn.routingParams.selectMode == "SelectOneUserInScope" || btn.routingParams.selectMode == "SelectOnePrjUser") { routine.OwnerType = OwnerType.Single; } else if (btn.routingParams.selectMode == "SelectMultiUserInScope" || btn.routingParams.selectMode == "SelectMultiPrjUser") { routine.OwnerType = OwnerType.Multi; } else { routine.OwnerType = OwnerType.Special; } if (btn.routingParams.selectAgain) { if (btn.routingParams.selectMode == "SelectOneUserInScope" || btn.routingParams.selectMode == "SelectOnePrjUser" || btn.routingParams.selectMode == "SelectOneUser") { routine.OwnerType = OwnerType.Single; if (btn.routingParams.selectMode == "SelectOneUser") { routine.OwnerUserIDs = ""; } } else if (btn.routingParams.selectMode == "SelectMultiUserInScope" || btn.routingParams.selectMode == "SelectMultiPrjUser" || btn.routingParams.selectMode == "SelectMultiUser") { routine.OwnerType = OwnerType.Multi; if (btn.routingParams.selectMode == "SelectMultiUser") { routine.OwnerUserIDs = ""; } } } } routine.OwnerUserIDs = btn.routingParams.userIDs; routine.RoutineName = btn.text; routine.MustInputComment = btn.routingParams.mustInputComment; list.Add(routine); } } return(list); } else { buttonInfoList = flowservice.JsonGetFlowButtons(formInstanceID, id, true); } FormulaHelper.ContextRemoveByKey("AgentUserLoginName"); List <RoutineDTO> Routines = new List <RoutineDTO>(); List <RoutineDTO> staticRoutines = new List <RoutineDTO>(); for (var i = 0; i < buttonInfoList.Count; i++) { RoutineDTO routine; var item = buttonInfoList[i]; if (item.id == "btnDoBack" || item.id == "btnDoBackFirst" || item.id == "btnDoBackFirstReturn") { routine = new RoutineDTO { ID = item.id, RoutineName = item.text, }; routine.OwnerType = OwnerType.None; routine.OwnerUserIDs = ""; staticRoutines.Add(routine); continue; } else if (item.id == "btnDelegate" || item.id == "btnAsk") { routine = new RoutineDTO { ID = item.id, RoutineName = item.text, }; routine.OwnerType = OwnerType.Single; routine.OwnerUserIDs = ""; staticRoutines.Add(routine); continue; } else if (item.id == "btnCirculate") { routine = new RoutineDTO { ID = item.id, RoutineName = item.text, }; routine.OwnerType = OwnerType.Multi; routine.OwnerUserIDs = ""; staticRoutines.Add(routine); continue; } else if (item.id == "btnView" || item.id == "btnReply" || item.id == "btnWithdrawAsk" || item.id == "btnWithdraw" || item.id == "btnDelete") { routine = new RoutineDTO { ID = item.id, RoutineName = item.text, }; routine.OwnerType = OwnerType.None; routine.OwnerUserIDs = ""; staticRoutines.Add(routine); continue; } else if (item.id.StartsWith("btn")) { //buttonInfoList.Remove(item); //这句注释掉,否则循环都乱了 continue; } routine = new RoutineDTO { ID = item.id, RoutineName = item.text, MustInputComment = item.routingParams.mustInputComment, SelectAgain = item.routingParams.selectAgain, DefaultComment = item.routingParams.defaultComment }; Routines.Add(routine); routine.OwnerType = OwnerType.None; routine.OwnerUserIDs = item.routingParams.userIDs; if (item.routingParams.flowComplete == true) //移动端在流程结束时不再选人 { routine.OwnerType = OwnerType.None; routine.OwnerUserIDs = ""; continue; } if (item.routingParams.routingID.Contains(','))//分支路由不用选人 { routine.OwnerType = OwnerType.None; continue; } if (item.routingParams.userIDs == "") { if (item.routingParams.selectMode == "SelectOneUser") { routine.OwnerType = OwnerType.Single; } else if (item.routingParams.selectMode == "SelectMultiUser") { routine.OwnerType = OwnerType.Multi; } else if (!string.IsNullOrEmpty(item.routingParams.userIDsFromField) || !string.IsNullOrEmpty(item.routingParams.orgIDFromField) || !string.IsNullOrEmpty(item.routingParams.roleIDsFromField)) { routine.OwnerType = OwnerType.None; } else { routine.OwnerType = OwnerType.None; } } else { if (item.routingParams.selectMode == "SelectOneUserInScope" || item.routingParams.selectMode == "SelectOnePrjUser") { routine.OwnerType = OwnerType.Single; } else if (item.routingParams.selectMode == "SelectMultiUserInScope" || item.routingParams.selectMode == "SelectMultiPrjUser") { routine.OwnerType = OwnerType.Multi; } else { routine.OwnerType = OwnerType.Special; } if (item.routingParams.selectAgain) { if (item.routingParams.selectMode == "SelectOneUserInScope" || item.routingParams.selectMode == "SelectOnePrjUser" || item.routingParams.selectMode == "SelectOneUser") { routine.OwnerType = OwnerType.Single; if (item.routingParams.selectMode == "SelectOneUser") { routine.OwnerUserIDs = ""; } } else if (item.routingParams.selectMode == "SelectMultiUserInScope" || item.routingParams.selectMode == "SelectMultiPrjUser" || item.routingParams.selectMode == "SelectMultiUser") { routine.OwnerType = OwnerType.Multi; if (item.routingParams.selectMode == "SelectMultiUser") { routine.OwnerUserIDs = ""; } } } } } //排序需要与PC端一致,故反过来 for (int i = 0; i < staticRoutines.Count; i++) { Routines.Add(staticRoutines[i]); } return(Routines); }
public async Task <IActionResult> Post([FromBody] RoutineDTO routineDTO) { var routine = await _routineService.AddRoutineAsync(routineDTO); return(Ok(routine)); }