RemoveUnit.aspx.cs
资源名称:H3_OA.rar [点击查看]
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:3k
源码类别:
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 RemoveUnit : PortalPage
- {
- #region 参数
- protected string EditID
- {
- get
- {
- return HttpUtility.UrlDecode(this.Request.QueryString[Param_ID]);
- }
- }
- private OThinker.Organization.Unit _EditUnit = null;
- protected OThinker.Organization.Unit EditUnit
- {
- get
- {
- if (this._EditUnit == null)
- {
- this._EditUnit = OThinker.H3.Server.Engine.Organization.GetUnit(this.EditID);
- }
- return this._EditUnit;
- }
- }
- #endregion
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!this.UserValidator.ValidateAdministrator())
- {
- this.NotifyMessage(LackOfAuth);
- }
- if (this.EditUnit == null)
- {
- this.NotifyMessage("选中的单元不存在");
- }
- else if (
- this.EditUnit is OThinker.Organization.Company ||
- this.EditID.ToLower() == OThinker.Organization.OrganizationUnit.RecyleID ||
- this.EditID.ToLower() == OThinker.Organization.User.AdministratorID ||
- this.EditID.ToLower() == OThinker.Organization.User.GuestID ||
- // ERROR, FOR一维ONLY
- this.EditID.ToLower() == OThinker.Organization.OrganizationUnit.UserOUID ||
- this.EditID.ToLower() == OThinker.Organization.OrganizationUnit.GroupOUID)
- {
- // 不允许删除公司
- this.NotifyMessage("不允许删除");
- }
- else if (OThinker.H3.Server.Engine.Organization.GetUnit(OThinker.Organization.OrganizationUnit.RecyleID) == null ||
- ((OThinker.Organization.NonCompany)this.EditUnit).ParentID == OThinker.Organization.OrganizationUnit.RecyleID)
- {
- // 检查是否存在回收站或者是否已经在回收站中,如果不存在则物理删除,否则只删除到回收站中
- OThinker.H3.Server.Engine.Organization.RemoveUnit(this.UserValidator.UserID, this.EditID);
- }
- else
- {
- ((OThinker.Organization.NonCompany)this.EditUnit).SourceParentID = ((OThinker.Organization.NonCompany)this.EditUnit).ParentID;
- ((OThinker.Organization.NonCompany)this.EditUnit).ParentID = OThinker.Organization.OrganizationUnit.RecyleID;
- OThinker.H3.Server.Engine.Organization.UpdateUnit(this.UserValidator.UserID, this.EditUnit);
- }
- // 显示结果
- this.NotifyResult(OThinker.Organization.HandleResult.SUCCESS, true, this.Request.QueryString[Param_ExpandPath]);
- }
- }
- }