ApplyLeave.aspx.cs
资源名称:H3_OA.rar [点击查看]
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:4k
源码类别:
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 WorkSheets
- {
- /// <summary>
- /// Summary description for ApplyLeave.
- /// </summary>
- public partial class ApplyLeave : OThinker.H3.WorkSheet.SheetPage
- {
- protected void Page_Load(object sender, System.EventArgs e)
- {
- if (!this.IsPostBack)
- {
- // TODO,这段代码用于获得可选的申请人
- this.SheetDropDownList1.DataSource = new string[] { "lixx", "loul" };
- this.SheetDropDownList1.DataBind();
- // TODO,这段代码用于获得用户所在的部门
- this.lblDept.Text = "财务部";
- // 初始化实际请假日期
- if (System.DateTime.Parse("1999-12-30").CompareTo(this.Enviroment.InstanceData["实际开始日期"].Value) == 1)
- {
- this.Enviroment.InstanceData["实际开始日期"].Value = this.Enviroment.InstanceData["开始日期"].Value;
- this.Enviroment.InstanceData["实际结束日期"].Value = this.Enviroment.InstanceData["结束日期"].Value;
- }
- this.SheetLabel3.Text = this.Enviroment.InstanceId.ToString();
- }
- }
- #region Web Form Designer generated code
- override protected void OnInit(EventArgs e)
- {
- //
- // CODEGEN: This call is required by the ASP.NET Web Form Designer.
- //
- InitializeComponent();
- base.OnInit(e);
- }
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- }
- #endregion
- /// <summary>
- /// 绑定的数据项
- /// </summary>
- private const string FieldName = "办公室成员";
- /// <summary>
- /// 要读取的组名称
- /// </summary>
- private const string GroupName = "办公室";
- public override void SaveDataFields(OThinker.H3.WorkSheet.SheetSubmitEventArgs Args)
- {
- base.SaveDataFields(Args);
- if (this.Enviroment.InstanceData[FieldName] == null)
- {
- // 获得发起人Id
- string originatorId = (string)this.Enviroment.InstanceData["Originator"].Value;
- // 获得发起人
- OThinker.Organization.User originatorUser = (OThinker.Organization.User)this.Enviroment.Organization.GetUnit(originatorId);
- // 获得所属的组织单元
- OThinker.Organization.OrganizationUnit parentUnit = (OThinker.Organization.OrganizationUnit)this.Enviroment.Organization.GetUnit(originatorUser.ParentID);
- // 获得子组
- string[] groupIds = this.Enviroment.Organization.GetChildren(parentUnit.UnitID, OThinker.Organization.UnitType.Group, false);
- // 获得相应的组
- OThinker.Organization.Group group = null;
- foreach (string groupId in groupIds)
- {
- group = (OThinker.Organization.Group)this.Enviroment.Organization.GetUnit(groupId);
- if (group.Name == GroupName)
- {
- break;
- }
- }
- // 设置会签人员
- this.Enviroment.InstanceData[FieldName].Value = group.Children;
- }
- }
- }
- }