public static IPViewModel GetIpCity(int IntIP) { if (IpCityStore != null) { var item = GetIpCityRecord(IntIP); if (item != null && item.CityId != 0) { var cityinfo = CityStore.get(item.CityId); if (cityinfo != null) { var stateinfo = StateStore.get(cityinfo.State); IPViewModel model = new IPViewModel(); model.Ip = Lib.Helper.IPHelper.FromInt(IntIP); model.City = cityinfo.CityName; if (stateinfo != null) { model.State = stateinfo.StateName; model.CountryCode = CountryCode.FromShort(stateinfo.Country); model.CountryName = CountryCode.GetCountryName(stateinfo.Country); } return(model); } } } return(GetIpCountry(IntIP)); }
public static int GetOrAddCityId(string cityname, string state, string Country) { if (CityStore == null) { return(0); } int stateid = IPLocation.GetOrAddStateId(state, Country); int cityid = Hash.ComputeIntCaseSensitive(cityname); var cityinfo = CityStore.get(cityid); while (cityinfo != null) { if (cityinfo.State == stateid) { return(cityinfo.Id); } else { cityid = Hash.ComputeIntCaseSensitive(cityid.ToString()); cityinfo = CityStore.get(cityid); } } cityinfo = new CityInfo(); cityinfo.Id = cityid; cityinfo.State = stateid; cityinfo.CityName = cityname; IPLocation.CityStore.add(cityid, cityinfo, false); return(cityid); }
public EditModel(CustomerStore customerStore, DniStore dniStore, CityStore cityStore) { this.CustomerStore = customerStore; this.DniStore = dniStore; this.CityStore = cityStore; Cities = CityStore.GetCities(); DocTypes = DniStore.GetDniTypes(); }
public static CityInfo GetCity(int cityid) { if (CityStore != null) { return(CityStore.get(cityid)); } return(null); }