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

OA系统

开发平台:

C#

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Web;
  5. using System.Web.Security;
  6. using System.Web.UI;
  7. using System.Web.UI.WebControls;
  8. using System.Web.UI.WebControls.WebParts;
  9. using System.Web.UI.HtmlControls;
  10. using System.ComponentModel;
  11. namespace OThinker.H3.Portal
  12. {
  13.     /// <summary>
  14.     /// Summary description for WorkItemGridItem.
  15.     /// </summary>
  16.     [DefaultProperty("Text"),
  17.       ToolboxData("<{0}:NotificationGridItem runat=server></{0}:NotificationGridItem>")]
  18.     public class NotificationGridItem : System.Web.UI.WebControls.WebControl
  19.     {
  20.         // 设置优先级的图标
  21.         private Image imageIcon = new Image();
  22.         // 标题行的标题名称单元
  23.         private HyperLink linkTitle = new HyperLink();
  24.         // Receive Time
  25.         private Label labelReceiveTime = new Label();
  26.         // Workflow Full Name
  27.         private Label labelFullName = new Label();
  28.         // To
  29.         private Label labelTo = new Label();
  30.         // From
  31.         private Label labelInstanceInfo = new Label();
  32.         public NotificationGridItem(
  33.             string Title,
  34.             string Url, 
  35.             OThinker.H3.Notification.NotificationState State,
  36.             System.DateTime ReceiveTime,
  37.             string WorkflowPackage,
  38.             string WorkflowName,
  39.             int WorkflowVersion,
  40.             string InstanceId,
  41.             string To)
  42.         {
  43.             this.imageIcon.ImageUrl = "images/Icon_Message.gif";
  44.             this.linkTitle.Text = Title;
  45.             this.linkTitle.NavigateUrl = Url;
  46.             this.linkTitle.Attributes.Add("target", "NotificationMain");
  47.             this.labelReceiveTime.Text = ReceiveTime.ToShortDateString();
  48.             this.labelInstanceInfo.Text = WorkflowTemplate.WorkflowTemplate.GetWorkflowFullName(
  49.                 WorkflowPackage, 
  50.                 WorkflowName, 
  51.                 WorkflowVersion) + "." + InstanceId;
  52.             this.labelTo.Text = To;
  53.         }
  54.         protected override void Render(HtmlTextWriter writer)
  55.         {
  56.             writer.Write("<TABLE WIDTH="100%" cellpadding="0" cellspacing="0">");
  57.             writer.Write("<TR  WIDTH="100%">");
  58.             writer.Write("<TD WIDTH="15" VALIGN="TOP">");
  59.             this.imageIcon.RenderControl(writer);
  60.             writer.Write("</TD>");
  61.             writer.Write("<TD WIDTH="100%">");
  62.             writer.Write("<TABLE WIDTH="100%" cellpadding="0" cellspacing="0">");
  63.             writer.Write("<TR WIDTH="100%">");
  64.             writer.Write("<TD>");
  65.             writer.Write("<TABLE WIDTH="100%" cellpadding="0" cellspacing="0">");
  66.             writer.Write("<TR WIDTH="100%">");
  67.             writer.Write("<TD>");
  68.             this.linkTitle.RenderControl(writer);
  69.             writer.Write("</TD>");
  70.             writer.Write("<TD ALIGN="RIGHT">");
  71.             this.labelReceiveTime.RenderControl(writer);
  72.             writer.Write("</TD>");
  73.             writer.Write("</TR>");
  74.             writer.Write("</TABLE>");
  75.             writer.Write("</TD>");
  76.             writer.Write("</TR>");
  77.             writer.Write("<TR>");
  78.             writer.Write("<TD>");
  79.             this.labelInstanceInfo.RenderControl(writer);
  80.             writer.Write("</TD>");
  81.             writer.Write("<TR>");
  82.             writer.Write("<TR>");
  83.             writer.Write("<TD>");
  84.             this.labelTo.RenderControl(writer);
  85.             writer.Write("</TD>");
  86.             writer.Write("<TR>");
  87.             writer.Write("</TABLE>");
  88.             writer.Write("</TD>");
  89.             writer.Write("</TR>");
  90.             writer.Write("</TABLE>");
  91.         }
  92.     }
  93. }