/// <summary> /// Get Location List /// </summary> /// <param name="ctx">client context</param> /// <returns>keyname pair dictionary</returns> internal static Dictionary <int, KeyNamePair> GetAllLocations(VAdvantage.Utility.Ctx ctx) { IDataReader dr = null; int MAX_ROWS = 10000; Dictionary <int, KeyNamePair> locs = new Dictionary <int, KeyNamePair>(); try { dr = VAdvantage.DataBase.DB.ExecuteReader("SELECT * FROM C_Location"); while (dr.Read()) { if (MAX_ROWS > 10000) { break; } MLocation loc = MLocation.Get(ctx, Convert.ToInt32(dr["C_Location_ID"]), null); locs[loc.Get_ID()] = new KeyNamePair(loc.Get_ID(), loc.ToString()); } dr.Close(); } catch { if (dr != null) { dr.Close(); dr = null; } } return(locs); }
/// <summary> /// Get Location List /// </summary> /// <param name="ctx">client context</param> /// <returns>keyname pair dictionary</returns> internal static LocationData GetAllLocations(VAdvantage.Utility.Ctx ctx) { IDataReader dr = null; LocationData locData = new LocationData(); int MAX_ROWS = 10000; int count = 0; Dictionary <int, KeyNamePair> locs = new Dictionary <int, KeyNamePair>(); Dictionary <int, LatLng> lstLatLng = new Dictionary <int, LatLng>(); try { dr = VAdvantage.DataBase.DB.ExecuteReader("SELECT * FROM C_Location"); while (dr.Read()) { if (count > MAX_ROWS) { break; } MLocation loc = MLocation.Get(ctx, Convert.ToInt32(dr["C_Location_ID"]), null); locs[loc.Get_ID()] = new KeyNamePair(loc.Get_ID(), loc.ToString()); lstLatLng[loc.Get_ID()] = new LatLng() { Latitude = loc.GetLatitude(), Longitude = loc.GetLongitude() }; count++; } dr.Close(); } catch { if (dr != null) { dr.Close(); dr = null; } } locData.LocLookup = locs; locData.LocLatLng = lstLatLng; return(locData); }