SheetSequenceID.cs
资源名称:H3_OA.rar [点击查看]
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:3k
源码类别:
OA系统
开发平台:
C#
- using System;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.ComponentModel;
- using System.Drawing;
- using System.Drawing.Design;
- [assembly:TagPrefix("OThinker.H3.WorkSheet","SheetControls")]
- namespace OThinker.H3.WorkSheet
- {
- /// <summary>
- /// SheetSequenceID1 的摘要说明。
- /// </summary>
- ///
- [ToolboxBitmap(typeof(SheetSequenceID),"OThinker.H3.WorkSheet.SheetSequenceID.bmp")]
- [ToolboxData("<{0}:SheetSequenceID runat=server></{0}:SheetSequenceID>")]
- public class SheetSequenceID : System.Web.UI.WebControls.Label, ISheetControl
- {
- public SheetSequenceID()
- {
- }
- /// <summary>
- /// 默认的总长度
- /// </summary>
- public const int DefaultLength = 16;
- private int _Length = DefaultLength;
- /// <summary>
- /// 总长度
- /// </summary>
- [Bindable(true), Category("WorkSheet"), Description("总长度")]
- public int Length
- {
- get
- {
- return this._Length;
- }
- set
- {
- this._Length = value;
- }
- }
- #region ISheetControl 成员
- public virtual void LoadDataField(OThinker.H3.WorkSheet.SheetPage SheetPage)
- {
- System.DateTime date;
- long sequenceId;
- if (this.DesignMode || SheetPage.Enviroment.InstanceId == null || SheetPage.Enviroment.InstanceId == "" || SheetPage.Enviroment.InstanceId == Instance.InstanceContext.UnspecifiedID)
- {
- date = System.DateTime.Now;
- sequenceId = 0;
- }
- else
- {
- // 获得流程信息
- OThinker.H3.Instance.InstanceContext context = SheetPage.Enviroment.InstanceManager.GetInstanceContext(SheetPage.Enviroment.InstanceId);
- date = context.CreatedTime;
- sequenceId = context.SequenceID;
- }
- string dateStr = date.Year + string.Format("{0:D2}", date.Month) + string.Format("{0:D2}", date.Day);
- int len = this.Length - dateStr.Length;
- len = len > 0 ? len : 0;
- this.Text = dateStr + string.Format("{0:D" + len + "}", sequenceId);
- }
- public virtual bool ValidateDataField(
- OThinker.H3.WorkSheet.SheetPage SheetPage,
- System.Collections.Generic.List<string> Errors)
- {
- return true;
- }
- public virtual void SaveDataField(OThinker.H3.WorkSheet.SheetPage SheetPage)
- {
- }
- #endregion
- protected override void Render(HtmlTextWriter writer)
- {
- if (this.DesignMode)
- {
- this.LoadDataField(null);
- }
- base.Render(writer);
- }
- }
- }