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

OA系统

开发平台:

C#

  1. //===========================================================================
  2. // This file was modified as part of an ASP.NET 2.0 Web project conversion.
  3. // The class name was changed and the class modified to inherit from the abstract base class 
  4. // in file 'App_CodeMigratedconsoleStub_addworkflowacl_aspx_cs.cs'.
  5. // During runtime, this allows other classes in your web application to bind and access 
  6. // the code-behind page using the abstract base class.
  7. // The associated content page 'consoleaddworkflowacl.aspx' was also modified to refer to the new class name.
  8. // For more information on this code pattern, please refer to http://go.microsoft.com/fwlink/?LinkId=46995 
  9. //===========================================================================
  10. using System;
  11. using System.Collections;
  12. using System.ComponentModel;
  13. using System.Data;
  14. using System.Drawing;
  15. using System.Web;
  16. using System.Web.SessionState;
  17. using System.Web.UI;
  18. using System.Web.UI.WebControls;
  19. using System.Web.UI.HtmlControls;
  20. namespace OThinker.H3.Portal
  21. {
  22. /// <summary>
  23. /// Summary description for AddWorkflowACL.
  24. /// </summary>
  25. public partial class AddWorkflowAcl : PortalPage
  26. {
  27. #region 参数
  28. private string GetWorkflowState
  29. {
  30. get
  31. {
  32. if(this.Request.QueryString[Param_WorkflowPackage] == null || this.Request.QueryString[Param_WorkflowPackage] == "")
  33. {
  34. return null;
  35. }
  36. else
  37. {
  38. return System.Web.HttpUtility.UrlDecode(this.Request.QueryString[Param_WorkflowPackage]);
  39. }
  40. }
  41. }
  42. private string WorkflowName
  43. {
  44. get
  45. {
  46. if(this.Request.QueryString[Param_WorkflowName] == null || this.Request.QueryString[Param_WorkflowName] == "")
  47. {
  48. return null;
  49. }
  50. else
  51. {
  52. return System.Web.HttpUtility.UrlDecode(this.Request.QueryString[Param_WorkflowName]);
  53. }
  54. }
  55. }
  56. #endregion
  57. protected System.Web.UI.WebControls.CheckBox chkPublishNewVersion;
  58. protected System.Web.UI.WebControls.CheckBox chkViewReport;
  59. protected System.Web.UI.WebControls.CheckBox chkViewInstances;
  60. protected System.Web.UI.WebControls.CheckBox chkAdminInstances;
  61. protected void Page_Load(object sender, System.EventArgs e)
  62. {
  63.             this.UserSelector.SelectUserUrl = PageName_SelectUser;
  64.             this.UserSelector.SelectUserImageUrl = PageName_SelectUserImage;
  65. if(!this.IsPostBack)
  66. {
  67. if(!this.UserValidator.ValidateAdministrator())
  68. {
  69.                     this.NotifyMessage(LackOfAuth);
  70. }
  71. this.lblWorkflowPackage.Text = this.GetWorkflowState;
  72. this.lblWorkflowName.Text = this.WorkflowName;
  73. }
  74. }
  75. #region Web Form Designer generated code
  76. override protected void OnInit(EventArgs e)
  77. {
  78. //
  79. // CODEGEN: This call is required by the ASP.NET Web Form Designer.
  80. //
  81. InitializeComponent();
  82. base.OnInit(e);
  83. }
  84. /// <summary>
  85. /// Required method for Designer support - do not modify
  86. /// the contents of this method with the code editor.
  87. /// </summary>
  88. private void InitializeComponent()
  89. {    
  90. }
  91. #endregion
  92. protected void btnOk_Click(object sender, System.EventArgs e)
  93. {
  94. OThinker.H3.Acl.WorkflowAcl acl = new OThinker.H3.Acl.WorkflowAcl();
  95.             string[] users = this.UserSelector.SelectedUsers;
  96.             acl.UserID = (users == null || users.Length == 0) ? null : users[0];
  97. acl.WorkflowPackage = this.lblWorkflowPackage.Text;
  98. acl.WorkflowName = this.lblWorkflowName.Text;
  99. acl.Administrator = this.chkAdministrator.Checked;
  100. acl.CreateInstance = this.chkCreateInstance.Checked;
  101. // acl.PublishNewVersion = this.chkPublishNewVersion.Checked;
  102. // acl.ViewAllInstances = this.chkViewInstances.Checked;
  103. // acl.ViewReport = this.chkViewReport.Checked;
  104. // acl.AdminAllInstances = this.chkAdminInstances.Checked;
  105.             acl.CreateBy = this.UserValidator.UserID;
  106.             acl.CreateTime = System.DateTime.Now;
  107. if(OThinker.H3.Server.Engine.WorkflowAclManager.Add(acl))
  108. {
  109. // 添加成功
  110. this.Response.Redirect(
  111. PageName_WorkflowAcl + "?" + 
  112. Param_WorkflowPackage + "=" + System.Web.HttpUtility.UrlEncode(this.GetWorkflowState) + "&" + 
  113. Param_WorkflowName + "=" + System.Web.HttpUtility.UrlEncode(this.WorkflowName));
  114. }
  115. else
  116. {
  117. // 添加不成功
  118.                 this.lblError.Text = "添加不成功,请检查:1、是否设置了组织单元/组/用户名;2、该组织单元/组/用户的权限控制单元是否已经存在。";
  119. }
  120. }
  121. protected void btnCancel_Click(object sender, System.EventArgs e)
  122. {
  123. // 添加成功
  124. this.Response.Redirect(
  125. PageName_WorkflowAcl + "?" + 
  126. Param_WorkflowPackage + "=" + System.Web.HttpUtility.UrlEncode(this.GetWorkflowState) + "&" + 
  127. Param_WorkflowName + "=" + System.Web.HttpUtility.UrlEncode(this.WorkflowName));
  128. }
  129. }
  130. }