internal void UpdateRegistrations()
        {
            Registrations = Persistence.Load();
            SetRegistrationNumbers();

            SortedRegistrations = new List <Registration>(Registrations).OrderBy(r => r.CompetitionNumber);


            Emails = Registrations.Any()
                ? Registrations.Select(x => x.OwnerEmail).Aggregate((y, z) => y + ";" + z)
                : string.Empty;

            SixMonthsCount                 = Registrations.Where(r => r.Group == CompetitionClass.Categories.SixMonths).Count();
            NineMonthsCount                = Registrations.Where(r => r.Group == CompetitionClass.Categories.NineMonths).Count();
            NineToFifteenMonthsCount       = Registrations.Where(r => r.Group == CompetitionClass.Categories.NineToFifteenMonths).Count();
            FifteenToTwentyFourMonthsCount = Registrations.Where(r => r.Group == CompetitionClass.Categories.FifteenToTwentyFourMonths).Count();
            FifteenMonthsCount             = Registrations.Where(r => r.Group == CompetitionClass.Categories.FifteenMonths).Count();
            EightYearsCount                = Registrations.Where(r => r.Group == CompetitionClass.Categories.EightYears).Count();
            TotalCount = Registrations.Count();

            GroupUnknownCount = Registrations.Where(r => r.CompetitionGroup == CompetitionGroup.Groups.Unknown).Count();
            GroupOneCount     = Registrations.Where(r => r.CompetitionGroup == CompetitionGroup.Groups.One).Count();
            GroupTwoCount     = Registrations.Where(r => r.CompetitionGroup == CompetitionGroup.Groups.Two).Count();
            GroupThreeCount   = Registrations.Where(r => r.CompetitionGroup == CompetitionGroup.Groups.Three).Count();
            GroupFourCount    = Registrations.Where(r => r.CompetitionGroup == CompetitionGroup.Groups.Four).Count();
            GroupFiveCount    = Registrations.Where(r => r.CompetitionGroup == CompetitionGroup.Groups.Five).Count();
            GroupSixCount     = Registrations.Where(r => r.CompetitionGroup == CompetitionGroup.Groups.Six).Count();
            GroupSevenCount   = Registrations.Where(r => r.CompetitionGroup == CompetitionGroup.Groups.Seven).Count();
            GroupEightCount   = Registrations.Where(r => r.CompetitionGroup == CompetitionGroup.Groups.Eight).Count();
            GroupNineCount    = Registrations.Where(r => r.CompetitionGroup == CompetitionGroup.Groups.Nine).Count();
            GroupTenCount     = Registrations.Where(r => r.CompetitionGroup == CompetitionGroup.Groups.Ten).Count();

            SetBestInCounts();
            SetBreedCounts();
        }
 /// <summary>
 /// Convert to service model
 /// </summary>
 /// <returns></returns>
 public TrustGroupRegistrationListModel ToServiceModel()
 {
     return(new TrustGroupRegistrationListModel {
         Registrations = Registrations?
                         .Select(g => g.ToServiceModel())
                         .ToList(),
         NextPageLink = NextPageLink,
     });
 }
