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); } } } }
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); } } } }
public override int GetHashCode() { unchecked { var hashCode = base.GetHashCode(); hashCode = (hashCode * 397) ^ (SystemInformationCollection != null ? SystemInformationCollection.GetHashCode() : 0); return(hashCode); } }
// ReSharper restore RedundantOverridenMember private void CleanArgs() { int count = 0; while (count < SystemInformationCollection.Count) { if (string.IsNullOrWhiteSpace(SystemInformationCollection[count].Result)) { SystemInformationCollection.RemoveAt(count); } else { count++; } } }
public override void UpdateForEachOutputs(IList <Tuple <string, string> > updates) { if (updates != null) { foreach (Tuple <string, string> t in updates) { // locate all updates for this tuple Tuple <string, string> t1 = t; var items = SystemInformationCollection.Where(c => !string.IsNullOrEmpty(c.Result) && c.Result.Equals(t1.Item1)); // issues updates foreach (var a in items) { a.Result = t.Item2; } } } }
public int GetCollectionCount() { return(SystemInformationCollection.Count(caseConvertTo => !caseConvertTo.CanRemove())); }
public override IList <DsfForEachItem> GetForEachOutputs() { var enumerable = SystemInformationCollection.Select(to => to.Result); return(GetForEachItems(enumerable.ToArray())); }
public override List <string> GetOutputs() => SystemInformationCollection.Select(to => to.Result).ToList();