//
        // GET: /SystemManager/Manager_role/

        public ActionResult Index()
        {
            //获取所有的后台导航
            B_Navigation b_nav = new B_Navigation();
            List <Order> order = new List <Order>()
            {
                Order.Asc("sort_id")
            };

            List <Domain.Navigation> list = new List <Domain.Navigation>();
            var list_nav = b_nav.LoadAll(order, 0);

            foreach (var nav in list_nav)
            {
                list.Add(nav);
                //查询二级菜单
                var list_sub_nav = b_nav.LoadAll(order, nav.id);
                foreach (var sub_nav in list_sub_nav)
                {
                    list.Add(sub_nav);
                }
            }
            ViewBag.list_nav = list;
            return(View());
        }
Example #2
0
        public JsonResult GetNav(int id)
        {
            B_Navigation b_nav = new B_Navigation();
            var          model = b_nav.GetNav(id);

            return(Json(model));
        }
Example #3
0
        /// <summary>
        /// 后台导航下拉框
        /// </summary>
        /// <param name="helper"></param>
        /// <returns></returns>
        public static string select_nav(this HtmlHelper helper)
        {
            B_Navigation b_nav = new B_Navigation();
            //先查询出所有的一级菜单
            List <Order> order = new List <Order>()
            {
                Order.Asc("sort_id")
            };
            var           list_nav = b_nav.LoadAll(order, 0);
            StringBuilder sb       = new StringBuilder();

            sb.Append("<select id=\"txt_parent_id\" name=\"txt_parent_id\" class=\"selectpicker show-tick form-control\" data-live-search=\"true\">");
            sb.Append("<optgroup label=\"一级菜单\">");
            sb.Append("<option data-subtext=\"一级菜单\" selected = \"true\">0</option>");
            sb.Append("</optgroup>");
            foreach (var nav in list_nav)
            {
                sb.Append("<optgroup label=" + nav.title + ">");
                sb.Append("<option data-subtext=" + nav.title + ">" + nav.id + "</option>"); //一级菜单放第一个
                //查询二级菜单
                var list_sub_nav = b_nav.LoadAll(order, nav.id);
                foreach (var sub_nav in list_sub_nav)
                {
                    sb.Append("<option data-subtext=" + sub_nav.title + ">" + sub_nav.id + "</option>"); //二级菜单
                }
                sb.Append("</optgroup>");
            }
            sb.Append("</select>");
            return(sb.ToString());
        }
Example #4
0
        public JsonResult EditNav(int id, string txt_parent_id, string txt_icon_url, string txt_title, string txt_link_url, string txt_sort_id, string txt_is_lock, string txt_action_type)
        {
            Common.Json  json  = new Common.Json();
            B_Navigation b_nav = new B_Navigation();

            Domain.Navigation model = b_nav.GetNav(id);
            model.icon_url = txt_icon_url;
            model.title    = txt_title;
            model.link_url = txt_link_url;
            if (!string.IsNullOrEmpty(model.link_url) && model.link_url != "#")
            {
                model.controllerName = model.link_url.Substring(model.link_url.LastIndexOf("/") + 1);
            }
            else
            {
                model.controllerName = "";
            }
            model.sort_id     = Convert.ToInt32(txt_sort_id);
            model.is_lock     = txt_is_lock;
            model.parent_id   = Convert.ToInt32(txt_parent_id);
            model.action_type = txt_action_type;
            if (model.parent_id == 0)
            {
                model.channel_id = 1;
            }
            else
            {
                model.channel_id = 2;
            }
            b_nav.Update(model);
            json.msg = "修改成功!";
            return(Json(json));
        }
Example #5
0
        public JsonResult DelNav(string ids)
        {
            Common.Json  json  = new Common.Json();
            B_Navigation b_nav = new B_Navigation();

            foreach (var id in ids.Split(new char[] { ',' }))
            {
                b_nav.Delete(Convert.ToInt32(id));
            }
            json.msg = "成功删除" + ids.Split(new char[] { ',' }).Length + "条记录!";
            return(Json(json));
        }
