public void LoadCurrents(AbsolutePlace place)
        {
            var countries = namazApi.GetCountries();

            countries.ForEach(c => Countries.Add(c));

            if (!string.IsNullOrWhiteSpace(place.Country?.UlkeID) &&
                Countries.Any())
            {
                var selectedCnt = Countries.FirstOrDefault(c => c.UlkeID == place.Country?.UlkeID);
                SelectedCountry = selectedCnt;

                var cities = namazApi.GetCities(selectedCnt.UlkeID);
                cities.ForEach(c => Cities.Add(c));

                if (!string.IsNullOrWhiteSpace(place.City?.SehirID))
                {
                    var selectedCity = Cities.FirstOrDefault(c => c.SehirID == place.City?.SehirID);
                    SelectedCity = selectedCity;

                    var towns = namazApi.GetTowns(selectedCity.SehirID);
                    towns.ForEach(i => Towns.Add(i));
                    if (!string.IsNullOrWhiteSpace(place.Town?.IlceID))
                    {
                        var selectedTown = Towns.FirstOrDefault(t => t.IlceID == place.Town?.IlceID);
                        SelectedTown = SelectedTown;
                    }
                    else
                    {
                        var cityCenter = towns.FirstOrDefault(t => t.IlceAdi == selectedCity.SehirAdi);
                        SelectedTown = cityCenter;
                    }
                }
            }
        }
        public void LoadCountries()
        {
            using var db = new AppDbContext();

            Countries = db.Countries.ToObservableCollection();

            SelectedCountry = Countries.FirstOrDefault(x => x.Alpha3code == Channel.Country);
        }
Example #3
0
 /// <summary>
 /// Obtain ISO3166-1 Country based on its alpha3 code.
 /// </summary>
 /// <param name="alpha3"></param>
 /// <returns></returns>
 public static ISO3166Country FromAlpha3(string alpha3)
 {
     if (string.IsNullOrEmpty(alpha3))
     {
         return(null);
     }
     alpha3 = alpha3.ToUpperInvariant();
     return(Countries.FirstOrDefault(p => p.Alpha3 == alpha3));
 }
        private async Task MakeCountriesList(Sport sportID)
        {
            Sportccbetdata matches = await dataManager.GetAllLiveMatchesForTodayForOneSport(sportID);

            foreach (Category cat in matches.Sports.Sport.Category)
            {
                if (Countries.Count == 0)
                {
                    await GetCountries();
                }
                var country1 = Countries.FirstOrDefault(x => x.Id == cat.Id);
                foreach (Tournament tour in cat.Tournaments)
                {
                    var tournamentGroup = new TournamentGroup()
                    {
                        Name = tour.Name
                    };
                    foreach (Match match in tour.Match)
                    {
                        var   matchIndex = 0;
                        Match obj        = country1.Matches.FirstOrDefault(x => x.Id == match.Id);
                        if (obj == null)
                        {
                            country1.Matches.Add(match);
                            Matches.Add(match);
                            match.CountryID = country1.Id;
                        }
                        else
                        {
                            Matches.Add(match);
                            match.CountryID = country1.Id;
                            matchIndex      = country1.Matches.IndexOf(obj);
                            country1.Matches[matchIndex].Result  = match.Result;
                            country1.Matches[matchIndex].Minutes = match.Minutes;
                        }

                        foreach (Competitor com in match.Competitors.Competitor)
                        {
                            if (com.Type == "1")
                            {
                                match.HomeTeam = com;
                            }
                            if (com.Type == "2")
                            {
                                match.AwayTeam = com;
                            }
                        }
                        if (!Tournaments.Contains(tournamentGroup))
                        {
                            Tournaments.Add(tournamentGroup);
                        }
                    }
                }
                CategoriesWithLiveGames.Add(cat);
            }
        }
Example #5
0
        /// <summary>
        /// Gets the name of the country.
        /// </summary>
        /// <param name="countryId">The country id.</param>
        /// <returns></returns>
        public static string GetCountryName(int countryId)
        {
            var country = Countries.FirstOrDefault(b => b.Id == countryId);

            if (country != null)
            {
                return(country.Name);
            }
            return(string.Empty);
        }
