예제 #1
0
        public ActionResult Left()
        {
            pbs_sys_MenuService mesMenuService = new pbs_sys_MenuService();
            pbs_sys_users       userDate       = (pbs_sys_users)Session["USER"];
            MenuModels          models         = new MenuModels();

            models.ParentItemList = new List <ParentItem>();
            if (userDate != null && !string.IsNullOrEmpty(userDate.role.ToString()))
            {
                ResultInfo <DataTable> resultPm = mesMenuService.GetThisTreeNodeMenu("#", userDate.role.ToString());
                if (resultPm.Result && resultPm.Data != null)
                {
                    foreach (DataRow prow in resultPm.Data.Rows) //得到行集合
                    {
                        ParentItem pi = new ParentItem();
                        pi.NodeId      = prow[0].ToString();
                        pi.NodeName    = prow[1].ToString();
                        pi.NodeGroup   = prow[2].ToString();
                        pi.ParentId    = prow[3].ToString();
                        pi.NodeUrl     = prow[4].ToString();
                        pi.BrotherList = new List <BrotherItem>();
                        ResultInfo <DataTable> resultBm = mesMenuService.GetThisTreeNodeMenu(pi.NodeId,
                                                                                             userDate.role.ToString());
                        if (resultBm.Result && resultBm.Data != null)
                        {
                            foreach (DataRow brow in resultBm.Data.Rows)
                            {
                                BrotherItem bi = new BrotherItem();
                                bi.NodeId       = brow[0].ToString();
                                bi.NodeName     = brow[1].ToString();
                                bi.NodeGroup    = brow[2].ToString();
                                bi.ParentId     = brow[3].ToString();
                                bi.NodeUrl      = brow[4].ToString();
                                bi.ChildrenList = new List <ChildrenItem>();
                                ResultInfo <DataTable> resultCm = mesMenuService.GetThisTreeNodeMenu(bi.NodeId,
                                                                                                     userDate.role.ToString());
                                if (resultCm.Result && resultCm.Data != null)
                                {
                                    foreach (DataRow crow in resultCm.Data.Rows)
                                    {
                                        ChildrenItem ci = new ChildrenItem();
                                        ci.NodeId    = crow[0].ToString();
                                        ci.NodeName  = crow[1].ToString();
                                        ci.NodeGroup = crow[2].ToString();
                                        ci.ParentId  = crow[3].ToString();
                                        ci.NodeUrl   = crow[4].ToString();
                                        bi.ChildrenList.Add(ci);
                                    }
                                }
                                pi.BrotherList.Add(bi);
                            }
                        }

                        models.ParentItemList.Add(pi);
                    }
                }
            }

            return(View(models));
        }
예제 #2
0
        /// <summary>
        /// 加载子菜单
        /// </summary>
        /// <param name="dicMenus">所有可访问菜单</param>
        /// <param name="menuModel">菜单</param>
        /// <param name="pid">父节点ID</param>
        private void LoadMenuByPid(Dictionary <int, BF_MENU.Entity> dicMenus, MenuModels menuModel, int pid)
        {
            var list = dicMenus.Where(p => p.Value.PID == pid && p.Value.IS_ENABLE == 1 && p.Value.IS_SHOW_NAV == 1).OrderBy(o => o.Value.ORDER_NUM);

            if (list.Count() > 0)
            {
                menuModel.children = new List <MenuModels>();

                foreach (var kvp in list)
                {
                    MenuModels model = new MenuModels();
                    model.id    = kvp.Key;
                    model.pid   = pid;
                    model.title = kvp.Value.NAME;
                    model.font  = string.IsNullOrWhiteSpace(kvp.Value.FONT) ? "layui-icon" : kvp.Value.FONT;
                    model.icon  = string.IsNullOrWhiteSpace(kvp.Value.ICON) ? "layui-icon-wenzhang3" : kvp.Value.ICON;
                    if (string.IsNullOrEmpty(kvp.Value.URL))
                    {
                        model.url = string.Empty;
                    }
                    else
                    {
                        model.url = ApplicationPath + kvp.Value.URL.ToLower();
                    }

                    menuModel.children.Add(model);

                    //递归,加载子菜单
                    LoadMenuByPid(dicMenus, model, model.id);
                }
            }
        }
