Example #1
0
        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);
        }
Example #2
0
 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;
             }
         }
     }
 }
Example #3
0
        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);
        }