using System;
using System.Collections.Generic;

namespace Stat.web
{
    /// <summary>
    /// 
    /// </summary>
    public partial class ResetPassword : System.Web.UI.Page
    {
        Stat.Cache.IConfig config = Stat.Cache.CacheFatory.CreateConfig();
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GetTop1();
            }
        }
        /// <summary>
        /// 
        /// </summary>
        protected void GetTop1()
        {
            IList<Stat.Model.Notify> list = Stat.BLL.Notify.GetTop1(1, 1);
            if (list.Count > 0)
            {
                this.LtrTitle.Text = "<a href=\"/Notice.aspx?id=" + list[0].ID + "\" target=\"_blank\">" + list[0].title + " (查看详细)</a>";
                this.LtrContent.Text = Plugin.Common.Cut(Plugin.Common.DealHtml(list[0].content), 300);
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSaveUser_Click(object sender, EventArgs e)
        {
            this.btnSaveUser.Enabled = false;
            this.btnSaveUser.Text = "请等待。。。";
            Stat.Model.Users model = new Stat.Model.Users();
            model.UserName = this.txtUname.Text.Trim();
            model.UserEmail = this.txtUEmail.Text.Trim();
            model.IsPwdMD5 = config.IsUserPwdMd5();
            BLL.Stmp.ResetPassWord(model);
            this.btnSaveUser.Text = "再来一次。";
            this.btnSaveUser.Enabled = true;
        }

    }
}
