Exemplo n.º 1
0
        /// <summary>
        /// 加载菜单 == 后期可以加入角色,可通过登录的角色加载菜单
        /// </summary>
        private void SetMenu()
        {
            StringBuilder sb = new StringBuilder();
            DataTable     dt = SystemSettingManager.GetFunctionList();

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Select("ParaentID='00000000-0000-0000-0000-000000000000'", "ParentSort ASC"))
                {
                    sb.AppendFormat("<li class=\"has-sub\">");
                    sb.AppendFormat("<a href=\"javascript:void(0);\">");
                    sb.AppendFormat("<i class=\"fa {0}\" style=\"margin-right:6px;\"></i>", string.IsNullOrEmpty(dr["Icon"].ToString()) == true ? "fa-folder-o" : dr["Icon"]);
                    sb.AppendFormat("<span class=\"title\">{0}</span>", dr["FunctionName"]);
                    sb.AppendFormat("<span class=\"fa fa-caret-left\" style=\"float:right;margin-top:3px;\"></span>");
                    sb.AppendFormat("</a>");
                    sb.AppendFormat("<ul class=\"sub\">");
                    foreach (DataRow _dr in dt.Select("ParaentID='" + dr["FunctionId"] + "'", "FunctionSort ASC"))
                    {
                        sb.AppendFormat("<li>");
                        sb.AppendFormat("<a href=\"{0}\">{1}</a>", string.IsNullOrEmpty(_dr["Url"].ToString()) == true ? "javascript:void(0)" : _dr["Url"], _dr["FunctionName"]);
                        sb.AppendFormat("</li>");
                    }
                    sb.AppendFormat("</ul></li>");
                }
            }
            ViewBag.MenuItems = sb.ToString();
        }
Exemplo n.º 2
0
 public ActionResult GetFunctionList()
 {
     try
     {
         DataTable dt = SystemSettingManager.GetFunctionList();
         if (dt.Rows.Count > 0)
         {
             //跳过dt的前10行,取后20行  即取得11-30行
             DataTable TakeTopList = dt.AsEnumerable().Skip((Convert.ToInt32(Request["page"]) - 1) * Convert.ToInt32(Request["limit"])).Take(Convert.ToInt32(Request["limit"])).CopyToDataTable <DataRow>();
             return(Json(new { total = dt.Rows.Count, rows = ConvertHelper <ModelGoodsCheck> .ConvertToModel(TakeTopList).ToList() }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(Json(new { total = dt.Rows.Count, rows = ConvertHelper <ModelGoodsCheck> .ConvertToModel(dt).ToList() }, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception)
     {
         return(Json(new { total = 0, rows = "" }, JsonRequestBehavior.AllowGet));
     }
 }