Ejemplo n.º 1
0
        private SingleRecordEntry CreateEmptySingleRecordEntry(Sex s, CourseType c, AgeGroup g, int length, SwimType swimType)
        {
            var entry = new SingleRecordEntry()
            {
                Club       = "",
                Name       = "",
                Surname    = "",
                Agegroup   = g,
                Date       = "",
                sex        = s,
                CourseType = c,
                Time       = new TimeSpan(0, 0, 0, 0, 0 * 10),
                Discipline = new Discipline(length, swimType)
            };

            return(entry);
        }
Ejemplo n.º 2
0
        public void RecordDBNew()
        {
            mSingleStorage = new List <SingleRecordEntry>();
            mTeamStorage   = new List <TeamRecordEntry>();
            mTables        = new List <RecordTable>();

            var groups = new AgeGroup[] {
                new AgeGroup(10, 10),
                new AgeGroup(11, 11),
                new AgeGroup(12, 12),
                new AgeGroup(13, 13),
                new AgeGroup(14, 14),
                new AgeGroup(15, 15),
                new AgeGroup(16, 16),
                new AgeGroup(0, 99),
            };

            var sexsel = new Sex[] { Sex.Female, Sex.Male };

            foreach (AgeGroup g in groups)
            {
                foreach (CourseType c in Enum.GetValues(typeof(CourseType)))
                {
                    foreach (Sex s in sexsel)
                    {
                        if ((s == Sex.Female && g == groups[6]) || (s == Sex.Male && g == groups[0]))
                        {
                            continue;
                        }

                        var table = new RecordTable()
                        {
                            AgeGroup = g, CourseType = c, Sex = s, Disciplines = new List <Discipline>()
                        };
                        if (g.IsOpen())
                        {
                            table.Name = "Landesrekorde";
                        }
                        else if (g.MinimumAge == g.MaximumAge)
                        {
                            table.Name = "Altersrekorde";
                        }
                        else
                        {
                            table.Name = "Altersklassenrekorde";
                        }


                        if (c != CourseType.OpenWater)
                        {
                            var type    = SwimType.Butterfly;
                            var lengths = new int[] { 50, 100, 200 };
                            foreach (int l in lengths)
                            {
                                table.Disciplines.Add(new Discipline(l, type));
                                mSingleStorage.Add(CreateEmptySingleRecordEntry(s, c, g, l, type));
                            }

                            type    = SwimType.Backstroke;
                            lengths = new int[] { 50, 100, 200 };
                            foreach (int l in lengths)
                            {
                                table.Disciplines.Add(new Discipline(l, type));
                                mSingleStorage.Add(CreateEmptySingleRecordEntry(s, c, g, l, type));
                            }

                            type    = SwimType.Breaststroke;
                            lengths = new int[] { 50, 100, 200 };
                            foreach (int l in lengths)
                            {
                                table.Disciplines.Add(new Discipline(l, type));
                                mSingleStorage.Add(CreateEmptySingleRecordEntry(s, c, g, l, type));
                            }

                            type    = SwimType.Freestyle;
                            lengths = new int[] { 50, 100, 200, 400, 800, 1500, 5000, 10000 };
                            foreach (int l in lengths)
                            {
                                table.Disciplines.Add(new Discipline(l, type));
                                mSingleStorage.Add(CreateEmptySingleRecordEntry(s, c, g, l, type));
                            }

                            type = SwimType.Medley;
                            if (c != CourseType.Long)
                            {
                                lengths = new int[] { 100, 200, 400 }
                            }
                            ;
                            else
                            {
                                lengths = new int[] { 200, 400 }
                            };
                            foreach (int l in lengths)
                            {
                                table.Disciplines.Add(new Discipline(l, type));
                                mSingleStorage.Add(CreateEmptySingleRecordEntry(s, c, g, l, type));
                            }

                            mTables.Add(table);
                        }
                        else
                        {
                            //mSingleStorage.Add(CreateEmptySingleRecordEntry(s, c, 1500, SwimType.Freestyle));
                        }
                    }
                }
            }

            //mSingleStorage = new List<SingleRecordEntry>();
            mTeamStorage = new List <TeamRecordEntry>();
        }