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;
using JuSNS.Model;
using JuSNS.UI.Control;

namespace JuSNS.Web.system.admin
{
    public partial class index : JuSNS.UI.Page.ManagePage
    {
        protected string sort = "admin";
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                string newPwd = this.TxtPassword.Text;
                string oldPwd = this.TxtOldPass.Text;
                JuSNS.Manage.Manager mg = new JuSNS.Manage.Manager();
                int n = mg.ChangePasswrod(UserID, oldPwd, newPwd);
                switch (n)
                {
                    case 0:
                        PageRight("密码修改成功", "index.aspx");
                        break;
                    case 1:
                        PageError("该管理员ID不存在", "index.aspx");
                        break;
                    case 2:
                        PageError("旧密码错误", "index.aspx");
                        break;
                    default:
                        PageError("修改密码时发生意外错误", "index.aspx");
                        break;
                }

            }
        }
    }
}
