Exemple #1
0
        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);
        }
Exemple #2
0
 static IPLocation()
 {
     IPLocation.InitDatabase(false);
 }
Exemple #3
0
 public static void RenewDataBase()
 {
     IPLocation.InitDatabase(false);
 }