Example #1
0
        public static string getBreadcrumb(string url)
        {
            string breadcrumbHtml   = "";
            List <SYS_FUNCTION> lst = (List <SYS_FUNCTION>)HttpContext.Current.Session["functions"];
            //使用list 物件查詢功能
            SYS_FUNCTION curFunction = lst.Find(x => x.FUNCTION_URI.Contains(url));

            log.Info("cur url=" + curFunction);
            if (null != curFunction && curFunction.ISMENU == "Y")
            {
                //未來有樹狀較完整後再調整
                //string[] breadcrumb = url.Split('/');
                // for (int i = 1; i < breadcrumb.Length; i++)
                // {
                //breadcrumbHtml = breadcrumbHtml + "<li class='breadcrumb-item'><a href='"+ curFunction.FUNCTION_URI + "'>"+ curFunction.FUNCTION_NAME+ "</a></li>";
                // }
                breadcrumbHtml = breadcrumbHtml + "<li class='breadcrumb-item'><a href='#'>" + curFunction.MODULE_NAME + "</a></li>";
                breadcrumbHtml = breadcrumbHtml + "<li class='breadcrumb-item'><a href='" + curFunction.FUNCTION_URI + "'>" + curFunction.FUNCTION_NAME + "</a></li>";
                HttpContext.Current.Session["sitepath"] = breadcrumbHtml;
            }
            else
            {
                breadcrumbHtml = (string)HttpContext.Current.Session["sitepath"];
            }
            return(breadcrumbHtml);
        }
        public ActionResult FuncDel(int id)
        {
            SysFunctionBll bll   = new SysFunctionBll();
            SYS_FUNCTION   model = bll.Query(t => t.FN_ID == id).FirstOrDefault();

            if (model != null)
            {
                bll.Delete(model, true);
            }
            return(Json(BaseModels.OK("成功!")));
        }
        /// <summary>
        /// 菜单
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public ActionResult FuncEdit(int?Id)
        {
            SysFunctionBll bll   = new SysFunctionBll();
            SYS_FUNCTION   model = new SYS_FUNCTION();

            ViewBag.Parent = bll.Query(t => t.FN_PARENT_ID == -1).ToDictionary(t => t.FN_ID, t => t.FN_NAME);

            if (Id.ToInt() > 0)
            {
                model = bll.Query(t => t.FN_ID == Id).FirstOrDefault();
            }

            return(View(model));
        }
        public ActionResult FuncEdit(SYS_FUNCTION model)
        {
            SysFunctionBll bll = new SysFunctionBll();

            ViewBag.Parent = bll.Query(t => t.FN_PARENT_ID == -1).ToDictionary(t => t.FN_ID, t => t.FN_NAME);

            model.FN_IS_LEAF = 0;
            if (model.FN_ID > 0)
            {
                bll.Update(model);
            }
            else
            {
                bll.Add(model);
            }

            ViewBag.Success = true;
            ViewBag.Message = "修改成功!";

            return(View(model));
        }