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

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 EditTitle : PortalPage
  14.     {
  15.         protected void Page_Load(object sender, EventArgs e)
  16.         {
  17.             if (!this.IsPostBack)
  18.             {
  19.                 // 验证是否具有管理员权限
  20.                 if (!this.UserValidator.ValidateAdministrator())
  21.                 {
  22.                     this.NotifyMessage(LackOfAuth);
  23.                 }
  24.                 // 设置COMPANY名称
  25.                 this.lblCompany.Text = OThinker.H3.Server.Engine.Organization.Company.Name;
  26.                 // 获得公司的所有职务
  27.                 OThinker.Organization.Title[] titles = OThinker.H3.Server.Engine.Organization.GetCompanyTitles();
  28.                 if (titles != null && titles.Length != 0)
  29.                 {
  30.                     foreach (OThinker.Organization.Title title in titles)
  31.                     {
  32.                         this.lstTitle.Items.Add(new ListItem(title.Name, title.TitleID));
  33.                     }
  34.                 }
  35.             }
  36.         }
  37.         protected void lnkAdd_Click(object sender, EventArgs e)
  38.         {
  39.             OThinker.Organization.Title title = new OThinker.Organization.Title(OThinker.H3.Server.Engine.Organization.Company.UnitID, this.txtTitleName.Text);
  40.             string titleId = OThinker.H3.Server.Engine.Organization.AddTitle(title);
  41.             if (titleId == OThinker.Organization.Title.NullTitleID)
  42.             {
  43.                 this.NotifyMessage("添加职务失败");
  44.             }
  45.             else
  46.             {
  47.                 this.NotifyMessage("添加职务成功");
  48.             }
  49.         }
  50.         protected void lnkModify_Click(object sender, EventArgs e)
  51.         {
  52.             if (this.lstTitle.SelectedValue == null || this.lstTitle.SelectedValue == "")
  53.             {
  54.                 this.NotifyMessage("没有选择的职务");
  55.             }
  56.             else if (this.txtTitleName.Text == null || this.txtTitleName.Text == "")
  57.             {
  58.                 this.NotifyMessage("不能修改,没有设置新的职务名称");
  59.             }
  60.             else
  61.             {
  62.                 OThinker.Organization.Title title = OThinker.H3.Server.Engine.Organization.GetTitle(this.lstTitle.SelectedValue);
  63.                 title.Name = this.txtTitleName.Text;
  64.                 this.NotifyResult(OThinker.H3.Server.Engine.Organization.UpdateTitle(title));
  65.             }
  66.         }
  67.         protected void lnkDel_Click(object sender, EventArgs e)
  68.         {
  69.             if (this.lstTitle.SelectedValue == null || this.lstTitle.SelectedValue == "")
  70.             {
  71.                 this.NotifyMessage("没有选择的职务");
  72.             }
  73.             else
  74.             {
  75.                 OThinker.H3.Server.Engine.Organization.RemoveTitle(this.UserValidator.UserID, this.lstTitle.SelectedValue);
  76.                 this.NotifyMessage("删除成功");
  77.             }
  78.         }
  79.     }
  80. }