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

OA系统

开发平台:

C#

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace OThinker.H3.WorkSheet
  5. {
  6.     /// <summary>
  7.     /// 服务
  8.     /// </summary>
  9.     public class SheetService
  10.     {
  11.         private System.Web.UI.Page _Page;
  12.         /// <summary>
  13.         /// 对应的表单
  14.         /// </summary>
  15.         public System.Web.UI.Page Page
  16.         {
  17.             get
  18.             {
  19.                 return this._Page;
  20.             }
  21.         }
  22.         
  23.         /// <summary>
  24.         /// 构造函数
  25.         /// </summary>
  26.         /// <param name="Page"></param>
  27.         public SheetService(System.Web.UI.Page Page)
  28.         {
  29.             this._Page = Page;
  30.         }
  31.         #region 服务
  32.         /// <summary>
  33.         /// 使用的组织结构
  34.         /// </summary>
  35.         public virtual OThinker.Organization.IOrganization Organization
  36.         {
  37.             get
  38.             {
  39.                 return OThinker.H3.Server.Engine.Organization;
  40.             }
  41.         }
  42.         /// <summary>
  43.         /// 使用的流程管理器
  44.         /// </summary>
  45.         public virtual OThinker.H3.Instance.IInstanceManager InstanceManager
  46.         {
  47.             get
  48.             {
  49.                 return OThinker.H3.Server.Engine.InstanceManager;
  50.             }
  51.         }
  52.         /// <summary>
  53.         /// 使用的工作项管理器
  54.         /// </summary>
  55.         public virtual OThinker.H3.WorkItem.IWorkItemManager WorkItemManager
  56.         {
  57.             get
  58.             {
  59.                 return OThinker.H3.Server.Engine.WorkItemManager;
  60.             }
  61.         }
  62.         /// <summary>
  63.         /// 流程数据管理器
  64.         /// </summary>
  65.         public virtual OThinker.H3.Data.IInstanceDataManager InstanceDataManager
  66.         {
  67.             get
  68.             {
  69.                 return OThinker.H3.Server.Engine.InstanceDataManager;
  70.             }
  71.         }
  72.         /// <summary>
  73.         /// 堆数据管理器
  74.         /// </summary>
  75.         public virtual OThinker.H3.Data.IHeapDataManager HeapDataManager
  76.         {
  77.             get
  78.             {
  79.                 return OThinker.H3.Server.Engine.HeapDataManager;
  80.             }
  81.         }
  82.         /// <summary>
  83.         /// 流程模板管理器
  84.         /// </summary>
  85.         public virtual OThinker.H3.WorkflowTemplate.IWorkflowTemplateManager WorkflowManager
  86.         {
  87.             get
  88.             {
  89.                 return OThinker.H3.Server.Engine.WorkflowManager;
  90.             }
  91.         }
  92.         /// <summary>
  93.         /// 令牌池
  94.         /// </summary>
  95.         public virtual OThinker.H3.Instance.ITokenPool TokenPool
  96.         {
  97.             get
  98.             {
  99.                 return OThinker.H3.Server.Engine.TokenPool;
  100.             }
  101.         }
  102.         #endregion
  103.         #region Web
  104.         /// <summary>
  105.         /// Web服务器的根目录
  106.         /// </summary>
  107.         protected virtual string PortalRoot
  108.         {
  109.             get
  110.             {
  111.                 return OThinker.H3.Configs.Config.Current.Web.PortalRoot + "/";
  112.             }
  113.         }
  114.         /// <summary>
  115.         /// 在WEB端显示消息
  116.         /// </summary>
  117.         /// <param name="Message"></param>
  118.         public virtual void NotifyMessage(string Message)
  119.         {
  120.             this.Page.Response.Redirect(this.PortalRoot + "NotifyMessage.aspx" + "?Message=" + System.Web.HttpUtility.UrlEncode(Message));
  121.         }
  122.         /// <summary>
  123.         /// 获得取消流程的URL
  124.         /// </summary>
  125.         /// <param name="InstanceId"></param>
  126.         /// <returns></returns>
  127.         public virtual void CancelInstance(string InstanceId)
  128.         {
  129.             string url = this.PortalRoot + "CancelInstance.aspx" + "?" + "InstanceId" + "=" + InstanceId;
  130.             this.Page.Response.Redirect(url);
  131.         }
  132.         /// <summary>
  133.         /// 获得选择用户的URL
  134.         /// </summary>
  135.         /// <returns></returns>
  136.         public virtual string GetSelectUserUrl()
  137.         {
  138.             return this.PortalRoot + "SelectUser.aspx";
  139.         }
  140.         /// <summary>
  141.         /// 获得选择用户的图片的URL
  142.         /// </summary>
  143.         /// <returns></returns>
  144.         public virtual string GetSelectUserImageUrl()
  145.         {
  146.             return this.PortalRoot + "images/IB_SelectUser.gif";
  147.         }
  148.         /// <summary>
  149.         /// 获得删除用户的图片的URL
  150.         /// </summary>
  151.         /// <returns></returns>
  152.         public virtual string GetRemoveUserImageUrl()
  153.         {
  154.             return this.PortalRoot + "images/IB_Remove.ico";
  155.         }
  156.         /// <summary>
  157.         /// 完成某个工作项
  158.         /// </summary>
  159.         /// <param name="WorkItemID"></param>
  160.         /// <param name="DestActivityName"></param>
  161.         /// <param name="Approval"></param>
  162.         /// <param name="Description"></param>
  163.         public virtual void FinishWorkItem(string WorkItemID, string DestActivityName, string ParticipateGroup, OThinker.Data.BoolMatchValue Approval, string Comment, string Description)
  164.         {
  165.             this.Page.Response.Redirect(this.PortalRoot + "FinishWorkItem.aspx" + "?" +
  166.                     "WorkItemID" + "=" + WorkItemID + "&" +
  167.                     "DestActivityName" + "=" + System.Web.HttpUtility.UrlEncode(DestActivityName) + "&" +
  168.                     "ParticipateGroup=" + System.Web.HttpUtility.UrlEncode(ParticipateGroup) + "&" + 
  169.                     "Approval" + "=" + Approval.ToString() + "&" +
  170.                     "Comment" + "=" + System.Web.HttpUtility.UrlEncode(Comment) + "&" + 
  171.                     "Description" + "=" + System.Web.HttpUtility.UrlEncode(Description));
  172.         }
  173.         /// <summary>
  174.         /// 获得征询意见的URL
  175.         /// </summary>
  176.         /// <param name="WorkItemID"></param>
  177.         /// <returns></returns>
  178.         public virtual string GetConsultUrl(string WorkItemID)
  179.         {
  180.             string strOption = null;
  181.             if (this.Page is ISheetPage)
  182.             {
  183.                 string[] options = ((ISheetPage)this.Page).OptionalConsultants;
  184.                 strOption = OThinker.Data.ArrayConvertor<string>.ArrayToString(options);
  185.             }
  186.             return this.PortalRoot + "Consult.aspx" + "?" + "WorkItemID" + "=" + WorkItemID + ((strOption == null) ? null : ("&OptionalConsultants=" + strOption));
  187.         }
  188.         /// <summary>
  189.         /// 获得转发工作项的URL
  190.         /// </summary>
  191.         /// <param name="WorkItemID"></param>
  192.         /// <returns></returns>
  193.         public virtual string GetForwardUrl(string WorkItemID)
  194.         {
  195.             return this.PortalRoot + "Forward.aspx" + "?" + "WorkItemID" + "=" + WorkItemID;
  196.         }
  197.         /// <summary>
  198.         /// 获得查看流程状态的URL
  199.         /// </summary>
  200.         /// <param name="InstanceId"></param>
  201.         /// <returns></returns>
  202.         public virtual string GetViewInstanceStateUrl(string InstanceId)
  203.         {
  204.             return this.PortalRoot + "InstanceStateChart.aspx?InstanceId=" + InstanceId;
  205.         }
  206.         /// <summary>
  207.         /// 获得查看附件的URL
  208.         /// </summary>
  209.         /// <param name="AttachmentID"></param>
  210.         /// <returns></returns>
  211.         public virtual string GetReadAttachment(string AttachmentID)
  212.         {
  213.             return this.PortalRoot + "ReadAttachment.aspx" + "?" + "AttachmentID=" + AttachmentID;
  214.         }
  215.         /// <summary>
  216.         /// 获得删除附件的图片的URL
  217.         /// </summary>
  218.         /// <returns></returns>
  219.         public virtual string GetDeleteAttachmentImageUrl()
  220.         {
  221.             return this.PortalRoot + "images/IB_Remove.ico";
  222.         }
  223.         /// <summary>
  224.         /// 获得取回的URL
  225.         /// </summary>
  226.         /// <param name="WorkItemID"></param>
  227.         /// <returns></returns>
  228.         public virtual string GetRetrieveUrl(string WorkItemID)
  229.         {
  230.             return this.PortalRoot + "RetrieveWorkItem.aspx" + "?" + "WorkItemID=" + WorkItemID;
  231.         }
  232.         #endregion
  233.         #region 当前用户名
  234.         /// <summary>
  235.         /// 获得当前登陆用户
  236.         /// </summary>
  237.         public virtual Portal.UserValidator UserValidator
  238.         {
  239.             get
  240.             {
  241.                 return Portal.UserValidatorFactory.GetUserValidator(this.Page);
  242.             }
  243.         }
  244.         /// <summary>
  245.         /// 当前登录用户的ID
  246.         /// </summary>
  247.         public virtual string Participant
  248.         {
  249.             get
  250.             {
  251.                 return this.UserValidator.UserID;
  252.             }
  253.         }
  254.         #endregion
  255.     }
  256. }