EditUserTitle.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 EditUserTitle : PortalPage
  14.     {
  15.         private string UserID
  16.         {
  17.             get
  18.             {
  19.                 return this.Request[Param_UserID];
  20.             }
  21.         }
  22.         private string ParentID
  23.         {
  24.             get
  25.             {
  26.                 return this.Request[Param_Parent];
  27.             }
  28.         }
  29.         protected void Page_Load(object sender, EventArgs e)
  30.         {
  31.             if (!this.IsPostBack)
  32.             {
  33.                 // 验证是否具有管理员权限
  34.                 if (!this.UserValidator.ValidateAdministrator())
  35.                 {
  36.                     this.NotifyMessage(LackOfAuth);
  37.                 }
  38.                 OThinker.Organization.Title[] titles = OThinker.H3.Server.Engine.Organization.GetCompanyTitles();
  39.                 System.Collections.Generic.List<string> nameList = new System.Collections.Generic.List<string>();
  40.                 System.Collections.Generic.List<string> idList = new System.Collections.Generic.List<string>();
  41.                 if (titles != null)
  42.                 {
  43.                     foreach (OThinker.Organization.Title title in titles)
  44.                     {
  45.                         idList.Add(title.TitleID);
  46.                         nameList.Add(title.Name);
  47.                     }
  48.                 }
  49.                 this.TitleSelector.OptionNames = nameList.ToArray();
  50.                 this.TitleSelector.OptionValues = idList.ToArray();
  51.                 OThinker.Organization.User user = (OThinker.Organization.User)OThinker.H3.Server.Engine.Organization.GetUnit(this.UserID);
  52.                 string[] userTitles = user.GetTitles(this.ParentID);
  53.                 this.TitleSelector.SelectedItems = userTitles;
  54.             }
  55.         }
  56.         protected void btnSubmit_Click(object sender, EventArgs e)
  57.         {
  58.             string[] titles = this.TitleSelector.SelectedItems;
  59.             OThinker.Organization.User user = (OThinker.Organization.User)OThinker.H3.Server.Engine.Organization.GetUnit(this.UserID);
  60.             user.SetTitles(this.ParentID, titles);
  61.             OThinker.Organization.HandleResult result = OThinker.H3.Server.Engine.Organization.UpdateUnit(this.UserValidator.UserID, user);
  62.             if (result == OThinker.Organization.HandleResult.SUCCESS)
  63.             {
  64.                 this.Response.Write("<script>window.close(false);</script>");
  65.             }
  66.             else
  67.             {
  68.                 this.NotifyResult(result);
  69.             }
  70.         }
  71.     }
  72. }