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

OA系统

开发平台:

C#

  1. using System;
  2. using System.Collections;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Web;
  7. using System.Web.SessionState;
  8. using System.Web.UI;
  9. using System.Web.UI.WebControls;
  10. using System.Web.UI.HtmlControls;
  11. namespace OThinker.H3.Portal
  12. {
  13.     /// <summary>
  14.     /// Summary description for CaseDataTrail.
  15.     /// </summary>
  16.     public partial class InstanceDataTrack : PortalPage
  17.     {
  18.         #region 参数
  19.         private string InstanceId
  20.         {
  21.             get
  22.             {
  23.                 return this.Request.QueryString[Param_InstanceId];
  24.             }
  25.         }
  26.         private string ItemName
  27.         {
  28.             get
  29.             {
  30.                 string itemName = this.Request.QueryString[Param_ItemName];
  31.                 return System.Web.HttpUtility.UrlDecode(itemName);
  32.             }
  33.         }
  34.         private Data.WorkflowDataItem _WorkflowDataItem;
  35.         private Data.WorkflowDataItem WorkflowDataItem
  36.         {
  37.             get
  38.             {
  39.                 if (this._WorkflowDataItem == null)
  40.                 {
  41.                     string package = OThinker.H3.Server.Engine.InstanceManager.GetInstanceWorkflowPackage(this.InstanceId);
  42.                     string name = OThinker.H3.Server.Engine.InstanceManager.GetInstanceWorkflowName(this.InstanceId);
  43.                     int version = OThinker.H3.Server.Engine.InstanceManager.GetInstanceWorkflowVersion(this.InstanceId);
  44.                     WorkflowTemplate.WorkflowTemplate workflow = OThinker.H3.Server.Engine.WorkflowManager.GetWorkflow(package, name, version);
  45.                     if (workflow != null)
  46.                     {
  47.                         this._WorkflowDataItem = workflow.GetDataItem(this.ItemName);
  48.                     }
  49.                 }
  50.                 return this._WorkflowDataItem;
  51.             }
  52.         }
  53.         #endregion
  54.         private System.Data.DataTable TrailTable;
  55.         protected void Page_Load(object sender, System.EventArgs e)
  56.         {
  57.             if (!this.IsPostBack)
  58.             {
  59.                 this.lblInstanceID.Text = this.InstanceId.ToString();
  60.                 this.lblItemName.Text = this.ItemName;
  61.                 this.TrailTable = OThinker.H3.Server.Engine.InstanceDataTrackManager.QueryTable(
  62.                     this.InstanceId,
  63.                     this.ItemName);
  64.                 this.TrailGrid.DataSource = this.TrailTable;
  65.                 this.TrailGrid.DataBind();
  66.             }
  67.         }
  68.         #region Web Form Designer generated code
  69.         override protected void OnInit(EventArgs e)
  70.         {
  71.             //
  72.             // CODEGEN: This call is required by the ASP.NET Web Form Designer.
  73.             //
  74.             InitializeComponent();
  75.             base.OnInit(e);
  76.         }
  77.         /// <summary>
  78.         /// Required method for Designer support - do not modify
  79.         /// the contents of this method with the code editor.
  80.         /// </summary>
  81.         private void InitializeComponent()
  82.         {
  83.             this.TrailGrid.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.TrailGrid_ItemDataBound);
  84.         }
  85.         #endregion
  86.         private void TrailGrid_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
  87.         {
  88.             if (e.Item.ItemType != ListItemType.Header &&
  89.                 e.Item.ItemType != ListItemType.Footer)
  90.             {
  91.                 int index = e.Item.ItemIndex;
  92.                 // 痕迹ID
  93.                 string strTrackId = e.Item.Cells[0].Text;
  94.                 long trackId = 0;
  95.                 try
  96.                 {
  97.                     trackId = long.Parse(strTrackId);
  98.                 }
  99.                 catch
  100.                 {
  101.                 }
  102.                 // 修改人
  103.                 string modifiedBy = e.Item.Cells[3].Text;
  104.                 e.Item.Cells[3].Text = OThinker.H3.Server.Engine.Organization.GetFullName(modifiedBy);
  105.                 // 修改值
  106.                 object dbOriginalValue = this.TrailTable.Rows[index][OThinker.H3.Data.InstanceDataItemTrack.PropertyName_BinModifiedValue];
  107.                 byte[] binOriginalValue;
  108.                 if (dbOriginalValue == null || dbOriginalValue == DBNull.Value)
  109.                 {
  110.                     binOriginalValue = null;
  111.                 }
  112.                 else
  113.                 {
  114.                     binOriginalValue = (byte[])dbOriginalValue;
  115.                 }
  116.                 object originalValue = OThinker.Data.Convertor.ByteArrayToObject(binOriginalValue, false);
  117.                 if (originalValue == null)
  118.                 {
  119.                     e.Item.Cells[4].Text = "null";
  120.                 }
  121.                 else
  122.                 {
  123.                     if (OThinker.H3.Data.DataLogicTypeConvertor.IsAttachmentType(this.WorkflowDataItem.LogicType))
  124.                     {
  125.                         // 是附件类型
  126.                         e.Item.Cells[4].Text =
  127.                             "<a href="" +
  128.                                 PageName_ReadAttachment + "?" +
  129.                                 Param_TrackID + "=" + trackId +
  130.                                 "">" + "查看附件" + "</a>";
  131.                     }
  132.                     else
  133.                     {
  134.                         e.Item.Cells[4].Text = originalValue.ToString();
  135.                     }
  136.                 }
  137.             }
  138.         }
  139.     }
  140. }