// InviteOther public static FlowActionRequest PostFlowActionInviteOther( string clientRequestGuid, string bizDocumentGuid, string bizDocumentTypeCode, DateTime bizTimeStamp, string userMemo, string bizDataPayloadJson, string optionalFlowActionDataJson, int userId, // 执行人员 string userGuid, int flowInstanceId, string flowInstanceGuid, string code, string currentActivityGuid, // 当前所处的活动状态(也许流程有多个入口) List <Paticipant> roles, // 接办人选择的下一个活动状态待办角色/人员列表 int relativeFlowTaskForUserId, int?delegateeUserId, string delegateeUserGuid ) { // 未通过合法性检查直接返回 if (!preValidate(clientRequestGuid)) { return(null); } var incomingReq = new FlowActionInviteOther( clientRequestGuid, bizDocumentGuid, bizDocumentTypeCode, bizTimeStamp, userMemo, bizDataPayloadJson, optionalFlowActionDataJson, userId, userGuid, flowInstanceId, flowInstanceGuid, code, currentActivityGuid, roles, relativeFlowTaskForUserId, delegateeUserId, delegateeUserGuid); return(saveToDB(incomingReq)); }
public FlowActionInviteOtherResult // inviteOther = More approval processActionRequest(FlowActionInviteOther req) { var concreteMetaObj = req.concreteMetaObj; using (var db = new EnouFlowInstanceContext()) { var flowInst = getFlowInstance(db, req.flowInstanceId, req.bizDocumentGuid); var reqInDb = getReqInDB(req.flowActionRequestId, db); string failReason; // 此类型ActionRequest不改TimeStamp DateTime bizTimeStampToUse = flowInst.bizTimeStamp; #region Check BizTimeStamp Valid if (!isBizTimeStampValid((DateTime)concreteMetaObj.bizTimeStamp, req, flowInst, out failReason)) { updateReqProcessingResultInDB(reqInDb, EnumFlowActionRequestResultType.fail, failReason); db.SaveChanges(); return(new FlowActionInviteOtherResult(req.flowActionRequestId, req.clientRequestGuid, flowInst, false, failReason)); } #endregion #region Decide List<UserDTO> //use the parameters of request List <UserDTO> taskUsers = new List <UserDTO>(); // taskUsers = FlowTemplateDefHelper.getUserDTOsFromPaticipantList(req.roles); taskUsers = getUserDTOsFromPaticipantList(req.roles, flowInst); #endregion #region add the invitation task for users: FlowTaskForUser taskUsers.ForEach(user => { var task = addFlowTaskForUser( db, user, flowInst, EnumFlowTaskType.invitation); // 邀请他人提供意见需要设置本身任务的FlowTaskForUserId用于对应跟踪 task.relativeFlowTaskForUserId = req.relativeFlowTaskForUserId; }); #endregion #region write 3 type logs addFlowInstanceFriendlyLog( flowInst, reqInDb.flowActionRequestId, flowInst.currentActivityName, reqInDb.userId.Value, reqInDb.delegateeUserId, "征询意见/Invite opinion", req.userMemo, db); #warning TODO: another 2 type logs #endregion #region update request updateRequestToSuccess(reqInDb, flowInst); #endregion #region save all to db db.SaveChanges(); #endregion return(new FlowActionInviteOtherResult(req.flowActionRequestId, req.clientRequestGuid, flowInst)); } }