public void ImportGeoLocationList() { IList <ELongGeoLocationAdapter> locals = ELongStaticClient.GetGeoLocationList(); this.OpenSession(); ITransaction tx = this.session.BeginTransaction(); foreach (ELongGeoLocationAdapter local in locals) { System.Console.WriteLine(string.Format("{0}:{1}:{2}:{3}", local.exType, local.exGeoId, local.id, local.name)); if (local.exType == ELongStaticClient.GEO_LOCATION_COMMERCIAL) { GeoCommercialLocationModel temp = new GeoCommercialLocationModel(); temp.from(local); this.session.SaveOrUpdate(temp); } else if (local.exType == ELongStaticClient.GEO_LOCATION_DISTRICTS) { GeoDistrictsModel temp = new GeoDistrictsModel(); temp.from(local); this.session.SaveOrUpdate(temp); } else if (local.exType == ELongStaticClient.GEO_LOCATION_LANDMARK) { GeoLandmarkLocationModel temp = new GeoLandmarkLocationModel(); temp.from(local); this.session.SaveOrUpdate(temp); } } tx.Commit(); this.CloseSession(); }
public void ImportGeoLocationList() { IList<ELongGeoLocationAdapter> locals = ELongStaticClient.GetGeoLocationList(); this.OpenSession(); ITransaction tx = this.session.BeginTransaction(); foreach (ELongGeoLocationAdapter local in locals) { System.Console.WriteLine(string.Format("{0}:{1}:{2}:{3}", local.exType,local.exGeoId,local.id,local.name)); if (local.exType == ELongStaticClient.GEO_LOCATION_COMMERCIAL) { GeoCommercialLocationModel temp = new GeoCommercialLocationModel(); temp.from(local); this.session.SaveOrUpdate(temp); } else if (local.exType == ELongStaticClient.GEO_LOCATION_DISTRICTS) { GeoDistrictsModel temp = new GeoDistrictsModel(); temp.from(local); this.session.SaveOrUpdate(temp); } else if (local.exType == ELongStaticClient.GEO_LOCATION_LANDMARK) { GeoLandmarkLocationModel temp = new GeoLandmarkLocationModel(); temp.from(local); this.session.SaveOrUpdate(temp); } } tx.Commit(); this.CloseSession(); }