private bool HasAnyUnusedItems() { if (!HasItems()) { return(false); } bool hasUnused = false; if (ScalarCollection != null) { hasUnused = ScalarCollection.Any(sc => !sc.IsUsed); if (hasUnused) { return(true); } } if (RecsetCollection != null) { hasUnused = RecsetCollection.Any(sc => !sc.IsUsed); if (hasUnused) { return(true); } hasUnused = RecsetCollection.SelectMany(sc => sc.Children).Any(sc => !sc.IsUsed); } return(hasUnused); }
void SetRecordSetItemsAsUsed() { if (RecsetCollection.Any(rc => rc.IsUsed == false)) { foreach (var dataListItemModel in RecsetCollection) { dataListItemModel.IsUsed = true; foreach (var listItemModel in dataListItemModel.Children) { listItemModel.IsUsed = true; } } } }
private bool HasAnyUnusedItems() { if (!HasItems()) { return(false); } bool hasUnused; if (ScalarCollection != null) { hasUnused = ScalarCollection.Any(sc => !sc.IsUsed); if (hasUnused) { DeleteCommand.RaiseCanExecuteChanged(); return(true); } } if (RecsetCollection != null) { hasUnused = RecsetCollection.Any(sc => !sc.IsUsed); if (!hasUnused) { hasUnused = RecsetCollection.SelectMany(sc => sc.Children).Any(sc => !sc.IsUsed); } if (hasUnused) { DeleteCommand.RaiseCanExecuteChanged(); return(true); } } if (ComplexObjectCollection != null) { hasUnused = ComplexObjectCollection.Any(sc => !sc.IsUsed); if (hasUnused) { DeleteCommand.RaiseCanExecuteChanged(); return(true); } } return(false); }