Пример #1
0
        public IEnumerable<Ability> AllAbilities() {
            List<Ability> abilities = null;
            using (IDbConnection connection = database.CreateOpenConnection()) {
                abilities = VM_Ability.RetrieveAllAbilities(connection);

                foreach (Ability a in abilities) {
                    a.Generation = VM_Generation.RetrieveSpecificGeneration(connection, a.Generation.Id);
                    
                    if (a.Generation != null && a.Generation.MainRegion != null) {
                        a.Generation.MainRegion = VM_Region.RetrieveSpecificRegion(connection, a.Generation.MainRegion.Id);
                    }

                    a.AbilityChangelog = VM_Ability.RetrieveSpecificAbilityChangelog(connection, a.Id);
                    foreach (AbilityChangelog ac in a.AbilityChangelog) {
                        if (ac != null && ac.ChangedInVersionGroup != null) {
                            ac.ChangedInVersionGroup = VM_VersionGroups.RetrieveSpecificVersionGroups(connection, ac.ChangedInVersionGroup.Id);
                            ac.AbilityChangelogProse = VM_Ability.RetrieveSpecificAbilityChangelogProse(connection, ac.Id);
                            foreach (AbilityChangelogProse acp in ac.AbilityChangelogProse) {
                                acp.LocalLanguage = VM_Language.RetrieveSpecificLanguage(connection, acp.LocalLanguage.Id);
                            }

                            if (ac.ChangedInVersionGroup.Generation != null) {
                                ac.ChangedInVersionGroup.Generation = VM_Generation.RetrieveSpecificGeneration(connection, ac.ChangedInVersionGroup.Generation.Id);

                                if (ac.ChangedInVersionGroup.Generation.MainRegion != null) {
                                    ac.ChangedInVersionGroup.Generation.MainRegion = VM_Region.RetrieveSpecificRegion(connection, ac.ChangedInVersionGroup.Generation.MainRegion.Id);
                                }
                            }
                        }
                    }

                    a.AbilityName = VM_Ability.RetrieveSpecificAbilityName(connection, a.Id);
                    foreach (AbilityName an in a.AbilityName) {
                        if (an != null && an.LocalLanguage != null) {
                            an.LocalLanguage = VM_Language.RetrieveSpecificLanguage(connection, an.LocalLanguage.Id);
                        }
                    }

                    a.AbilityProse = VM_Ability.RetrieveSpecificAbilityProse(connection, a.Id);
                    foreach (AbilityProse ap in a.AbilityProse) {
                        if (ap != null && ap.LocalLanguage != null) {
                            ap.LocalLanguage = VM_Language.RetrieveSpecificLanguage(connection, ap.LocalLanguage.Id);
                        }
                    }
                } // foreach
                connection.Close();
            } // Connection
            return abilities;
        }
Пример #2
0
        public IEnumerable<Berry> AllBerries() {
            List<Berry> berries = null;
            using (IDbConnection connection = database.CreateOpenConnection()) {
                berries = VM_Berry.RetrieveAllBerries(connection);

                foreach (Berry b in berries) {
                    b.Item = VM_Item.RetrieveSpecificItem(connection, b.Item.Id);
                    if (b.Item != null && b.Item.Category != null) {
                        b.Item.Category = VM_Category.RetrieveSpecificCategory(connection, b.Item.Category.Id);
                        if (b.Item.Category != null && b.Item.Category.Pocket != null) {
                            b.Item.Category.Pocket = VM_Pocket.RetrieveSpecificPocket(connection, b.Item.Category.Pocket.Id);
                        }
                    }
                    b.BerryFirmness = VM_Berry.RetrieveSpecificBerryFirmness(connection, b.BerryFirmness.Id);
                    if (b.BerryFirmness != null) {
                        b.BerryFirmness.BerryFirmnessName = VM_Berry.RetrieveSpecificBerryFirmnessName(connection, b.BerryFirmness.Id);
                        foreach (BerryFirmnessName bfn in b.BerryFirmness.BerryFirmnessName) {
                            bfn.LocalLanguage = VM_Language.RetrieveSpecificLanguage(connection, bfn.LocalLanguage.Id);
                        }
                    }
                    b.NaturalGiftType = VM_Type.RetrieveSpecificType(connection, b.NaturalGiftType.Id);
                    if (b.NaturalGiftType != null && b.NaturalGiftType.DamageClass != null) {
                        b.NaturalGiftType.Generation = VM_Generation.RetrieveSpecificGeneration(connection, b.NaturalGiftType.Generation.Id);
                        if (b.NaturalGiftType.Generation != null && b.NaturalGiftType.Generation.MainRegion != null) {
                            b.NaturalGiftType.Generation.MainRegion = VM_Region.RetrieveSpecificRegion(connection, b.NaturalGiftType.Generation.MainRegion.Id);
                        }
                        b.NaturalGiftType.DamageClass = VM_DamageClass.RetrieveSpecificDamageClass(connection, b.NaturalGiftType.DamageClass.Id);
                    }
                    b.BerryFlavors = VM_Berry.RetrieveSpecificBerryFlavor(connection, b.Id);
                    foreach (BerryFlavor bf in b.BerryFlavors) {
                        bf.ContestType = VM_ContestType.RetrieveSpecificContestType(connection, bf.ContestType.Id);
                    }
                }
                connection.Close();
            } // Connection
            return berries;
        }