예제 #1
0
        // [ValidateAntiForgeryToken]
        public ContentResult Login(User model, string returnUrl)
        {
            string userName = model.UserName;
            string userPass = model.UserPass;

            //bool rememberMe = model.RememberMe;
            HXD.MS.Entity.User user = userBll.GetUserByUserName(userName);
            if (user != null)
            {
                //用户存在,比较密码
                if (user.UserPass.Equals(EncryptHelper.EncryptWithMD5(userPass)))
                {
                    if (!user.Enable)
                    {
                        //CookieHelper.Set("UserName", user.UserName);
                        //CookieHelper.Set("UserPass", user.UserPass);
                        return(Content(AjaxMsgHelper.AjaxMsg(CodeType.UserLoginError, "账号已禁用")));
                    }
                    SessionHelper.Set("User", user);

                    //记录日志
                    LogHelper.Info(this.GetType(), string.Format("{0}登录成功", user.UserName));
                }
                else
                {
                    return(Content(AjaxMsgHelper.AjaxMsg(CodeType.UserLoginError, "用户名或密码错误")));
                }
            }
            else
            {
                return(Content(AjaxMsgHelper.AjaxMsg(CodeType.UserLoginError, "用户名或密码错误")));
            }
            return(Content(AjaxMsgHelper.AjaxMsg()));
        }
예제 #2
0
 public ActionResult UserEdit(User model)
 {
     HXD.MS.Entity.User user = sessionManager.SessionObject;
     model.Creater = user.UserName;
     if (!userService.Update(model))
     {
         return(Content(AjaxMsgHelper.AjaxMsg(CodeType.Error, "更新失败")));
     }
     return(Content(AjaxMsgHelper.AjaxMsg()));
 }
예제 #3
0
 public ActionResult Login(string returnUrl)
 {
     HXD.MS.Entity.User user = sessionManager.SessionObject;
     if (user != null)
     {
         return(RedirectToAction("Index", "Home"));
     }
     ViewBag.ReturnUrl = returnUrl;
     return(View());
 }
예제 #4
0
 public ContentResult IconAdd(Icon model)
 {
     HXD.MS.Entity.User user = sessionManager.SessionObject;
     model.Creater = user.UserName;
     if (!(iconService.Add(model) > 0))
     {
         return(Content(AjaxMsgHelper.AjaxMsg(CodeType.Error, "新增失败")));
     }
     return(Content(AjaxMsgHelper.AjaxMsg()));
 }
예제 #5
0
 public ContentResult MenuEdit(Menu model)
 {
     HXD.MS.Entity.User user = sessionManager.SessionObject;
     model.Creater = user.UserName;
     if (!menuBll.Update(model))
     {
         return(Content(AjaxMsgHelper.AjaxMsg(CodeType.Error, "更新失败")));
     }
     return(Content(AjaxMsgHelper.AjaxMsg()));
 }
예제 #6
0
 public ContentResult MenuAdd(Menu model)
 {
     HXD.MS.Entity.User user = sessionManager.SessionObject;
     model.Creater = user.UserName;
     if (!(menuBll.Add(model) > 0))
     {
         return(Content(AjaxMsgHelper.AjaxMsg(CodeType.Error, "新增失败")));
     }
     return(Content(AjaxMsgHelper.AjaxMsg()));
 }
예제 #7
0
        public ActionResult UserAdd(User model)
        {
            HXD.MS.Entity.User user = sessionManager.SessionObject;
            model.Creater  = user.UserName;
            model.UserPass = EncryptHelper.EncryptWithMD5(PubConstant.DefaultUserPass);
            int r = userService.Add(model);

            if (r < 0)
            {
                return(Content(AjaxMsgHelper.AjaxMsg(CodeType.Error, "用户已经存在")));
            }
            return(Content(AjaxMsgHelper.AjaxMsg()));
        }
예제 #8
0
 public ContentResult GetMenuButton(string menuCode)
 {
     HXD.MS.Entity.User user = sessionManager.SessionObject;
     return(Content(buttonService.GetButtonByUserId(user.Id, menuCode)));
 }