示例#1
0
        public ActionResult GetEmpMenu()
        {
            string strJson = string.Empty;

            try
            {
                if (!WebCookieHelper.EmployeeCheckLogin())
                {
                    return(RedirectToAction("Admin/Account/Login"));
                }

                int nEmpID = WebCookieHelper.GetEmployeeId();

                var menus = MenuServices.GetMenuByEmpID(nEmpID);


                if (menus.ToList().Count > 0)
                {
                    strJson = JsonHelper.GetMenuJson(menus, 0);
                    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\"}]}]";
            }
            catch (Exception ex)
            {
                throw;
            }
            return(Content(strJson));
        }