예제 #3
0
        /// <summary>
        /// 初始化树 默认找出顶级菜单
        /// add by lpl
        /// 2019-1-2
        /// </summary>
        /// <returns></returns>
        public List <MenuModels> InitTree()
        {
            var user = CurrentUser.CrmUser;
            //根据权限加载用户树
            bool isAdmin  = new CrmUserMenuBll().GetAuthorizationByUserId("System", "Admin", user.Id);
            var  TreeList = new ComMenuBll().GetAllMenu(new ComMenuEntity()
            {
                IsMenu = 1
            }, isAdmin);
            List <MenuModels> rootNode = new List <MenuModels>();

            foreach (var plist in TreeList.Where(t => t.ParentMenuId == "00001"))
            {
                MenuModels jt = new MenuModels();
                jt.id         = plist.Id;
                jt.text       = plist.MenuName;
                jt.parentid   = plist.ParentMenuId;
                jt.icon       = "";
                jt.url        = plist.MenuUrl;
                jt.attributes = CreateUrl(TreeList, jt);
                jt.menus      = CreateChildTree(TreeList, jt);
                rootNode.Add(jt);
            }
            return(rootNode);
        }
예제 #4
0
        /// <summary>
        /// 初始化树 默认找出顶级菜单
        /// </summary>
        /// <returns></returns>
        public List <MenuModels> InitTree()
        {
            db_BFSEntities ent = new db_BFSEntities();
            //var TreeList = ent.SysMenu.ToList();

            string username = System.Web.HttpContext.Current.Session["username"].ToString();
            var    TreeList = (from p in ent.tAdmin
                               where p.Name == username
                               join urole in ent.tSmartRole on p.AdminID equals urole.AdminID
                               join r in ent.tRole on urole.RoleID equals r.RoleID
                               join rm in ent.tRoleMenu on r.RoleID equals rm.RoleID
                               join m in ent.tSysMenu on rm.MenuID equals m.MenuID orderby m.Menusort
                               select m).ToList();
            List <MenuModels> rootNode = new List <MenuModels>();

            foreach (var plist in TreeList.Where(t => t.MenuURL == "#"))
            {
                MenuModels jt = new MenuModels();
                jt.MenuID     = plist.MenuID;
                jt.MenuName   = plist.MenuName;
                jt.MenuPartNo = Convert.ToInt32(plist.MenuPartNo);
                jt.MenuURL    = plist.MenuURL;
                jt.MenuIcon   = plist.MenuIcon.Trim();
                jt.attributes = CreateUrl(TreeList, jt);
                jt.menus      = CreateChildTree(TreeList, jt);
                rootNode.Add(jt);
            }
            return(rootNode);
        }
예제 #5
0
        /// <summary>
        /// 获取菜单列表
        /// </summary>
        /// <returns></returns>
        public string GetMenus()
        {
            int userID = SystemSession.UserID;

            if (userID < 0)
            {
                return(ToJsonString(null, 0, 1, "未登录"));
            }

            List <MenuModels> list = new List <MenuModels>();

            try
            {
                //从SESSION里面读取
                Dictionary <int, BF_MENU.Entity> dic = SystemSession.UserMenus;
                //从数据库里面查询最新(开发期间开启)
#if DEBUG
                dic = BF_USER.Instance.GetMenusByUserID(userID);
#endif
                MenuModels menuModel = new MenuModels();
                menuModel.id    = 0;
                menuModel.pid   = 0;
                menuModel.title = "";
                menuModel.url   = string.Empty;
                LoadMenuByPid(dic, menuModel, menuModel.id);
                list.Add(menuModel);
                return(ToJsonString(list, list.Count));
            }
            catch (Exception ex)
            {
                return(ToJsonString(null, 0, 1, "获致菜单出错:" + ex.Message));
            }
        }
