必须填写至少10个字的日志
nnhy authored at 2012-07-27 18:48:21
1.36 KiB
X
using System;
using System.Web.UI;
using NewLife;
using NewLife.CommonEntity;
using NewLife.Security;
using XCode;

public partial class Pages_AdminInfo : MyEntityForm
{
    /// <summary>实体类型</summary>
    public override Type EntityType { get { return CommonManageProvider.Provider.AdminstratorType; } set { base.EntityType = value; } }

    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        // 用户信息页面,无需进行权限控制,只能修改自己短信息
        Manager.ValidatePermission = false;

        EntityForm.OnSetForm += EntityForm_OnSetForm;
        EntityForm.OnGetForm += EntityForm_OnGetForm;
    }

    void EntityForm_OnSetForm(object sender, EntityFormEventArgs e)
    {
        frmPassword.Text = null;
    }

    void EntityForm_OnGetForm(object sender, EntityFormEventArgs e)
    {
        if (!String.IsNullOrEmpty(frmPassword.Text)) EntityForm.Entity.SetItem("Password", DataHelper.Hash(frmPassword.Text));
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if ("" + EntityForm.EntityID != "" + Manager.Current.ID)
        {
            Response.Redirect("AdminInfo.aspx?ID=" + Manager.Current.ID);
        }

        if (!Page.IsPostBack)
        {
            btnSave.Visible = true;
            btnSave.Text = "保存";
        }
    }
}