Beispiel #1
0
        /// <inheritdoc />
        public void Sets(ICaller caller)
        {
            using IDealData data = InstanceFactory.GetInstance <IDealData>();

            IList <ISet> existingSets = data.ReadAllSets();

            ISetWithPacksFactory setFactory = new SetWithPacksFactory(
                owners: data.ReadAllOwners(),
                packColours: data.ReadAllPackColours(),
                setPurposes: data.ReadAllSetPurposes(),
                setColours: data.ReadAllSetColours());

            IList <ISetWithPacks> setsWithPacks = new List <ISetWithPacks>
            {
                setFactory.Create32BoardSet("BRADGATE", "EVENTS", "LT-BLUE", "Blue"),
                setFactory.Create32BoardSet("BRADGATE", "EVENTS", "PINK", "Pink"),
                setFactory.Create32BoardSet("BRADGATE", "EVENTS", "LT-GREEN", "Green"),
                setFactory.Create32BoardSet("BRADGATE", "EVENTS", "WHITE", "White"),
                setFactory.Create32BoardSet("GLENFIELD", "EVENTS", "DK-BLUE", "Black"),
                setFactory.Create32BoardSet("GLENFIELD", "EVENTS", "LT-BLUE", "Blue"),
                setFactory.Create32BoardSet("GLENFIELD", "EVENTS", "DK-GREEN", "Green"),
                setFactory.Create32BoardSet("GLENFIELD", "EVENTS", "LT-GREEN", "Lime"),
                setFactory.Create32BoardSet("LCBA", "EVENTS", "DK-BLUE", "Black"),
                setFactory.Create32BoardSet("LCBA", "EVENTS", "ORANGE", "Orange"),
                setFactory.Create32BoardSet("LCBA", "EVENTS", "RED", "Red"),
                setFactory.Create32BoardSet("LCBA", "EVENTS", "YELLOW", "Yellow"),
                setFactory.Create32BoardSet("WRIGHT", "EVENTS", "YELLOW", "Yellow"),
            };

            foreach (ISetWithPacks setWithPacks in setsWithPacks)
            {
                if (existingSets.Where(es => es.Owner.Code == setWithPacks.Owner.Code)
                    .Where(es => es.SetPurpose.Code == setWithPacks.SetPurpose.Code)
                    .Where(es => es.SetColour.Code == setWithPacks.SetColour.Code)
                    .Any(es => es.Description == setWithPacks.Description))
                {
                    continue;
                }

                data.CreateSet(setWithPacks);
                foreach (IPack pack in setWithPacks.Packs)
                {
                    data.CreatePack(pack);
                }

                Console.WriteLine($@"Seeding Set: {setWithPacks.Owner.Code} {setWithPacks.Description}.");
            }
        }