예제 #6
0
        /// <summary>
        /// Delete menu by Id
        /// </summary>
        /// <param name="Id"></param>
        public void DeleteMenuById(int Id)
        {
            var model = new MenuModels();
            var _conn = new SqlConnection(ConfigurationManager.ConnectionStrings["InfoWebAppDbStr"].ConnectionString);

            if (_conn.State == ConnectionState.Closed)
            {
                _conn.Open();
            }
            //Create command store procedure
            var command = new SqlCommand("DeleteMenuById");

            command.Connection  = _conn;
            command.CommandType = CommandType.StoredProcedure;
            try
            {
                var IdParam = new SqlParameter("@Id", Id);
                IdParam.Direction = ParameterDirection.Input;
                command.Parameters.Add(IdParam);
                command.ExecuteScalar();
            }
            finally
            {
                command.Connection.Close();
                command.Connection.Dispose();
            }
        }
예제 #7
0
        /// <summary>
        /// Add new item and return Id
        /// </summary>
        /// <returns></returns>
        public MenuModels Add(MenuModels model)
        {
            var _conn = new SqlConnection(ConfigurationManager.ConnectionStrings["InfoWebAppDbStr"].ConnectionString);

            if (_conn.State == ConnectionState.Closed)
            {
                _conn.Open();
            }
            //Create command store procedure
            var command = new SqlCommand("Add_tblMenu");

            command.Connection  = _conn;
            command.CommandType = CommandType.StoredProcedure;
            try
            {
                var NameParam = new SqlParameter("@Name", model.Name);
                NameParam.Direction = ParameterDirection.Input;
                var DescriptionParam = new SqlParameter("@Description", model.Description);
                DescriptionParam.Direction = ParameterDirection.Input;
                var ParentIdParam = new SqlParameter("@ParentId", model.ParentId);
                ParentIdParam.Direction = ParameterDirection.Input;

                command.Parameters.Add(NameParam);
                command.Parameters.Add(DescriptionParam);
                command.Parameters.Add(ParentIdParam);

                model.Id = int.Parse(command.ExecuteScalar().ToString());
            }
            finally
            {
                command.Connection.Close();
                command.Connection.Dispose();
            }
            return(model);
        }
예제 #8
0
        public void saveData(MenuModels model)
        {
            ServiceZeusClient cls = new ServiceZeusClient();

            int cargo = 0;

            if (model.cargo.Equals("Empleado"))
            {
                cargo = 1;
            }
            else
            {
                cargo = 2;
            }

            try
            {
                cls.AgregarEmpleado(model.login, model.pass, HelperMethods.ConvertToUnixTimestamp(DateTime.Now), HelperMethods.ConvertToUnixTimestamp(DateTime.Now),
                                    HelperMethods.ConvertToUnixTimestamp(DateTime.Now), model.nombres, model.apellidos, model.direccion, model.salario,
                                    model.celular, model.telefono, model.correo, (short)model.departamento, HelperMethods.getFoto(model.foto), model.identificacion,
                                    (short)cargo, (short)model.grupo, HelperMethods.ConvertToUnixTimestamp(model.fechaNacimiento));
            }

            catch (Exception) { }
        }
예제 #9
0
        public ActionResult Edit(string Name, int id)
        {
            if (id <= 0)
            {
                throw new HttpRequestValidationException();
            }
            IMenusService menuSrv = IoC.Resolve <IMenusService>();
            Menu          model   = menuSrv.Getbykey(id);

            try
            {
                TryUpdateModel <Menu>(model);
                model.Name = Name;
                menuSrv.Save(model);
                menuSrv.CommitChanges();
                Messages.AddFlashMessage("Cập nhật thành công!");
                log.Info("Update menu by:" + HttpContext.User.Identity.Name + ", Date:" + DateTime.Now);
                MenuModels.ResetMenu();
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                log.Error("Update menu error", ex);
                ViewBag.ParentMenus = menuSrv.GetParent(model.ComID);
                Messages.AddErrorMessage("Có lỗi trong quá trình xử lý, vui lòng thực hiện lại!");
                return(View(model));
            }
        }
예제 #10
0
        public ActionResult Create(MenuModels model)
        {
            try
            {
                string     user_id = User.Identity.GetUserId();
                MenuModels newM    = new MenuModels
                {
                    MenuName            = model.MenuName,
                    Desc                = model.MenuName,
                    ApplicationUserId   = User.Identity.GetUserId(),
                    RestaurantModels_id = model.RestaurantModels_id
                };
                db.Menus.Add(newM);
                db.SaveChanges();

                TempData["Message"] = $"Created Menu: {model.MenuName}";

                // TODO: Add insert logic here
                return(RedirectToAction("Index", new { Id = model.RestaurantModels_id }));
            }
            catch (Exception e)
            {
                return(Content(e.InnerException.ToString()));
            }
        }