Example #3
0
        //public interface ITestEntityMapping
        //{

        //}

        //public class TestEntityMapping
        //    : ITestEntityMapping
        //{

        //}


        //public class TestEntityMapping2
        //            : TestEntityMapping
        //{

        //}

        ////public class TestEntityMapping3
        ////            : TestEntityMapping2
        ////{

        ////}

        ////public class TestEntityMapping4
        ////            : ITestEntityMapping
        ////{

        ////}

        ////public class TestEntityMapping5
        ////        : ITestEntityMapping
        ////{

        ////}

        protected virtual void RegisterDependencies(IConfigurationSectionHandler config, TestClassConfigOptions opts = null)
        {
            if (opts == null)
            {
                opts = new TestClassConfigOptions();
            }


            var builder   = new ContainerBuilder();
            var container = builder.Build();

            this._containerManager = new ContainerManager(container);

            //dependencies
            var typeFinder = new WebAppTypeFinder();

            builder = new ContainerBuilder();
            builder.RegisterInstance(typeFinder).As <ITypeFinder>().SingleInstance();

            builder
            .Register <IDbContext>(c => new ReposContext("ReposContext"))
            .InstancePerLifetimeScope();

            //builder.RegisterType<TestEntityMapping>()
            //    .As<ITestEntityMapping>()
            //    .InstancePerLifetimeScope();

            builder.Update(container);

            typeFinder.AssemblySkipLoadingPattern =
                "^Test^System" + "|^mscorlib" + "|^Microsoft" +
                "|^AjaxControlToolkit" + "|^Antlr3" + "|^Autofac" +
                "|^AutoMapper" + "|^Castle" + "|^ComponentArt" +
                "|^CppCodeProvider" + "|^DotNetOpenAuth" + "|^EntityFramework" +
                "|^EPPlus" + "|^FluentValidation" + "|^ImageResizer" +
                "|^itextsharp" + "|^log4net" + "|^MaxMind" +
                "|^MbUnit" + "|^MiniProfiler" + "|^Mono.Math" +
                "|^MvcContrib" + "|^Newtonsoft" + "|^NHibernate" +
                "|^nunit" + "|^Org.Mentalis" + "|^PerlRegex" +
                "|^QuickGraph" + "|^Recaptcha" + "|^Remotion" +
                "|^RestSharp" + "|^Rhino" + "|^Telerik" +
                "|^Iesi" + "|^TestDriven" + "|^TestFu" +
                "|^UserAgentStringLibrary" + "|^VJSharpCodeProvide" + "r|^WebActivator" +
                "|^WebDev" + "|^WebGrease";


            var drInstances = new List <IDependencyRegistrar>();

            var drTypes = typeFinder.FindClassesOfType <IDependencyRegistrar>().AsEnumerable();


            foreach (var drType in drTypes)
            {
                drInstances.Add((IDependencyRegistrar)Activator.CreateInstance(drType));
            }

            foreach (var regtype in Enum.GetValues(typeof(RegType)))
            {
                foreach (var dependencyRegistrar in drInstances
                         .Where(w => w.RegisterType.ToString() == regtype.ToString())
                         .OrderBy(o => o.Order))
                {
                    var depAssmName  = dependencyRegistrar.GetType().Assembly.FullName;
                    var thisAssmName = this.GetType().Assembly.FullName;

                    if (depAssmName == thisAssmName)
                    {
                        continue;
                    }

                    bool execute = false;
                    switch (dependencyRegistrar.RegisterType)
                    {
                    case RegType.baseReg:
                    case RegType.common:
                    case RegType.handlers:
                    case RegType.edits:
                    case RegType.filters:
                    case RegType.rules:

                        execute = true;
                        break;

                    default:

                        break;
                    }

                    if (!execute)
                    {
                        continue;
                    }

                    builder = new ContainerBuilder();


                    dependencyRegistrar.Register(builder, container, typeFinder, config, opts);

                    builder.Update(container);
                }
            }
            Registrations = container
                            .ComponentRegistry
                            .Registrations
                            .Select(r => r.Activator.LimitType);

            //var HandlerTypes = EngineContext
            //                      .Current
            //                      .ContainerManager
            //                      .Resolve<ITypeFinder>()
            //                      .FindClassesOfType<IHandler>()
            //                      .Where(w => typeof(IGenericHandler).IsAssignableFrom(w)
            //                             ||   typeof(IServiceHandler).IsAssignableFrom(w));

            Dups = Registrations
                   .Select(s => s)
                   //.GroupBy(g => new { g.Name,g.Assembly.FullName })
                   .GroupBy(g => new { g.Name })
                   .Where(w => w.Skip(1).Any() && 1 == 2)
                   .SelectMany(sm => sm);
        }
Example #4
0
 public bool IsRegistered(object t)
 {
     return(Registrations.Select(item => item.Value).Any(v => v.Any(vItem => vItem.Registrant == t)));
 }