EditGroupChild.aspx.cs
资源名称:H3_OA.rar [点击查看]
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:4k
源码类别:
OA系统
开发平台:
C#
- using System;
- using System.Collections;
- using System.Configuration;
- using System.Data;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.HtmlControls;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- namespace OThinker.H3.Portal
- {
- public partial class EditGroupChild : PortalPage
- {
- public const char Seperator = ';';
- #region 参数
- protected string EditID
- {
- get
- {
- return HttpUtility.UrlDecode(this.Request.QueryString[Param_ID]);
- }
- }
- private OThinker.Organization.Group _EditUnit;
- protected OThinker.Organization.Group EditUnit
- {
- get
- {
- if (this._EditUnit != null)
- {
- return this._EditUnit;
- }
- else if (EditID == null || EditID == "")
- {
- return null;
- }
- else
- {
- OThinker.Organization.Unit unit = OThinker.H3.Server.Engine.Organization.GetUnit(this.EditID);
- if (unit == null || unit.UnitType != OThinker.Organization.UnitType.Group)
- {
- return null;
- }
- this._EditUnit = (OThinker.Organization.Group)unit;
- return this._EditUnit;
- }
- }
- }
- #endregion
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!this.IsPostBack)
- {
- // 验证是否具有管理员权限
- if (!this.UserValidator.ValidateAdministrator())
- {
- this.NotifyMessage(LackOfAuth);
- }
- // 加载已有成员
- if (this.EditUnit.Children != null && this.EditUnit.Children.Length != 0)
- {
- foreach (string child in this.EditUnit.Children)
- {
- string name = OThinker.H3.Server.Engine.Organization.GetFullName(child);
- this.lstChild.Items.Add(new ListItem(name, child));
- this.txtSelectedIds.Text += child + Seperator;
- }
- }
- // 添加子成员
- HtmlButton btnAdd = new HtmlButton();
- btnAdd.Attributes.Add("id", "btnAdd");
- btnAdd.InnerText = "添加";
- btnAdd.Attributes.Add(
- "onclick",
- "javascript:selectedUser('" + this.txtChild.User.ClientID + "', '" + this.txtChild.UserIDs.ClientID + "', '" + this.lstChild.ClientID + "', '" + this.txtSelectedIds.ClientID + "');");
- this.PlaceHolderEdit.Controls.Add(btnAdd);
- // 删除子成员
- HtmlButton btnDel = new HtmlButton();
- btnDel.InnerText = "删除";
- btnDel.Attributes.Add(
- "onclick",
- "javascript:removeUser('" + this.lstChild.ClientID + "', '" + this.txtSelectedIds.ClientID + "');");
- this.PlaceHolderEdit.Controls.Add(btnDel);
- }
- }
- protected void lnkOk_Click(object sender, EventArgs e)
- {
- string[] children = null;
- if (this.txtSelectedIds.Text != null && this.txtSelectedIds.Text != "")
- {
- children = this.txtSelectedIds.Text.Split(new char[]{Seperator});
- }
- System.Collections.Generic.List<string> list = new System.Collections.Generic.List<string>();
- if (children != null)
- {
- foreach (string child in children)
- {
- if (child != null && child != "")
- {
- list.Add(child);
- }
- }
- }
- this.EditUnit.Children = list.ToArray();
- OThinker.Organization.HandleResult result = OThinker.H3.Server.Engine.Organization.UpdateUnit(this.UserValidator.UserID, this.EditUnit);
- this.NotifyResult(result);
- }
- }
- }