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

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 DefaultSheet.
  15. /// </summary>
  16.     public partial class DefaultSheet : WorkSheet.SheetPage
  17. {
  18. public DefaultSheet() : base()
  19. {
  20. }
  21.         public override void LoadDataFields()
  22.         {
  23.             H3.WorkflowTemplate.WorkflowTemplate workflow = OThinker.H3.Server.Engine.WorkflowManager.GetWorkflow(this.Enviroment.WorkflowPackage, this.Enviroment.WorkflowName, this.Enviroment.WorkflowVersion);
  24.             if (workflow == null)
  25.             {
  26.                 return;
  27.             }
  28.             // 设置宽度为100%
  29.             this.SheetTable.Attributes.Add("width", "100%");
  30.             this.SheetTable.Attributes.Add("cellpadding", "0");
  31.             this.SheetTable.Attributes.Add("cellspacing", "0");
  32.             foreach (OThinker.H3.Data.WorkflowDataItem processDataItem in workflow.DataItems)
  33.             {
  34.                 TableRow row = new TableRow();
  35.                 this.SheetTable.Rows.Add(row);
  36.                 // 名称单元
  37.                 TableCell nameCell = new TableCell();
  38.                 OThinker.H3.WorkSheet.SheetLabel nameLabel = new OThinker.H3.WorkSheet.SheetLabel();
  39.                 nameLabel.DataField = processDataItem.ItemName;
  40.                 nameLabel.Text = processDataItem.ItemName;
  41.                 nameLabel.BindType = OThinker.H3.WorkSheet.BindType.OnlyVisibility;
  42.                 nameCell.Controls.Add(nameLabel);
  43.                 nameCell.Attributes.Add("valign", "top");
  44.                 nameCell.Attributes.Add("width", "20%");
  45.                 row.Cells.Add(nameCell);
  46.                 // 数据单元
  47.                 TableCell valueCell = new TableCell();
  48.                 valueCell.Attributes.Add("width", "80%");
  49.                 valueCell.Attributes.Add("valign", "top");
  50.                 row.Cells.Add(valueCell);
  51.                 // 单元控件
  52.                 WebControl cellControl = null;
  53.                 switch (processDataItem.LogicType)
  54.                 {
  55.                     case OThinker.H3.Data.DataLogicType.Bool:
  56.                         cellControl = new OThinker.H3.WorkSheet.SheetCheckBox();
  57.                         ((OThinker.H3.WorkSheet.SheetCheckBox)cellControl).DataField = processDataItem.ItemName;
  58.                         break;
  59.                     case OThinker.H3.Data.DataLogicType.Sign:
  60.                         cellControl = new OThinker.H3.WorkSheet.SheetSign();
  61.                         ((OThinker.H3.WorkSheet.SheetSign)cellControl).DataField = processDataItem.ItemName;
  62.                         break;
  63.                     case OThinker.H3.Data.DataLogicType.DateTime:
  64.                         OThinker.H3.WorkSheet.SheetTime dropDownTime = new OThinker.H3.WorkSheet.SheetTime();
  65.                         dropDownTime.Modal = H3.WorkSheet.DropDownTimeModal.SimplifiedTime;
  66.                         dropDownTime.DefaultValue = H3.WorkSheet.SheetTime.DefaultValueType.CurrentTime;
  67.                         dropDownTime.DataField = processDataItem.ItemName;
  68.                         cellControl = dropDownTime;
  69.                         break;
  70.                     case OThinker.H3.Data.DataLogicType.TimeSpan:
  71.                     case OThinker.H3.Data.DataLogicType.Double:
  72.                     case OThinker.H3.Data.DataLogicType.Money:
  73.                     case OThinker.H3.Data.DataLogicType.Int:
  74.                     case OThinker.H3.Data.DataLogicType.Long:
  75.                     case OThinker.H3.Data.DataLogicType.ShortString:
  76.                     case OThinker.H3.Data.DataLogicType.Byte:
  77.                     case OThinker.H3.Data.DataLogicType.Char:
  78.                         cellControl = new OThinker.H3.WorkSheet.SheetTextBox();
  79.                         ((OThinker.H3.WorkSheet.SheetTextBox)cellControl).DataField = processDataItem.ItemName;
  80.                         break;
  81.                     case OThinker.H3.Data.DataLogicType.HyperLink:
  82.                         cellControl = new OThinker.H3.WorkSheet.SheetEditableHyperlink();
  83.                         ((OThinker.H3.WorkSheet.SheetEditableHyperlink)cellControl).DataField = processDataItem.ItemName;
  84.                         break;
  85.                     case OThinker.H3.Data.DataLogicType.Discussion:
  86.                         cellControl = new OThinker.H3.WorkSheet.SheetComment();
  87.                         cellControl.Height = 180;
  88.                         cellControl.Width = 300;
  89.                         ((OThinker.H3.WorkSheet.SheetComment)cellControl).DataField = processDataItem.ItemName;
  90.                         ((OThinker.H3.WorkSheet.SheetComment)cellControl).ReadDataFields = processDataItem.ItemName;
  91.                         break;
  92.                     case OThinker.H3.Data.DataLogicType.Attachment:
  93.                         cellControl = new OThinker.H3.WorkSheet.SheetAttachment();
  94.                         ((OThinker.H3.WorkSheet.SheetAttachment)cellControl).DataField = processDataItem.ItemName;
  95.                         break;
  96.                     case OThinker.H3.Data.DataLogicType.String:
  97.                         cellControl = new OThinker.H3.WorkSheet.SheetTextBox();
  98.                         ((OThinker.H3.WorkSheet.SheetTextBox)cellControl).DataField = processDataItem.ItemName;
  99.                         ((OThinker.H3.WorkSheet.SheetTextBox)cellControl).TextMode = TextBoxMode.MultiLine;
  100.                         break;
  101.                     case OThinker.H3.Data.DataLogicType.DataTable:
  102.                         cellControl = new OThinker.H3.WorkSheet.SheetGridView();
  103.                         ((OThinker.H3.WorkSheet.SheetGridView)cellControl).DataField = processDataItem.ItemName;
  104.                         break;
  105.                     case OThinker.H3.Data.DataLogicType.SingleParticipant:
  106.                         cellControl = new OThinker.H3.WorkSheet.SheetUserSelector();
  107.                         ((OThinker.H3.WorkSheet.SheetUserSelector)cellControl).UserSelectable = true;
  108.                         ((OThinker.H3.WorkSheet.SheetUserSelector)cellControl).DataField = processDataItem.ItemName;
  109.                         break;
  110.                     case OThinker.H3.Data.DataLogicType.MultiParticipant:
  111.                         cellControl = new OThinker.H3.WorkSheet.SheetUserSelector();
  112.                         ((OThinker.H3.WorkSheet.SheetUserSelector)cellControl).UserSelectable = true;
  113.                         ((OThinker.H3.WorkSheet.SheetUserSelector)cellControl).CompanySelectable = true;
  114.                         ((OThinker.H3.WorkSheet.SheetUserSelector)cellControl).OrgUnitSelectable = true;
  115.                         ((OThinker.H3.WorkSheet.SheetUserSelector)cellControl).GroupSelectable = true;
  116.                         ((OThinker.H3.WorkSheet.SheetUserSelector)cellControl).DataField = processDataItem.ItemName;
  117.                         cellControl.Height = new Unit(60);
  118.                         break;
  119.                     case OThinker.H3.Data.DataLogicType.ByteArray:
  120.                         cellControl = null;
  121.                         break;
  122.                     default:
  123.                         break;
  124.                 }
  125.                 if (cellControl != null)
  126.                 {
  127.                     valueCell.Controls.Add(cellControl);
  128.                     if (cellControl is WorkSheet.SheetUserSelector)
  129.                     {
  130.                         cellControl.Width = new Unit(200);
  131.                     }
  132.                     else
  133.                     {
  134.                         cellControl.Width = System.Web.UI.WebControls.Unit.Percentage(100.0);
  135.                     }
  136.                 }
  137.             }
  138.             base.LoadDataFields();
  139.         }
  140. }
  141. }