Example #1
0
        public DTResultadoOperacionList <DTPuerto> GuardarPuertoEditado(DTPuerto _Viaje)
        {
            DTResultadoOperacionList <DTPuerto> ResultList = new DTResultadoOperacionList <DTPuerto>();

            ResultList = new DMPuerto().GuardarPuertoEditado(_Viaje);

            return(ResultList);
        }
Example #2
0
        public DTResultadoOperacionList <DTPuerto> ConsultarUnPuerto(DTPuerto _puerto)
        {
            DTResultadoOperacionList <DTPuerto> ResultList = new DTResultadoOperacionList <DTPuerto>();

            ResultList = new DMPuerto().consultarUnPuerto(_puerto);



            return(ResultList);
        }
Example #3
0
        public DTResultadoOperacionList <DTPuerto> ConsultarPuertos()
        {
            DTResultadoOperacionList <DTPuerto> ResultList = new DTResultadoOperacionList <DTPuerto>();

            ResultList = new DMPuerto().consultarPuertos();



            return(ResultList);
        }
Example #4
0
        public DTResultadoOperacionList <DTEscala> consultarEscalas()
        {
            DTResultadoOperacionList <DTEscala> ResultList = new DTResultadoOperacionList <DTEscala>();

            List <DTEscala> ResultadoReporte = new List <DTEscala>();
            DMPuerto        _puerto          = new DMPuerto();
            DTEscala        _escala          = new DTEscala();
            DMViaje         _viaje           = new DMViaje();

            //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)
                    {
                        //DTEscala _escala = new DTEscala();
                        //write the line to console
                        Console.WriteLine(line);
                        _escala = viajeRegistro2Objeto(line);
                        //_viaje.PuertoOrigen = dmPuerto.consultarPuertoPorId(_viaje.idPuertoOrigen);
                        string puertoOrigen  = _viaje.consultarViajePorId(_escala.idViaje).PuertoOrigen;
                        string puertoDestino = _viaje.consultarViajePorId(_escala.idViaje).PuertoDestino;
                        _escala.viaje = puertoOrigen + "-" + puertoDestino;
                        //_escala.PuertoDestino = _puerto.consultarPuertoPorId(_viaje.idPuertoDestino).nombrePuerto;
                        _escala.nombrePuerto = _puerto.consultarPuertoPorId(_escala.idPuerto).nombrePuerto;
                        //_escala.Capitan = _capitan.buscarCapitanPorCedula(_viaje.cedulaCapitan).nombreCapitan;
                        ResultadoReporte.Add(_escala);
                        //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);
        }
Example #5
0
        public DTResultadoOperacionList <DTPuerto> generarArchivoPuerto(DTPuerto _Puerto)
        {
            DTResultadoOperacionList <DTPuerto> ResultList = new DTResultadoOperacionList <DTPuerto>();
            //Verificar si ya existe un barco con ese registro Mercantíl
            bool resultadoBusqueda = ArbolPuerto.buscarNodo(Convert.ToInt32(_Puerto.registroMercantil));

            if (resultadoBusqueda == true)
            {
                //El registroMercantíl ya existe. Retornar valor False
                ResultList.Resultado = false;
            }
            else
            {
                //
                //Insertar nuevo puerto en archivo
                //
                ResultList = new DMPuerto().generarArchivoPuerto(_Puerto);
            }

            return(ResultList);
        }
Example #6
0
        public DTViaje consultarViajePorId(int idViaje)
        {
            DMPuerto _puerto = new DMPuerto();
            DTViaje  _viaje  = new DTViaje();

            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)
                    {
                        _viaje = viajeRegistro2Objeto(line);
                        if (_viaje.idViaje == idViaje)
                        {
                            _viaje.PuertoOrigen  = _puerto.consultarPuertoPorId(_viaje.idPuertoOrigen).nombrePuerto;
                            _viaje.PuertoDestino = _puerto.consultarPuertoPorId(_viaje.idPuertoDestino).nombrePuerto;
                            break;
                        }
                        else
                        {
                            _viaje = null;
                        }
                        //Read the next line
                        line = file.ReadLine();
                    }
                    file.Close();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception: " + ex.Message);
            }

            return(_viaje);
        }
Example #7
0
        public void cargarPuertosEnArbol()
        {
            DMPuerto dMPuerto = new DMPuerto();

            dMPuerto.cargarPuertosEnArbol();
        }