Example #6
0
        public JsonResult GetNavList(int limit = 10, int offset = 1)
        {
            B_Navigation b_nav = new B_Navigation();
            List <Order> order = new List <Order>()
            {
                Order.Asc("sort_id")
            };

            List <Domain.Navigation> list = new List <Domain.Navigation>();
            List <SearchTemplate>    st   = new List <SearchTemplate>()
            {
                new SearchTemplate()
                {
                    key = "parent_id", value = 0, searchType = Common.EnumBase.SearchType.Eq
                },
                new SearchTemplate()
                {
                    key = "", value = new int[] { offset, limit }, searchType = Common.EnumBase.SearchType.Paging
                }
            };
            var list_nav      = b_nav.GetList(st, order);
            var list_nav_cout = b_nav.GetCount(st);

            foreach (var nav in list_nav)
            {
                list.Add(nav);
                st = new List <SearchTemplate>()
                {
                    new SearchTemplate()
                    {
                        key = "parent_id", value = nav.id, searchType = Common.EnumBase.SearchType.Eq
                    }
                };
                //查询二级菜单
                var list_sub_nav = b_nav.GetList(st, order);
                foreach (var sub_nav in list_sub_nav)
                {
                    list.Add(sub_nav);
                }
            }
            return(Json(new { total = list_nav_cout, rows = list }, JsonRequestBehavior.AllowGet));
        }
Example #7
0
        public JsonResult GetNavSubList(string index, string parent_id, int limit = 10, int offset = 1)
        {
            B_Navigation b_nav = new B_Navigation();
            List <Order> order = new List <Order>()
            {
                Order.Asc("sort_id")
            };
            List <SearchTemplate> st = new List <SearchTemplate>()
            {
                new SearchTemplate()
                {
                    key = "parent_id", value = Convert.ToInt32(parent_id), searchType = Common.EnumBase.SearchType.Eq
                },
                new SearchTemplate()
                {
                    key = "", value = new int[] { offset, limit }, searchType = Common.EnumBase.SearchType.Paging
                }
            };
            var list_nav = b_nav.GetList(st, order);

            return(Json(list_nav, JsonRequestBehavior.AllowGet));
        }
Example #8
0
        public JsonResult AddNav(string txt_parent_id, string txt_icon_url, string txt_title, string txt_link_url, string txt_sort_id, string txt_is_lock, string txt_action_type)
        {
            Common.Json  json  = new Common.Json();
            B_Navigation b_nav = new B_Navigation();

            Domain.Navigation model = new Domain.Navigation();

            model.icon_url = txt_icon_url;
            model.title    = txt_title;
            model.link_url = txt_link_url;
            if (!string.IsNullOrEmpty(model.link_url) && model.link_url != "#")
            {
                model.controllerName = model.link_url.Substring(model.link_url.LastIndexOf("/") + 1);
            }
            model.sort_id     = Convert.ToInt32(txt_sort_id);
            model.is_lock     = txt_is_lock;
            model.parent_id   = Convert.ToInt32(txt_parent_id);
            model.action_type = txt_action_type;
            if (model.parent_id == 0)
            {
                model.channel_id = 1;
            }
            else
            {
                model.channel_id = 2;
            }
            var res = b_nav.Save(model);

            if (res <= 0)
            {
                json.status = -1;
                json.msg    = "添加失败!";
                return(Json(json));
            }
            json.msg = "添加成功!";

            return(Json(json));
        }
Example #9
0
        public static string Menu(this HtmlHelper helper, int role_id)
        {
            B_Navigation b_nav = new B_Navigation();
            //先查询出所有的一级菜单
            List <Order> order = new List <Order>()
            {
                Order.Asc("sort_id")
            };
            var                  list_nav = b_nav.LoadAll(order, 0);
            StringBuilder        sb       = new StringBuilder();
            B_Manager_role_value b_mrv    = new B_Manager_role_value();

            foreach (var nav in list_nav)
            {
                List <SearchTemplate> st = new List <SearchTemplate>()
                {
                    new SearchTemplate()
                    {
                        key = "role_id", value = role_id, searchType = Common.EnumBase.SearchType.Eq
                    },
                    new SearchTemplate()
                    {
                        key = "nav_id", value = nav.id, searchType = Common.EnumBase.SearchType.Eq
                    }
                };
                IList <Domain.Manager_role_value> list = b_mrv.GetList(st, null);
                if (list.Count == 0)
                {
                    continue;
                }
                if (!list[0].action_type.Contains("查看"))
                {
                    continue;
                }
                sb.Append("<li>");
                sb.Append("<a href=\"" + nav.link_url + "\">");
                sb.Append(nav.icon_url);
                sb.Append("<span class=\"nav-label\">" + nav.title + "</span>");
                sb.Append("<span class=\"fa arrow\"></span>");
                sb.Append("</a>");
                sb.Append("<ul class=\"nav nav-second-level\">");
                //查询二级菜单
                st = new List <SearchTemplate>()
                {
                    new SearchTemplate()
                    {
                        key = "parent_id", value = nav.id, searchType = Common.EnumBase.SearchType.Eq
                    }
                };
                var list_sub_nav = b_nav.GetList(st, order);
                foreach (var sub_nav in list_sub_nav)
                {
                    st = new List <SearchTemplate>()
                    {
                        new SearchTemplate()
                        {
                            key = "role_id", value = role_id, searchType = Common.EnumBase.SearchType.Eq
                        },
                        new SearchTemplate()
                        {
                            key = "nav_id", value = sub_nav.id, searchType = Common.EnumBase.SearchType.Eq
                        }
                    };
                    list = b_mrv.GetList(st, null);
                    if (list.Count == 0)
                    {
                        continue;
                    }
                    if (!list[0].action_type.Contains("查看"))
                    {
                        continue;
                    }
                    sb.Append("<li>");
                    sb.Append("<a class=\"J_menuItem\" href=" + sub_nav.link_url + " data-index=" + sub_nav.sort_id + ">" + sub_nav.icon_url + "</i>" + sub_nav.title + "</a>");
                    sb.Append("</li>");
                }
                sb.Append("</ul>");
                sb.Append("</li>");
            }
            return(sb.ToString());
        }
