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

OA系统

开发平台:

C#

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. namespace OThinker.H3.Portal
  12. {
  13.     public partial class EditCompany : PortalPage
  14.     {
  15.         private EditUserType _EditMode = EditUserType.Unspecified;
  16.         /// <summary>
  17.         /// 是否是自己修改自己信息的模式
  18.         /// </summary>
  19.         protected EditUserType EditMode
  20.         {
  21.             get
  22.             {
  23.                 if (this._EditMode == EditUserType.Unspecified)
  24.                 {
  25.                     if (this.UserValidator.ValidateAdministrator())
  26.                     {
  27.                         this._EditMode = EditUserType.Admin;
  28.                     }
  29.                     else
  30.                     {
  31.                         this._EditMode = EditUserType.View;
  32.                     }
  33.                 }
  34.                 return this._EditMode;
  35.             }
  36.         }
  37.         protected void Page_Load(object sender, EventArgs e)
  38.         {
  39.             if (!this.IsPostBack)
  40.             {
  41.                 if (this.EditMode == EditUserType.Admin)
  42.                 {
  43.                     // 添加成员的面板
  44.                     string id = OThinker.H3.Server.Engine.Organization.Company.UnitID;
  45.                     string param = "?" + Param_Parent + "=" + id + "&" + Param_Q + "=" + HttpUtility.UrlEncode(this.Request.Url.AbsoluteUri) + "&" + Param_ExpandPath + "=" + this.Request.QueryString[Param_ExpandPath];
  46.                     this.lnkAddOrganizationUnit.NavigateUrl = PageName_EditOrganizationUnit + param;
  47.                     this.lnkAddGroup.NavigateUrl = PageName_EditGroup + param;
  48.                     this.lnkAddUser.NavigateUrl = PageName_EditUser + param;
  49.                     this.lnkSyncUser.NavigateUrl = PageName_SyncUser + param;
  50.                     this.lnkSyncAllUsers.NavigateUrl = PageName_SyncAllUsers + param;
  51.                     this.lnkManager.Visible = false;
  52.                     this.txtManager.LoadSelection(OThinker.H3.Server.Engine.Organization, OThinker.H3.Server.Engine.Organization.Company.ManagerID);
  53.                 }
  54.                 else
  55.                 {
  56.                     this.panelAdmin.Visible = false;
  57.                     this.txtName.Enabled = false;
  58.                     this.txtDescription.Enabled = false;
  59.                     this.txtManager.Editable = false;
  60.                     this.lnkManager.Visible = true;
  61.                     this.txtManager.Visible = false;
  62.                     string managerId = OThinker.H3.Server.Engine.Organization.Company.ManagerID;
  63.                     if (managerId == null)
  64.                     {
  65.                         this.lnkManager.Text = "未设置";
  66.                     }
  67.                     else
  68.                     {
  69.                         string managerName = OThinker.H3.Server.Engine.Organization.GetFullName(managerId);
  70.                         this.lnkManager.Text = managerName;
  71.                         this.lnkManager.NavigateUrl = PageName_EditUser + "?" + Param_ID + "=" + managerId;
  72.                     }
  73.                 }
  74.                 this.txtName.Text = OThinker.H3.Server.Engine.Organization.Company.Name;
  75.                 this.txtDescription.Text = OThinker.H3.Server.Engine.Organization.Company.Description;
  76.             }
  77.         }
  78.         protected void lnkOk_Click(object sender, EventArgs e)
  79.         {
  80.             OThinker.Organization.Company company = OThinker.H3.Server.Engine.Organization.Company;
  81.             company.Name = this.txtName.Text;
  82.             company.Description = this.txtDescription.Text;
  83.             company.ManagerID = this.txtManager.SelectedUser;
  84.             OThinker.Organization.HandleResult result = OThinker.H3.Server.Engine.Organization.UpdateUnit(this.UserValidator.UserID, company);
  85.             this.NotifyResult(
  86.                 result,
  87.                 result == OThinker.Organization.HandleResult.SUCCESS,
  88.                 this.Request.QueryString[Param_ExpandPath]);
  89.         }
  90.     }
  91. }