Example #6
0
        /// <summary>
        /// Update <see cref="Country.LawLink"/> by <paramref name="countryName"/> for <see cref="Countries"/>
        /// </summary>
        /// <param name="countryName">Target country name</param>
        /// <param name="lawLink">Target law link</param>
        /// <exception cref="ArgumentNullException">If <paramref name="countryName"/> is null</exception>
        /// <exception cref="ArgumentNullException">
        ///     If contry with name from <paramref name="countryName"/> don`t exist in <see cref="Countries"/>
        /// </exception>
        public static void UpdateCountryLawLink(string countryName, string lawLink = null)
        {
            if (string.IsNullOrWhiteSpace(countryName))
            {
                throw new ArgumentNullException($"Contry name can`t be null or empty!");
            }

            var countryFromList = Countries.FirstOrDefault(c => c.Name == countryName);

            countryFromList.LawLink = lawLink;
        }
Example #7
0
        public MainViewModel(IWebDataProvider webDataProvider)
        {
            LoadedCities    = Tools.JsonDeserialize <List <City> >(@"DataSystem/city.list.json");
            Countries       = Tools.JsonDeserialize <ObservableCollection <CountryInfo> >(@"DataSystem/country.list.json");
            SelectedCountry = Countries.FirstOrDefault();
            Cities          = new ObservableCollection <City>(LoadedCities
                                                              .Where(x => x.Country == SelectedCountry.Alpha2Code)
                                                              .OrderBy(x => x.Name));

            SelectedCity = Cities.FirstOrDefault();
        }
        private void LoadSelectedCountry()
        {
            var selectedCountry = Countries.FirstOrDefault(c => c.Code == CultureName);

            if (selectedCountry != null)
            {
                SelectedCountryId = selectedCountry.Id;
            }
            else
            {
                Context.ChangeCulture(Constants.DefaultCultureName);
            }
        }
        public void FillOracleDataOrgPers(object parameter)// ?????? Сам метод возвращает ViewModel. Как лучше? Возвращать Model и потом мапить во ViewModel или можно так
        {
            _oracleInfoRepository = new AutoFillRepo();
            var org = _oracleInfoRepository.AutoFilKontra(Organization.UNPOrg);

            Organization.FullNameOrg         = org.AutoFillViewModelOrg.FullNameOrg;
            Organization.ShortNameOrg        = org.AutoFillViewModelOrg.ShortNameOrg;
            Organization.CreatedateOrg.Value = org.AutoFillViewModelOrg.CreateDateOrg;
            Person1.HeadName             = org.AutoFillViewModelPers.HeadName;
            Person1.OwnerName            = org.AutoFillViewModelPers.OwnerName;
            Organization.SelectedCountry = Countries.FirstOrDefault(x => x.NameCountry == org.AutoFillViewModelOrg.CountryOrg);
            Person1.SelectedCountry      = Countries.FirstOrDefault(x => x.NameCountry == org.AutoFillViewModelPers.CountryPers);
        }
