SheetController.cs
资源名称:H3_OA.rar [点击查看]
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:5k
源码类别:
OA系统
开发平台:
C#
- using System;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.HtmlControls;
- using System.ComponentModel;
- using System.Drawing;
- using System.Drawing.Design;
- [assembly: TagPrefix("OThinker.H3.WorkSheet", "SheetControls")]
- namespace OThinker.H3.WorkSheet
- {
- /// <summary>
- /// SheetController 的摘要说明。
- /// </summary>
- [ToolboxBitmap(typeof(SheetController), "OThinker.H3.WorkSheet.SheetController.bmp")]
- [ToolboxData("<{0}:SheetController runat=server></{0}:SheetController>"), DefaultValue("")]
- public class SheetController : System.Web.UI.WebControls.WebControl
- {
- public SheetController()
- {
- this._Enviroment = new SheetEnviroment(this);
- }
- private SheetEnviroment _Enviroment;
- /// <summary>
- /// 环境
- /// </summary>
- public virtual SheetEnviroment Enviroment
- {
- get
- {
- return this._Enviroment;
- }
- }
- // 工作项头
- protected SheetHeader SheetHeader;
- // 添加操作面板
- protected OThinker.H3.WorkSheet.SheetActionPane ActionPane;
- // 用户评论区
- protected SheetUserComment UserComment;
- // 查看其他人的评论区
- protected SheetWorkItemComments WorkItemComments;
- protected void UserComment_FinishedUserComment(object sender, EventArgs e)
- {
- //若是FinishedButton,则进行工作项的提交,也就是smButton.DataType == EnumButtonType.FinishedButton
- this.Enviroment.WorkItemManager.FinishWorkItem(this.Enviroment.WorkItemID, this.Enviroment.UserValidator.UserID, false);
- this.Enviroment.WorkItem.State = OThinker.H3.WorkItem.WorkItemState.Finished;
- // 转到另外一个页面上
- this.Enviroment.NotifyMessage("任务已完成!");
- }
- protected virtual void Load()
- {
- if (this.Enviroment == null)
- {
- return;
- }
- // 工作模式的条件
- bool workCondition =
- this.Enviroment.SheetMode == SheetMode.Work &&
- this.Enviroment.WorkItem != null &&
- this.Enviroment.WorkItem.State != OThinker.H3.WorkItem.WorkItemState.Finished;
- // 普通工作模式
- bool normalCondition = workCondition && this.Enviroment.WorkItem.ItemType == OThinker.H3.WorkItem.WorkItemType.Normal;
- // 征询意见模式
- bool consultCondition = workCondition && this.Enviroment.WorkItem.ItemType == OThinker.H3.WorkItem.WorkItemType.Consultancy;
- // 发起模式的条件
- bool originateCondition = this.Enviroment.SheetMode == SheetMode.Originate;
- // 取回模式
- bool retrieveCondition =
- this.Enviroment.SheetMode == SheetMode.View &&
- this.Enviroment.WorkItem != null &&
- this.Enviroment.WorkItem.State == OThinker.H3.WorkItem.WorkItemState.Finished &&
- this.Enviroment.WorkItem.PermittedActions.Retrieve;
- if (workCondition)
- {
- // 工作项的头
- this.SheetHeader = new SheetHeader(this.Enviroment.WorkItem);
- this.Controls.Add(this.SheetHeader);
- }
- if (normalCondition || originateCondition)
- {
- // 操作面板
- this.ActionPane = new SheetActionPane();
- this.ActionPane.InitAsWorkMode(this.Enviroment);
- this.ActionPane.Submit += new SheetSubmitEventHandler(this.SheetController_Submit);
- this.Controls.Add(this.ActionPane);
- }
- if (retrieveCondition)
- {
- // 操作面板
- this.ActionPane = new SheetActionPane();
- this.ActionPane.InitAsRetreiveMode(this.Enviroment);
- this.Controls.Add(this.ActionPane);
- }
- if (consultCondition)
- {
- // 用户的评论
- this.UserComment = new SheetUserComment(this.Enviroment.WorkItem);
- this.UserComment.FinishedUserComment += new EventHandler(UserComment_FinishedUserComment);
- this.Controls.Add(this.UserComment);
- }
- if (normalCondition)
- {
- // 我的评论
- this.WorkItemComments = new SheetWorkItemComments(this.Enviroment);
- this.Controls.Add(this.WorkItemComments);
- }
- }
- public event SheetSubmitEventHandler Submit;
- protected virtual void SheetController_Submit(object Sender, SheetSubmitEventArgs e)
- {
- if (this.Submit != null)
- {
- this.Submit(Sender, e);
- }
- }
- }
- }