public DTResultadoOperacionList <DTCapitan> ConsultarCapitan() { DTResultadoOperacionList <DTCapitan> ResultList = new DTResultadoOperacionList <DTCapitan>(); ResultList = new DMCapitan().consultarCapitanes(); return(ResultList); }
public DTResultadoOperacionList <DTViaje> consultarViajes() { DTResultadoOperacionList <DTViaje> ResultList = new DTResultadoOperacionList <DTViaje>(); List <DTViaje> ResultadoReporte = new List <DTViaje>(); DMPuerto _puerto = new DMPuerto(); DMBarco _barco = new DMBarco(); DMCapitan _capitan = new DMCapitan(); try { using (StreamReader file = new StreamReader(NOMBRE_ARCHIVO, true)) //se crea el archivo { String line; line = file.ReadLine(); //Continue to read until you reach end of file while (line != null) { DTViaje _viaje = new DTViaje(); //write the line to console Console.WriteLine(line); _viaje = viajeRegistro2Objeto(line); //_viaje.PuertoOrigen = dmPuerto.consultarPuertoPorId(_viaje.idPuertoOrigen); _viaje.PuertoOrigen = _puerto.consultarPuertoPorId(_viaje.idPuertoOrigen).nombrePuerto; _viaje.PuertoDestino = _puerto.consultarPuertoPorId(_viaje.idPuertoDestino).nombrePuerto; _viaje.NombreBarco = _barco.consultarBarcoPorId(_viaje.idBarco).nombreBarco; _viaje.Capitan = _capitan.buscarCapitanPorCedula(_viaje.cedulaCapitan).nombreCapitan; ResultadoReporte.Add(_viaje); //Read the next line line = file.ReadLine(); } file.Close(); ResultList.Resultado = true; } ResultList.Datos = ResultadoReporte; } catch (Exception ex) { ResultList.Resultado = false; Console.WriteLine("Exception: " + ex.Message); } return(ResultList); }
public DTResultadoOperacionList <DTCapitan> GenerarArchivoCapitan(DTCapitan _Capitan) { DTResultadoOperacionList <DTCapitan> informeResultado = new DTResultadoOperacionList <DTCapitan>(); //Verificar si ya existe un capitán con esa cédula bool resultadoBusqueda = ArbolCapitan.buscarNodo(Convert.ToInt32(_Capitan.cedulaCapitan)); if (resultadoBusqueda == true) { //La cédula ya existe. Retornar valor False informeResultado.Resultado = false; } else { // //Insertar nuevo capitán en archivo // DTCapitan _dtCapitan = new DTCapitan(); informeResultado = new DMCapitan().generarArchivoCapitan(_Capitan); } return(informeResultado); }
public void cargarCapitanesEnArbol() { DMCapitan dMCapitan = new DMCapitan(); dMCapitan.cargarCapitanesEnArbol(); }