예제 #1
0
파일: Menu.cs 프로젝트: hpatel3790/PitStop
        public static Queue<Menu> loadMenu(int securityLevel)
        {
            Queue<Menu> ret = new Queue<Menu>();

            string sQuery;
            sQuery = "Select * from " + DB.MenuTable + " where ParentId=0 And MinSecLevel<=" + securityLevel + " Order By Priority;";
            IEnumerable<dynamic> results = DB.query(sQuery);

            foreach(dynamic trace in results)
            {
                Menu temp = new Menu(trace);
                temp.loadSubMenu(securityLevel);
                ret.Enqueue(temp);
            }

            return ret;
        }
예제 #2
0
파일: Menu.cs 프로젝트: hpatel3790/PitStop
        public void loadSubMenu(int securityLevel)
        {
            string sQuery = "Select * from " + DB.MenuTable + " where ParentId=" + _id + " And MinSecLevel<=" + securityLevel + " Order By Priority;";
            IEnumerable<dynamic> results = DB.query(sQuery);
            int subId;

            if (results == null || !results.Any()) { return; }

            foreach(dynamic menu in results)
            {
                subId = menu.Id;
                if (subId > _id)
                {
                    Menu newSub = new Menu(menu);
                    newSub.loadSubMenu(securityLevel);
                    subMenu.Enqueue(newSub);
                }
            }
        }