AbstractNotificationGrid.cs
资源名称:H3_OA.rar [点击查看]
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:4k
源码类别:
OA系统
开发平台:
C#
- using System;
- using System.Data;
- using System.Configuration;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using System.ComponentModel;
- namespace OThinker.H3.Portal
- {
- /// <summary>
- /// Summary description for AbstractNotificationGrid
- /// </summary>
- [DefaultProperty("Text"),
- ToolboxData("<{0}:AbstractNotificationGrid runat=server></{0}:AbstractNotificationGrid>")]
- public class AbstractNotificationGrid : NotificationGrid
- {
- protected TemplateColumn AbstractColumn = new TemplateColumn();
- protected int AbstractColumnIndex
- {
- get
- {
- return this.Columns.IndexOf(this.AbstractColumn);
- }
- }
- public AbstractNotificationGrid()
- {
- this.PageIndexChanged += new DataGridPageChangedEventHandler(InstanceGridView_PageIndexChanged);
- this.AllowPaging = true;
- this.PagerStyle.Mode = PagerMode.NumericPages;
- foreach (DataGridColumn column in this.Columns)
- {
- column.Visible = false;
- }
- this.AbstractColumn.HeaderText = "消息";
- this.Columns.Add(this.AbstractColumn);
- }
- protected override void Grid_ItemDataBound(object sender, DataGridItemEventArgs e)
- {
- base.Grid_ItemDataBound(sender, e);
- if (
- e.Item.ItemType != System.Web.UI.WebControls.ListItemType.Header &&
- e.Item.ItemType != System.Web.UI.WebControls.ListItemType.Footer)
- {
- string title = e.Item.Cells[this.TitleColumnIndex].Text;
- if (title == null || title == "" || title == " ")
- {
- title = "未命名";
- }
- // From
- string from = e.Item.Cells[this.FromColumnIndex].Text;
- if (!this.DesignMode)
- {
- from = OThinker.H3.Server.Engine.Organization.GetFullName(from);
- }
- // To
- string to = e.Item.Cells[this.ToColumnIndex].Text;
- if (!this.DesignMode)
- {
- to = OThinker.H3.Server.Engine.Organization.GetFullName(to);
- }
- System.DateTime receiveTime = System.DateTime.Now;
- if (!this.DesignMode)
- {
- receiveTime = System.DateTime.Parse(e.Item.Cells[this.ReceiveTimeColumnIndex].Text);
- }
- OThinker.H3.Notification.NotificationState state = OThinker.H3.Notification.NotificationState.Read;
- if (!this.DesignMode)
- {
- state = (OThinker.H3.Notification.NotificationState)int.Parse(e.Item.Cells[this.StateColumnIndex].Text);
- }
- string package = e.Item.Cells[this.WorkflowPackageColumnIndex].Text;
- string workflowName = e.Item.Cells[this.WorkflowNameColumnIndex].Text;
- string strVersion = e.Item.Cells[this.WorkflowVersionColumnIndex].Text;
- int version = WorkflowTemplate.WorkflowTemplate.NullWorkflowVersion;
- if(!this.DesignMode)
- {
- version = int.Parse(strVersion);
- }
- string instanceId = e.Item.Cells[this.InstanceIDColumnIndex].Text;
- NotificationGridItem item = new NotificationGridItem(
- title,
- e.Item.Cells[this.UrlColumnIndex].Text,
- state,
- receiveTime,
- package,
- workflowName,
- version,
- instanceId,
- to);
- e.Item.Cells[AbstractColumnIndex].Controls.Add(item);
- }
- }
- private void InstanceGridView_PageIndexChanged(object source, DataGridPageChangedEventArgs e)
- {
- this.CurrentPageIndex = e.NewPageIndex;
- this.DataBind();
- }
- }
- }