コード例 #1
0
        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();
        }
コード例 #2
0
        private void SetBestInCounts()
        {
            var pups = Registrations.Where(r =>
                                           r.Group == CompetitionClass.Categories.SixMonths ||
                                           r.Group == CompetitionClass.Categories.NineMonths);
            var pupGroups = pups.GroupBy(p => p.Breed);

            var adults = Registrations.Where(r =>
                                             r.Group == CompetitionClass.Categories.NineToFifteenMonths ||
                                             r.Group == CompetitionClass.Categories.FifteenToTwentyFourMonths ||
                                             r.Group == CompetitionClass.Categories.FifteenMonths);
            var adultGroups = adults.GroupBy(p => p.Breed);

            var veterans = Registrations.Where(r =>
                                               r.Group == CompetitionClass.Categories.EightYears);
            var veteranGroups = veterans.GroupBy(p => p.Breed);

            // BIR (Best In Race) valp(2 klasser?)/vuxen(3 klasser!)/veteran per ras
            PupBestInRaceCount     = GetBirCount(pups);
            AdultBestInRaceCount   = GetBirCount(adults);
            VeteranBestInRaceCount = GetBirCount(veterans);

            // BIM (Best I Motsatt kön) om, minst, en hane och en hona i samma ras och klasser
            PupBestInMotsattKönCount     = GetGroupBimCount(pupGroups);
            AdultBestInMotsattKönCount   = GetGroupBimCount(adultGroups);
            VeteranBestInMotsattKönCount = GetGroupBimCount(veteranGroups);
        }
コード例 #3
0
 public void Unregister(object registrant)
 {
     Event.WaitOne();
     try
     {
         var removeList = (from item in Registrations from action in item.Value where action.Registrant == registrant select action).ToList();
         foreach (var item in removeList)
         {
             var closeItem = item;
             closeItem.Dispose();
             foreach (var registration in Registrations.Where(r => r.Value.Contains(closeItem)).ToList())
             {
                 try
                 {
                     registration.Value?.Remove(closeItem);
                 }
                 catch
                 {
                 }
             }
         }
     }
     finally
     {
         Event.Set();
     }
 }
コード例 #4
0
 public void Submit()
 {
     submitted = true;
     foreach (RegistrationInfo i in Registrations.Where(x => x.Register))
     {
         data.Login(new FundRegistration {
             Id = FundID, FundAssets = i.Budget, Shares = 0
         }, i.ExchangeName);
     }
     data.Login(new FundRegistration {
         Id = FundID, FundAssets = MainBudget, Shares = MainShares
     }, MainExchange);
     ButtonText = "Waiting for confirmation ...";
 }
コード例 #5
0
 public void OnNewFundDepotAvailable(FundDepot depot)
 {
     if (locator.Funds == null)
     {
         locator.Funds = new List <FundDepot>();
     }
     locator.Funds.Add(depot);
     confirmedCounter++;
     if (confirmedCounter == Registrations.Where(x => x.Register).Count())
     {
         Messenger.Default.Send <NotificationMessage>(new NotificationMessage(this, "Close"));
         var MainWindow = new MainWindow();
         MainWindow.Show();
         this.Cleanup();
     }
 }
コード例 #6
0
        public void Submit()
        {
            ButtonText = "Waiting for confirmation ...";
            foreach (RegistrationInfo i in Registrations.Where(x => x.Register))
            {
                data.Login(new InvestorRegistration()
                {
                    Email = Email, Budget = i.Budget
                }, i.ExchangeName);
            }
            ((ViewModelLocator)App.Current.Resources["Locator"]).RegisteredExchanges = Registrations.Where(x => x.Register).Select(x => x.ExchangeName);
            Messenger.Default.Send <NotificationMessage>(new NotificationMessage(this, "Close"));
            var MainWindow = new MainWindow();

            MainWindow.Show();
            this.Cleanup();
        }
コード例 #7
0
 /// <summary>
 /// Get registration by social security number (SSN) and PIN
 /// </summary>
 /// <param name="ssn">Social Security Number</param>
 /// <param name="pin">PIN code</param>
 /// <returns>
 /// Registration result or null if no registration with given SSN and PIN was found.
 /// </returns>
 public async Task <GetRegistrationResult?> GetRegistration(long ssn, int pin)
 => await Registrations.Where(r => r.SocialSecurityNumber == ssn && r.PinCode == pin)
 .Select(r => new GetRegistrationResult(r.Id, r.SocialSecurityNumber, r.FirstName, r.LastName))
 .FirstOrDefaultAsync();
コード例 #8
0
 /// <summary>
 /// Gets the registrations for.
 /// </summary>
 /// <param name="serviceType">Type of the service.</param>
 /// <returns></returns>
 public IEnumerable <ServiceRegistration> GetRegistrationsFor(Type serviceType)
 {
     return(Registrations
            .Where(x => serviceType.IsAssignableFrom(x.ServiceType)));
 }