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

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 WorkSheets
  12. {
  13. /// <summary>
  14. /// Summary description for ApplyLeave.
  15. /// </summary>
  16. public partial class ApplyLeave : OThinker.H3.WorkSheet.SheetPage
  17. {
  18. protected void Page_Load(object sender, System.EventArgs e)
  19. {
  20.             if (!this.IsPostBack)
  21.             {
  22.                 // TODO,这段代码用于获得可选的申请人
  23.                 this.SheetDropDownList1.DataSource = new string[] { "lixx", "loul" };
  24.                 this.SheetDropDownList1.DataBind();
  25.                 // TODO,这段代码用于获得用户所在的部门
  26.                 this.lblDept.Text = "财务部";
  27.                 // 初始化实际请假日期
  28.                 if (System.DateTime.Parse("1999-12-30").CompareTo(this.Enviroment.InstanceData["实际开始日期"].Value) == 1)
  29.                 {
  30.                     this.Enviroment.InstanceData["实际开始日期"].Value = this.Enviroment.InstanceData["开始日期"].Value;
  31.                     this.Enviroment.InstanceData["实际结束日期"].Value = this.Enviroment.InstanceData["结束日期"].Value;
  32.                 }
  33.                 this.SheetLabel3.Text = this.Enviroment.InstanceId.ToString();
  34.             }
  35. }
  36. #region Web Form Designer generated code
  37. override protected void OnInit(EventArgs e)
  38. {
  39. //
  40. // CODEGEN: This call is required by the ASP.NET Web Form Designer.
  41. //
  42. InitializeComponent();
  43. base.OnInit(e);
  44. }
  45. /// <summary>
  46. /// Required method for Designer support - do not modify
  47. /// the contents of this method with the code editor.
  48. /// </summary>
  49. private void InitializeComponent()
  50. {    
  51. }
  52. #endregion
  53.         /// <summary>
  54.         /// 绑定的数据项
  55.         /// </summary>
  56.         private const string FieldName = "办公室成员";
  57.         /// <summary>
  58.         /// 要读取的组名称
  59.         /// </summary>
  60.         private const string GroupName = "办公室";
  61.         public override void SaveDataFields(OThinker.H3.WorkSheet.SheetSubmitEventArgs Args)
  62.         {
  63.             base.SaveDataFields(Args);
  64.             if (this.Enviroment.InstanceData[FieldName] == null)
  65.             {
  66.                 // 获得发起人Id
  67.                 string originatorId = (string)this.Enviroment.InstanceData["Originator"].Value;
  68.                 // 获得发起人
  69.                 OThinker.Organization.User originatorUser = (OThinker.Organization.User)this.Enviroment.Organization.GetUnit(originatorId);
  70.                 // 获得所属的组织单元
  71.                 OThinker.Organization.OrganizationUnit parentUnit = (OThinker.Organization.OrganizationUnit)this.Enviroment.Organization.GetUnit(originatorUser.ParentID);
  72.                 // 获得子组
  73.                 string[] groupIds = this.Enviroment.Organization.GetChildren(parentUnit.UnitID, OThinker.Organization.UnitType.Group, false);
  74.                 // 获得相应的组
  75.                 OThinker.Organization.Group group = null;
  76.                 foreach (string groupId in groupIds)
  77.                 {
  78.                     group = (OThinker.Organization.Group)this.Enviroment.Organization.GetUnit(groupId);
  79.                     if (group.Name == GroupName)
  80.                     {
  81.                         break;
  82.                     }
  83.                 }
  84.                 // 设置会签人员
  85.                 this.Enviroment.InstanceData[FieldName].Value = group.Children;
  86.             }
  87.         }
  88. }
  89. }