Пример #1
0
 public bool Equals(Division other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return Equals(other.Id, Id);
 }
        List<Division> GenerateDivisions(string companyId, ICommand src)
        {
            var commands = new List<DivisionCreateCommand>();
            var sizes = new[] { "", "Small", "Large" };

            var names = new[] { "Tiny", "Mini", "Youth", "Junior" };
            var list = GenerateDivisionCommands(new[] { "", "Coed" }, names, "hiphopprep");
            commands.AddRange(list);

            names = new[] { "Tiny", "Mini", "Youth", "Junior", "Senior", "Open" };
            list = GenerateDivisionCommands(new[] { "", "Coed" }, names, "danceprep");
            commands.AddRange(list);

            list = GenerateDivisionCommands(new[] { "", "Coed" }, names, "crew");
            commands.AddRange(list);

            list = GenerateDivisionCommands(new[] { "", "Coed" }, names, "hiphop");
            commands.AddRange(list);

            list = GenerateDivisionCommands(new[] { "", "Coed" }, names, "dance");
            commands.AddRange(list);

            names = new[] { "Elementary", "Junior High" };
            list = GenerateDivisionCommands(new[] { "" }, names, "school");
            commands.AddRange(list);

            names = new[] { "Novice", "Intermediate", "Advanced" };
            list = GenerateDivisionCommands(new[] { "" }, names, "highschool");
            commands.AddRange(list);

            names = new[] { "Novice", "Intermediate", "Advanced" };
            list = GenerateDivisionCommands(new[] { "" }, names, "college");
            commands.AddRange(list);

            names = new[] { "Tiny", "Mini", "Youth", "Junior", "Senior" };
            var levels = new[] { "cheerprep1", "cheerprep2", "cheerprep3" };
            list = GenerateDivisionCommands(sizes, names, levels);
            commands.AddRange(list);

            levels = new[] { "clubcheernovice", "clubcheerintermediate", "clubcheeradvanced" };
            list = GenerateDivisionCommands(sizes, names, levels);
            commands.AddRange(list);

            levels = new[] { "gamerecnovice", "gamerecintermediate", "gamerecadvanced" };
            list = GenerateDivisionCommands(sizes, names, levels);
            commands.AddRange(list);

            names = new[] { "Tiny", "Mini", "Youth", "Junior", "Senior" };
            list = GenerateDivisionCommands(sizes, names, "1");
            commands.AddRange(list);

            names = new[] { "Mini", "Youth", "Junior", "Senior" };
            list = GenerateDivisionCommands(sizes, names, "2");
            commands.AddRange(list);

            names = new[] { "Youth", "Junior", "Senior", "Senior Coed", "Open" };
            list = GenerateDivisionCommands(sizes, names, "3");
            commands.AddRange(list);

            names = new[] { "Youth", "Junior", "Senior", "Senior Coed", "Open" };
            list = GenerateDivisionCommands(sizes, names, "4");
            commands.AddRange(list);

            names = new[] { "Senior 4.2" };
            list = GenerateDivisionCommands(sizes, names, "4", "scoring-division42");
            commands.AddRange(list);

            names = new[] { "Youth", "Junior" };
            list = GenerateDivisionCommands(sizes, names, "5");
            commands.AddRange(list);

            names = new[] { "Senior", "Open", "Open Coed" };
            list = GenerateDivisionCommands(new[] { "", "Small", "Medium", "Large" }, names, "5");
            commands.AddRange(list);

            names = new[] { "Senior Coed" };
            list = GenerateDivisionCommands(new[] { "", "Small", "Medium", "Large" }, names, "5");
            commands.AddRange(list);

            names = new[] { "International Open", "International Open Coed", "Worlds" };
            list = GenerateDivisionCommands(new[] { "" }, names, "5");
            commands.AddRange(list);

            names = new[] { "Senior Restricted" };
            list = GenerateDivisionCommands(sizes, names, "5", "scoring-restricted5");
            commands.AddRange(list);

            names = new[] { "Open", "Open Coed" };
            list = GenerateDivisionCommands(sizes, names, "6");
            commands.AddRange(list);

            names = new[] { "Special Needs" };
            list = GenerateDivisionCommands(new[] { "" }, names, "specialneeds");
            commands.AddRange(list);

            names = new[] { "Parents" };
            list = GenerateDivisionCommands(new[] { "" }, names, "parents");
            commands.AddRange(list);

            commands.ForEach(x =>
            {
                x.LevelId = Level.FormatId(companyId) + x.LevelId;
                x.CommandCompanyId = companyId;
                x.CommandByUser = src.CommandByUser;
                x.CommandWhen = src.CommandWhen;

            });

            var divisions =
                commands
                    .Select(command =>
                    {
                        var division = new Division();
                        division.Update(command);
                        return division;
                    })
                    .ToList();

            return divisions;
        }