private void OnAddJcUserButtonClick(object sender, RoutedEventArgs e) { var btn = sender as Button; if (btn != null) { var parent = Utility.Utility.FindVisualParent <Grid>(btn); if (parent != null) { var acb = parent.FindName("JcUsersAutoCompleteBox") as AutoCompleteBox; var lsb = parent.FindName("JcUsersListBox") as ListBox; if (acb != null && lsb != null && acb.SelectedItem != null && acb.SelectedItem is SystemUser) { var user = acb.SelectedItem as SystemUser; var item = new JointCheckupUser { Id = 0, StepId = 0, UserId = user.UserId, UserInfo = user.Clone() as SystemUser }; var source = lsb.ItemsSource as List <JointCheckupUser> ?? new List <JointCheckupUser>(); source.Add(item); lsb.ItemsSource = null; lsb.ItemsSource = source; } } } }
//审计存档工作流 public int AuditArchiveWorkflow(FlowAuditRecord auditRecord) { if (auditRecord == null || auditRecord.FlowId < 1) { return(-2); } var awf = GetArchiveWorkflow(auditRecord.FlowId); if (awf == null || awf.FlowId != auditRecord.FlowId) { return(-3); } var twf = GetWorkflowInfo(awf.FlowType); WorkflowAuditStep curStep = null, nextStep = null; foreach (var step in twf.AuditSteps) { if (step.StepId == awf.CurrentStep) { curStep = step; continue; } if (curStep != null) { nextStep = step; break; } } if (curStep == null) { return(-4); } SqlHelper.Insert(auditRecord); if (curStep.AuditType == AuditType.JointCheckup) { var records = GetFlowAuditRecords(awf.FlowId); foreach (var user in GetStepJointCheckupUsers(curStep.StepId)) { JointCheckupUser user1 = user; if (!records.Exists(o => user1.UserId == o.AuditUserId)) { nextStep = curStep; break; } } } switch (auditRecord.Operation) { case AuditOperation.Audit: case AuditOperation.Final: case AuditOperation.JointCheck: if (nextStep != null && nextStep != curStep) { awf.CurrentStep = nextStep.StepId; awf.Status = AuditStatus.Auditing; } else if (nextStep == null) { awf.Status = AuditStatus.Audited; foreach (var file in awf.Files) { if (file.DocumentInfo != null) { file.DocumentInfo.Status = DocumentStatus.FinalVersion; SqlHelper.Update(file.DocumentInfo); } } } break; case AuditOperation.Return: awf.Status = AuditStatus.Returned; foreach (var file in awf.Files) { if (file.DocumentInfo != null) { file.DocumentInfo.Status = DocumentStatus.Hide; SqlHelper.Update(file.DocumentInfo); } } break; case AuditOperation.Reject: awf.CurrentStep = twf.AuditSteps.OrderBy(o => o.AuditIndex).First().StepId; awf.Status = AuditStatus.Rejected; break; } return(SqlHelper.Update(awf)); }