Exemplo n.º 1
0
 public ActionResult Login(Account account)
 {
     //if (Session["ValidateCode"].ToString() != account.VerifyCode)
     //{
     //    ModelState.AddModelError("VerifyCode", "validate code is error");
     //    return View();
     //}
     if (!ModelState.IsValid)
     {
         return(View());
     }
     if (string.IsNullOrWhiteSpace(account.Name))
     {
         ModelState.AddModelError("Name", "消息:用户名不能为空!");
         return(View());
     }
     if (string.IsNullOrWhiteSpace(account.Password))
     {
         ModelState.AddModelError("Name", "消息:密码不能为空!");
         return(View());
     }
     MemoryCacheHelper.RemoveCacheAll();
     if (!LCLPrincipal.Login(account.Name, account.Password))
     {
         ModelState.AddModelError("Name", "消息:用户或密码错误,请重新输入!");
         return(View());
     }
     else
     {
         return(RedirectIndex());
     }
 }
Exemplo n.º 2
0
        public JsonResult AjaxLogin(string name, string password)
        {
            var result = new Result(false);

            if (string.IsNullOrWhiteSpace(name))
            {
                result.Message = "消息:用户名不能为空!";
            }
            if (string.IsNullOrWhiteSpace(password))
            {
                result.Message = "消息:密码不能为空!";
            }
            MemoryCacheHelper.RemoveCacheAll();
            if (!RbacPrincipal.Login(name, password))
            {
                result.Message = "消息:用户或密码错误,请重新输入!!";
            }
            else
            {
                result = new Result(true);
                var identity = LEnvironment.Principal as MyFormsPrincipal <MyUserDataPrincipal>;
                if (identity != null)
                {
                    //if (identity.DepUserType == 2)
                    //{
                    //    result.Message = "../../" + LCL.MvcExtensions.PageFlowService.PageNodes.FindPageNode("LayoutHome1").Value;
                    //}
                    //else
                    //{
                    result.Message = "../../" + LCL.MvcExtensions.PageFlowService.PageNodes.FindPageNode("LayoutHome").Value;
                    // }
                }
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
 public void Execute(object state)
 {
     Logger.LogInfo("" + DateTime.Now + "正在执行事件:定时清理缓存");
     try
     {
         MemoryCacheHelper.RemoveCacheAll();
         DbFactory.DBA.ExecuteText("DELETE TLog WHERE AddDate < '" + DateTime.Now.AddDays(-5).ToString("yyyy-MM-dd") + "'");
     }
     catch (Exception ex)
     {
         Logger.LogError("ClearCatchEvent", ex);
     }
 }
Exemplo n.º 4
0
 public void RemoveCacheAll()
 {
     MemoryCacheHelper.RemoveCacheAll();
 }