Пример #1
0
        public List <ActionURLViewModel> GetNavigation(string AccountUsername)
        {
            string SQLString = "SELECT * FROM ActionURL WHERE ID IN (SELECT ActionURLID FROM RoleActionURL_Mapping WHERE RoleID=(select RoleID from Account where Username=@Username )) AND Showable=1";
            var    Lists     = CurrentDBSession.ExcuteQuery <ActionURLViewModel>(SQLString, new System.Data.SqlClient.SqlParameter("@Username", AccountUsername));



            var MenuLists = new List <ActionURLViewModel>();
            //RootLists:
            //1   系统设置        0       fa fa-flash 1   1   1
            //5   员工管理        0       fa fa-flash 2   1   1

            var RootLists = Lists.FindAll(a => a.ParentID == 0 && a.IsRoot == true);

            foreach (var FirstLevelitem in RootLists)
            {
                var FirstLevelMenu = new ActionURLViewModel();
                FirstLevelMenu.ID       = FirstLevelitem.ID;
                FirstLevelMenu.MenuName = FirstLevelitem.MenuName;
                FirstLevelMenu.Icon     = FirstLevelitem.Icon;
                FirstLevelMenu.URL      = FirstLevelitem.URL;

                //含有子菜单(2级菜单)
                var SecondLevelMenuLists = Lists.FindAll(a => a.ParentID == FirstLevelMenu.ID && a.IsRoot == true);
                FirstLevelMenu.Childrens = SecondLevelMenuLists;

                foreach (var Seconditem in SecondLevelMenuLists)
                {
                    var SecondLevelMenu = new ActionURLViewModel();
                    SecondLevelMenu.ID       = Seconditem.ID;
                    SecondLevelMenu.MenuName = Seconditem.MenuName;
                    SecondLevelMenu.Icon     = Seconditem.Icon;
                    SecondLevelMenu.URL      = Seconditem.URL;

                    //含有子菜单三级菜单
                    var ThirdLevelMenuLists = Lists.FindAll(a => a.ParentID == SecondLevelMenu.ID && a.IsRoot == false);


                    if (ThirdLevelMenuLists.Count > 0)
                    {
                        foreach (var Thirditem in ThirdLevelMenuLists)
                        {
                            var ThirdLevelMenu = new ActionURLViewModel();
                            ThirdLevelMenu.ID       = Thirditem.ID;
                            ThirdLevelMenu.MenuName = Thirditem.MenuName;
                            ThirdLevelMenu.Icon     = Thirditem.Icon;
                            ThirdLevelMenu.URL      = Thirditem.URL;
                        }
                        Seconditem.Childrens = ThirdLevelMenuLists;
                    }
                }

                MenuLists.Add(FirstLevelMenu);
            }

            return(MenuLists);
        }
Пример #2
0
        public List <ActionURL> GetActionURLs(string Filter = "")
        {
            string SQLString = "SELECT * FROM ActionURL" + (string.IsNullOrEmpty(Filter)?"":" WHERE " + Filter);

            return(CurrentDBSession.ExcuteQuery <ActionURL>(SQLString));
        }
Пример #3
0
        public List <int> GetAllTopActionURLIDS()
        {
            string SQLString = "SELECT ID FROM ActionURL WHERE ParentID=0";

            return(CurrentDBSession.ExcuteQuery <int>(SQLString));
        }