InstanceData.aspx.cs
资源名称:H3_OA.rar [点击查看]
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:6k
源码类别:
OA系统
开发平台:
C#
- using System;
- using System.Collections;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Web;
- using System.Web.SessionState;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.HtmlControls;
- namespace OThinker.H3.Portal
- {
- /// <summary>
- /// Summary description for CaseData.
- /// </summary>
- public partial class InstanceData : PortalPage
- {
- private System.Data.DataTable ValueTable = new DataTable();
- private System.Collections.ArrayList ValueList = new ArrayList();
- protected void Page_Load(object sender, System.EventArgs e)
- {
- string instanceId = this.Request.QueryString[Param_InstanceId];
- if (instanceId != null && instanceId != "" && instanceId != Instance.InstanceContext.NullObjectID)
- {
- string processCatalog = OThinker.H3.Server.Engine.InstanceManager.GetInstanceWorkflowPackage(instanceId);
- string processName = OThinker.H3.Server.Engine.InstanceManager.GetInstanceWorkflowName(instanceId);
- int processVersion = OThinker.H3.Server.Engine.InstanceManager.GetInstanceWorkflowVersion(instanceId);
- // 获得工作流
- H3.WorkflowTemplate.WorkflowTemplate workflow = this.GetWorkflow(
- processCatalog,
- processName,
- processVersion);
- Data.InstanceData data = new OThinker.H3.Data.InstanceData(
- OThinker.H3.Server.Engine.InstanceDataManager,
- OThinker.H3.Server.Engine.WorkflowManager,
- OThinker.H3.Server.Engine.InstanceManager,
- instanceId,
- Instance.Token.UnspecifiedID,
- workflow,
- null,
- this.UserValidator.UserID,
- null);
- if(workflow.DataItems != null)
- {
- this.ValueTable.Columns.Clear();
- this.ValueTable.Columns.Add("Name");
- this.ValueTable.Columns.Add("Type");
- this.ValueTable.Columns.Add("Value");
- this.ValueTable.Columns.Add("ViewDataTrailText");
- this.ValueTable.Columns.Add("ViewDataTrailUrl");
- this.ValueList.Clear();
- foreach(OThinker.H3.Data.WorkflowDataItem processItem in workflow.DataItems)
- {
- // 显示这条流程数据
- System.Data.DataRow row = this.ValueTable.NewRow();
- this.ValueTable.Rows.Add(row);
- row["Name"] = processItem.ItemName;
- row["Type"] = processItem.LogicTypeName;
- if (processItem.Trackable)
- {
- row["ViewDataTrailText"] = "查看";
- row["ViewDataTrailUrl"] =
- PageName_InstanceDataTrack + "?" +
- Param_InstanceId + "=" + instanceId + "&" +
- Param_ItemName + "=" + System.Web.HttpUtility.UrlEncode(processItem.ItemName);
- }
- object itemValue = null;
- if (!OThinker.H3.Data.DataLogicTypeConvertor.IsAttachmentType(processItem.LogicType))
- {
- // 非附件类型
- itemValue = data[processItem.ItemName].Value;
- }
- else
- {
- // 是附件类型
- itemValue =
- "<a href="" +
- PageName_ReadAttachment + "?" +
- Param_InstanceId + "=" + instanceId + "&" +
- Param_ItemName + "=" + System.Web.HttpUtility.UrlEncode(processItem.ItemName) +
- "">" + "查看附件" + "</a>";
- }
- this.ValueList.Add(itemValue);
- }
- }
- }
- this.InstanceDataGrid.DataSource = this.ValueTable;
- this.InstanceDataGrid.DataBind();
- }
- #region Web Form Designer generated code
- override protected void OnInit(EventArgs e)
- {
- //
- // CODEGEN: This call is required by the ASP.NET Web Form Designer.
- //
- InitializeComponent();
- base.OnInit(e);
- }
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.InstanceDataGrid.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.InstanceDataGrid_ItemDataBound);
- }
- #endregion
- private void InstanceDataGrid_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
- {
- if(e.Item.ItemType != System.Web.UI.WebControls.ListItemType.Header &&
- e.Item.ItemType != System.Web.UI.WebControls.ListItemType.Footer)
- {
- System.Web.UI.WebControls.WebControl control = null;
- object itemValue = this.ValueList[e.Item.ItemIndex];
- if(itemValue == null)
- {
- control = new Label();
- ((Label)control).Text = "null";
- }
- else if(itemValue.GetType().BaseType == typeof(System.Array))
- {
- Table table = new Table();
- control = table;
- for(int count=0; count<((System.Array)itemValue).Length; count++)
- {
- TableRow arrayTableRow = new TableRow();
- table.Rows.Add(arrayTableRow);
- this.AddCell(arrayTableRow, count.ToString() + ": ") ;
- object arrayElementValue = ((System.Array)itemValue).GetValue(count);
- if(arrayElementValue == null)
- {
- this.AddCell(arrayTableRow, "null");
- }
- else
- {
- this.AddCell(arrayTableRow, arrayElementValue.ToString().Replace("n", "<BR>"));
- }
- }
- }
- else
- {
- control = new Label();
- ((Label)control).Text = itemValue.ToString().Replace("n", "<BR>");
- }
- e.Item.Cells[2].Controls.Add(control);
- }
- }
- private void AddCell(TableRow Row, string Content)
- {
- TableCell cell = new TableCell();
- cell.Attributes.Add("valign", "top");
- Row.Cells.Add(cell);
- Label label = new Label();
- cell.Controls.Add(label);
- label.Text = Content;
- }
- }
- }