예제 #11
0
        public PartialViewResult GetSiteMapList(string ModuleName)
        {
            MenuModels model = new MenuModels();

            GetMenuList(ModuleName);
            //PrepareMenu(model.MenuList, ModuleName);
            return(PartialView("SiteMap", model));
        }
예제 #12
0
        public ActionResult CreateMenu(MenuModels menuModels)
        {
            var menuDb = new MenuDb();

            menuModels = menuDb.Add(menuModels);
            RefreshMenu();
            Session["AddMenuSuccessMessage"] = "Thêm menu thành công!";
            return(RedirectToAction("EditMenu", "Home", new { @Id = menuModels.Id }));
        }
예제 #13
0
        // GET: Menu/Edit/5
        public ActionResult Edit(int id)
        {
            var menu = new MenuModels();

            using (db = new ApplicationDbContext())
            {
                menu = db.Menus.Find(id);
            }
            return(View(menu));
        }
예제 #14
0
        public ActionResult MenuBycomp(string viewname, int position = 0)
        {
            IList <MenuModels> model = MenuModels.GetTree(position);

            if (!string.IsNullOrWhiteSpace(viewname))
            {
                return(PartialView(viewname, model));
            }
            return(PartialView(model));
        }
예제 #15
0
        public ActionResult EditMenu(MenuModels menuModels)
        {
            var menuDb = new MenuDb();

            menuDb.Update(menuModels);
            ViewBag.ListParentMenu = menuDb.GetParentMenu();
            RefreshMenu();
            Session["AddMenuSuccessMessage"] = "Sửa menu thành công!";
            return(View(menuModels));
        }
예제 #16
0
        /// <summary>
        /// 把Url属性添加到attribute中,如果需要别的属性,也可以在这里添加
        /// </summary>
        /// <param name="TreeList"></param>
        /// <param name="jt"></param>
        /// <returns></returns>
        private Dictionary <string, string> CreateUrl(List <ComMenuEntity> TreeList, MenuModels jt)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();
            string keyid   = jt.id;
            var    urlList = TreeList.Where(t => t.Id == keyid).SingleOrDefault();
            string Sysurl  = urlList.MenuUrl;

            //string Indexurl = urlList.IndexUrl;
            dic.Add("sysurl", Sysurl);
            //dic.Add("indurl", Indexurl);
            dic.Add("close", "true");
            return(dic);
        }
예제 #17
0
        //public PartialViewResult GetMenuList(string ModuleName)
        //{
        //    MenuModels model = new MenuModels();

        //    PrepareMenu(model.MenuList, ModuleName);

        //    return PartialView("Menu", model);
        //}

        public PartialViewResult GetMenuList(string ModuleName)
        {
            MenuModels model = new MenuModels();
            var        UID   = User.Identity.Name;
            var        list  = _userAgent.GetMenuList(ModuleName, UID).ToList();

            foreach (var item in list)
            {
                model.MenuList.Add(item);
            }

            return(PartialView("Menu", model));
        }
예제 #18
0
        public List <MenuModels> GetCategoryNews()
        {
            var listParentMenu = new List <MenuModels>();
            var itemMain       = new MenuModels();

            itemMain.Name     = "-- Chọn chuyên mục --";
            itemMain.ParentId = 0;
            itemMain.Id       = 0;
            listParentMenu.Add(itemMain);
            var _conn = new SqlConnection(ConfigurationManager.ConnectionStrings["InfoWebAppDb_v2.1"].ConnectionString);

            if (_conn.State == ConnectionState.Closed)
            {
                _conn.Open();
            }
            //Create command store procedure
            var command = new SqlCommand("Get_CategoryNews");

            command.Connection  = _conn;
            command.CommandType = CommandType.StoredProcedure;
            try
            {
                SqlDataReader reader = command.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        var item = new MenuModels();
                        item.Id        = reader.GetInt32(0);
                        item.Name      = reader.GetString(1);
                        item.ParentId  = reader.GetInt32(2);
                        item.ActionUrl = reader.IsDBNull(3) ? string.Empty : reader.GetString(3);
                        item.Category  = reader.IsDBNull(4) ? string.Empty : reader.GetString(4);
                        listParentMenu.Add(item);
                    }
                    reader.Close();
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                command.Connection.Close();
                command.Connection.Dispose();
            }
            return(listParentMenu);
        }
