Exemplo n.º 1
0
        /// <summary>
        /// Gets all the reps types.
        /// </summary>
        /// <param name="typeMask">The type mask.</param>
        /// <returns></returns>
        public List <UPCRMRep> AllRepsOfTypes(UPCRMRepType typeMask)
        {
            if (typeMask == UPCRMRepType.All)
            {
                return(this.RepArray);
            }

            var list = new List <UPCRMRep>();

            foreach (UPCRMRepType repType in Enum.GetValues(typeof(UPCRMRepType)).Cast <UPCRMRepType>())
            {
                if (typeMask.HasFlag(repType))
                {
                    list.AddRange(this.RepArray.Where(rep => rep.RepType == repType));
                }
            }

            return(list);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Internals the rep group has children of type recursive.
 /// </summary>
 /// <param name="rep">The rep.</param>
 /// <param name="repType">Type of the rep.</param>
 /// <param name="recursive">if set to <c>true</c> [recursive].</param>
 /// <returns></returns>
 public bool InternalRepGroupHasChildrenOfTypeRecursive(UPCRMRep rep, UPCRMRepType repType, bool recursive)
 {
     return(rep.RepChildren?.Any(childrep => (repType.HasFlag(childrep.RepType) || repType == UPCRMRepType.All) ||
                                 (recursive && this.InternalRepGroupHasChildrenOfTypeRecursive(childrep, repType, true))) ?? false);
 }