示例#1
0
        private string GetMenuListForMain(HttpContext context)
        {
            if (context.User != null)
            {
                SysMenuBLL     bll  = new SysMenuBLL();
                List <SysMenu> list = bll.GetList("");
                return(JsonConvert.SerializeObject(list));
            }

            return(JsonConvert.SerializeObject(new { }));
        }
示例#2
0
        private string GetList(HttpContext context)
        {
            int    pageIndex = ObjectConvertHelper.ConvertToInt(context.Request["page"]);
            int    pageSize  = ObjectConvertHelper.ConvertToInt(context.Request["limit"]);
            string name      = ObjectConvertHelper.ConvertToString(context.Request["txtName"]);

            string strWhere = "";

            if (!string.IsNullOrEmpty(name))
            {
                strWhere += " and Name like '%" + name + "%' ";
            }
            if (context.User != null)
            {
                SysMenuBLL     bll   = new SysMenuBLL();
                List <SysMenu> list  = bll.GetList(strWhere, pageIndex, pageSize);
                int            count = bll.GetCount(strWhere);
                return(JsonConvert.SerializeObject(new
                {
                    code = "0",
                    msg = "",
                    count = count,
                    data = list
                }));
            }
            else
            {
                return(JsonConvert.SerializeObject(new
                {
                    code = "0",
                    msg = "",
                    count = 0,
                    data = ""
                }));
            }
        }