Example #10
0
        private void UpdateCobuyerAddressWithProspectAddress()
        {
            if (Cobuyer.Prospect.StreetAddress != null)
            {
                StreetAddress = Cobuyer.Prospect.StreetAddress.ShallowCopy();
                ActiveState   = States.FirstOrDefault(p => p.Code == StreetAddress.State);
                ActiveCountry = Countries.FirstOrDefault(p => p.Code == StreetAddress.Country);
            }

            if (Cobuyer.Prospect.HomePhoneNumber != null)
            {
                HomePhoneNumber = Cobuyer.Prospect.HomePhoneNumber.Phone;
            }
        }
        private async Task GetCountries()
        {
            Sportccbetdata scc = await dataManager.GetAllCountries();

            foreach (Country country in scc.CountryList.Countries)
            {
                Country obj = Countries.FirstOrDefault(x => x.Id == country.Id);
                if (obj == null)
                {
                    Countries.Add(country);
                }
            }
            CountriesWithLiveGamesToday = Countries;
        }
        public MovieEditionViewModel(Entities.Movie movie)
        {
            LoadCountries();

            if (movie == null)
            {
                return;
            }

            Id              = movie.Id;
            Name            = movie.Name;
            Year            = movie.Year;
            SelectedCountry = Countries.FirstOrDefault(c => c.Id == movie.CountryId);
        }
        private void SetNextState()
        {
            this.state = this.state != ResultsState.TwelvePoints ? this.state + 1 : ResultsState.RevealCountry;

            if (this.state == ResultsState.SplashScreen)
            {
                Messenger.Default.Send(new ReadyForLateVotesMessage());
            }

            if (this.state == ResultsState.RevealCountry)
            {
                if (Countries.Count(c => c.IsInQueue) > 0)
                {
                    this.currentlyRevealedCountry = GetSelectedCountry();
                }
                else
                {
                    this.state = ResultsState.RevealWinner;
                }
            }

            if (this.state == ResultsState.TwelvePoints)
            {
                if (this.currentlyRevealedCountry != null)
                {
                    this.currentlyRevealedCountry.IsSelected = false;
                    this.currentlyRevealedCountry.IsInQueue  = false;

                    if (Countries.Count(c => c.IsInQueue) > 0)
                    {
                        if (Countries.Count(c => c.IsInQueue && c.IsSelected) == 0)
                        {
                            Countries.First(c => c.IsInQueue).IsSelected = true;
                        }
                    }
                }
            }

            var selectedCountryId = Countries.FirstOrDefault(c => c.IsSelected)?.Id;

            Model.Country nextCountry = null;
            if (selectedCountryId.HasValue)
            {
                nextCountry = dataService.GetCountry(selectedCountryId.Value);
            }

            Messenger.Default.Send(new ChangeStateMessage(this.state, nextCountry));
            NextCommand.RaiseCanExecuteChanged();
        }
Example #14
0
        public async Task LoadCities(string country, string toFind)
        {
            string         json;
            string         id       = Countries.FirstOrDefault(x => x.Value == country).Key;
            HttpWebRequest request  = (HttpWebRequest)WebRequest.Create("https://api.vk.com/method/database.getCities?country_id=" + id + "&need_all=1&count=1000&q=" + toFind);
            WebResponse    response = await Task.Factory.FromAsync <WebResponse>(request.BeginGetResponse, request.EndGetResponse, null);

            using (StreamReader reader = new StreamReader(response.GetResponseStream()))
            {
                json = await reader.ReadLineAsync();
            }
            SimpleVKJSonParser parser = new SimpleVKJSonParser(json);

            Cities = parser.ParseToDictionary("cid", "title");
        }
Example #15
0
        public string GetCountryValue(string countryCode)
        {
            if (!Countries.Any())
            {
                return(null);
            }
            if (string.IsNullOrEmpty(countryCode))
            {
                return(null);
            }

            var country = Countries.FirstOrDefault(c => c.Code.Equals(countryCode, StringComparison.OrdinalIgnoreCase));

            return(country != null ? country.Value : null);
        }
Example #16
0
        /// <summary>
        /// Метод возвращает экземпляр класса <see cref="Country"/> или, если в таблице нет такой записи, создаёт её
        /// </summary>
        /// <param name="name">Название страны</param>
        /// <returns>Экземпляр класса <see cref="Country"/></returns>
        public Country GetCountry(string name)
        {
            var country = Countries.FirstOrDefault(c => c.Name.Equals(name));

            if (country == null)
            {
                country = new Country {
                    Name = name
                };
                Countries.Add(country);
                SaveChanges();
            }

            return(country);
        }
Example #17
0
        /// <summary>
        /// Setter for <see cref="Countries"/>
        /// </summary>
        /// <param name="country">Target country</param>
        /// <exception cref="ArgumentNullException">If <paramref name="country"/> is null</exception>
        /// <exception cref="ArgumentException">
        ///     If contry with name from <paramref name="country"/> already exist in <see cref="Countries"/>
        /// </exception>
        public static void AddCountry(Country country)
        {
            if (country == null)
            {
                throw new ArgumentNullException($"{nameof(country)} can`t be null!");
            }

            var countryFromList = Countries.FirstOrDefault(c => c.Name == country.Name);

            if (countryFromList != null)
            {
                throw new ArgumentException($"Country witn name {country.Name} already exist");
            }

            Countries.Add(country);
        }
