Beispiel #1
0
 public void Populate(NavFromDB nav, List <string> children)
 {
     for (int i = 0; i < children.Count; i++)
     {
         int ChildID;
         if (Int32.TryParse(children[i], out ChildID))
         {
             NavItemFromDB ni = nav.GetNavID(ChildID);
             if (ni != null)
             {
                 GlobalMenuItem ChildItem = new GlobalMenuItem(ChildID, ni.Label, ni.LabelID, this.Level + 1, ni.Url);
                 ChildItem.Populate(nav, ni.ChildrenNavIDs);
                 Children.Add(ChildItem);
             }
         }
     }
 }
Beispiel #2
0
        public MenuItem(int ID, NavFromDB nav, int level)
        {
            Level = level;
            NavItemFromDB ni = nav.GetNavID(ID);

            ni.Udane = true;

            Init(ID, ni.Label, ni.Url);
            for (int i = 0; i < ni.ChildrenNavIDs.Count; i++)
            {
                int ChildID = -1;
                if (Int32.TryParse(ni.ChildrenNavIDs[i], out ChildID))
                {
                    MenuItem nmi = new MenuItem(ChildID, nav, level + 1);
                    AddMenuItem(nmi);
                }
            }
        }
Beispiel #3
0
        public void ProcessNavigation(DataTable dt)
        {
            NavFromDB nav = new NavFromDB();

            for (int r = 0; r < dt.Rows.Count; r++)
            {
                NavItemFromDB ni = new NavItemFromDB();
                ni.NavID       = DBUtil.GetInt(dt.Rows[r], 0);
                ni.Label       = DBUtil.GetString(dt.Rows[r], 1);
                ni.Url         = DBUtil.GetString(dt.Rows[r], 2);
                ni.ParentNavID = DBUtil.GetInt(dt.Rows[r], 3);
                ni.Icon        = Encoding.UTF8.GetBytes(DBUtil.GetString(dt.Rows[r], 4));
                ni.SetChildrenNavIDs(DBUtil.GetString(dt.Rows[r], 5));
                nav.navs.Add(ni);
            }

            root = new MenuItem(NavID, nav, 0);    // Reconstruct Navigation
            root.Select("ShowProject");
        }
Beispiel #4
0
        private static GlobalMenuItem ProcessMenu(DataTable dt)
        {
            NavFromDB nav = new NavFromDB();

            for (int r = 0; r < dt.Rows.Count; r++)
            {
                NavItemFromDB ni = new NavItemFromDB();
                ni.NavID = DBUtil.GetInt(dt.Rows[r], 0);
                ni.Label = DBUtil.GetString(dt.Rows[r], 1);
                ni.Icon  = Encoding.UTF8.GetBytes(DBUtil.GetString(dt.Rows[r], 2));
                ni.SetChildrenNavIDs(DBUtil.GetString(dt.Rows[r], 3));
                ni.Type    = DBUtil.GetString(dt.Rows[r], 4);
                ni.Url     = DBUtil.GetString(dt.Rows[r], 5);
                ni.LabelID = DBUtil.GetInt(dt.Rows[r], 6);

                nav.navs.Add(ni);
            }

            GlobalMenuItem root = new GlobalMenuItem(0, "", -1, 0, "");

            root.Populate(nav, nav.GetRootChildren("gm-root"));
            return(root);
        }