Exemplo n.º 1
0
        public DTResultadoOperacionList <DTBarco> ConsultarBarcos()
        {
            DTResultadoOperacionList <DTBarco> ResultList = new DTResultadoOperacionList <DTBarco>();

            ResultList = new DMBarco().consultarBarcos();



            return(ResultList);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        public DTResultadoOperacionList <DTBarco> GenerarArchivoBarco(DTBarco _barco)
        {
            DTResultadoOperacionList <DTBarco> ResultList = new DTResultadoOperacionList <DTBarco>();
            //Verificar si ya existe un barco con ese registro Mercantíl
            bool resultadoBusqueda = ArbolBarco.buscarNodo(Convert.ToInt32(_barco.registroMercantil));

            if (resultadoBusqueda == true)
            {
                //El registroMercantíl ya existe. Retornar valor False
                ResultList.Resultado = false;
            }
            else
            {
                //
                //Insertar nuevo capitán en archivo
                //
                ResultList = new DMBarco().generarArchivoBarco(_barco);
            }
            return(ResultList);
        }