예제 #19
0
        /// <summary>
        /// 把Url属性添加到attribute中,如果需要别的属性,也可以在这里添加
        /// </summary>
        /// <param name="TreeList"></param>
        /// <param name="jt"></param>
        /// <returns></returns>
        private List <MenuModels.children> CreateUrl(List <tSysMenu> TreeList, MenuModels jt)
        {
            List <MenuModels.children> dic = new List <MenuModels.children>();
            int keyid = jt.MenuID;

            //var urlList = TreeList.Where(t => t.MenuPartNo == keyid).ToList();
            var urlList = (from p in TreeList where p.MenuPartNo != 0 && p.MenuPartNo == keyid select p).ToList();

            foreach (var item in urlList)
            {
                dic.Add(new MenuModels.children {
                    MenuURL = item.MenuURL, MenuName = item.MenuName
                });
            }

            return(dic);
        }
 // GET: Admin/HomeAdmin
 //[HttpGet]
 public ActionResult LoadMenu()
 {
     try
     {
         MenuModels Menu  = new MenuModels();
         Menu_Datos MenuD = new Menu_Datos();
         Menu.Conexion = Conexion;
         Menu.User     = User.Identity.Name;
         Menu.TipoMenu = 1;
         Menu          = MenuD.ObtenerAllPermisoUsuario(Menu);
         return(View(Menu));
     }
     catch (Exception)
     {
         MenuModels Menu = new MenuModels();
         return(View(Menu));
     }
 }
예제 #21
0
        /// <summary>
        /// 递归生成子树
        /// </summary>
        /// <param name="TreeList"></param>
        /// <param name="jt"></param>
        /// <returns></returns>
        private List <MenuModels> CreateChildTree(List <ComMenuEntity> TreeList, MenuModels jt)
        {
            string            keyid    = jt.id;//根节点ID
            List <MenuModels> nodeList = new List <MenuModels>();
            var children = TreeList.Where(t => t.ParentMenuId == keyid);

            foreach (var chl in children)
            {
                MenuModels node = new MenuModels();
                node.id         = chl.Id;
                node.text       = chl.MenuName;
                node.parentid   = chl.ParentMenuId;
                node.icon       = "";
                node.url        = chl.MenuUrl;
                node.attributes = CreateUrl(TreeList, node);
                node.menus      = CreateChildTree(TreeList, node);
                nodeList.Add(node);
            }
            return(nodeList);
        }
예제 #22
0
        /// <summary>
        /// 递归生成子树
        /// </summary>
        /// <param name="TreeList"></param>
        /// <param name="jt"></param>
        /// <returns></returns>
        private List <MenuModels> CreateChildTree(List <tSysMenu> TreeList, MenuModels jt)
        {
            int keyid = jt.MenuPartNo;//根节点ID
            List <MenuModels> nodeList = new List <MenuModels>();
            var children = TreeList.Where(t => t.MenuID == keyid);

            foreach (var chl in children)
            {
                MenuModels node = new MenuModels();
                node.MenuID     = chl.MenuID;
                node.MenuName   = chl.MenuName;
                node.MenuPartNo = Convert.ToInt32(chl.MenuPartNo);
                node.MenuURL    = chl.MenuURL;
                jt.MenuIcon     = chl.MenuIcon;
                node.attributes = CreateUrl(TreeList, node);
                node.menus      = CreateChildTree(TreeList, node);
                nodeList.Add(node);
            }
            return(nodeList);
        }
