Exemple #1
0
        public UptakeGeography[] GetUptakeGeographies(bool others)
        {
            BasicUptakeGeography[] basics = SwarmDb.GetDatabaseForReading()
                                            .GetOrganizationUptakeGeographies(Identity, others);
            List <UptakeGeography> retVal = new List <UptakeGeography>();

            foreach (BasicUptakeGeography b in basics)
            {
                try
                {
                    UptakeGeography ug = UptakeGeography.FromBasic(b);
                    if (ug.Organization != null && ug.Geography != null && ug.Organization.ParentIdentity != -1)
                    {
                        retVal.Add(UptakeGeography.FromBasic(b));
                    }
                }
                catch
                {
                    //catch bad references
                }
            }

            if (others)
            {
                throw new NotImplementedException("Apollo 13. Contact the devs with the Apollo 13.");

                // When is this code used anyway? One organization setting its geography uptake structure should NEVER interfere with
                // other organizations' uptake trees ("Organization.RootIdentity"). There is no reason whatsoever to get all
                // organizations at any time when determining uptake. We set an exception here to catch this logic in action.

                /*
                 * Dictionary<int, BasicOrganization> allOrgs = OrganizationCache.GetOrganizationHashtable(Organization.RootIdentity);
                 * foreach (BasicOrganization bo in allOrgs.Values)
                 * {
                 *  if (bo.Identity > 0)
                 *  {
                 *      BasicUptakeGeography myAnchor = new BasicUptakeGeography(bo.Identity, bo.AnchorGeographyId);
                 *      retVal.Add(UptakeGeography.FromBasic(myAnchor));
                 *  }
                 * }*/
            }
            BasicUptakeGeography myAnchor = new BasicUptakeGeography(Identity, AnchorGeographyId);

            if (retVal.Find(delegate(UptakeGeography ug) { return(ug.GeoId == AnchorGeographyId); }) == null)
            {
                retVal.Add(UptakeGeography.FromBasic(myAnchor));
            }

            return(retVal.ToArray());
        }
Exemple #2
0
        public UptakeGeography[] GetUptakeGeographies(bool others)
        {
            BasicUptakeGeography[] basics = SwarmDb.GetDatabaseForReading().GetOrganizationUptakeGeographies(Identity, others);
            List <UptakeGeography> retVal = new List <UptakeGeography>();

            foreach (BasicUptakeGeography b in basics)
            {
                try
                {
                    UptakeGeography ug = UptakeGeography.FromBasic(b);
                    if (ug.Organization != null && ug.Geography != null && ug.Organization.ParentIdentity != -1)
                    {
                        retVal.Add(UptakeGeography.FromBasic(b));
                    }
                }
                catch
                {
                    //catch bad references
                }
            }

            if (others)
            {
                Dictionary <int, BasicOrganization> allOrgs = OrganizationCache.GetOrganizationHashtable(Organization.RootIdentity);
                foreach (BasicOrganization bo in allOrgs.Values)
                {
                    if (bo.Identity > 0)
                    {
                        BasicUptakeGeography myAnchor = new BasicUptakeGeography(bo.Identity, bo.AnchorGeographyId);
                        retVal.Add(UptakeGeography.FromBasic(myAnchor));
                    }
                }
            }
            else
            {
                BasicUptakeGeography myAnchor = new BasicUptakeGeography(Identity, AnchorGeographyId);
                if (retVal.Find(delegate(UptakeGeography ug) { return(ug.GeoId == AnchorGeographyId); }) == null)
                {
                    retVal.Add(UptakeGeography.FromBasic(myAnchor));
                }
            }

            return(retVal.ToArray());
        }
Exemple #3
0
 public static UptakeGeography FromBasic(BasicUptakeGeography basic)
 {
     return(new UptakeGeography(basic));
 }
Exemple #4
0
        } // disallow public direct construction

        private UptakeGeography(BasicUptakeGeography basic)
            : base(basic)
        {
        }
 public BasicUptakeGeography(BasicUptakeGeography other)
 {
     this.orgId = other.orgId;
     this.geoId = other.geoId;
 }