Пример #1
0
 private static bool ExpansionRequired(EPDistributionBase t)
 {
     if (!t.DistributionTypeId.HasValue)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
Пример #2
0
        private IEnumerable <EPDistributionBase> InternalExpand(IEnumerable <EPDistributionBase> items)
        {
            Debug.Assert(items.Count() > 0);
            Debug.Assert(this.m_Provider.Values.Count > 0);

            if (this.m_Provider.Values.Count == 0 || items.Count() == 0)
            {
                return(items);
            }

            List <EPDistributionBase> Expanded = new List <EPDistributionBase>();

            foreach (EPDistributionBase t in items)
            {
                if (!ExpansionRequired(t))
                {
                    Expanded.Add(t);
                    continue;
                }

                Dictionary <string, EPDistributionValue> l = this.GetValueDictionary(t);

                if (l == null)
                {
                    Expanded.Add(t);
                    continue;
                }

                foreach (EPDistributionValue v in l.Values)
                {
                    EPDistributionBase n = t.Clone();
                    n.JurisdictionId = v.JurisdictionId;

                    Expanded.Add(n);
                }
            }

            Debug.Assert(Expanded.Count() >= items.Count());
            return(Expanded);
        }
Пример #3
0
        private Dictionary <string, EPDistributionValue> GetValueDictionary(EPDistributionBase t)
        {
            Dictionary <string, EPDistributionValue> l = null;

            if (!t.JurisdictionId.HasValue)
            {
                l = this.m_1.GetItemExact(t.DistributionTypeId);
            }
            else
            {
                l = this.m_2.GetItemExact(t.DistributionTypeId, t.JurisdictionId.Value);
            }

#if DEBUG
            if (l != null)
            {
                Debug.Assert(l.Count > 0);
            }
#endif

            return(l);
        }