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

OA系统

开发平台:

C#

  1. using System;
  2. using System.Collections;
  3. using System.Configuration;
  4. using System.Data;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.HtmlControls;
  9. using System.Web.UI.WebControls;
  10. using System.Web.UI.WebControls.WebParts;
  11. namespace OThinker.H3.Portal
  12. {
  13.     public partial class RemoveUnit : PortalPage
  14.     {
  15.         #region 参数
  16.         protected string EditID
  17.         {
  18.             get
  19.             {
  20.                 return HttpUtility.UrlDecode(this.Request.QueryString[Param_ID]);
  21.             }
  22.         }
  23.         private OThinker.Organization.Unit _EditUnit = null;
  24.         protected OThinker.Organization.Unit EditUnit
  25.         {
  26.             get
  27.             {
  28.                 if (this._EditUnit == null)
  29.                 {
  30.                     this._EditUnit = OThinker.H3.Server.Engine.Organization.GetUnit(this.EditID);
  31.                 }
  32.                 return this._EditUnit;
  33.             }
  34.         }
  35.         #endregion
  36.         protected void Page_Load(object sender, EventArgs e)
  37.         {
  38.             if (!this.UserValidator.ValidateAdministrator())
  39.             {
  40.                 this.NotifyMessage(LackOfAuth);
  41.             }
  42.             if (this.EditUnit == null)
  43.             {
  44.                 this.NotifyMessage("选中的单元不存在");
  45.             }
  46.             else if (
  47.                 this.EditUnit is OThinker.Organization.Company || 
  48.                 this.EditID.ToLower() == OThinker.Organization.OrganizationUnit.RecyleID ||
  49.                 this.EditID.ToLower() == OThinker.Organization.User.AdministratorID ||
  50.                 this.EditID.ToLower() == OThinker.Organization.User.GuestID || 
  51.                 // ERROR, FOR一维ONLY
  52.                 this.EditID.ToLower() == OThinker.Organization.OrganizationUnit.UserOUID || 
  53.                 this.EditID.ToLower() == OThinker.Organization.OrganizationUnit.GroupOUID)
  54.             {
  55.                 // 不允许删除公司
  56.                 this.NotifyMessage("不允许删除");
  57.             }
  58.             else if (OThinker.H3.Server.Engine.Organization.GetUnit(OThinker.Organization.OrganizationUnit.RecyleID) == null ||
  59.                 ((OThinker.Organization.NonCompany)this.EditUnit).ParentID == OThinker.Organization.OrganizationUnit.RecyleID)
  60.             {
  61.                 // 检查是否存在回收站或者是否已经在回收站中,如果不存在则物理删除,否则只删除到回收站中
  62.                 OThinker.H3.Server.Engine.Organization.RemoveUnit(this.UserValidator.UserID, this.EditID);
  63.             }
  64.             else
  65.             {
  66.                 ((OThinker.Organization.NonCompany)this.EditUnit).SourceParentID = ((OThinker.Organization.NonCompany)this.EditUnit).ParentID;
  67.                 ((OThinker.Organization.NonCompany)this.EditUnit).ParentID = OThinker.Organization.OrganizationUnit.RecyleID;
  68.                 OThinker.H3.Server.Engine.Organization.UpdateUnit(this.UserValidator.UserID, this.EditUnit);
  69.             }
  70.             
  71.             // 显示结果
  72.             this.NotifyResult(OThinker.Organization.HandleResult.SUCCESS, true, this.Request.QueryString[Param_ExpandPath]);
  73.         }
  74.     }
  75. }