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

OA系统

开发平台:

C#

  1. using System;
  2. using System.Collections;
  3. using System.Configuration;
  4. using System.Data;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.HtmlControls;
  9. using System.Web.UI.WebControls;
  10. using System.Web.UI.WebControls.WebParts;
  11. namespace OThinker.H3.Portal
  12. {
  13.     public partial class QueryOrgLog : PortalPage
  14.     {
  15.         protected void Page_Load(object sender, EventArgs e)
  16.         {
  17.             if (!this.IsPostBack)
  18.             {
  19.                 if (!this.UserValidator.ValidateAdministrator())
  20.                 {
  21.                     this.NotifyMessage(LackOfAuth);
  22.                 }
  23.                 this.txtStart.Text = System.DateTime.Now.AddDays(-7).ToShortDateString();
  24.                 this.txtEnd.Text = System.DateTime.Now.AddDays(1).ToShortDateString();
  25.             }
  26.         }
  27.         private DataTable Table
  28.         {
  29.             get
  30.             {
  31.                 return (DataTable)this.Session[OThinker.H3.WorkSheet.Sessions.GetOrgLogTable()];
  32.             }
  33.             set
  34.             {
  35.                 this.Session[OThinker.H3.WorkSheet.Sessions.GetOrgLogTable()] = value;
  36.             }
  37.         }
  38.         protected void btnQuery_Click(object sender, EventArgs e)
  39.         {
  40.             System.DateTime start = System.DateTime.Now;
  41.             System.DateTime end = System.DateTime.Now;
  42.             try
  43.             {
  44.                 start = System.DateTime.Parse(this.txtStart.Text);
  45.                 end = System.DateTime.Parse(this.txtEnd.Text);
  46.             }
  47.             catch
  48.             {
  49.                 this.NotifyMessage("输入的开始日期或者结束日期有错误");
  50.             }
  51.             this.Table = OThinker.H3.Server.Engine.Organization.QueryLog(start, end);
  52.             this.gridLog.DataSource = this.Table;
  53.             this.gridLog.DataBind();
  54.         }
  55.         protected void gridLog_RowDataBound(object sender, GridViewRowEventArgs e)
  56.         {
  57.             if (e.Row.RowType != DataControlRowType.Header && e.Row.RowType != DataControlRowType.Footer && e.Row.RowType != DataControlRowType.Pager)
  58.             {
  59.                 // 修改人的名称
  60.                 string userId = e.Row.Cells[0].Text;
  61.                 string userName = null;
  62.                 if (userId == null || userId.Trim() == "" || userId == " ")
  63.                 {
  64.                     userName = "系统";
  65.                 }
  66.                 else
  67.                 {
  68.                     userId = userId.Trim().ToLower();
  69.                     userName = OThinker.H3.Server.Engine.Organization.GetFullName(userId);
  70.                 }
  71.                 e.Row.Cells[0].Text = userName;
  72.                 // 操作
  73.                 string operationStr = e.Row.Cells[2].Text.Trim();
  74.                 int operationInt = int.Parse(operationStr);
  75.                 OThinker.Organization.OrganizationLog.OperationType operation = (OThinker.Organization.OrganizationLog.OperationType)operationInt;
  76.                 e.Row.Cells[2].Text = OThinker.Organization.OrganizationLog.GetOperationName(operation);
  77.                 // 对象
  78.                 object name = this.Table.Rows[this.gridLog.PageIndex * this.gridLog.PageSize + e.Row.RowIndex]["Name"];
  79.                 string unitId = e.Row.Cells[3].Text.Trim();
  80.                 string fullName = OThinker.H3.Server.Engine.Organization.GetFullName(unitId);
  81.                 e.Row.Cells[3].Text = fullName != null ? fullName : (name == null ? null : name.ToString());
  82.             }
  83.         }
  84.         protected void gridLog_PageIndexChanged(object sender, EventArgs e)
  85.         {
  86.             // this.gridLog.CurrentPageIndex = e.NewPageIndex;
  87.             // this.gridLog.DataBind();
  88.         }
  89.         protected void gridLog_PageIndexChanging(object sender, GridViewPageEventArgs e)
  90.         {
  91.             this.gridLog.PageIndex = e.NewPageIndex;
  92.             this.gridLog.DataSource = this.Table;
  93.             this.gridLog.DataBind();
  94.         }
  95. }
  96. }