Пример #1
0
        public ActionResult ChangePwd()
        {
            string szPwdOld     = Request.Form["pwdold"] != "" ? Request.Form["pwdold"] : "";
            string szPwdNew     = Request.Form["pwdnew"] != "" ? Request.Form["pwdnew"] : "";
            string szPwdConfirm = Request.Form["pwdconfirm"] != "" ? Request.Form["pwdconfirm"] : "";
            int    id           = WebCookieHelper.GetSysUserId();
            var    curUser      = SysUserDao.Instance.QueryOne(id);
            string writeMsg     = "更改失败!";

            if (curUser == null)
            {
                writeMsg = "用户登录状态过期,请重新登录!";
                return(Content(writeMsg));
            }
            if (curUser.Password != Utility.MD5Helper.MD5(szPwdOld))
            {
                writeMsg = "原始密码错误,无法更改密码!";
            }
            else
            {
                curUser.Password = Utility.MD5Helper.MD5(szPwdNew);
                bool result = SysUserDao.Instance.ChangePassword(curUser);
                if (result)
                {
                    writeMsg = "更改成功!";
                }
                else
                {
                    writeMsg = "更改失败!";
                }
            }
            return(Content(writeMsg));
        }
Пример #2
0
        public ActionResult GetMenus()
        {
            int    parentid = int.Parse(Request.Form["parentid"].ToString());
            int    userid   = WebCookieHelper.GetSysUserId();
            string strJson  = string.Empty;

            var menus = new List <SysMenu>();

            if (parentid != 0)
            {
                menus = SysMenuDao.Instance.GetChildNodes(parentid, userid);
            }
            else
            {
                menus = SysMenuDao.Instance.GetSysMenus(null).ToList();
            }
            if (menus.ToList().Count > 0)
            {
                strJson = JsonHelper.GetMenuJson(menus, parentid);
                strJson = "{" + strJson + "}";
            }
            else
            {
                strJson = "\"menus\":[]";
            }
            //string strJson = "[{\"id\":\"1\",\"text\":\"hello1\",\"checked\":\"true\",\"state\":\"open\",\"children\":[{\"id\":\"2\",\"text\":\"hello2\",\"state\":\"open\"}]},{\"id\":\"1\",\"text\":\"hello1\",\"state\":\"open\",\"children\":[{\"id\":\"2\",\"text\":\"hello2\",\"state\":\"open\"}]}]";

            return(Content(strJson));
        }
Пример #3
0
        //
        // GET: /Operation/Home/

        public ActionResult Index()
        {
            int id = WebCookieHelper.GetSysUserId();

            if (id == 0)
            {
                return(Redirect("/login.html"));
            }
            string url     = Request.Url.AbsolutePath.ToString();
            var    systems = SysMenuDao.Instance.GetSysMenus(null).Where(m => m.MenuType == "系统").ToList();

            ViewBag.sysmenu = systems.Where(m => m.Url == url).FirstOrDefault();
            ViewBag.systems = systems;
            ViewBag.name    = WebCookieHelper.GetSysUserInfo(1);
            return(View());
        }