InstanceManager.cs
资源名称:H3_OA.rar [点击查看]
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:9k
源码类别:
OA系统
开发平台:
C#
- using System;
- using System.Web;
- using System.Collections;
- using System.Web.Services;
- using System.Web.Services.Protocols;
- /// <summary>
- /// Summary description for InstanceManager
- /// </summary>
- [WebService(Namespace = "http://tempuri.org/")]
- [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
- public class InstanceManager : System.Web.Services.WebService
- {
- public InstanceManager()
- {
- //Uncomment the following line if using designed components
- //InitializeComponent();
- }
- // 创建一个流程实例,InstanceId为新创建的实例的ID,WorkflowDefinitionID为他的定义的模板的ID
- [WebMethod]
- public string CreateInstance(
- string WorkflowPackage,
- string WorkflowName,
- int WorkflowVersion,
- string InstanceName,
- string Originator,
- string OriginateRole,
- string Department,
- bool IsChildInstance,
- string ParentInstanceID,
- string ParentActivityName,
- long ParentActivityTokenID)
- {
- return OThinker.H3.Server.Engine.InstanceManager.CreateInstance(
- WorkflowPackage,
- WorkflowName,
- WorkflowVersion,
- InstanceName,
- Originator,
- OriginateRole,
- Department,
- IsChildInstance,
- ParentInstanceID,
- ParentActivityName,
- ParentActivityTokenID);
- }
- [WebMethod]
- public void RemoveInstance(string InstanceId)
- {
- OThinker.H3.Server.Engine.InstanceManager.RemoveInstance(InstanceId);
- }
- [WebMethod]
- public void SendMessage(byte[] BinMessage)
- {
- OThinker.H3.Messages.Message message
- = (OThinker.H3.Messages.Message)OThinker.Data.Convertor.ByteArrayToObject(BinMessage, false);
- if (message != null)
- {
- OThinker.H3.Server.Engine.InstanceManager.SendMessage(message);
- }
- }
- // 获得一个实例的状态
- [WebMethod]
- public byte[] GetInstanceContext(string InstanceId)
- {
- OThinker.H3.Instance.InstanceContext context = OThinker.H3.Server.Engine.InstanceManager.GetInstanceContext(InstanceId);
- return OThinker.Data.Convertor.ObjectToByteArray(context, true);
- }
- [WebMethod]
- public string GetInstanceName(string InstanceId)
- {
- return OThinker.H3.Server.Engine.InstanceManager.GetInstanceName(InstanceId);
- }
- [WebMethod]
- public void SetInstanceName(string InstanceId, string InstanceName)
- {
- OThinker.H3.Server.Engine.InstanceManager.SetInstanceName(InstanceId, InstanceName);
- }
- [WebMethod]
- public OThinker.H3.Instance.PriorityType GetInstancePriority(string InstanceId)
- {
- return OThinker.H3.Server.Engine.InstanceManager.GetInstancePriority(InstanceId);
- }
- [WebMethod]
- public void SetInstancePriority(string InstanceId, OThinker.H3.Instance.PriorityType Priority)
- {
- OThinker.H3.Server.Engine.InstanceManager.SetInstancePriority(InstanceId, Priority);
- }
- [WebMethod]
- public string GetInstanceOriginator(string InstanceId)
- {
- return OThinker.H3.Server.Engine.InstanceManager.GetInstanceOriginator(InstanceId);
- }
- [WebMethod]
- public string GetInstanceOriginateGroup(string InstanceId)
- {
- return OThinker.H3.Server.Engine.InstanceManager.GetInstanceOriginateGroup(InstanceId);
- }
- [WebMethod]
- public System.DateTime GetInstanceCreateTime(string InstanceId)
- {
- return OThinker.H3.Server.Engine.InstanceManager.GetInstanceCreateTime(InstanceId);
- }
- [WebMethod]
- public string GetInstanceWorkflowPackage(string InstanceId)
- {
- return OThinker.H3.Server.Engine.InstanceManager.GetInstanceWorkflowPackage(InstanceId);
- }
- [WebMethod]
- public string GetInstanceWorkflowName(string InstanceId)
- {
- return OThinker.H3.Server.Engine.InstanceManager.GetInstanceWorkflowName(InstanceId);
- }
- [WebMethod]
- public int GetInstanceWorkflowVersion(string InstanceId)
- {
- return OThinker.H3.Server.Engine.InstanceManager.GetInstanceWorkflowVersion(InstanceId);
- }
- /// <summary>
- /// 查找符合条件的实例
- /// </summary>
- /// <param name="ParentInstanceID">父实例ID,如果为OThinker.H3.Instance.InstanceContext.UnspecifiedID,则忽略</param>
- /// <param name="InstanceState">实例状态,如果为OThinker.H3.Instance.InstanceState.Unspecified,则忽略</param>
- /// <param name="WorkflowPackage">流程类型,如果为null,则忽略</param>
- /// <param name="WorkflowName">流程名,如果为null,则忽略</param>
- /// <param name="WorkflowVersion">流程版本号,如果为OThinker.H3.Workflow.Workflow.AllWorkflowVersion,则忽略</param>
- /// <param name="CreateTime_From">最小创建时间,如果为System.DateTime.MinValue,则忽略</param>
- /// <param name="CreateTime_To">最大创建时间,如果为System.DateTime.MaxValue,则忽略</param>
- /// <returns>实例ID</returns>
- [WebMethod]
- public string[] Query(
- string[] Originators,
- string Department,
- string ParentInstanceID,
- OThinker.H3.Instance.InstanceState InstanceState,
- string WorkflowPackage,
- string WorkflowName,
- int WorkflowVersion,
- System.DateTime CreatedTime_From,
- System.DateTime CreatedTime_To,
- string Name)
- {
- return OThinker.H3.Server.Engine.InstanceManager.Query(
- Originators,
- Department,
- ParentInstanceID,
- InstanceState,
- WorkflowPackage,
- WorkflowName,
- WorkflowVersion,
- CreatedTime_From,
- CreatedTime_To,
- Name);
- }
- [WebMethod]
- public System.Data.DataTable QueryDataTable(
- string[] Instances,
- string[] Originators,
- string Department,
- string ParentInstanceID,
- OThinker.H3.Instance.InstanceState InstanceState,
- string WorkflowPackage,
- string WorkflowName,
- int WorkflowVersion,
- System.DateTime CreatedTime_From,
- System.DateTime CreatedTime_To,
- string Name,
- OThinker.H3.Instance.PriorityType Priority)
- {
- return OThinker.H3.Portal.Query.QueryInstance(
- Instances,
- Originators,
- Department,
- ParentInstanceID,
- InstanceState,
- WorkflowPackage,
- WorkflowName,
- WorkflowVersion,
- CreatedTime_From,
- CreatedTime_To,
- Name,
- Priority,
- OThinker.Data.BoolMatchValue.Unspecified,
- OThinker.Data.BoolMatchValue.Unspecified);
- }
- /// <summary>
- /// 获得流程的性能
- /// </summary>
- /// <param name="WorkflowPackage"></param>
- /// <param name="WorkflowName"></param>
- /// <param name="WorkflowVersion"></param>
- /// <param name="CreatedTime_From"></param>
- /// <param name="CreatedTime_To"></param>
- /// <returns></returns>
- [WebMethod]
- public OThinker.H3.WorkflowTemplate.WorkflowPerformance GetWorkflowPerformance(
- string[] Originators,
- string Department,
- string WorkflowPackage,
- string WorkflowName,
- int WorkflowVersion,
- System.DateTime CreatedTime_From,
- System.DateTime CreatedTime_To)
- {
- return OThinker.H3.Server.Engine.InstanceManager.GetWorkflowPerformance(
- Originators,
- Department,
- WorkflowPackage,
- WorkflowName,
- WorkflowVersion,
- CreatedTime_From,
- CreatedTime_To);
- }
- /// <summary>
- /// 绘制流程图
- /// </summary>
- /// <param name="InstanceId"></param>
- /// <param name="FinishedElements"></param>
- /// <param name="RunningElements"></param>
- /// <returns></returns>
- [WebMethod]
- public byte[] ChartInstanceState(
- string InstanceId,
- string[] FinishedActivities,
- string[] RunningActivities,
- string[] ExceptionalActivities)
- {
- return OThinker.H3.Server.Engine.InstanceManager.ChartInstanceState(InstanceId, FinishedActivities, RunningActivities, ExceptionalActivities);
- }
- /// <summary>
- /// 获得父流程的工作流信息
- /// </summary>
- /// <param name="InstanceId"></param>
- /// <returns></returns>
- [WebMethod]
- public OThinker.H3.Instance.ParentInstanceInfo GetParentInstanceInfo(string InstanceId)
- {
- return OThinker.H3.Server.Engine.InstanceManager.GetParentInstanceInfo(InstanceId);
- }
- }