DefaultSheet.aspx.cs
资源名称:H3_OA.rar [点击查看]
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:8k
源码类别:
OA系统
开发平台:
C#
- using System;
- using System.Collections;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Web;
- using System.Web.SessionState;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.HtmlControls;
- namespace OThinker.H3.Portal
- {
- /// <summary>
- /// Summary description for DefaultSheet.
- /// </summary>
- public partial class DefaultSheet : WorkSheet.SheetPage
- {
- public DefaultSheet() : base()
- {
- }
- public override void LoadDataFields()
- {
- H3.WorkflowTemplate.WorkflowTemplate workflow = OThinker.H3.Server.Engine.WorkflowManager.GetWorkflow(this.Enviroment.WorkflowPackage, this.Enviroment.WorkflowName, this.Enviroment.WorkflowVersion);
- if (workflow == null)
- {
- return;
- }
- // 设置宽度为100%
- this.SheetTable.Attributes.Add("width", "100%");
- this.SheetTable.Attributes.Add("cellpadding", "0");
- this.SheetTable.Attributes.Add("cellspacing", "0");
- foreach (OThinker.H3.Data.WorkflowDataItem processDataItem in workflow.DataItems)
- {
- TableRow row = new TableRow();
- this.SheetTable.Rows.Add(row);
- // 名称单元
- TableCell nameCell = new TableCell();
- OThinker.H3.WorkSheet.SheetLabel nameLabel = new OThinker.H3.WorkSheet.SheetLabel();
- nameLabel.DataField = processDataItem.ItemName;
- nameLabel.Text = processDataItem.ItemName;
- nameLabel.BindType = OThinker.H3.WorkSheet.BindType.OnlyVisibility;
- nameCell.Controls.Add(nameLabel);
- nameCell.Attributes.Add("valign", "top");
- nameCell.Attributes.Add("width", "20%");
- row.Cells.Add(nameCell);
- // 数据单元
- TableCell valueCell = new TableCell();
- valueCell.Attributes.Add("width", "80%");
- valueCell.Attributes.Add("valign", "top");
- row.Cells.Add(valueCell);
- // 单元控件
- WebControl cellControl = null;
- switch (processDataItem.LogicType)
- {
- case OThinker.H3.Data.DataLogicType.Bool:
- cellControl = new OThinker.H3.WorkSheet.SheetCheckBox();
- ((OThinker.H3.WorkSheet.SheetCheckBox)cellControl).DataField = processDataItem.ItemName;
- break;
- case OThinker.H3.Data.DataLogicType.Sign:
- cellControl = new OThinker.H3.WorkSheet.SheetSign();
- ((OThinker.H3.WorkSheet.SheetSign)cellControl).DataField = processDataItem.ItemName;
- break;
- case OThinker.H3.Data.DataLogicType.DateTime:
- OThinker.H3.WorkSheet.SheetTime dropDownTime = new OThinker.H3.WorkSheet.SheetTime();
- dropDownTime.Modal = H3.WorkSheet.DropDownTimeModal.SimplifiedTime;
- dropDownTime.DefaultValue = H3.WorkSheet.SheetTime.DefaultValueType.CurrentTime;
- dropDownTime.DataField = processDataItem.ItemName;
- cellControl = dropDownTime;
- break;
- case OThinker.H3.Data.DataLogicType.TimeSpan:
- case OThinker.H3.Data.DataLogicType.Double:
- case OThinker.H3.Data.DataLogicType.Money:
- case OThinker.H3.Data.DataLogicType.Int:
- case OThinker.H3.Data.DataLogicType.Long:
- case OThinker.H3.Data.DataLogicType.ShortString:
- case OThinker.H3.Data.DataLogicType.Byte:
- case OThinker.H3.Data.DataLogicType.Char:
- cellControl = new OThinker.H3.WorkSheet.SheetTextBox();
- ((OThinker.H3.WorkSheet.SheetTextBox)cellControl).DataField = processDataItem.ItemName;
- break;
- case OThinker.H3.Data.DataLogicType.HyperLink:
- cellControl = new OThinker.H3.WorkSheet.SheetEditableHyperlink();
- ((OThinker.H3.WorkSheet.SheetEditableHyperlink)cellControl).DataField = processDataItem.ItemName;
- break;
- case OThinker.H3.Data.DataLogicType.Discussion:
- cellControl = new OThinker.H3.WorkSheet.SheetComment();
- cellControl.Height = 180;
- cellControl.Width = 300;
- ((OThinker.H3.WorkSheet.SheetComment)cellControl).DataField = processDataItem.ItemName;
- ((OThinker.H3.WorkSheet.SheetComment)cellControl).ReadDataFields = processDataItem.ItemName;
- break;
- case OThinker.H3.Data.DataLogicType.Attachment:
- cellControl = new OThinker.H3.WorkSheet.SheetAttachment();
- ((OThinker.H3.WorkSheet.SheetAttachment)cellControl).DataField = processDataItem.ItemName;
- break;
- case OThinker.H3.Data.DataLogicType.String:
- cellControl = new OThinker.H3.WorkSheet.SheetTextBox();
- ((OThinker.H3.WorkSheet.SheetTextBox)cellControl).DataField = processDataItem.ItemName;
- ((OThinker.H3.WorkSheet.SheetTextBox)cellControl).TextMode = TextBoxMode.MultiLine;
- break;
- case OThinker.H3.Data.DataLogicType.DataTable:
- cellControl = new OThinker.H3.WorkSheet.SheetGridView();
- ((OThinker.H3.WorkSheet.SheetGridView)cellControl).DataField = processDataItem.ItemName;
- break;
- case OThinker.H3.Data.DataLogicType.SingleParticipant:
- cellControl = new OThinker.H3.WorkSheet.SheetUserSelector();
- ((OThinker.H3.WorkSheet.SheetUserSelector)cellControl).UserSelectable = true;
- ((OThinker.H3.WorkSheet.SheetUserSelector)cellControl).DataField = processDataItem.ItemName;
- break;
- case OThinker.H3.Data.DataLogicType.MultiParticipant:
- cellControl = new OThinker.H3.WorkSheet.SheetUserSelector();
- ((OThinker.H3.WorkSheet.SheetUserSelector)cellControl).UserSelectable = true;
- ((OThinker.H3.WorkSheet.SheetUserSelector)cellControl).CompanySelectable = true;
- ((OThinker.H3.WorkSheet.SheetUserSelector)cellControl).OrgUnitSelectable = true;
- ((OThinker.H3.WorkSheet.SheetUserSelector)cellControl).GroupSelectable = true;
- ((OThinker.H3.WorkSheet.SheetUserSelector)cellControl).DataField = processDataItem.ItemName;
- cellControl.Height = new Unit(60);
- break;
- case OThinker.H3.Data.DataLogicType.ByteArray:
- cellControl = null;
- break;
- default:
- break;
- }
- if (cellControl != null)
- {
- valueCell.Controls.Add(cellControl);
- if (cellControl is WorkSheet.SheetUserSelector)
- {
- cellControl.Width = new Unit(200);
- }
- else
- {
- cellControl.Width = System.Web.UI.WebControls.Unit.Percentage(100.0);
- }
- }
- }
- base.LoadDataFields();
- }
- }
- }