public static List <Country> GetActiveCountry() { CountryCache cache = new CountryCache(HttpContext.Current); List <Country> list = (List <Country>)cache.Value; return(list.FindAll(x => x.Visible == true)); }
public static List <Country> GetSpecificCountry(int countryId) { CountryCache cache = new CountryCache(HttpContext.Current); List <Country> list = (List <Country>)cache.Value; return(list.FindAll(x => x.CountryId == countryId)); }
public GetCountriesQueryHandler(AccountContext context, CountryCache cache, ILoggerService loggerService) { _context = context; _cache = cache; _loggerService = loggerService; }
/// <summary> /// Checks for a country to be valid according to restcountries.eu api. /// </summary> /// <param name="country">The country to check</param> private bool BeValidCountry(string country) { if (string.IsNullOrEmpty(country)) { return(false); } return(CountryCache.Contains(country.ToLower())); }
public void BindCountries() { CountryCache cache = new CountryCache(this.Context); List <CSBusiness.Country> list = (List <CSBusiness.Country>)cache.Value; DropDownListCountry.DataSource = list; DropDownListCountry.DataTextField = "Name"; DropDownListCountry.DataValueField = "CountryId"; DropDownListCountry.DataBind(); }
public static int CountryId(string countryName) { CountryCache cache = new CountryCache(HttpContext.Current); List <Country> list = (List <Country>)cache.Value; Country item = list.FirstOrDefault(x => x.Name == countryName); if (item != null) { return(item.CountryId); } return(-1); }
public static string CountryCode(int countryId) { string countryCode = String.Empty; CountryCache cache = new CountryCache(HttpContext.Current); List <Country> list = (List <Country>)cache.Value; Country item = list.FirstOrDefault(x => x.CountryId == countryId); if (item != null) { countryCode = item.Code; } return(countryCode); }
protected void BindCounty() { List <CSBusiness.Country> MasterList = CountryManager.GetAllMasterCountries(); CountryCache cache = new CountryCache(this.Context); List <CSBusiness.Country> list = (List <CSBusiness.Country>)cache.Value; foreach (CSBusiness.Country item in list) { CSBusiness.Country existItem = MasterList.FirstOrDefault(x => x.CountryId == item.CountryId); if (existItem != null) { MasterList.Remove(existItem); } } ddlProducts.DataSource = MasterList; ddlProducts.DataTextField = "Name"; ddlProducts.DataValueField = "CountryId"; ddlProducts.DataBind(); ddlProducts.Items.Insert(0, new ListItem("Select", "")); }
public static void ResetCountryCache() { CountryCache cache = new CountryCache(HttpContext.Current); cache.RemoveCacheKey(); }
public static List <Country> GetCacheCountry() { CountryCache cache = new CountryCache(HttpContext.Current); return((List <Country>)cache.Value); }