InstanceAcl.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 OThinker.H3.Portal
- {
- /// <summary>
- /// Summary description for CaseACL.
- /// </summary>
- public partial class InstanceAcl : PortalPage
- {
- #region 参数
- private string InstanceId
- {
- get
- {
- return this.Request.QueryString[Param_InstanceId];
- }
- }
- #endregion
- protected void Page_Load(object sender, System.EventArgs e)
- {
- if(!this.IsPostBack)
- {
- if(!this.UserValidator.ValidateInstanceAdministrator(this.InstanceId))
- {
- // 没有操作的权限
- this.NotifyMessage("您不具有该权限!");
- }
- else
- {
- this.InstanceACLTable = OThinker.H3.Server.Engine.InstanceAclManager.QueryDataTable(
- new string[]{this.UserValidator.UserID},
- this.InstanceId,
- OThinker.Data.BoolMatchValue.Unspecified,
- OThinker.Data.BoolMatchValue.Unspecified);
- }
- }
- this.SelectionCheckBoxes.Clear();
- this.InstanceACLGrid.DataSource = this.InstanceACLTable;
- this.InstanceACLGrid.DataBind();
- }
- // CaseACLGrid对应的表
- private System.Data.DataTable InstanceACLTable
- {
- get
- {
- return (System.Data.DataTable)this.Session[OThinker.H3.WorkSheet.Sessions.GetInstanceACLTable(this.InstanceId)];
- }
- set
- {
- this.Session[OThinker.H3.WorkSheet.Sessions.GetInstanceACLTable(this.InstanceId)] = value;
- }
- }
- #region 获得选中的ID
- private System.Collections.ArrayList SelectionCheckBoxes
- {
- get
- {
- if(this.Session[OThinker.H3.WorkSheet.Sessions.GetInstanceACLCheckBoxes(this.InstanceId)] == null)
- {
- this.Session[OThinker.H3.WorkSheet.Sessions.GetInstanceACLCheckBoxes(this.InstanceId)] = new System.Collections.ArrayList();
- }
- return (System.Collections.ArrayList)this.Session[OThinker.H3.WorkSheet.Sessions.GetInstanceACLCheckBoxes(this.InstanceId)];
- }
- }
- // 获得选中的Case ID
- private long[] GetSelectedACLs()
- {
- // 获得选中的
- System.Collections.ArrayList selections = new ArrayList();
- for(int count=0; count<this.SelectionCheckBoxes.Count; count++)
- {
- if(((System.Web.UI.WebControls.CheckBox)this.SelectionCheckBoxes[count]).Checked)
- {
- System.Data.DataRow row = this.InstanceACLTable.Rows[count];
- selections.Add(row["ObjectID"]);
- }
- }
- long[] selectedCases = new long[selections.Count];
- for(int count=0; count<selectedCases.Length; count++)
- {
- selectedCases[count] = long.Parse(selections[count].ToString());
- }
- return selectedCases;
- }
- #endregion
- #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()
- {
- this.InstanceACLGrid.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.InstanceACLGrid_ItemDataBound);
- }
- #endregion
- private void InstanceACLGrid_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
- {
- if(
- e.Item.ItemType != System.Web.UI.WebControls.ListItemType.Header &&
- e.Item.ItemType != System.Web.UI.WebControls.ListItemType.Footer)
- {
- CheckBox box = new System.Web.UI.WebControls.CheckBox();
- this.SelectionCheckBoxes.Add(box);
- e.Item.Cells[0].Controls.Add(box);
- e.Item.Cells[2].Text = OThinker.H3.Server.Engine.Organization.GetFullName(e.Item.Cells[2].Text);
- // 授予权限
- CheckBox administrator = new CheckBox();
- administrator.Enabled = false;
- if(e.Item.Cells[3].Text == "1")
- {
- administrator.Checked = true;
- }
- else
- {
- administrator.Checked = false;
- }
- e.Item.Cells[3].Controls.Add(administrator);
- // 查看
- CheckBox view = new CheckBox();
- view.Enabled = false;
- if(e.Item.Cells[4].Text == "1")
- {
- view.Checked = true;
- }
- else
- {
- view.Checked = false;
- }
- e.Item.Cells[4].Controls.Add(view);
- }
- }
- }
- }