Example #1
0
        public static void Init(IQueryAdapter dbClient)
        {
            dbClient.setQuery("SELECT * FROM pets_racesoncatalogue");
            var Table = dbClient.getTable();

            Races = new List <PetRace>();
            foreach (DataRow Race in Table.Rows)
            {
                var R = new PetRace
                {
                    RaceId    = (int)Race["raceid"],
                    Color1    = (int)Race["color1"],
                    Color2    = (int)Race["color2"],
                    Has1Color = ((string)Race["has1color"] == "1"),
                    Has2Color = ((string)Race["has2color"] == "1")
                };
                Races.Add(R);
            }
        }
Example #2
0
        internal static void Initialize(IQueryAdapter dbClient)
        {
            dbClient.setQuery("SELECT * FROM pet_races");
            DataTable dTable = dbClient.getTable();

            int raceID;
            int colorPrimary;
            int colorSecondary;
            bool hasPrimaryColor;
            bool hasSecondaryColor;

            raceRegister = new Hashtable();

            foreach (DataRow Race in dTable.Rows)
            {
                raceID = (int)Race["raceid"];
                colorPrimary = (int)Race["color1"];
                colorSecondary = (int)Race["color2"];
                hasPrimaryColor = ((string)Race["has1color"] == "1");
                hasSecondaryColor = ((string)Race["has2color"] == "1");

                PetRace race = new PetRace(raceID, colorPrimary, colorSecondary, hasPrimaryColor, hasSecondaryColor);

                if (raceRegister.ContainsKey(raceID))
                {
                    List<PetRace> races = (List<PetRace>)raceRegister[raceID];
                    races.Add(race);
                }
                else
                {
                    List<PetRace> races = new List<PetRace>();
                    races.Add(race);
                    raceRegister.Add(raceID, races);
                }
            }
        }