public ActionResult Index(LogOnModel model)
        {
            #region 验证码验证

            if (Session["__VCode"] == null || (Session["__VCode"] != null && model.ValidateCode != Session["__VCode"].ToString()))
            {
                ModelState.AddModelError("PersonName", "验证码错误!"); //return "";
                return(View());
            }
            #endregion

            if (ModelState.IsValid)
            {
                string accountId = AccountBLL.ValidateUser(model.PersonName, model.Password);
                if (!string.IsNullOrWhiteSpace(accountId))
                {//登录成功
                    Account account = new Account();
                    account.PersonName = model.PersonName;
                    account.Id         = accountId;
                    Session["account"] = account;

                    LoginUserManage.Add(Session.SessionID, account.PersonName);

                    return(RedirectToAction("Index", "Home"));
                }
            }

            ModelState.AddModelError("PersonName", "用户名或者密码出错。");
            return(View());
        }
        public JsonResult Login(string UserName, string Password, string Code)
        {
            //if(Session["Code"]==null)
            //    return Json(JsonHandler.CreateMessage(0, "请重新刷新验证码"), JsonRequestBehavior.AllowGet);

            //if (Session["Code"].ToString().ToLower() != Code.ToLower())
            //    return Json(JsonHandler.CreateMessage(0, "验证码错误"), JsonRequestBehavior.AllowGet);
            SysUser user = accountBLL.Login(UserName, ValueConvert.MD5(Password));

            if (user == null)
            {
                LogHandler.WriteServiceLog(UserName, ResultHelper.NowTime + "登录系统,IP:" + ResultHelper.GetUserIP() + "账户或密码错误", "失败", "登录", "系统入口");
                return(Json(JsonHandler.CreateMessage(0, "用户名或密码错误"), JsonRequestBehavior.AllowGet));
            }
            else if (!Convert.ToBoolean(user.State))//被禁用
            {
                return(Json(JsonHandler.CreateMessage(0, "账户被系统禁用"), JsonRequestBehavior.AllowGet));
            }

            AccountModel account = new AccountModel();

            account.Id         = user.Id;
            account.TrueName   = user.TrueName;
            account.Photo      = string.IsNullOrEmpty(user.Photo)?"/Images/Photo.jpg":user.Photo;
            account.UserName   = user.UserName;
            Session["Account"] = account;
            GetThemes(user.Id);

            LoginUserManage.Add(Session.SessionID, account.Id);

            //在线用户统计
            //OnlineHttpModule.ProcessRequest();
            LogHandler.WriteServiceLog(UserName, ResultHelper.NowTime + "登录系统,IP:" + ResultHelper.GetUserIP(), "成功", "登录", "系统入口");
            return(Json(JsonHandler.CreateMessage(1, ""), JsonRequestBehavior.AllowGet));
        }