Пример #1
0
 private static void RefreshNavCore(ref List<NavigationDefineAttribute> navDefines,
                                    ref SysNavigationCollection navs,
                                    NavigationDefineAttribute navDefine,
                                    SysNavigation nav)
 {
     string navUrl = navDefine == null ? string.Empty : navDefine.NavUrl;
     List<NavigationDefineAttribute> partNavDefines = FindNavDefinesByUrl(ref navDefines, navUrl);
     if (partNavDefines.Count == 0 && navDefine == null && nav == null)
     {
         partNavDefines = navDefines;
     }
     foreach (NavigationDefineAttribute partNav in partNavDefines)
     {
         //not exist item and new item to navs
         SysNavigation cNav = FindNavByUrl(navs, partNav.NavUrl);
         if (cNav == null)
         {
             SysNavigation pNav = FindNavByUrl(navs, partNav.P_NavUrl);
             cNav = AddNewNavigation(partNav, pNav == null ? nav : pNav);
             AutoRoleAssignement(cNav);
             //?
             navs.Add(cNav);
         }
         RefreshNavCore(ref navDefines, ref navs, partNav, cNav);
     }
 }
Пример #2
0
 private static SysNavigation AddNewNavigation(NavigationDefineAttribute navDefine, SysNavigation pNav)
 {
     int nPID = 0;
     string sDepth = "/";
     if (pNav != null)
     {
         nPID = Utilities.ToInt(pNav.Id);
         sDepth = pNav.Depth;
     }
     SysNavigation cNav = new SysNavigation( )
     {
         IsFooter = navDefine.IsFooter,
         IsHeader = navDefine.IsHeader,
         IsMainNav = navDefine.IsMainNav,
         NavName = navDefine.NavName,
         NavUrl = navDefine.NavUrl,
         PId = nPID,
         PermissionRequired = navDefine.PermissionRequired,
         SecName = navDefine.SecName,
         OthName = navDefine.OthName,
         SubSysId = Convert.ToInt32(navDefine.SubSys),
         Visible = true,
         Sort = 0,
         Depth = "/",
         NavIcon = navDefine.NavIcon
     };
     cNav.Save(AppContextBase.CurrentUserID);
     cNav.Sort = cNav.Id;
     cNav.Depth = string.Concat(sDepth, cNav.Id, "/");
     cNav.Save( );
     return cNav;
 }