Ejemplo n.º 1
0
        public static bool Sort(List <SelectedNodeInfo> selectedNode)
        {
            bool Retval = true;

            try
            {
                selectedNode.Sort(delegate(SelectedNodeInfo CompareNId1, SelectedNodeInfo CompareNId2) { return(CompareNId1.Level.CompareTo(CompareNId2.Level)); });

                for (int i = 0; i < selectedNode.Count - 2; i++)
                {
                    int Index = i;
                    for (int j = i + 1; j < selectedNode.Count - 1; j++)
                    {
                        if (selectedNode[i].Level == selectedNode[j].Level && string.Compare(selectedNode[i].Text.ToLower(), selectedNode[j].Text.ToLower()) >= 0)
                        {
                            Index = j;
                        }
                    }
                    SelectedNodeInfo TempNId = new SelectedNodeInfo(selectedNode[Index].NId, selectedNode[Index].Text, selectedNode[Index].GId, selectedNode[Index].Level, selectedNode[Index].ParentNid);
                    selectedNode[Index] = selectedNode[i];
                    selectedNode[i]     = TempNId;
                }
            }
            catch (Exception)
            {
                Retval = false;
            }
            return(Retval);
        }
Ejemplo n.º 2
0
        public static bool Sort(List<SelectedNodeInfo> selectedNode)
        {
            bool Retval = true;
            try
            {
                selectedNode.Sort(delegate(SelectedNodeInfo CompareNId1, SelectedNodeInfo CompareNId2) { return CompareNId1.Level.CompareTo(CompareNId2.Level); });

                for (int i = 0; i < selectedNode.Count-2; i++)
                {
                    int Index = i;
                    for (int j = i + 1; j < selectedNode.Count-1; j++)
                    {
                        if (selectedNode[i].Level == selectedNode[j].Level && string.Compare(selectedNode[i].Text.ToLower(), selectedNode[j].Text.ToLower()) >= 0)
                        {
                            Index = j;
                        }
                    }
                    SelectedNodeInfo TempNId = new SelectedNodeInfo(selectedNode[Index].NId, selectedNode[Index].Text, selectedNode[Index].GId, selectedNode[Index].Level, selectedNode[Index].ParentNid);
                    selectedNode[Index] = selectedNode[i];
                    selectedNode[i] = TempNId;
                }
            }
            catch (Exception)
            {
                Retval = false;
            }
            return Retval;
        }