/// <summary> /// Gets a country /// </summary> /// <param name="CountryID">Country identifier</param> /// <returns>Country</returns> public static Country GetCountryByID(int CountryID) { if (CountryID == 0) { return(null); } string key = string.Format(COUNTRIES_BY_ID_KEY, CountryID); object obj2 = NopCache.Get(key); if (CountryManager.CacheEnabled && (obj2 != null)) { return((Country)obj2); } DBCountry dbItem = DBProviderManager <DBCountryProvider> .Provider.GetCountryByID(CountryID); Country country = DBMapping(dbItem); if (CountryManager.CacheEnabled) { NopCache.Max(key, country); } return(country); }
/// <summary> /// Gets a country by three letter ISO code /// </summary> /// <param name="ThreeLetterISOCode">Country three letter ISO code</param> /// <returns>Country</returns> public static Country GetCountryByThreeLetterISOCode(string ThreeLetterISOCode) { DBCountry dbItem = DBProviderManager <DBCountryProvider> .Provider.GetCountryByThreeLetterISOCode(ThreeLetterISOCode); Country country = DBMapping(dbItem); return(country); }
public string GetCountryImageUrl(string countryName) { DBCountry country = _db.Countries.ToList().Find(x => x.CountryName.Equals(countryName)); if (country == null) { return(""); } else { return(country.CountryHtmlImageUrl); } }
/// <summary> /// Inserts a country /// </summary> /// <param name="Name">The name</param> /// <param name="AllowsRegistration">A value indicating whether registration is allowed to this country</param> /// <param name="AllowsBilling">A value indicating whether billing is allowed to this country</param> /// <param name="AllowsShipping">A value indicating whether shipping is allowed to this country</param> /// <param name="TwoLetterISOCode">The two letter ISO code</param> /// <param name="ThreeLetterISOCode">The three letter ISO code</param> /// <param name="NumericISOCode">The numeric ISO code</param> /// <param name="Published">A value indicating whether the entity is published</param> /// <param name="DisplayOrder">The display order</param> /// <returns>Country</returns> public static Country InsertCountry(string Name, bool AllowsRegistration, bool AllowsBilling, bool AllowsShipping, string TwoLetterISOCode, string ThreeLetterISOCode, int NumericISOCode, bool Published, int DisplayOrder) { DBCountry dbItem = DBProviderManager <DBCountryProvider> .Provider.InsertCountry(Name, AllowsRegistration, AllowsBilling, AllowsShipping, TwoLetterISOCode, ThreeLetterISOCode, NumericISOCode, Published, DisplayOrder); Country country = DBMapping(dbItem); if (CountryManager.CacheEnabled) { NopCache.RemoveByPattern(COUNTRIES_PATTERN_KEY); } return(country); }
private static Country DBMapping(DBCountry dbItem) { if (dbItem == null) { return(null); } Country item = new Country(); item.CountryID = dbItem.CountryID; item.Name = dbItem.Name; item.AllowsRegistration = dbItem.AllowsRegistration; item.AllowsBilling = dbItem.AllowsBilling; item.AllowsShipping = dbItem.AllowsShipping; item.TwoLetterISOCode = dbItem.TwoLetterISOCode; item.ThreeLetterISOCode = dbItem.ThreeLetterISOCode; item.NumericISOCode = dbItem.NumericISOCode; item.Published = dbItem.Published; item.DisplayOrder = dbItem.DisplayOrder; return(item); }
public DGVCountry(DBCountry dbCountry, Image countryFlag) : base(dbCountry.CountryName, dbCountry.CountryHtmlImageUrl) { CountryFlag = countryFlag; }
public override void Initialize() { base.Initialize(); dbEntity = new DBCountry(connManager); }