[fix]Config创建默认配置文件的开关Runtime.CreateConfigOnMissing,仅需对自动创建生效,而不应该阻止用户主动Save
智能大石头 authored at 2024-08-09 00:30:41 石头 committed at 2024-08-10 14:22:24
1.13 KiB
X
using System;
using NewLife.CommonEntity;
using NewLife.Security;
using XCode.Membership;

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

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

        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", SecurityHelper.MD5(frmPassword_.Text, null));
    }

    protected override void OnInitComplete(EventArgs e)
    {
        base.OnInitComplete(e);
        ods.DataObjectTypeName = ods.TypeName = ManageProvider.Provider.GetService<IRole>().GetType().FullName;
    }

    protected void Page_Load(object sender, EventArgs e)
    {
    }
}