Пример #1
0
        //管理员登录

        public Administrator Login(string uid, string pwd)
        {
            //加密密码
            pwd = Encryption(pwd);

            if (new Rule.AdministratorRule().TestInsert(uid))
            {
                return(new Administrator()
                {
                    AdminID = "", AdminName = "管理员名错误!"
                });
            }
            List <Administrator> admin = new List <Administrator>();

            admin = new DAL.AdministratorDAL().GetAdministrator(" and [Account]='" + uid + "' and [APassword]='" + pwd + "'");

            if (admin.Count != 1)
            {
                return(new Administrator()
                {
                    AdminID = "", AdminName = "密码错误!"
                });
            }
            else
            {
                return(admin[0]);
            }
        }
Пример #2
0
        //找回登录密码
        /// </summary>
        /// <param name="account">名字</param>
        /// <param name="question">保密问题</param>
        /// <returns>操作结果</returns>
        public Model.Administrator FindPassword(string account)
        {
            Administrator        admin = new Administrator();
            List <Administrator> adm   = new DAL.AdministratorDAL().GetAdministrator(" and Account ='" + account + "'");

            if (adm.Count == 0)
            {
                admin.AdminInfo = "账号不存在";
                return(admin);
            }
            if (new DAL.AdministratorDAL().UpdateAdministrator(new Administrator()
            {
                AdminID = adm[0].AdminID, APassword = Encryption("12345")
            }) > 0)
            {
                admin.AdminInfo = "密码重置成功";
                admin.State     = 1;
            }
            else
            {
                admin.AdminInfo = "密码重置失败!请重新输入";
            }
            return(adm[0]);
        }