Example #18
0
        public string GetCountryCode(string countryValue)
        {
            if (!Countries.Any())
            {
                return(null);
            }
            if (string.IsNullOrEmpty(countryValue))
            {
                return(null);
            }

            var country = Countries.FirstOrDefault(c => c.Translations.Any(t => t.Value != null &&
                                                                           t.Value.Contains(countryValue)));

            return(country != null ? country.Code : null);
        }
Example #19
0
        private void InitializeDatabaseOwnerCompany()
        {
            Companies = new ObservableCollection <Company>();
            Country country = Countries.FirstOrDefault(x => x.Code == "BG");

            Companies.Add(new Company()
            {
                Id              = 1,
                Code            = "1",
                CompanyName     = "Rovaj",
                Address         = "Sofia",
                Country         = country,
                CountryId       = country.Id,
                IsDatabaseOwner = true,
                ZipCode         = "1000"
            });
        }
        public override async Task Initialize()
        {
            FirstName        = Prospect.FirstName;
            LastName         = Prospect.LastName;
            MiddleName       = Prospect.MiddleName;
            NickName         = Prospect.NickName;
            StreetAddress    = Prospect.StreetAddress == null ? new StreetAddress() : Prospect.StreetAddress.ShallowCopy();
            FollowUpSettings = Prospect.FollowUpSettings.ShallowCopy();
            MobilePhone      = Prospect.MobilePhoneNumber == null ? new PhoneNumber() : Prospect.MobilePhoneNumber.ShallowCopy();
            WorkPhone        = Prospect.WorkPhoneNumber == null ? new PhoneNumber() : Prospect.WorkPhoneNumber.ShallowCopy();
            HomePhone        = Prospect.HomePhoneNumber == null ? new PhoneNumber() : Prospect.HomePhoneNumber.ShallowCopy();
            Email            = Prospect.Email == null ? new Email() : Prospect.Email.ShallowCopy();

            _originalProspect = Prospect.ShallowCopy();
            _originalProspect.FollowUpSettings  = FollowUpSettings.ShallowCopy();
            _originalProspect.StreetAddress     = StreetAddress.ShallowCopy();
            _originalProspect.MobilePhoneNumber = MobilePhone.ShallowCopy();
            _originalProspect.WorkPhoneNumber   = WorkPhone.ShallowCopy();
            _originalProspect.HomePhoneNumber   = HomePhone.ShallowCopy();
            _originalProspect.Email             = Email.ShallowCopy();

            Prefixes     = (await _userDefinedCodeService.GetPrefixUserDefinedCodes()).ToObservableCollection();
            ActivePrefix = Prefixes.FirstOrDefault(p => p.Description1 == Prospect.NamePrefix);

            Suffixes     = (await _userDefinedCodeService.GetSuffixUserDefinedCodes()).ToObservableCollection();
            ActiveSuffix = Suffixes.FirstOrDefault(p => p.Description1 == Prospect.NameSuffix);

            ContactPreferences      = (await _userDefinedCodeService.GetContactPreferenceUserDefinedCodes()).ToObservableCollection();
            ActiveContactPreference = ContactPreferences.FirstOrDefault(p => p.Description1 == Prospect.FollowUpSettings.PreferredContactMethod);

            ExcludeReasons      = (await _userDefinedCodeService.GetExcludeReasonUserDefinedCodes()).ToObservableCollection();
            ActiveExcludeReason = ExcludeReasons.FirstOrDefault(p => p.Code == Prospect.FollowUpSettings.ExcludeReason);

            States      = (await _userDefinedCodeService.GetStateUserDefinedCodes()).ToObservableCollection();
            ActiveState = Prospect.StreetAddress != null?States.FirstOrDefault(p => p.Code == Prospect.StreetAddress.State) : null;

            Countries     = (await _userDefinedCodeService.GetCountryUserDefinedCodes()).ToObservableCollection();
            ActiveCountry = Prospect.StreetAddress != null?Countries.FirstOrDefault(p => p.Code == Prospect.StreetAddress.Country) : null;

            TrafficSources      = (await _trafficSourceService.GetTrafficSourcesByDivision(Prospect.ProspectCommunity.Division)).ToObservableCollection();
            ActiveTrafficSource = TrafficSources.FirstOrDefault(t => t.TrafficSourceDetails.Any(td => td.CodeId == Prospect.TrafficSourceCodeId));
            if (ActiveTrafficSource != null)
            {
                ActiveTrafficSourceDetail = ActiveTrafficSource.TrafficSourceDetails.First(td => td.CodeId == Prospect.TrafficSourceCodeId);
            }
        }
