WorkflowReportBase.cs
资源名称:H3_OA.rar [点击查看]
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:3k
源码类别:
OA系统
开发平台:
C#
- using System;
- namespace OThinker.H3.Portal
- {
- /// <summary>
- /// Summary description for WorkflowReportBase.
- /// </summary>
- public class WorkflowReportBase : ReportPage
- {
- public WorkflowReportBase()
- {
- }
- protected System.DateTime ParseFromTime(string FromTime)
- {
- if(this.IsSelectedNull(FromTime))
- {
- return System.DateTime.MinValue;
- }
- else
- {
- try
- {
- return System.DateTime.Parse(FromTime);
- }
- catch
- {
- return System.DateTime.MinValue;
- }
- }
- }
- protected System.DateTime ParseToTime(string ToTime)
- {
- if(this.IsSelectedNull(ToTime))
- {
- return System.DateTime.MaxValue;
- }
- else
- {
- try
- {
- return System.DateTime.Parse(ToTime);
- }
- catch
- {
- return System.DateTime.MaxValue;
- }
- }
- }
- // 获得发起人
- protected string[] ParseOriginators(string InputOriginator)
- {
- if(this.IsSelectedNull(InputOriginator))
- {
- return null;
- }
- else
- {
- return OThinker.H3.Server.Engine.Organization.GetChildren(InputOriginator, OThinker.Organization.UnitType.User, true);
- }
- }
- protected System.Data.DataTable CreatePerformanceTable()
- {
- System.Data.DataTable table = new System.Data.DataTable();
- table.Columns.Add("流程模板全名");
- table.Columns.Add("执行次数");
- table.Columns.Add("最短完成时间");
- table.Columns.Add("平均完成时间");
- table.Columns.Add("最长完成时间");
- return table;
- }
- // 获得性能,并将结果添加到性能统计表中
- protected void GetPerformance(
- System.Data.DataTable Performances,
- string WorkflowPackage,
- string WorkflowName,
- int WorkflowVersion,
- string[] Originators,
- System.DateTime From,
- System.DateTime To)
- {
- // 获得性能统计值
- OThinker.H3.WorkflowTemplate.WorkflowPerformance performance
- = OThinker.H3.Server.Engine.InstanceManager.GetWorkflowPerformance(
- Originators,
- null,
- WorkflowPackage,
- WorkflowName,
- WorkflowVersion,
- From,
- To);
- // 获得流程模板全名
- string fullName;
- if(WorkflowName == null)
- {
- fullName = H3.WorkflowTemplate.WorkflowTemplate.GetWorkflowFullName(WorkflowPackage);
- }
- else if(
- WorkflowVersion == OThinker.H3.WorkflowTemplate.WorkflowTemplate.AllWorkflowVersion ||
- WorkflowVersion == OThinker.H3.WorkflowTemplate.WorkflowTemplate.NullWorkflowVersion)
- {
- fullName = H3.WorkflowTemplate.WorkflowTemplate.GetWorkflowFullName(WorkflowPackage, WorkflowName);
- }
- else
- {
- fullName = H3.WorkflowTemplate.WorkflowTemplate.GetWorkflowFullName(WorkflowPackage, WorkflowName, WorkflowVersion);
- }
- if(performance == null)
- {
- Performances.Rows.Add(
- new object[]{
- fullName,
- 0,
- null,
- null,
- null});
- }
- else
- {
- Performances.Rows.Add(
- new object[]{
- fullName,
- performance.ExecutedTimes,
- OThinker.Data.Convertor.Format(new System.TimeSpan(performance.ShortestUsedTime)),
- OThinker.Data.Convertor.Format(new System.TimeSpan(performance.AverageUsedTime)),
- OThinker.Data.Convertor.Format(new System.TimeSpan(performance.LongestUsedTime))});
- }
- }
- }
- }