예제 #23
0
        /// <summary>
        /// Get all item of parent menu
        /// </summary>
        /// <returns></returns>
        public List <MenuModels> GetParentMenu()
        {
            var listParentMenu = new List <MenuModels>();
            var itemMain       = new MenuModels();

            itemMain.Name = "--Chọn Menu--";
            itemMain.Id   = 0;
            listParentMenu.Add(itemMain);
            var _conn = new SqlConnection(ConfigurationManager.ConnectionStrings["InfoWebAppDbStr"].ConnectionString);

            if (_conn.State == ConnectionState.Closed)
            {
                _conn.Open();
            }
            //Create command store procedure
            var command = new SqlCommand("Get_ParentMenu");

            command.Connection  = _conn;
            command.CommandType = CommandType.StoredProcedure;
            try
            {
                SqlDataReader reader = command.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        var item = new MenuModels();
                        item.Name = reader.GetString(1);
                        item.Id   = reader.GetInt32(0);
                        listParentMenu.Add(item);
                    }
                    reader.Close();
                }
            }
            finally
            {
                command.Connection.Close();
                command.Connection.Dispose();
            }
            return(listParentMenu);
        }
예제 #24
0
        public ActionResult Edit(int id, MenuModels collection)
        {
            try
            {
                // TODO: Add update logic here

                var r = db.Menus.Find(id);
                collection.ApplicationUserId   = User.Identity.GetUserId();
                collection.RestaurantModels_id = r.RestaurantModels_id;
                db.Entry(r).CurrentValues.SetValues(collection);
                db.SaveChanges();

                TempData["Message"] = $"You have edited restaurant: {r.MenuName}";

                return(RedirectToAction("Index", new { Id = r.RestaurantModels_id }));
            }
            catch
            {
                return(View());
            }
        }
예제 #25
0
        /// <summary>
        /// Get menu by Id
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public MenuModels GetMenuById(int Id)
        {
            var model = new MenuModels();
            var _conn = new SqlConnection(ConfigurationManager.ConnectionStrings["InfoWebAppDbStr"].ConnectionString);

            if (_conn.State == ConnectionState.Closed)
            {
                _conn.Open();
            }
            //Create command store procedure
            var command = new SqlCommand("GetMenuById");

            command.Connection  = _conn;
            command.CommandType = CommandType.StoredProcedure;
            try
            {
                var IdParam = new SqlParameter("@Id", Id);
                IdParam.Direction = ParameterDirection.Input;
                command.Parameters.Add(IdParam);
                SqlDataReader reader = command.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        model.Id          = reader.GetInt32(0);
                        model.Name        = reader.GetString(1);
                        model.Description = reader.GetString(2);
                        model.ParentId    = reader.GetInt32(3);
                        break;
                    }
                    reader.Close();
                }
            }
            finally
            {
                command.Connection.Close();
                command.Connection.Dispose();
            }
            return(model);
        }
예제 #26
0
        public List <MenuModels> GetCategoryBDS(int id)
        {
            var listCategoriesBDS = new List <MenuModels>();
            var _conn             = new SqlConnection(ConfigurationManager.ConnectionStrings["InfoWebAppDbStr"].ConnectionString);

            if (_conn.State == ConnectionState.Closed)
            {
                _conn.Open();
            }
            //Create command store procedure
            var command = new SqlCommand("Get_ParentMenuById");

            try
            {
                command.Connection = _conn;
                SqlParameter menuParams = command.Parameters.AddWithValue("@Id", id);
                command.CommandType = CommandType.StoredProcedure;
                SqlDataReader reader = command.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        var item = new MenuModels();
                        item.Name = reader.GetString(1);
                        item.Id   = reader.GetInt32(0);
                        listCategoriesBDS.Add(item);
                    }
                    reader.Close();
                }
            }
            catch (Exception)
            {
                command.Connection.Close();
                command.Connection.Dispose();
                throw;
            }
            return(listCategoriesBDS);
        }
예제 #27
0
 public ActionResult load(MenuModels model)
 {
     return(View("Menu"));
 }
예제 #28
0
        public ActionResult MenuTop(int position = 1)
        {
            IList <MenuModels> model = MenuModels.GetTree(position);

            return(PartialView(model));
        }
