QueryException.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 QueryException.
  15. /// </summary>
  16.     public partial class QueryException : PortalPage
  17. {
  18.         protected System.Web.UI.WebControls.Panel DetailContainer;
  19.         #region 参数
  20.         private System.DateTime From
  21.         {
  22.             get
  23.             {
  24.                 string strFrom = this.Request.QueryString[Param_From];
  25.                 if (strFrom != null && strFrom != "")
  26.                 {
  27.                     return System.DateTime.Parse(strFrom);
  28.                 }
  29.                 else
  30.                 {
  31.                     return System.DateTime.Now.Subtract(new System.TimeSpan(3, 0, 0, 0, 0));
  32.                 }
  33.             }
  34.         }
  35.         private System.DateTime To
  36.         {
  37.             get
  38.             {
  39.                 string strTo = this.Request.QueryString[Param_To];
  40.                 if (strTo != null && strTo != "")
  41.                 {
  42.                     return System.DateTime.Parse(strTo);
  43.                 }
  44.                 else
  45.                 {
  46.                     return System.DateTime.Now;
  47.                 }
  48.             }
  49.         }
  50.         #endregion
  51.         protected void Page_Load(object sender, System.EventArgs e)
  52. {
  53. if(!this.IsPostBack)
  54. {
  55.                 // 验证是否具有管理员权限
  56.                 if (!this.UserValidator.ValidateAdministrator())
  57.                 {
  58.                     this.NotifyMessage(LackOfAuth);
  59.                 }
  60.                 System.Data.DataTable table = OThinker.H3.Server.Engine.ExceptionManager.QueryTable(
  61.                 H3.Instance.InstanceContext.UnspecifiedID, this.From, this.To, H3.Exceptions.ExceptionState.Unspecified);
  62.                 this.ExceptionGrid.DataSource = table;
  63.                 this.ExceptionGrid.DataBind();
  64. }
  65. }
  66. #region Web Form Designer generated code
  67. override protected void OnInit(EventArgs e)
  68. {
  69. //
  70. // CODEGEN: This call is required by the ASP.NET Web Form Designer.
  71. //
  72. InitializeComponent();
  73. base.OnInit(e);
  74. }
  75. /// <summary>
  76. /// Required method for Designer support - do not modify
  77. /// the contents of this method with the code editor.
  78. /// </summary>
  79. private void InitializeComponent()
  80. {    
  81. this.ExceptionGrid.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.ExceptionGrid_ItemDataBound);
  82. }
  83. #endregion
  84. private void ExceptionGrid_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
  85. {
  86. if(
  87. e.Item.ItemType != ListItemType.Header && 
  88. e.Item.ItemType != ListItemType.Footer)
  89. {
  90. #region 流程实例摘要
  91. #region 标题行
  92. HyperLink linkTitle = new HyperLink();
  93. // 获得全名
  94. linkTitle.Text = e.Item.Cells[0].Text + "[" + e.Item.Cells[1].Text + "\" + e.Item.Cells[2].Text + "\" + e.Item.Cells[3].Text + "." + e.Item.Cells[4].Text + "]";
  95. linkTitle.Target = "ExceptionMain";
  96.                 linkTitle.NavigateUrl = PageName_ExceptionDetail + "?" + Param_ExceptionID + "=" + e.Item.Cells[0].Text;
  97. TableRow rowTitle = this.RowControl(new Control[]{linkTitle});
  98. #endregion
  99. #region 详细
  100. TableRow rowMisc;
  101. #region 阻塞和修复
  102. // 阻塞
  103. Label labelBlocked = new Label();
  104.                 labelBlocked.Text = e.Item.Cells[5].Text == "1" ? "阻塞" : "未阻塞";
  105. // 修复
  106. Label labelFixed = new Label();
  107.                 OThinker.H3.Exceptions.ExceptionState state = (OThinker.H3.Exceptions.ExceptionState)int.Parse(e.Item.Cells[6].Text);
  108.                 labelFixed.Text = state == OThinker.H3.Exceptions.ExceptionState.Fixed ? "已修复" : "未修复";
  109. rowMisc = this.RowControl(new Control[]{labelBlocked, labelFixed});
  110. #endregion
  111. Table tableDetail = this.TableRows(new TableRow[]{rowMisc});
  112. TableRow rowDetail = this.RowControl(new Control[]{tableDetail});
  113. #endregion
  114. Table tableAbstract = this.TableRows(new TableRow[]{rowTitle, rowDetail});
  115. e.Item.Cells[7].Controls.Add(tableAbstract);
  116. #endregion
  117. }
  118. }
  119. private TableCell CellControl(Control[] Controls)
  120. {
  121. TableCell cell = new TableCell();
  122. cell.Attributes.Add("background", "images/BG_Item.gif");
  123. foreach(Control control in Controls)
  124. {
  125. cell.Controls.Add(control);
  126. }
  127. return cell;
  128. }
  129. private TableCell CellControl(Control Control)
  130. {
  131. TableCell cell = new TableCell();
  132. cell.Attributes.Add("background", "images/BG_Item.gif");
  133. cell.Controls.Add(Control);
  134. return cell;
  135. }
  136. private TableRow RowControl(Control[] Controls)
  137. {
  138. TableRow row = new TableRow();
  139. foreach(Control control in Controls)
  140. {
  141. TableCell cell = this.CellControl(control);
  142. row.Cells.Add(cell);
  143. }
  144. return row;
  145. }
  146. private Table TableRows(TableRow[] Rows)
  147. {
  148. Table table = new Table();
  149. table.Attributes.Add("background", "images/BG_Item.gif");
  150. table.CssClass = "ms-vb2";
  151. table.Attributes.Add("width", "100%");
  152. foreach(TableRow row in Rows)
  153. {
  154. table.Rows.Add(row);
  155. }
  156. return table;
  157. }
  158. }
  159. }