public static List <Estacion> GetEstacionesAll(double latitud, double longitud) { List <Estacion> returnEST = new List <Estacion>(); List <EstacionEntity> estaciones = Provider.Provider.Estacion.GetEstacionesAll(); Estacion paquete = null; double flag = 0; foreach (EstacionEntity get in estaciones) { double x = Math.Pow(longitud - Convert.ToDouble(get.Longitud), 2); double y = Math.Pow(latitud - Convert.ToDouble(get.Latitud), 2); double Result = Math.Sqrt(x + y); if (flag == 0) { flag = Result; } if (Result < flag) { flag = Result; paquete = new Estacion(get.Numero, get.Idred, get.Nombre, get.EstadoId, get.MunicipioId, get.Productor, get.Latitud, get.Longitud, get.Altitud, get.Inicio, get.InicioParseo); } } returnEST.Add(paquete); return(returnEST); }
public static List <Estacion> GetEstacionesByIdMunicipio(int idmun) { List <Estacion> ListaEstn = new List <Estacion>(); List <EstacionEntity> Estaciones = new List <EstacionEntity>(); //Referencia en archivo SisAletas/Provider Estaciones = Provider.Provider.Estacion.GetEstacionesByIdMunicipio(idmun); foreach (EstacionEntity get in Estaciones) { Estacion esTrucEstacion = new Estacion(get.Numero, get.Idred, get.Nombre, get.EstadoId, get.MunicipioId, get.Productor, get.Latitud, get.Longitud, get.Altitud, get.Inicio, get.InicioParseo); ListaEstn.Add(esTrucEstacion); } return(ListaEstn); }
public static List <Estacion> GetEstacionesDesfaseByEstado(int edo, string fecha) { List <Estacion> ListaEstn = new List <Estacion>(); List <EstacionEntity> Estaciones = new List <EstacionEntity>(); Estaciones = Provider.Provider.Estacion.GetEstacionesDesfaseByEstado(edo, fecha); foreach (EstacionEntity get in Estaciones) { Estacion esTrucEstacion = new Estacion(get.Numero, get.Idred, get.Nombre, get.EstadoId, get.MunicipioId, get.Productor, get.Latitud, get.Longitud, get.Altitud, get.Inicio, get.InicioParseo); ListaEstn.Add(esTrucEstacion); } return(ListaEstn); }