예제 #29
0
        // GET: System
        public ActionResult UserPermissions(string roleCode)
        {
            if (string.IsNullOrEmpty(roleCode))
            {
                roleCode = "1";
            }
            pbs_sys_PermissionsService permissionsService = new pbs_sys_PermissionsService();
            pbs_sys_MenuService        mesMenuService     = new pbs_sys_MenuService();
            pbs_sys_users userDate = (pbs_sys_users)Session["USER"];
            MenuModels    models   = new MenuModels();

            models.ParentItemList = new List <ParentItem>();
            if (userDate != null && !string.IsNullOrEmpty(userDate.role.ToString()))
            {
                models.UserId = userDate.id.ToString();
                ResultInfo <DataTable> resultPm = mesMenuService.GetThisTreeNodeMenu("#", userDate.role.ToString());
                if (resultPm.Result && resultPm.Data != null)
                {
                    foreach (DataRow prow in resultPm.Data.Rows) //得到行集合
                    {
                        ParentItem pi = new ParentItem();
                        pi.NodeId      = prow[0].ToString();
                        pi.NodeName    = prow[1].ToString();
                        pi.NodeGroup   = prow[2].ToString();
                        pi.ParentId    = prow[3].ToString();
                        pi.NodeUrl     = prow[4].ToString();
                        pi.BrotherList = new List <BrotherItem>();
                        ResultInfo <bool> resultExistsPi = permissionsService.ExistsPermissions(Utility.Util.ParseHelper.ToInt(roleCode),
                                                                                                prow[0].ToString(), Utility.Util.ParseHelper.ToInt(userDate.id));
                        if (resultExistsPi.Result && resultExistsPi.Data)
                        {
                            pi.IsOrNullExists = true;
                        }
                        else
                        {
                            pi.IsOrNullExists = false;
                        }
                        ResultInfo <DataTable> resultBm = mesMenuService.GetThisTreeNodeMenu(pi.NodeId,
                                                                                             userDate.role.ToString());
                        if (resultBm.Result && resultBm.Data != null)
                        {
                            foreach (DataRow brow in resultBm.Data.Rows)
                            {
                                BrotherItem bi = new BrotherItem();
                                bi.NodeId       = brow[0].ToString();
                                bi.NodeName     = brow[1].ToString();
                                bi.NodeGroup    = brow[2].ToString();
                                bi.ParentId     = brow[3].ToString();
                                bi.NodeUrl      = brow[4].ToString();
                                bi.ChildrenList = new List <ChildrenItem>();
                                ResultInfo <bool> resultExistsbi = permissionsService.ExistsPermissions(Utility.Util.ParseHelper.ToInt(roleCode),
                                                                                                        brow[0].ToString(), Utility.Util.ParseHelper.ToInt(userDate.id));
                                if (resultExistsbi.Result && resultExistsbi.Data)
                                {
                                    bi.IsOrNullExists = true;
                                }
                                else
                                {
                                    bi.IsOrNullExists = false;
                                }

                                ResultInfo <DataTable> resultCm = mesMenuService.GetThisTreeNodeMenu(bi.NodeId,
                                                                                                     userDate.role.ToString());
                                if (resultCm.Result && resultCm.Data != null)
                                {
                                    foreach (DataRow crow in resultCm.Data.Rows)
                                    {
                                        ChildrenItem ci = new ChildrenItem();
                                        ci.NodeId    = crow[0].ToString();
                                        ci.NodeName  = crow[1].ToString();
                                        ci.NodeGroup = crow[2].ToString();
                                        ci.ParentId  = crow[3].ToString();
                                        ci.NodeUrl   = crow[4].ToString();
                                        ResultInfo <bool> resultExistsci = permissionsService.ExistsPermissions(Utility.Util.ParseHelper.ToInt(roleCode),
                                                                                                                crow[0].ToString(), Utility.Util.ParseHelper.ToInt(userDate.id));
                                        if (resultExistsci.Result && resultExistsci.Data)
                                        {
                                            ci.IsOrNullExists = true;
                                        }
                                        else
                                        {
                                            ci.IsOrNullExists = false;
                                        }
                                        bi.ChildrenList.Add(ci);
                                    }
                                }
                                pi.BrotherList.Add(bi);
                            }
                        }

                        models.ParentItemList.Add(pi);
                    }
                }
            }
            models.RoleCode = roleCode;
            return(View(models));
        }