public void Include(EntityData otherData) { Alerts.AddRange(otherData.Alerts); EmailAlertRecipients.AddRange(otherData.EmailAlertRecipients); SmsAlertRecipients.AddRange(otherData.SmsAlertRecipients); AlertReports.AddRange(otherData.AlertReports); AlertRules.AddRange(otherData.AlertRules); ApplicationLanguages.AddRange(otherData.ApplicationLanguages); ContentLanguages.AddRange(otherData.ContentLanguages); Countries.AddRange(otherData.Countries); DataCollectors.AddRange(otherData.DataCollectors); Districts.AddRange(otherData.Districts); GatewaySettings.AddRange(otherData.GatewaySettings); HeadManagerConsents.AddRange(otherData.HeadManagerConsents); HealthRisks.AddRange(otherData.HealthRisks); HealthRiskLanguageContents.AddRange(otherData.HealthRiskLanguageContents); Localizations.AddRange(otherData.Localizations); LocalizedTemplates.AddRange(otherData.LocalizedTemplates); NationalSocieties.AddRange(otherData.NationalSocieties); Notifications.AddRange(otherData.Notifications); Projects.AddRange(otherData.Projects); SupervisorUserProjects.AddRange(otherData.SupervisorUserProjects); ProjectHealthRisks.AddRange(otherData.ProjectHealthRisks); RawReports.AddRange(otherData.RawReports); Regions.AddRange(otherData.Regions); Reports.AddRange(otherData.Reports); Users.AddRange(otherData.Users); UserNationalSocieties.AddRange(otherData.UserNationalSocieties); Villages.AddRange(otherData.Villages); Zones.AddRange(otherData.Zones); }
public AirportsViewModel(IEnumerable <string> cities) { Countries.Add(new SelectListItem { Text = "All", Value = "All" }); Countries.AddRange(cities.Select(c => new SelectListItem { Text = c, Value = c })); }
private void RefreshCountries(ICountryRepository countryService) { Countries.AddRange(countryService.GetAll().Select(x => new SelectableViewModelBase <Country>(x))); foreach (var countryViewModel in Countries) { countryViewModel.IsSelectedChanged += IsSelectedChanged; } }
private void LoadResources() { Action loadResources = async() => { User user = UnitOfWork.UserRepository.GetUser(); if (user == null) { // App used for the first time. ShowLoader(AppResources.SplashLoaderTextRegistration); CountrySelection = AppResources.SplashButtonTextSelectCountry; try { cancellationTokenSource = new CancellationTokenSource(); LoaderText = AppResources.SplashLoaderTextCountries; Countries.Clear(); Countries.AddRange(await BumbleApiService.Countries()); ShowCountrySelector(); } catch (Exception e) { base.ShowPopup(CustomPopupMessageType.Error, e.Message, AppResources.CustomPopupGenericOkMessage, null); ShowRetryResources(); } } else if (user.Country == null) { // Changed country. ShowLoader(AppResources.SplashLoaderTextRegistration); CountrySelection = AppResources.SplashButtonTextSelectCountry; try { LoaderText = AppResources.SplashLoaderTextCountries; Countries.Clear(); Countries.AddRange(await BumbleApiService.Countries()); ShowCountrySelector(); } catch (Exception e) { base.ShowPopup(CustomPopupMessageType.Error, e.Message, AppResources.CustomPopupGenericOkMessage, null); ShowRetryResources(); } } else { ShowLoader(AppResources.SplashLoaderTextCheckingForUpdates); SetUserPopupStates(user); // App loaded, check cache if expired. foreach (CacheSetting cacheSetting in UnitOfWork.CacheSettingRepository.GetAllCacheSettings()) { if (cacheSetting.LastRefreshedDateUtc == null || cacheSetting.LastRefreshedDateUtc.Value.AddSeconds(cacheSetting.CacheValidDurationInSeconds) < DateTime.UtcNow) { switch (cacheSetting.ResourceType) { case ResourceType.Operators: try { await DownloadCountryData(user.Country, cacheSetting.LastRefreshedDateUtc); } catch (Exception e) { base.ShowPopup(CustomPopupMessageType.Error, e.Message, AppResources.CustomPopupGenericOkMessage, null); ShowRetryResources(); return; } break; } } } //LoaderText = AppResources.SplashLoaderTextComplete; TryNavigateToStartPage(); } }; DispatcherHelper.CheckBeginInvokeOnUI(loadResources); }