Example #10
0
        public static string select_auth(this HtmlHelper helper, string manager_id, string controllerName)
        {
            B_Navigation          b_nav = new B_Navigation();
            List <SearchTemplate> st    = new List <SearchTemplate>()
            {
                new SearchTemplate()
                {
                    key = "controllerName", value = controllerName, searchType = Common.EnumBase.SearchType.Eq
                }
            };
            var list_nav = b_nav.GetList(st, null);
            int nav_id   = 0;

            if (list_nav.Count > 0)
            {
                nav_id = list_nav[0].id;
            }
            B_Manager_role_value b_mrv     = new B_Manager_role_value();
            B_Manager            b_manager = new B_Manager();
            var m_manager = b_manager.Get(Convert.ToInt32(manager_id));

            st = new List <SearchTemplate>()
            {
                new SearchTemplate()
                {
                    key = "role_id", value = m_manager.manager_role.id, searchType = Common.EnumBase.SearchType.Eq
                },
                new SearchTemplate()
                {
                    key = "nav_id", value = nav_id, searchType = Common.EnumBase.SearchType.Eq
                }
            };
            var list_mrv = b_mrv.GetList(st, null);

            if (list_mrv.Count == 0)
            {
                return("");
            }
            StringBuilder sb = new StringBuilder();

            sb.Append("<div id=\"toolbar\" class=\"btn-group\">");
            if (list_mrv[0].action_type.Contains(EnumBase.Authorize.添加.Description()))
            {
                sb.Append("<button id=\"btn_add\" type=\"button\" class=\"btn btn-blue\">");
                sb.Append("<span class=\"glyphicon glyphicon-plus\" aria-hidden=\"true\"></span>" + EnumBase.Authorize.添加.Description());
                sb.Append("</button>");
            }
            if (list_mrv[0].action_type.Contains(EnumBase.Authorize.修改.Description()))
            {
                sb.Append("<button id=\"btn_edit\" type=\"button\" class=\"btn btn-warning\">");
                sb.Append("<span class=\"glyphicon glyphicon-pencil\" aria-hidden=\"true\"></span>" + EnumBase.Authorize.修改.Description());
                sb.Append("</button>");
            }
            if (list_mrv[0].action_type.Contains(EnumBase.Authorize.除.Description()))
            {
                sb.Append("<button id=\"btn_delete\" type=\"button\" class=\"btn btn-danger\">");
                sb.Append("<span class=\"glyphicon glyphicon-remove\" aria-hidden=\"true\"></span>" + EnumBase.Authorize.除.Description());
                sb.Append("</button>");
            }
            if (list_mrv[0].action_type.Contains(EnumBase.Authorize.审核.Description()))
            {
                sb.Append("<button id=\"btn_exam\" type=\"button\" class=\"btn btn-info\">");
                sb.Append("<span class=\"glyphicon glyphicon-check\" aria-hidden=\"true\"></span>" + EnumBase.Authorize.审核.Description());
                sb.Append("</button>");
            }
            if (list_mrv[0].action_type.Contains(EnumBase.Authorize.载.Description()))
            {
                sb.Append("<button id=\"btn_download\" type=\"button\" class=\"btn btn-success\">");
                sb.Append("<span class=\"fa fa-cloud-download\" aria-hidden=\"true\"></span>" + EnumBase.Authorize.载.Description());
                sb.Append("</button>");
            }
            sb.Append("</div>");
            return(sb.ToString());
        }