private void ProcessTree(HierarchyNode hNode, int?TreeIdParent, string NazovParrent, int C_Modul_Id, ref List <Tree> treeDBDelete, ref List <string> treeDBAdd)
        {
            Tree   tree;
            bool   isRoot = TreeIdParent == null;
            string myName = NazovParrent + (string.IsNullOrEmpty(NazovParrent) ? "" : " / ") + hNode.Nazov + ((hNode is DatabaseHierarchyNode) ? " []" : "");

            /*
             * // v dms vylucit adresare bez SysKod
             * if (!hNode.IsRoot && hNode.KodRoot == "dms")
             * {
             *  long id = 0;
             *  if (long.TryParse(hNode.KodPolozky.Split('!').Last(), out id))
             *  {
             *      var adr = GetList<ServiceModel.Office.Dms.Types.AdresarView>(a => a.D_Adresar_Id == id).FirstOrDefault();
             *      if (adr != null && adr.SysKod == null)
             *          return;
             *  }
             * }
             */

            if (hNode.GeneratedNode)
            {
                return;
            }

            string kodPolozky = HierarchyNodeExtensions.RemoveParametersFromKodPolozky(HierarchyNodeExtensions.CleanKodPolozky(hNode.KodPolozky));

            if ((tree = treeDBDelete.FirstOrDefault(t => t.Kod == kodPolozky)) == null)
            {
                if (!treeDBAdd.Contains(kodPolozky))
                {
                    TreeIdParent = (int)Create(new Tree()
                    {
                        C_Tree_Id_Parent = TreeIdParent,
                        Kod        = kodPolozky,
                        Nazov      = myName,
                        C_Modul_Id = C_Modul_Id
                    });
                }
            }
            else
            {
                tree.C_Tree_Id_Parent = TreeIdParent;
                tree.Nazov            = myName;
                Update(tree);
                treeDBDelete.Remove(tree);
                TreeIdParent = tree.C_Tree_Id;
            }

            treeDBAdd.Add(kodPolozky);

            if (hNode.HasChildren)
            {
                foreach (var n in hNode.Children)
                {
                    ProcessTree(n, TreeIdParent, (isRoot) ? "" : myName, C_Modul_Id, ref treeDBDelete, ref treeDBAdd);
                }
            }
        }
 private static string RepairNodeKey(string nodeKey)
 {
     if (nodeKey.ToLower().StartsWith("all-"))
     {
         if (nodeKey.Contains("!"))
         {
             nodeKey = HierarchyNodeExtensions.CleanKodPolozky(nodeKey);
         }
         else
         {
             nodeKey = HostContext.ServiceName + nodeKey.Substring(3); //Namiesto "all" dám meno modulu
         }
     }
     return(HierarchyNodeExtensions.RemoveParametersFromKodPolozky(nodeKey));
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="NodeAction" /> class.
        /// </summary>
        /// <param name="type">The type.</param>
        public NodeAction(NodeActionType type, Type actionSS = null, string caption = null)
        {
            this.ActionType    = type;
            this.Caption       = string.IsNullOrEmpty(caption) ? type.ToCaption() : caption;
            this.SelectionMode = PfeSelection.Single;

            bool hasActionIcon = type.GetType().GetField(type.ToString()).HasAttribute <NodeActionIconAttribute>();

            this.ActionIcon = hasActionIcon ? type.GetType().GetField(type.ToString()).FirstAttribute <NodeActionIconAttribute>().Icon : NodeActionIcons.Default;

            if (actionSS != null)
            {
                if (actionSS.HasAttribute <RouteAttribute>())
                {
                    this.url = string.Format("{0}{1}", HierarchyNodeExtensions.GetStartUrl(actionSS), actionSS.FirstAttribute <RouteAttribute>().Path);
                    if (this.url.Contains("{"))
                    {
                        this.url = this.url.Substring(0, this.url.IndexOf("{"));
                    }
                }
            }

            //nastavenie IdField pre zname akcie (a ine nastavenia podla typu)
            switch (type)
            {
            case NodeActionType.ZmenaStavu:
            case NodeActionType.Delete:
                this.SelectionMode = PfeSelection.Multi;
                break;

            case NodeActionType.ZobrazitRozhodnutiaDcom:
                this.Url = "https://egov.intra.dcom.sk/DAP/#dap-roz";
                break;

            case NodeActionType.ZobrazitCiselnikyDcom:
                this.Url = "https://egov.intra.dcom.sk/DAP/#dap-cis-ndas";
                break;
            }
        }