SetPassword.aspx.cs
资源名称:H3_OA.rar [点击查看]
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:4k
源码类别:
OA系统
开发平台:
C#
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- namespace OThinker.H3.Portal
- {
- public partial class SetPassword : PortalPage
- {
- #region 参数
- private string _EditID = OThinker.Organization.Unit.NullID;
- protected string EditID
- {
- get
- {
- if (this._EditID == OThinker.Organization.Unit.NullID)
- {
- this._EditID = HttpUtility.UrlDecode(this.Request.QueryString[Param_ID]);
- }
- return this._EditID;
- }
- }
- #endregion
- private EditUserType _EditMode = EditUserType.Unspecified;
- /// <summary>
- /// 是否是自己修改自己信息的模式
- /// </summary>
- protected EditUserType EditMode
- {
- get
- {
- if (this._EditMode == EditUserType.Unspecified)
- {
- if (this.UserValidator.ValidateAdministrator())
- {
- this._EditMode = EditUserType.Admin;
- }
- else if (this.UserValidator.UserID == this.EditID)
- {
- this._EditMode = EditUserType.Profile;
- }
- else
- {
- this._EditMode = EditUserType.Unspecified;
- }
- }
- return this._EditMode;
- }
- }
- private OThinker.Organization.User _EditUnit;
- protected OThinker.Organization.User EditUnit
- {
- get
- {
- if (this._EditUnit == null)
- {
- string id = null;
- switch (this.EditMode)
- {
- case EditUserType.Admin:
- id = this.EditID;
- break;
- case EditUserType.Profile:
- id = this.UserValidator.UserID;
- break;
- default:
- throw new NotImplementedException();
- }
- this._EditUnit = (OThinker.Organization.User)OThinker.H3.Server.Engine.Organization.GetUnit(id);
- }
- return this._EditUnit;
- }
- }
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!this.IsPostBack)
- {
- // 验证是否具有管理员权限
- if (this.EditMode == EditUserType.Unspecified)
- {
- this.NotifyMessage(LackOfAuth);
- }
- this.txtUserAlias.Text = this.EditUnit.Alias;
- this.txtUserName.Text = this.EditUnit.Name;
- this.txtDescription.Text = this.EditUnit.Description;
- }
- }
- protected void lnkOk_Click(object sender, EventArgs e)
- {
- this.SavePassword();
- }
- protected void btnOk_Click(object sender, ImageClickEventArgs e)
- {
- this.SavePassword();
- }
- private void SavePassword()
- {
- this.EditUnit.Password = this.txtPassword.Text;
- OThinker.H3.Server.Engine.Organization.UpdateUnit(this.UserValidator.UserID, this.EditUnit);
- this.NotifyMessage("修改密码成功");
- }
- }
- }