public async Task <List <CountryInfo> > GetCountryInfoByRegion(CountryRegions regions)
        {
            var client  = new RestClient(_options.Value.MarketCheck.Path);
            var path    = $"{_options.Value.CountryCheck.Path}/{CountryRegions.Europe.ToString().ToLower()}";
            var request = new RestRequest(path, Method.GET, DataFormat.Json);

            var result = await client.ExecuteAsync(request);

            return(JsonConvert.DeserializeObject <List <CountryInfo> >(result.Content, new JsonSerializerSettings()
            {
                NullValueHandling = NullValueHandling.Ignore,
                MissingMemberHandling = MissingMemberHandling.Ignore
            }));
        }
        public ActionResult Index(string country)
        {
            //ищем список стран, в которых есть экскурсии
            if (string.IsNullOrEmpty(country))
            {
                var model = new CountriesCatalog()
                {
                    Countries   = GetCountriesList(),
                    Description = "Каталог стран проекта ExGo",
                    Title       = "Каталог стран",
                    Keywords    = "Каталог, купить экскурсию",
                    SeoText     = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
                };

                return(base.View(model));
            }
            else
            {
                var lang      = UrlLanguage.CurrentLanguage;
                var countryId = GetCountryBySlug(country);

                if (countryId.HasValue)
                {
                    var seoFields = SeoObjectProvider.GetSeoObject(countryId.Value, "country", lang);

                    var model = new CountryRegions()
                    {
                        CountryName = country,
                        CountryId   = country,
                        Description = seoFields.Description,
                        Title       = seoFields.Title,
                        Keywords    = seoFields.Keywords,
                        SeoText     = seoFields.SeoText,
                        Regions     = GetCountryRegions(countryId.Value)
                    };

                    return(base.View("country", model));
                }
                else
                {
                    return(RedirectPermanent("/error/404"));
                }
            }
        }
Пример #3
0
        public CongressCandidateSectionViewModel(Entities.Country country)
        {
            Info           = new CongressInfoViewModel(country);
            CountryRegions = CreateSelectList(country.Regions.ToList(), true, "Select Region");
            CountryRegions.Add(new SelectListItem()
            {
                Text = "All regions", Value = "ALL"
            });
            CountryParties = CreateSelectList(country.Parties.ToList(), p => p.Entity.Name, p => p.ID, true, "Select Party");

            var lastVoting = country.GetLastCongressCandidateVoting();

            if (SessionHelper.CurrentEntity.Is(EntityTypeEnum.Citizen))
            {
                CanVote = !lastVoting.HasVoted(SessionHelper.LoggedCitizen) &&
                          lastVoting.VotingStatusID == (int)VotingStatusEnum.Ongoing;
            }

            VotingStatus = (VotingStatusEnum)lastVoting.VotingStatusID;
            CountryID    = country.ID;
            VotingDay    = lastVoting.VotingDay;
            DaysLeft     = lastVoting.VotingDay - GameHelper.CurrentDay;
        }
Пример #4
0
        public static void convertCsvToDictionary(List <dynamic> LocationList, string type)
        {
            foreach (var lcsv in LocationList)
            {
                var    dict     = (IDictionary <string, object>)lcsv;
                string Country  = lcsv.countryregion.ToLower();
                string Province = lcsv.provincestate.ToLower();


                if (!String.IsNullOrEmpty(Country))
                {
                    CountryRegions.Add(Country.ToLower());
                }
                if (!String.IsNullOrEmpty(Province))
                {
                    ProvinceStates.Add(Province.ToLower());
                    LocationKey lk = new LocationKey(Country, Province);
                    if (!CountryProvinces.ContainsKey(Country))
                    {
                        CountryProvinces.Add(Country, new Country());
                    }
                    //CountryProvinces.Add(lk, new Location(Country, Province, new Coordinates(lcsv.Lat, lcsv.Long)));
                    else
                    {
                        if (!CountryProvinces[Country].Provinces.Contains(Province))
                        {
                            CountryProvinces[Country].Provinces.Add(Province);
                        }
                    }
                }



                DateTime firstDate     = DateTime.Parse("1/1/2020");
                DateTime endDate       = DateTime.Now;
                int      daysToAttempt = (endDate - firstDate).Days + 10;


                for (int i = 0; i < daysToAttempt; i++)
                {
                    StatusCount statusCount   = new StatusCount();
                    DateTime    dateToAttempt = firstDate.AddDays(i);
                    string      targetDay     = dateToAttempt.ToString("Mdyy");

                    if (dict.TryGetValue(targetDay, out var count) && !String.IsNullOrEmpty(count.ToString()))
                    {
                        int intcount = int.Parse(count.ToString());
                        if (type == "Confirmed")
                        {
                            statusCount.Confirmed = intcount;
                        }
                        else if (type == "Deaths")
                        {
                            statusCount.Deaths = intcount;
                        }
                        else if (type == "Recovered")
                        {
                            statusCount.Recovered = intcount;
                        }

                        Occurences occurences = new Occurences();
                        occurences.DateOccurrences.Add(dateToAttempt, statusCount);

                        LocationKey location = new LocationKey(Country.ToLower(), Province.ToLower());

                        if (!LocationOccurrences.ContainsKey(location))
                        {
                            LocationOccurrences.Add(location, occurences);
                        }


                        if (!LocationOccurrences[location].DateOccurrences.ContainsKey(dateToAttempt))
                        {
                            LocationOccurrences[location].DateOccurrences[dateToAttempt] = new StatusCount();
                        }

                        if (type == "Confirmed")
                        {
                            LocationOccurrences[location].DateOccurrences[dateToAttempt].Confirmed = statusCount.Confirmed;
                        }
                        else if (type == "Deaths")
                        {
                            LocationOccurrences[location].DateOccurrences[dateToAttempt].Deaths = statusCount.Deaths;
                        }
                        else if (type == "Recovered")
                        {
                            LocationOccurrences[location].DateOccurrences[dateToAttempt].Recovered = statusCount.Recovered;
                        }
                    }
                }
            }
        }