Example #21
0
        private void SelectForUpdate(object obj)
        {
            updateModel                            = UpdateMapper.OrganizationViewModelToOrganizationModel(this);
            kontragentModelUpdate                  = upsateRepo.FindOrgForUpdate(updateModel);
            Organization.UNPOrg                    = kontragentModelUpdate.OrgForUpdate?.UNPOrg;
            Organization.FullNameOrg               = kontragentModelUpdate.OrgForUpdate?.FullNameOrg;
            Organization.ShortNameOrg              = kontragentModelUpdate.OrgForUpdate?.ShortNameOrg;
            Organization.BrokerOpinion             = kontragentModelUpdate.OrgForUpdate?.BrokerOpinion;
            Organization.AuditorOpinion            = kontragentModelUpdate.OrgForUpdate?.AuditorOpinion;
            Organization.SectionHeadOpinion        = kontragentModelUpdate.OrgForUpdate?.SectionHeadOpinion;
            Organization.DescriptionOrg            = kontragentModelUpdate.OrgForUpdate?.DescriptionOrg;
            Organization.CreateDateOrg             = kontragentModelUpdate.OrgForUpdate.CreateDateOrg;
            Organization.SelectedCountry           = Countries.FirstOrDefault(x => x.NameCountry == kontragentModelUpdate.OrgForUpdate.CountyrOrg);
            Organization.SelectedSection           = Section.FirstOrDefault(x => x.NameSection == kontragentModelUpdate.OrgForUpdate.NameSection);
            Organization.OwnershipOrg              = kontragentModelUpdate.OrgForUpdate.OwnershipOrg;
            Organization.TaxDebt                   = kontragentModelUpdate.OrgForUpdate.TaxDebt;
            Organization.DebtsEnforcementDocuments = kontragentModelUpdate.OrgForUpdate.DebtsEnforcementDocuments;
            Organization.FalseBusiness             = kontragentModelUpdate.OrgForUpdate.FalseBusiness;
            Organization.SpecialRisc               = kontragentModelUpdate.OrgForUpdate.SpecialRisc;
            Organization.ExecuteProc               = kontragentModelUpdate.OrgForUpdate.ExecuteProc;
            Organization.BankruptcyProc            = kontragentModelUpdate.OrgForUpdate.BankruptcyProc;
            Organization.LiquidationProc           = kontragentModelUpdate.OrgForUpdate.LiquidationProc;
            Organization.BrokerClient              = kontragentModelUpdate.OrgForUpdate.BrokerClient;
            Organization.PrevBrokerClient          = kontragentModelUpdate.OrgForUpdate.PrevBrokerClient;
            Organization.Manufacturer              = kontragentModelUpdate.OrgForUpdate.Manufacturer;
            Organization.NegativData               = kontragentModelUpdate.OrgForUpdate.NegativData;
            Organization.Reputation                = kontragentModelUpdate.OrgForUpdate.Reputation;
            Organization.ExchengeTradingDisorders  = kontragentModelUpdate.OrgForUpdate.ExchengeTradingDisorders;
            Organization.SecondAccred              = kontragentModelUpdate.OrgForUpdate.SecondAccred;
            Organization.ForcedDeposite            = kontragentModelUpdate.OrgForUpdate.ForcedDeposite;
            Organization.Deposit                   = kontragentModelUpdate.OrgForUpdate.Deposit;
            Organization.RecomendDeposit           = kontragentModelUpdate.OrgForUpdate.RecomendDeposit;
            Person.DescriptionPers                 = kontragentModelUpdate.PersForUpdate?.DescriptionPers;
            Person.HeadName                        = kontragentModelUpdate.PersForUpdate?.HeadName;
            Person.OwnerName                       = kontragentModelUpdate.PersForUpdate?.OwnerName;
            Person.SelectedCountry                 = Countries.FirstOrDefault(x => x.NameCountry == kontragentModelUpdate.PersForUpdate.СountryPers);
            Person.PrevLiquidated                  = kontragentModelUpdate.PersForUpdate.PrevBankruptcy;
            Person.PrevBankruptcy                  = kontragentModelUpdate.PersForUpdate.PrevBankruptcy;
            Person.PrevStateDebt                   = kontragentModelUpdate.PersForUpdate.PrevStateDebt;
            Person.PrevTaxDebt                     = kontragentModelUpdate.PersForUpdate.PrevTaxDebt;
            Person.PrevExecuteProc                 = kontragentModelUpdate.PersForUpdate.PrevExecuteProc;
            Person.NegativDataPers                 = kontragentModelUpdate.PersForUpdate.NegativDataPers;

            Organization.RiskLevel = kontragentModelUpdate.OrgForUpdate.RiscLevel.ToString();
        }
        public Bag Translate(Thee source)
        {
            var teabrand   = Brands.FirstOrDefault(brand => brand.Name == source.TheeMerk.Trim());
            var teabagType = BagTypes.FirstOrDefault(bagType => bagType.Name == source.TheeSoortzakje.Trim());
            var teacountry = Countries.FirstOrDefault(country => country.Name == source.TheeLandvanherkomst.Trim());

            return(new Bag(null,
                           "36544cc9-36ae-42c0-b614-a5a2010d4258",
                           source.MainID,
                           new Domain.RefValue(teabrand.Id, teabrand.Name),
                           source.TheeSerie.Trim(),
                           source.TheeSmaak.Trim(),
                           source.TheeKenmerken.Trim(),
                           teabagType != null ? new Domain.RefValue(teabagType.Id, teabagType.Name) : null,
                           teacountry != null ? new Domain.RefValue(teacountry.Id, teacountry.Name) : null,
                           source.TheeSerienummer.Trim(),
                           ParseInvoerDatum(source),
                           Images.FirstOrDefault(image => image.Filename == $"{source.MainID}.jpg")?.Id));
        }
