public override void SetParams() { base.SetParams(); Countersign1.Submit(); //FlowParams.SetParams("leaders", @"founder\zhangweixing,founder\zybpmadmin");//分管领导 //return; string counterSignDeptIds = Countersign1.Result; StringBuilder leaders = new StringBuilder(); if (!string.IsNullOrEmpty(counterSignDeptIds)) { string[] deptIds = counterSignDeptIds.Split(','); foreach (var item in deptIds) { BFPmsUserRoleDepartment bfurd = new BFPmsUserRoleDepartment(); DataTable dt = bfurd.GetSelectRoleUser(item, "主管领导"); foreach (DataRow dr in dt.Rows) { leaders.AppendFormat(@"Founder\{0},", dt.Rows[0]["LoginName"].ToString()); } } } FlowParams.SetParams("leaders", leaders.ToString().Trim(','));//分管领导 }
public override void SetParams() { base.SetParams(); FlowParams.SetParams("WFM", @"founder\tangsheng"); //流程审核人 FlowParams.SetParams("DeptManager", GetUserLoginName("部门负责人")); //部门负责人 FlowParams.SetParams("CEO", GetUserLoginName("CEO")); //CEO FlowParams.SetParams("StartUser", _BPMContext.CurrentUser.LoginId); //发起人 //FlowParams.SetParams("CounterSignUsers", @"founder\yanghechun,founder\zhangweixing");//会签部门 ///提交前所有字段需传入 Countersign1.Submit(); }
public byte[] ExecuteFlowWithReturn(string flowID, string[] keys, string[] values) { if (string.IsNullOrEmpty(flowID) || string.IsNullOrEmpty(flowID)) { throw new Exception("Missing required parameter FlowID."); } FlowParams flowParams = new FlowParams(); flowParams.FlowID = flowID; flowParams.Keys = keys; flowParams.Values = values; flowParams.ResetEvent = new ManualResetEvent(false); flowParams.ReturnValue = new byte[0]; Thread thread = new Thread(new ParameterizedThreadStart(this.ExecuteFlowWithReturnWorkerMethod)); thread.Start(flowParams); flowParams.ResetEvent.WaitOne(); return(flowParams.ReturnValue); }
private void ExecuteFlowWithReturnWorkerMethod(object param) { FlowParams flowParams = param as FlowParams; string flowID = flowParams.FlowID; string[] keys = flowParams.Keys; string[] values = flowParams.Values; NameValueCollection inputParameters = GenerateInputParameters(flowID, keys, values); // // Force insertion of ResponseInBrowser = true // string respInBrowser = inputParameters["ResponseInBrowser"]; if (respInBrowser != null) { inputParameters.Remove("ResponseInBrowser"); } inputParameters["ResponseInBrowser"] = "True"; FlowManifest manifest = new FlowManifest(); manifest.RequestInitiated = DateTime.Now; manifest.InputParameters = inputParameters; manifest.FlowID = flowID; manifest.GUID = Guid.NewGuid(); byte[] returnValue = new byte[0]; string msmqPath = ConfigurationManager.AppSettings["DestinationMsmqPath"]; try { manifest.FlowStatus = FlowStatus.CompletedGateway; // // Send to Retrival. // using (MessageQueue mqPublisher = new MessageQueue(msmqPath)) { mqPublisher.Formatter = new BinaryMessageFormatter(); System.Messaging.Message msgPublisher = new System.Messaging.Message(); msgPublisher.Formatter = new BinaryMessageFormatter(); msgPublisher.Body = manifest.ToXmlDocument().OuterXml; msgPublisher.Label = string.Format("{0} - {1}", manifest.FlowID, manifest.FlowStatus.ToString()); mqPublisher.Send(msgPublisher); } // // Send message to log. // bool bLogToEvents = bool.Parse(ConfigurationManager.AppSettings["LogToEvents"]); if (bLogToEvents) { msmqPath = ConfigurationManager.AppSettings["EventsMsmqPath"]; using (MessageQueue mqLog = new MessageQueue(msmqPath)) { mqLog.Formatter = new BinaryMessageFormatter(); System.Messaging.Message msgLog = new System.Messaging.Message(); msgLog.Formatter = new BinaryMessageFormatter(); msgLog.Body = manifest.ToXmlDocument().OuterXml; msgLog.Label = string.Format("{0} - {1}", manifest.FlowID, manifest.FlowStatus.ToString()); mqLog.Send(msgLog); } } // Handle response and return. ResponseInBrowserHost host = new ResponseInBrowserHost(this.Context, "net.pipe://localhost/CompuFlow.Gateway." + manifest.GUID.ToString()); host.NoHttpContextWrite = true; host.Start(manifest.GUID); returnValue = host.ResponseInBrowserData; } catch (StackOverflowException) { throw; } catch (OutOfMemoryException) { throw; } catch (ThreadAbortException) { throw; } catch (Exception x) { string msg = string.Format("Failure to send message to MSMQ Path: {0}\r\nFlow: {0}.", msmqPath, manifest.GUID.ToString()); ExceptionManager.PublishException(new Exception(msg, x), "Error"); } flowParams.ReturnValue = returnValue; flowParams.ResetEvent.Set(); }