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

OA系统

开发平台:

C#

  1. using System;
  2. namespace OThinker.H3.Portal
  3. {
  4. /// <summary>
  5. /// 所有页面的基类
  6. /// </summary>
  7. public class PortalPage : System.Web.UI.Page
  8. {
  9. public PortalPage()
  10. {
  11. }
  12.         public const string LackOfAuth = "您不具备该操作的权限";
  13.         
  14.         public const string PageName_Login = "Login.aspx";
  15.         public const string PageName_CancelInstance = "CancelInstance.aspx";
  16.         public const string PageName_EditCompany = "EditCompany.aspx";
  17.         public const string PageName_EditOrganizationUnit = "EditOrganizationUnit.aspx";
  18.         public const string PageName_EditOrganization = "EditOrganization.htm";
  19.         public const string PageName_EditGroup = "EditGroup.aspx";
  20.         public const string PageName_EditUser = "EditUser.aspx";
  21.         public static string GetEditPageName(OThinker.Organization.UnitType UnitType, string ID)
  22.         {
  23.             switch (UnitType)
  24.             {
  25.                 case OThinker.Organization.UnitType.Company:
  26.                     return PageName_EditCompany + "?" + Param_ID + "=" + ID;
  27.                 case OThinker.Organization.UnitType.OrganizationUnit:
  28.                     return PageName_EditOrganizationUnit + "?" + Param_ID + "=" + ID;
  29.                 case OThinker.Organization.UnitType.Group:
  30.                     return PageName_EditGroup + "?" + Param_ID + "=" + ID;
  31.                 case OThinker.Organization.UnitType.User:
  32.                     return PageName_EditUser + "?" + Param_ID + "=" + ID;
  33.                 default:
  34.                     throw new NotImplementedException();
  35.             }
  36.         }
  37.         public const string PageName_SetPassword = "SetPassword.aspx";
  38.         public const string PageName_RemoveUnit = "RemoveUnit.aspx";
  39.         public const string PageName_SyncAD = "SyncAD.aspx";
  40.         public const string PageName_SyncUser = "SyncUser.aspx";
  41.         public const string PageName_SyncAllUsers = "SyncAllUsers.aspx";
  42.         public const string PageName_EditTitle = "EditTitle.aspx";
  43.         public const string PageName_EditUserTitle = "EditUserTitle.aspx";
  44.         public const string PageName_QueryUser = "QueryUser.aspx";
  45.         public const string PageName_QueryTransactionLog = "QueryTransactionLog.aspx";
  46.         public const string PageName_InstanceStateChart = "InstanceStateChart.aspx";
  47.         public const string PageName_ExceptionDetail = "ExceptionDetail.aspx";
  48.         public const string PageName_QueryException = "QueryException.aspx";
  49.         public const string PageName_AddInstanceAcl = "AddInstanceAcl.aspx";
  50.         public const string PageName_WorkflowAcl = "WorkflowAcl.aspx";
  51.         public const string PageName_UpdateWorkflowAcl = "UpdateWorkflowAcl.aspx";
  52.         public const string PageName_UpdateSystemAcl = "UpdateSystemAcl.aspx";
  53.         public const string PageName_InstanceDataTrack = "InstanceDataTrack.aspx";
  54.         public const string PageName_ActivityReport = "ActivityReport.aspx";
  55.         public const string PageName_Settings = "Settings.aspx";
  56.         public const string PageName_InstanceAcl = "InstanceAcl.aspx";
  57.         public const string PageName_InstanceDetail = "InstanceDetail.aspx";
  58.         public const string PageName_InstanceDataReport = "InstanceDataReport.aspx";
  59.         public const string PageName_EnabledActivity = "EnabledActivity.aspx";
  60.         public const string PageName_MyInstance = "MyInstance.aspx";
  61.         public const string PageName_MyDeptInstance = "MyDeptInstance.aspx";
  62.         public const string PageName_MyHandledInstance = "MyHandledInstance.aspx";
  63.         public const string PageName_MyWorkItem = "MyWorkItem.aspx";
  64.         public const string PageName_MyDelegation = "MyDelegation.aspx";
  65.         public const string PageName_NotifyMessage = "NotifyMessage.aspx";
  66.         public const string PageName_QueryInstance = "QueryInstance.aspx";
  67.         public const string PageName_QueryProject = "QueryProject.aspx";
  68.         public const string PageName_InstanceToken = "InstanceToken.aspx";
  69.         public const string PageName_InstanceData = "InstanceData.aspx";
  70.         public const string PageName_QueryDelegation = "QueryDelegation.aspx";
  71.         public const string PageName_HeapData = "HeapData.aspx";
  72.         public const string PageName_QueryWorkItem = "QueryWorkItem.aspx";
  73.         public const string PageName_StartInstance = "StartInstance.aspx";
  74.         public const string PageName_WorkflowInfo = "WorkflowInfo.aspx";
  75.         public const string PageName_SystemACL = "SystemACL.aspx";
  76.         public const string PageName_UserReport = "UserReport.aspx";
  77.         public const string PageName_UrgeInstance = "UrgeInstance.aspx";
  78.         public const string PageName_InstanceSheets = "InstanceSheets.aspx";
  79.         public const string PageName_UserSelector = "UserSelector.aspx";
  80.         public const string PageName_ReadAttachment = "ReadAttachment.aspx";
  81.         public const string PageName_MyNotification = "MyNotification.aspx";
  82.         public const string PageName_NotificationDetail = "NotificationDetail.aspx";
  83.         public const string PageName_EditForm = "EditForm.aspx";
  84.         public const string PageName_EditProject = "EditProject.aspx";
  85.         public const string PageName_DefaultSheet = "DefaultSheet.aspx";
  86.         public const string PageName_WorkItemDetail = "WorkItemDetail.aspx";
  87.         public const string PageName_ActionSheet = "ActionSheet.aspx";
  88.         public const string PageName_QuerySchedule = "QuerySchedule.aspx";
  89.         public const string PageName_WorkflowChart = "WorkflowChart.aspx";
  90.         public const string PageName_AddWorkflowAcl = "AddWorkflowAcl.aspx";
  91.         public const string PageName_SelectUser = "SelectUser.aspx";
  92.         public const string PageName_SelectUserImage = "images/IB_SelectUser.GIF";
  93.         public const string PageName_ActivateActivity = "ActivateActivity.aspx";
  94.         public const string PageName_QueryInstanceByData = "QueryInstanceByData.aspx";
  95.         public const string Param_ExpandPath = "ExpandPath";
  96.         public const string Param_Q = "q";
  97.         public const string Param_AttachmentID = "AttachmentID";
  98.         public const string Param_UnitType = "UnitType";
  99.         public const string Param_VisibleUnitType = "VisibleUnitType";
  100.         public const string Param_VisibleType = "VisibleType";
  101.         public const string Param_Description = "Description";
  102.         public const string Param_Priority = "Priority";
  103.         public const string Param_LeastRecurrences = "LeastRecurrences";
  104.         public const string Param_OptionalConsultants = "OptionalConsultants";
  105.         public const string Param_ProjectID = "ProjectID";
  106.         public const string Param_NotificationID = "NotificationID";
  107.         public const string Param_TrackID = "TrackID";
  108.         public const string Param_TextBoxID = "TextBoxID";
  109.         public const string Param_ControlID = "ControlID";
  110.         public const string Param_SelectMode = "Mode";
  111.         // 委托人
  112.         public const string Param_Delegant = "Delegant";
  113.         // 被委托人
  114.         public const string Param_Delegatee = "Delegatee";
  115.         public const string Param_Message = "Message";
  116.         public const string Param_Mode = "Mode";
  117.         public const string Param_State = "State";
  118.         public const string Param_ItemName = "ItemName";
  119.         public const string Param_InstanceId = "InstanceId";
  120.         public const string Param_InstanceName = "InstanceName";
  121.         public const string Param_WorkflowPackage = "WorkflowPackage";
  122.         public const string Param_WorkflowName = "WorkflowName";
  123.         public const string Param_WorkflowVersion = "WorkflowVersion";
  124.         public const string Param_ExceptionID = "ExceptionID";
  125.         public const string Param_AclID = "AclID";
  126.         public const string Param_Alias = "Alias";
  127.         public const string Param_From = "From";
  128.         public const string Param_To = "To";
  129.         public const string Param_Elapsed = "Elapsed";
  130.         public const string Param_EstimatedElapsed = "EstimatedElapsed";
  131.         // 工作项ID
  132.         public const string Param_WorkItemID = "WorkItemID";
  133.         // 目的活动
  134.         public const string Param_DestActivityName = "DestActivityName";
  135.         // 是否同意
  136.         public const string Param_Approval = "Approval";
  137.         public const string Param_Comment = "Comment";
  138.         public const string Param_ParticipateGroup = "ParticipateGroup";
  139.     // 是否是创建
  140.         public const string Param_EditMode = "EditMode";
  141.         public enum EditModeType
  142.         {
  143.             Create,
  144.             Edit, 
  145.             Import
  146.         }
  147.         // 编辑的表单的名称
  148.         public const string Param_FormName = "FormName";
  149.         // 用户名
  150.         public const string Param_UserID = "UserID";
  151.         public const string Param_ID = "ID";
  152.         public const string Param_ADUser = "ADUser";
  153.         public const string Param_Parent = "Parent";
  154.         public const string Param_ParentGroup = "ParentGroup";
  155.         public const string Param_OriginateRole = "OriginateRole";
  156.         public OThinker.H3.WorkflowTemplate.WorkflowTemplate GetWorkflow(
  157. string WorkflowPackageName, 
  158. string WorkflowName, 
  159. int WorkflowVersion)
  160. {
  161. string sessionName = OThinker.H3.WorkSheet.Sessions.GetWorkflow(
  162. WorkflowPackageName, 
  163. WorkflowName, 
  164. WorkflowVersion);
  165. if(this.Session[sessionName] == null)
  166. {
  167. this.Session[sessionName] = H3.Server.Engine.WorkflowManager.GetWorkflow(
  168. WorkflowPackageName, 
  169. WorkflowName, 
  170. WorkflowVersion);
  171. }
  172.             return (H3.WorkflowTemplate.WorkflowTemplate)this.Session[sessionName];
  173. }
  174. // 获得当前登陆用户的Principal Name
  175. protected UserValidator UserValidator
  176. {
  177. get
  178. {
  179.                 return UserValidatorFactory.GetUserValidator(this);
  180. }
  181. }
  182. protected void NotifyMessage(string Message)
  183. {
  184. this.Response.Redirect(this.GetNotifyPage(Message));
  185. }
  186.         protected string GetNotifyPage(string Message)
  187.         {
  188.             return "NotifyMessage.aspx" + "?" + "Message" + "=" + System.Web.HttpUtility.UrlEncode(Message);
  189.         }
  190.         /// <summary>
  191.         /// 获得某一个表单的某一种操作对应的URL
  192.         /// </summary>
  193.         /// <param name="Mode"></param>
  194.         /// <param name="Workflow"></param>
  195.         /// <param name="SheetName"></param>
  196.         /// <param name="InstanceId"></param>
  197.         /// <returns></returns>
  198.         public static string GetViewSheetUrl(
  199.             WorkflowTemplate.Sheet Sheet, 
  200.             string InstanceId)
  201.         {
  202.             if (Sheet == null)
  203.             {
  204.                 return null;
  205.             }
  206.             else
  207.             {
  208.                 string baseUrl = GetSheetBaseUrl(Sheet.SheetType, Sheet.SheetAddress);
  209.                 return baseUrl +
  210.                     OThinker.H3.WorkSheet.SheetEnviroment.Param_Mode + "=" + WorkSheet.SheetMode.View + "&" +
  211.                     OThinker.H3.WorkSheet.SheetEnviroment.Param_InstanceId + "=" + InstanceId;
  212.             }
  213.         }
  214.         public static string GetViewSheetUrl(WorkItem.WorkItem WorkItem)
  215.         {
  216.             string baseUrl = GetSheetBaseUrl(WorkItem.SheetType, WorkItem.SheetAddress);
  217.             return baseUrl +
  218.                     OThinker.H3.WorkSheet.SheetEnviroment.Param_Mode + "=" + WorkSheet.SheetMode.View + "&" +
  219.                     OThinker.H3.WorkSheet.SheetEnviroment.Param_WorkItemID + "=" + WorkItem.WorkItemID;
  220.         }
  221.         public static string GetWorkSheetUrl(WorkItem.WorkItem WorkItem)
  222.         {
  223.             if (WorkItem == null)
  224.             {
  225.                 return null;
  226.             }
  227.             else
  228.             {
  229.                 string baseUrl = GetSheetBaseUrl(WorkItem.SheetType, WorkItem.SheetAddress);
  230.                 return baseUrl +
  231.                         OThinker.H3.WorkSheet.SheetEnviroment.Param_Mode + "=" + WorkSheet.SheetMode.Work + "&" +
  232.                         OThinker.H3.WorkSheet.SheetEnviroment.Param_WorkItemID + "=" + WorkItem.WorkItemID;
  233.             }
  234.         }
  235.         public static string GetSheetBaseUrl(
  236.             OThinker.H3.WorkflowTemplate.SheetType SheetType,
  237.             string SheetAddress)
  238.         {
  239.             string baseUrl = null;
  240.             switch (SheetType)
  241.             {
  242.                 case OThinker.H3.WorkflowTemplate.SheetType.None:
  243.                     baseUrl = null;
  244.                     break;
  245.                 case OThinker.H3.WorkflowTemplate.SheetType.DefaultSheet:
  246.                     baseUrl = PageName_DefaultSheet + "?";
  247.                     break;
  248.                 case OThinker.H3.WorkflowTemplate.SheetType.CustomSheet:
  249.                     baseUrl = SheetAddress + "?";
  250.                     break;
  251.                 default:
  252.                     throw new NotImplementedException();
  253.             } 
  254.             return baseUrl;
  255.         }
  256.         // 空元素只能设置为"",因为没有选中的值为""
  257.         protected const string NullItemValue = "";
  258.         protected bool IsSelectedNull(string SelectedValue)
  259.         {
  260.             if (
  261.                 SelectedValue == NullItemValue ||
  262.                 SelectedValue == "" ||
  263.                 SelectedValue == null)
  264.             {
  265.                 return true;
  266.             }
  267.             else
  268.             {
  269.                 return false;
  270.             }
  271.         }
  272.         // 分析模板类型条件是否为空
  273.         protected string ParseWorkflowPackage(string WorkflowPackage)
  274.         {
  275.             if (this.IsSelectedNull(WorkflowPackage))
  276.             {
  277.                 return null;
  278.             }
  279.             else
  280.             {
  281.                 return WorkflowPackage;
  282.             }
  283.         }
  284.         protected string ParseWorkflowName(string WorkflowName)
  285.         {
  286.             if (this.IsSelectedNull(WorkflowName))
  287.             {
  288.                 return null;
  289.             }
  290.             else
  291.             {
  292.                 return WorkflowName;
  293.             }
  294.         }
  295.         protected int ParseWorkflowVersion(string WorkflowVersion)
  296.         {
  297.             if (this.IsSelectedNull(WorkflowVersion))
  298.             {
  299.                 return OThinker.H3.WorkflowTemplate.WorkflowTemplate.NullWorkflowVersion;
  300.             }
  301.             else
  302.             {
  303.                 try
  304.                 {
  305.                     return int.Parse(WorkflowVersion);
  306.                 }
  307.                 catch
  308.                 {
  309.                     return OThinker.H3.WorkflowTemplate.WorkflowTemplate.NullWorkflowVersion;
  310.                 }
  311.             }
  312.         }
  313.         #region 编辑组织结构的结果显示
  314.         protected void NotifyResult(OThinker.Organization.HandleResult Result)
  315.         {
  316.             this.NotifyMessage(this.ParseResult(Result));
  317.         }
  318.         protected void NotifyResult(OThinker.Organization.HandleResult Result, bool Refresh, string ExpandPath)
  319.         {
  320.             string script_reload = null;
  321.             if (Refresh)
  322.             {
  323.                 script_reload = 
  324.                     "var frm=this.parent.frames[1];" + 
  325.                     "if(frm)" + 
  326.                     "frm.window.location.href = '" + "EditOrganization.aspx?" + Param_ExpandPath + "=" + System.Web.HttpUtility.UrlEncode(ExpandPath) + "';";
  327.             }
  328.             string resultMessage = this.ParseResult(Result);
  329.             string resultUrl = this.GetNotifyPage(resultMessage);
  330.             string script =
  331.                 "<script>" +
  332.                 script_reload +
  333.                 "window.location.href='" + resultUrl + "'</script>";
  334.             this.Response.Write(script);
  335.         }
  336.         protected string ParseResult(OThinker.Organization.HandleResult Result)
  337.         {
  338.             switch (Result)
  339.             {
  340.                 case OThinker.Organization.HandleResult.ACTIVE_DIRECTORY_NOT_CONNECTED:
  341.                     return "无法连接到活动目录";
  342.                 case OThinker.Organization.HandleResult.ALIAS_INVALID:
  343.                     return "用户别名不合法";
  344.                 case OThinker.Organization.HandleResult.ALIAS_NULL:
  345.                     return "用户名为空";
  346.                 case OThinker.Organization.HandleResult.ALIAS_REDUPLICATE:
  347.                     return "用户名已经存在";
  348.                 case OThinker.Organization.HandleResult.CANNT_ITERATE_TO_COMPANY:
  349.                     return "无法从该组织单元路由到公司";
  350.                 case OThinker.Organization.HandleResult.CHILD_NOT_ALLOW_BELONG_TO_MULTI_GROUP:
  351.                     return "该组中存在某个组是其他组的子组,同时该子组又禁止了同时属于多个父组";
  352.                 case OThinker.Organization.HandleResult.COMPANY_INCONSISTENT:
  353.                     return "公司信息不一致";
  354.                 case OThinker.Organization.HandleResult.COMPANY_INVALIDATE:
  355.                     return "公司信息不合法";
  356.                 case OThinker.Organization.HandleResult.COMPANY_NOT_EXIST:
  357.                     return "指定的公司不存在";
  358.                 case OThinker.Organization.HandleResult.CYCLE_INVALIDATE:
  359.                     return "不允许有环状组织结构,请检查是否存在互相引用和间接的互相引用";
  360.                 case OThinker.Organization.HandleResult.DELEGANT_OR_DELEGATEE_NULL:
  361.                     return "委托人或者被委托人为空";
  362.                 case OThinker.Organization.HandleResult.DELEGATEE_EQUAL_DELEGANT:
  363.                     return "禁止委托给本人";
  364.                 case OThinker.Organization.HandleResult.EXTERNAL_ID_REDUPLICATE:
  365.                     return "外部ID重复";
  366.                 case OThinker.Organization.HandleResult.GROUP_CHILD_INVALIDATE:
  367.                     return "组成员不合法";
  368.                 case OThinker.Organization.HandleResult.GUID_REDUPLICATE:
  369.                     return "GUID重复";
  370.                 case OThinker.Organization.HandleResult.ID_INVALIDATE:
  371.                     return "ID不合法";
  372.                 case OThinker.Organization.HandleResult.ID_REDUPLICATE:
  373.                     return "ID重复";
  374.                 case OThinker.Organization.HandleResult.LOGIN_ACTIVE_DIRECTORY_FAILED:
  375.                     return "无法登录到活动目录,请检查登录活动目录的用户名和密码";
  376.                 case OThinker.Organization.HandleResult.MANAGER_INVALIDATE:
  377.                     return "经理属性设置不正确";
  378.                 case OThinker.Organization.HandleResult.NAME_INVALID:
  379.                     return "名称不合法";
  380.                 case OThinker.Organization.HandleResult.NAME_REDUPLICATE:
  381.                     return "出现重名错误";
  382.                 case OThinker.Organization.HandleResult.NOT_SUPPORT_UNIT:
  383.                     return "不支持这种类型";
  384.                 case OThinker.Organization.HandleResult.ORGANIZATION_UNIT_CYCLE_INVALIDATE:
  385.                     return "组织单元出现环,请检查是否存在互相引用和间接的互相引用";
  386.                 case OThinker.Organization.HandleResult.PARAM_IS_NULL:
  387.                     return "参数为空";
  388.                 case OThinker.Organization.HandleResult.PARENT_NULL:
  389.                     return "父属性设置为空";
  390.                 case OThinker.Organization.HandleResult.SECRETARY_INVALIDATE:
  391.                     return "秘书属性设置不正确";
  392.                 case OThinker.Organization.HandleResult.SUCCESS:
  393.                     return "成功";
  394.                 case OThinker.Organization.HandleResult.SUPERVISOR_INVALIDATE:
  395.                     return "监管人设置不正确";
  396.                 case OThinker.Organization.HandleResult.SYNCHRONING:
  397.                     return "正在同步";
  398.                 case OThinker.Organization.HandleResult.TITLE_NAME_DUPLICATE:
  399.                     return "职务名称重复";
  400.                 case OThinker.Organization.HandleResult.TITLE_NAME_NULL:
  401.                     return "职务名称为空";
  402.                 case OThinker.Organization.HandleResult.UNIT_ID_INVALIDATE:
  403.                     return "ID不正确";
  404.                 case OThinker.Organization.HandleResult.UNKNOWN_ERROR:
  405.                     return "未知的错误";
  406.                 case OThinker.Organization.HandleResult.USER_ALIAS_NOT_EXIST_IN_AD:
  407.                     return "用户名在活动目录中不存在";
  408.                 case OThinker.Organization.HandleResult.VICE_MANAGER_INVALIDATE:
  409.                     return "副经理设置不正确";
  410.                 default:
  411.                     return Result.ToString();
  412.             }
  413.         }
  414.         #endregion
  415.         #region 发起流程
  416.         protected string OriginateInstance(string WorkflowPackage, string WorkflowName, int WorkflowVersion, Instance.PriorityType Priority, string InstanceName, string OriginateRole, System.Collections.Generic.Dictionary<string, object> ParameterTable)
  417.         {
  418.             string originator = this.UserValidator.UserID;
  419.             string department = this.UserValidator.Department;
  420.             // 检查该工作流是否存在
  421.             OThinker.H3.WorkflowTemplate.WorkflowTemplate workflow = OThinker.H3.Server.Engine.WorkflowManager.GetWorkflow(
  422.                 WorkflowPackage,
  423.                 WorkflowName,
  424.                 WorkflowVersion);
  425.             if (workflow == null)
  426.             {
  427.                 this.NotifyMessage("该流程模板不存在!");
  428.             }
  429.             // 创建
  430.             string instanceId = OThinker.H3.Server.Engine.InstanceManager.CreateInstance(
  431.                 WorkflowPackage,
  432.                 WorkflowName,
  433.                 WorkflowVersion,
  434.                 InstanceName,
  435.                 originator, 
  436.                 null,
  437.                 department,
  438.                 false,
  439.                 OThinker.H3.Instance.InstanceContext.UnspecifiedID,
  440.                 null,
  441.                 Instance.Token.UnspecifiedID);
  442.             // 判断是否创建失败
  443.             if (instanceId == OThinker.H3.Instance.InstanceContext.UnspecifiedID)
  444.             {
  445.                 this.NotifyMessage("无法创建流程:" + workflow.WorkflowFullName);
  446.             }
  447.             // 设置消息的紧急程度
  448.             OThinker.H3.Messages.MessageEmergencyType emergency = Messages.MessageEmergencyType.Normal;
  449.             // 如果是带表单方式的发起,则需要将紧急程度设置为高
  450.             if (workflow.StartWithSheet)
  451.             {
  452.                 emergency = OThinker.H3.Messages.MessageEmergencyType.High;
  453.             }
  454.             // 启动该流程
  455.             OThinker.H3.Messages.StartInstanceMessage startMessage
  456.                 = new OThinker.H3.Messages.StartInstanceMessage(
  457.                 emergency,
  458.                 instanceId,
  459.                 ParameterTable,
  460.                 Priority,
  461.                 false,
  462.                 0,
  463.                 OThinker.H3.Instance.Token.UnspecifiedID,
  464.                 null);
  465.             OThinker.H3.Server.Engine.InstanceManager.SendMessage(startMessage);
  466.             if (!workflow.StartWithSheet)
  467.             {
  468.                 // 不需要进行操作,直接显示成功
  469.                 this.NotifyMessage("发起流程成功,流程ID为:" + instanceId);
  470.             }
  471.             // 获得该实例的任务
  472.             string[] jobs = null;
  473.             for (int triedTimes = 0; triedTimes < 10; triedTimes++)
  474.             {
  475.                 System.Threading.Thread.Sleep(1500);
  476.                 jobs = OThinker.H3.Server.Engine.WorkItemManager.Query(
  477.                     null,
  478.                     new string[] { instanceId },
  479.                     new string[] { this.UserValidator.UserID },
  480.                     System.DateTime.MinValue,
  481.                     System.DateTime.MaxValue,
  482.                     OThinker.H3.WorkItem.WorkItemState.Unfinished);
  483.                 if (jobs != null && jobs.Length != 0)
  484.                 {
  485.                     break;
  486.                 }
  487.             }
  488.             if (jobs == null || jobs.Length == 0)
  489.             {
  490.                 this.NotifyMessage(
  491.                     "超时,可能是如下原因造成的:" +
  492.                     "1、创建或启动流程的时候出现了异常,请点击Web控制台上的管理->异常,查看是否出现了异常" +
  493.                     "2、创建该流程的时间比较长,请点击Web控制台上的管理->未完成的工作项,查看是否存在该工作项" +
  494.                     "3、该流程的第一个环节的处理人并非发起人,请检查该流程模板的第一个环节的参与者属性");
  495.             }
  496.             return jobs[0];
  497.         }
  498.         #endregion
  499.     }
  500. }