InstanceDataManager.cs
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:10k
源码类别:

OA系统

开发平台:

C#

  1. using System;
  2. using System.Web;
  3. using System.Collections;
  4. using System.Web.Services;
  5. using System.Web.Services.Protocols;
  6. /// <summary>
  7. /// Summary description for InstanceDataManager
  8. /// </summary>
  9. [WebService(Namespace = "http://tempuri.org/")]
  10. [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
  11. public class InstanceDataManager : System.Web.Services.WebService
  12. {
  13.     public InstanceDataManager()
  14.     {
  15.         //Uncomment the following line if using designed components 
  16.         //InitializeComponent(); 
  17.     }
  18.     [WebMethod]
  19.     public bool Exist(
  20.         string InstanceId,
  21.         string ItemName)
  22.     {
  23.         return OThinker.H3.Server.Engine.InstanceDataManager.Exist(
  24.             InstanceId,
  25.             ItemName);
  26.     }
  27.     // 获得数据项的值
  28.     [WebMethod]
  29.     public byte[] GetItemValue(
  30.         string InstanceId,
  31.         long TokenID, 
  32.         string ItemName)
  33.     {
  34.         object itemValue = OThinker.H3.Server.Engine.InstanceDataManager.GetItemValue(InstanceId, TokenID, ItemName);
  35.         return OThinker.Data.Convertor.ObjectToByteArray(itemValue, false);
  36.     }
  37.     [WebMethod]
  38.     public byte[] GetItemValue2(
  39.             string WorkflowPackage,
  40.             string WorkflowName,
  41.             int WorkflowVersion,
  42.             string InstanceId,
  43.             long TokenID, 
  44.             string ItemName,
  45.             string Filler, 
  46.             ref object RelatedValue)
  47.     {
  48.         object itemValue = OThinker.H3.Server.Engine.InstanceDataManager.GetItemValue(
  49.             WorkflowPackage, 
  50.             WorkflowName, 
  51.             WorkflowVersion, 
  52.             InstanceId, 
  53.             TokenID, 
  54.             ItemName,
  55.             Filler, 
  56.             ref RelatedValue);
  57.         return OThinker.Data.Convertor.ObjectToByteArray(itemValue, false);
  58.     }
  59.     // 设置值
  60.     [WebMethod]
  61.     public long SetItemValue(
  62.         string InstanceId,
  63.         long TokenID, 
  64.         string ItemName,
  65.         string ActivityName,
  66.         string ModifiedBy,
  67.         byte[] SerializedValue)
  68.     {
  69.         object itemValue = OThinker.Data.Convertor.ByteArrayToObject(SerializedValue, false);
  70.         return OThinker.H3.Server.Engine.InstanceDataManager.SetItemValue(
  71.             InstanceId,
  72.             TokenID, 
  73.             ItemName,
  74.             ActivityName,
  75.             ModifiedBy,
  76.             itemValue);
  77.     }
  78.     // 追加一个数据
  79.     [WebMethod]
  80.     public long Append(
  81.         string InstanceId,
  82.         long TokenID, 
  83.         string ItemName,
  84.         string ActivityName,
  85.         string ModifiedBy,
  86.         byte[] SerializedValue)
  87.     {
  88.         object itemValue = OThinker.Data.Convertor.ByteArrayToObject(SerializedValue, false);
  89.         return OThinker.H3.Server.Engine.InstanceDataManager.Append(
  90.             InstanceId,
  91.             TokenID, 
  92.             ItemName,
  93.             ActivityName,
  94.             ModifiedBy,
  95.             itemValue);
  96.     }
  97.     // 创建一个数据集合
  98.     [WebMethod]
  99.     public long CreateItems(string InstanceId)
  100.     {
  101.         return OThinker.H3.Server.Engine.InstanceDataManager.CreateItems(InstanceId);
  102.     }
  103.     // 复制一个数据项
  104.     [WebMethod]
  105.     public long CopyInstanceData(
  106.         string SourceInstanceID,
  107.         long SourceTokenID, 
  108.         string SourceItemName,
  109.         string DestInstanceID,
  110.         long DestTokenID, 
  111.         string DestItemName)
  112.     {
  113.         return OThinker.H3.Server.Engine.InstanceDataManager.CopyInstanceData(
  114.             SourceInstanceID,
  115.             SourceTokenID, 
  116.             SourceItemName,
  117.             DestInstanceID,
  118.             DestTokenID, 
  119.             DestItemName);
  120.     }
  121.     // 移除一个数据集合
  122.     [WebMethod]
  123.     public void RemoveInstance(string InstanceId)
  124.     {
  125.         OThinker.H3.Server.Engine.InstanceDataManager.RemoveInstance(InstanceId);
  126.     }
  127.     /// <summary>
  128.     /// 统计信息
  129.     /// </summary>
  130.     /// <param name="WorkflowPackage"></param>
  131.     /// <param name="WorkflowName"></param>
  132.     /// <param name="WorkflowVersion"></param>
  133.     /// <param name="Instances"></param>
  134.     /// <param name="ItemName"></param>
  135.     /// <returns></returns>
  136.     [WebMethod]
  137.     public OThinker.H3.Data.InstanceDataStatistics Stat(
  138.         string WorkflowPackage,
  139.         string WorkflowName,
  140.         int WorkflowVersion,
  141.         string[] Instances,
  142.         string ItemName)
  143.     {
  144.         return OThinker.H3.Server.Engine.InstanceDataManager.Stat(
  145.             WorkflowPackage,
  146.             WorkflowName,
  147.             WorkflowVersion,
  148.             Instances,
  149.             ItemName);
  150.     }
  151.     /// <summary>
  152.     /// 按照关键字来查找流程,查找数据项值略为ItemValue的流程ID集合,该方法使用的时间会比较长
  153.     /// </summary>
  154.     /// <param name="Workflow">所属的流程模板</param>
  155.     /// <param name="ItemName">数据项名称</param>
  156.     /// <param name="ItemValue">数据项值</param>
  157.     /// <param name="Instances">流程范围,只在该范围内进行搜索</param>
  158.     /// <returns>流程ID</returns>
  159.     [WebMethod]
  160.     public string[] Query(
  161.         OThinker.H3.WorkflowTemplate.WorkflowTemplate Workflow,
  162.         string ItemName,
  163.         OThinker.Data.ComparisonOperatorType Operator, 
  164.         object ItemValue,
  165.         string[] Instances)
  166.     {
  167.         return OThinker.H3.Server.Engine.InstanceDataManager.Query(Workflow, ItemName, Operator, ItemValue, Instances);
  168.     }
  169.     /// <summary>
  170.     /// 修改一个评论
  171.     /// </summary>
  172.     /// <param name="WorkflowPackage">该评论所属的流程的流程模板的包名称</param>
  173.     /// <param name="WorkflowName">该评论所属的流程的流程模板的名称</param>
  174.     /// <param name="WorkflowVersion">该评论所属的流程的流程模板的版本号</param>
  175.     /// <param name="InstanceId">该评论所属的流程的流程</param>
  176.     /// <param name="ItemName">该评论对应的字段</param>
  177.     /// <param name="CommentID">该评论的ID</param>
  178.     /// <param name="Text">新评论的文本</param>
  179.     /// <param name="Approval">新评论是否标记为同意</param>
  180.     /// <returns>如果找不到该评论则返回ErrorCode.ITEM_NOT_EXIST,否则返回ErrorCode.SUCCESS</returns>
  181.     [WebMethod]
  182.     public long ModifyComment(string InstanceId, string ItemName, string CommentID, string Text, OThinker.Data.BoolMatchValue Approval)
  183.     {
  184.         return OThinker.H3.Server.Engine.InstanceDataManager.ModifyComment(InstanceId, ItemName, CommentID, Text, Approval);
  185.     }
  186.     /// <summary>
  187.     /// 添加一个评论
  188.     /// </summary>
  189.     /// <param name="WorkflowPackage">该评论所属的流程的流程模板的包名称</param>
  190.     /// <param name="WorkflowName">该评论所属的流程的流程模板的名称</param>
  191.     /// <param name="WorkflowVersion">该评论所属的流程的流程模板的版本号</param>
  192.     /// <param name="InstanceId">该评论所属的流程的流程</param>
  193.     /// <param name="ItemName">该评论对应的字段</param>
  194.     /// <param name="Comment"></param>
  195.     [WebMethod]
  196.     public long AddComment(string InstanceId, string ItemName, OThinker.H3.Data.Comment Comment)
  197.     {
  198.         return OThinker.H3.Server.Engine.InstanceDataManager.AddComment(InstanceId, ItemName, Comment);
  199.     }
  200.     /// <summary>
  201.     /// 按照条件查找相应的评论
  202.     /// </summary>
  203.     /// <param name="WorkflowPackage"></param>
  204.     /// <param name="WorkflowName"></param>
  205.     /// <param name="WorkflowVersion"></param>
  206.     /// <param name="InstanceId"></param>
  207.     /// <param name="ItemNames"></param>
  208.     /// <param name="UserID"></param>
  209.     /// <param name="Activity"></param>
  210.     /// <returns></returns>
  211.     [WebMethod]
  212.     public OThinker.H3.Data.Comment[] GetComments(string InstanceId, string[] ItemNames, string UserID, string Activity)
  213.     {
  214.         return OThinker.H3.Server.Engine.InstanceDataManager.GetComments(InstanceId, ItemNames, UserID, Activity);
  215.     }
  216.     /// <summary>
  217.     /// 获得附件
  218.     /// </summary>
  219.     /// <param name="AttachmentID"></param>
  220.     /// <returns></returns>
  221.     [WebMethod]
  222.     public OThinker.H3.Data.Attachment GetAttachment(string AttachmentID)
  223.     {
  224.         return OThinker.H3.Server.Engine.InstanceDataManager.GetAttachment(AttachmentID);
  225.     }
  226.     /// <summary>
  227.     /// 添加附件
  228.     /// </summary>
  229.     /// <param name="Attachment"></param>
  230.     /// <returns></returns>
  231.     [WebMethod]
  232.     public string AddAttachment(OThinker.H3.Data.Attachment Attachment)
  233.     {
  234.         return OThinker.H3.Server.Engine.InstanceDataManager.AddAttachment(Attachment);
  235.     }
  236.     /// <summary>
  237.     /// 删除附件
  238.     /// </summary>
  239.     /// <param name="AttachmentID"></param>
  240.     [WebMethod]
  241.     public void RemoveAttachment(string AttachmentID)
  242.     {
  243.         OThinker.H3.Server.Engine.InstanceDataManager.RemoveAttachment(AttachmentID);
  244.     }
  245.     /// <summary>
  246.     /// 删除流程的所有附件
  247.     /// </summary>
  248.     /// <param name="InstanceId"></param>
  249.     [WebMethod]
  250.     public void RemoveInstanceAttachment(string InstanceId)
  251.     {
  252.         OThinker.H3.Server.Engine.InstanceDataManager.RemoveInstanceAttachment(InstanceId);
  253.     }
  254.     /// <summary>
  255.     /// 查询流程附件的基本信息,不包括附件的内容
  256.     /// </summary>
  257.     /// <param name="InstanceId"></param>
  258.     /// <param name="DataField"></param>
  259.     /// <param name="LastVersion"></param>
  260.     /// <param name="FileName"></param>
  261.     /// <returns></returns>
  262.     [WebMethod]
  263.     public OThinker.H3.Data.AttachmentHeader[] QueryAttachment(string InstanceId, string DataField, OThinker.Data.BoolMatchValue LastVersion, string FileName)
  264.     {
  265.         return OThinker.H3.Server.Engine.InstanceDataManager.QueryAttachment(InstanceId, DataField, LastVersion, FileName);
  266.     }
  267. }