private void SaveWorkflowMessage(SysWorkflowMessage msg) { Trace.Assert(msg.MessageId > 0); if (msg.NextApproveUserList.Count > 0) { foreach (IApproveUser user in msg.NextApproveUserList) { MessageApproveUser user2 = new MessageApproveUser(user) { WorkflowMessageId = msg.MessageId, MessageApproveUserId = this._context.GetNextIdentity_Int(false) }; this._context.Insert(user2); } } this._context.Insert(msg); }
public void CompleteApproveWorkItemAsync(int workItemId, ApproveResultEnum approveResult, string approveComment, List <IApproveUser> nextApproveUserList, bool addUser = false, int?addUserId = new int?()) { try { this.UpdateWorkItemAsCompleting(workItemId); int num = this._context.GetNextIdentity_Int(false); SysWorkflowMessage message = new SysWorkflowMessage { MessageId = num, MessageType = WorkflowMessageTypeEnum.CompletingApproveWorkItem, WorkItemId = workItemId, State = SysWorkflowMessageStateEnum.Inited, CreateTime = DateTime.Now, ApproveResult = approveResult, ApproveComment = approveComment, AddUser = addUser, AddUserId = addUserId }; if ((nextApproveUserList != null) && (nextApproveUserList.Count > 0)) { foreach (IApproveUser user in nextApproveUserList) { MessageApproveUser user2 = new MessageApproveUser(user) { WorkflowMessageId = num, MessageApproveUserId = this._context.GetNextIdentity_Int(false) }; this._context.Insert(user2); } } this._context.Insert(message); } catch (Exception exception) { AppLogHelper.Error(exception, "完成签核工作项失败,workitem_id={0}", new object[] { workItemId }); throw; } }
internal virtual int StartProcessAsync(int startUserId, int relativeObjectId, List <IApproveUser> nextApproveUserList) { using (BizDataContext context = new BizDataContext(true)) { SysProcessInstance instance = new SysProcessInstance { StartTime = new DateTime?(DateTime.Now), InstanceStatus = 0, ObjectId = relativeObjectId, ProcessId = new long?(this._process.ProcessId), ProcessInstanceId = context.GetNextIdentity_Int(false), StartUserId = new int?(startUserId) }; this._pi = instance; SysWorkflowMessage message = new SysWorkflowMessage { ProcessId = this._process.ProcessId, ProcessInstanceId = this._pi.ProcessInstanceId, CreateTime = DateTime.Now, MessageId = context.GetNextIdentity_Int(false), MessageType = WorkflowMessageTypeEnum.StartingProcess, OperationUserId = startUserId, State = SysWorkflowMessageStateEnum.Inited }; foreach (IApproveUser user in nextApproveUserList) { MessageApproveUser user2 = new MessageApproveUser(user) { //WorkflowMessageId = message.MessageId, WorkflowMessageId = context.GetNextIdentity_Int(false) }; context.Insert(user2); } context.Insert(message); context.Insert(this._pi); } return(this._pi.ProcessInstanceId); }