Esempio n. 1
0
        private void InsertToCollection(IEnumerable <string> listToAdd, ModelItem modelItem)
        {
            var modelProperty = modelItem.Properties["SystemInformationCollection"];

            if (modelProperty != null)
            {
                ModelItemCollection mic = modelProperty.Collection;

                if (mic != null)
                {
                    List <GatherSystemInformationTO> listOfValidRows = SystemInformationCollection.Where(c => !c.CanRemove()).ToList();
                    if (listOfValidRows.Count > 0)
                    {
                        GatherSystemInformationTO gatherSystemInformationTo = SystemInformationCollection.Last(c => !c.CanRemove());
                        int startIndex = SystemInformationCollection.IndexOf(gatherSystemInformationTo) + 1;
                        foreach (string s in listToAdd)
                        {
                            mic.Insert(startIndex, new GatherSystemInformationTO(SystemInformationCollection[startIndex - 1].EnTypeOfSystemInformation, s, startIndex + 1));
                            startIndex++;
                        }
                        CleanUpCollection(mic, modelItem, startIndex);
                    }
                    else
                    {
                        AddToCollection(listToAdd, modelItem);
                    }
                }
            }
        }
Esempio n. 2
0
        void InsertToCollection(IEnumerable <string> listToAdd, ModelItem modelItem)
        {
            var modelProperty = modelItem.Properties["SystemInformationCollection"];

            if (modelProperty != null)
            {
                var mic = modelProperty.Collection;

                if (mic != null)
                {
                    var listOfValidRows = SystemInformationCollection.Where(c => !c.CanRemove()).ToList();
                    if (listOfValidRows.Count > 0)
                    {
                        var gatherSystemInformationTo = SystemInformationCollection.Last(c => !c.CanRemove());
                        var startIndex = SystemInformationCollection.IndexOf(gatherSystemInformationTo) + 1;
                        startIndex = InsertAllItems(listToAdd, mic, startIndex);
                        CleanUpCollection(mic, modelItem, startIndex);
                    }
                    else
                    {
                        AddToCollection(listToAdd, modelItem);
                    }
                }
            }
        }