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(); }
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); }
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(); } }
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 ..."; }
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(); } }
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(); }
/// <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();
/// <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))); }