Пример #1
0
        private static void ReadFromConfigurationDataSet(Action parent, DataRow[] actionRows, List <ActionType> allowedTypes, ActionCollection actions)
        {
            foreach (ConfigurationDataSet.ActionRow row in actionRows)
            {
                ActionType type = (ActionType)row.ActionTypeId;
                if (allowedTypes.Contains(type))
                {
                    Action item = CreateAction(row, parent);

                    DataRow[] childActionRows = row.GetActionRows();
                    if (childActionRows.Length > 0)
                    {
                        ReadFromConfigurationDataSet(item, childActionRows, allowedTypes, actions);
                    }

                    if ((type == ActionType.Page) || (type == ActionType.GlobalNavigationLink))
                    {
                        if (parent != null)
                        {
                            parent.ChildActions.Add(item);
                        }
                        actions.Add(item);
                    }
                    else if (type == ActionType.Control && parent != null)
                    {
                        parent.ChildControls.Add(item);
                    }
                }
            }

            if (parent != null)
            {
                if (parent.ChildActions.Count > 1)
                {
                    parent.ChildActions.Sort();
                }
            }
            else if (actions.Count > 1)
            {
                actions.Sort();
            }
        }