Example #23
0
        private void InitializeContacts()
        {
            Contacts = new ObservableCollection <Contact>();
            Country country = Countries.FirstOrDefault(x => x.Code == "BG");
            Company company = Companies.FirstOrDefault(x => x.Id == 1);

            Contacts.Add(new Contact()
            {
                Id        = 1,
                Name      = "Rovaj",
                Surname   = "Vorodot",
                Family    = "Vehsarba",
                Address   = "Sofia",
                ZipCode   = "1000",
                CompanyId = 1,
                Email     = "*****@*****.**",
                Country   = country,
                CountryId = country.Id,
                Phone     = "+35988888888888888",
                Company   = company,
            });
        }
Example #24
0
        public override async Task Initialize()
        {
            _user = await _userService.GetLoggedInUser();

            _originalCobuyer = Cobuyer.ShallowCopy();
            _originalCobuyer.StreetAddress     = StreetAddress.ShallowCopy();
            _originalCobuyer.MobilePhoneNumber = MobilePhone.ShallowCopy();
            _originalCobuyer.WorkPhoneNumber   = WorkPhone.ShallowCopy();
            _originalCobuyer.HomePhoneNumber   = HomePhone.ShallowCopy();
            _originalCobuyer.Email             = Email.ShallowCopy();

            Prefixes     = (await _userDefinedCodeService.GetPrefixUserDefinedCodes()).ToObservableCollection();
            ActivePrefix = Prefixes.FirstOrDefault(p => p.Description1 == Cobuyer.NamePrefix);

            Suffixes     = (await _userDefinedCodeService.GetSuffixUserDefinedCodes()).ToObservableCollection();
            ActiveSuffix = Suffixes.FirstOrDefault(p => p.Description1 == Cobuyer.NameSuffix);

            States      = (await _userDefinedCodeService.GetStateUserDefinedCodes()).ToObservableCollection();
            ActiveState = Cobuyer.StreetAddress != null?States.FirstOrDefault(p => p.Code == Cobuyer.StreetAddress.State) : null;

            Countries     = (await _userDefinedCodeService.GetCountryUserDefinedCodes()).ToObservableCollection();
            ActiveCountry = Cobuyer.StreetAddress != null?Countries.FirstOrDefault(p => p.Code == Cobuyer.StreetAddress.Country) : null;
        }
        public TestValuesModel GetSignificatives(int singificativeId)
        {
            List <TestValues> testValues = new List <TestValues>();

            try
            {
                Countries         = Context.Countries.ToList();
                ElementOfSections = Context.ElementOfSections
                                    .Join(Context.ElementOfSectionSignificates,
                                          sign => sign.ElementOfSectionId,
                                          el => el.ElementOfSectionId,
                                          (el, sign) => el)
                                    .GroupBy(x => x.ElementOfSectionName)
                                    .Select(x => x.FirstOrDefault())
                                    .ToList();
                ElementOfSectionSignificates = Context.ElementOfSectionSignificates.Where(x => x.SignificativeId == singificativeId).ToList();
                foreach (var record in ElementOfSectionSignificates)
                {
                    testValues.Add(new TestValues
                    {
                        Value            = record.Count,
                        Country          = Countries.FirstOrDefault(x => x.CountryId == record.CountryId).CountryName,
                        ElementOfSection = ElementOfSections.FirstOrDefault(x => x.ElementOfSectionId == record.ElementOfSectionId).ElementOfSectionName
                    });
                }
            }
            catch (Exception e)
            {
            }
            return(new TestValuesModel
            {
                Countries = Countries.Select(x => x.CountryName).ToList(),
                Years = ElementOfSections.Select(x => x.ElementOfSectionName).ToList(),
                TestValues = testValues
            });
        }
