Beispiel #1
0
        /// <summary>
        /// 教师、学生登录检查
        /// </summary>
        /// <returns></returns>
        public ActionResult CheckStLoginInfo()
        {
            string account    = Request["account"];
            string password   = Request["password"];
            string clientRole = Request["role"];
            string realRole;
            bool   whetherLegal = new UserLogin_bll().LoginYes(account, password, out realRole);

            if (whetherLegal && clientRole == realRole)
            {
                Session["Account"] = account;
                Session["Role"]    = realRole;
                DbOperation.SetXmlPath(AppDomain.CurrentDomain.BaseDirectory + "TableMappingObj.xml");
                if (realRole.Equals("教师"))
                {
                    Teacher teacher  = (Teacher)DbOperation.QueryById(typeof(Teacher), account, "teacher");
                    string  identity = teacher.specialIdentity.IsEmpty() ? "教师" : teacher.specialIdentity;
                    Session["Identity"] = identity;
                }
                return(Json(new { tip = "成功登录", role = realRole, errorcode = "0" }));
            }
            else
            {
                return(Json(new { tip = "帐号不存在或密码错误", errorcode = "1" }));
            }
        }
Beispiel #2
0
        public ActionResult SystemAdminMakeLogin()
        {
            string Account  = Request["Account"];
            string Password = Request["Password"];

            UserLogin_bll user  = new UserLogin_bll();
            bool          login = user.LoginYes(Account, Password);

            if (login)
            {
                return(Content("1"));
            }
            else
            {
                return(Content("0"));
            }
        }
Beispiel #3
0
        /// <summary>
        /// 管理员登录检查
        /// </summary>
        /// <returns></returns>
        public ActionResult SystemAdminMakeLogin()
        {
            string Account  = Request["Account"];
            string Password = Request["Password"];
            string roles;

            UserLogin_bll user  = new UserLogin_bll();
            bool          login = user.LoginYes(Account, Password, out roles);

            if (login && roles == "管理员")
            {
                Session["Account"] = Account;
                Session["Role"]    = roles;
                DbOperation.SetXmlPath(AppDomain.CurrentDomain.BaseDirectory + "TableMappingObj.xml");
                return(Content("1"));
            }
            else
            {
                return(Content("0"));
            }
        }
        public ActionResult SystemAdminMakeLogin()
        {
            //创建session对象
            Session["Account"] = null;
            Session["role"]    = null;

            //接受登陆信息
            string Account  = Request["Account"];
            string Password = Request["Password"];

            UserLogin_bll user  = new UserLogin_bll();
            bool          login = user.LoginYes(Account, Password);

            if (login)
            {
                Session["Account"] = Account;
                Session["role"]    = "1";
                return(Content("1"));
            }
            else
            {
                return(Content("0"));
            }
        }