Example #26
0
        /// <summary>
        /// Update <see cref="Company"/> by <paramref name="companyName"/> for <see cref="Companies"/>
        /// </summary>
        /// <param name="companyName">Target company name</param>
        /// <param name="description">Target description</param>
        /// <param name="countryName">Target country name</param>
        /// <param name="photo">Target photo</param>
        /// <exception cref="ArgumentNullException">If <paramref name="companyName"/> is null</exception>
        /// <exception cref="ArgumentNullException">
        ///     If company with name <paramref name="companyName"/> don`t exist in <see cref="Companies"/>
        /// </exception>
        /// <exception cref="ArgumentException">
        ///     Country with name <paramref name="countryName"/> don`t exist in <see cref="Countries"/>
        /// </exception>
        public static void UpdateCompany(Company company)
        {
            if (string.IsNullOrWhiteSpace(company.Name))
            {
                throw new ArgumentNullException($"Company name can`t be null or empty!");
            }

            var companyFromList = Companies.FirstOrDefault(c => c.Name == company.Name);

            if (company.CountryOfFoundation != Guid.Empty)
            {
                Country country = Countries.FirstOrDefault(c => c.Id == company.CountryOfFoundation);

                if (country == null)
                {
                    throw new ArgumentException($"Country with name {company.CountryOfFoundation} don`t exist!");
                }

                companyFromList.CountryOfFoundation = companyFromList.Id;
            }

            companyFromList.Description = company.Description;
            companyFromList.Photo       = company.Photo;
        }
Example #27
0
 public MyDataContext()
 {
     Data         = AllPlayers;
     SelectedItem = Countries.FirstOrDefault();
 }
Example #28
0
 private void LoadCurrentCountyDepartmentCity()
 {
     Country    = Countries.FirstOrDefault(c => c.Departments.FirstOrDefault(d => d.Cities.FirstOrDefault(ci => ci.Id == User.City.Id) != null) != null);
     Department = Country.Departments.FirstOrDefault(d => d.Cities.FirstOrDefault(c => c.Id == User.City.Id) != null);
     City       = Department.Cities.FirstOrDefault(c => c.Id == User.City.Id);
 }
Example #29
0
 /// <summary>
 /// Obtain ISO3166-1 Country based on its alpha3 code.
 /// </summary>
 /// <param name="numericCode"></param>
 /// <returns></returns>
 public static ISO3166Country FromNumericCode(int numericCode)
 {
     return(Countries.FirstOrDefault(p => p.NumericCode == numericCode));
 }
Example #30
0
 protected override Task MapEditedItemToEditor(City item)
 {
     SelectedCountry = Countries.FirstOrDefault(e => e.Id == item.CountryId);
     return(base.MapEditedItemToEditor(item));
 }