public DTResultadoOperacionList <DTPuerto> GuardarPuertoEditado(DTPuerto _puertoEditado) { DTResultadoOperacionList <DTPuerto> ResultList = new DTResultadoOperacionList <DTPuerto>(); List <DTPuerto> ResultadoReporte = new List <DTPuerto>(); DTPuerto _puerto = new DTPuerto(); String line; String cadena; using (var fs = File.Open(NOMBRE_ARCHIVO, FileMode.Open, FileAccess.ReadWrite)) { var destinationReader = new StreamReader(fs); var writer = new StreamWriter(fs); while ((line = destinationReader.ReadLine()) != null) { _puerto = puertoRegistro2Objeto(line); if (_puerto.idPuerto == _puertoEditado.idPuerto) { cadena = parsePuerto2String(_puertoEditado); writer.WriteLine(cadena); ResultList.Resultado = true; break; } } } return(ResultList); }
public DTResultadoOperacionList <DTEscala> generarArchivoEscala(DTEscala _escala) { CrearDirectorio(); DTResultadoOperacionList <DTEscala> ResultList = new DTResultadoOperacionList <DTEscala>(); List <DTEscala> ResultadoReporte = new List <DTEscala>(); try { ResultList.Resultado = true; //GENERAR HILO PARA LA CREACIÓN DEL ARCHIVO PLANO (SI ES NECESARIO). int idUltimaEscala = consultarIdUltimoEscala(); _escala.idEscala = idUltimaEscala + 1; using (StreamWriter file = new StreamWriter(NOMBRE_ARCHIVO, true)) //se crea el archivo { string cadena = parseViaje2String(_escala); file.WriteLine(cadena); file.Close(); cargarUnaEscalaEnArbol(_escala); //LLeva la nueva escala al Arbol } ResultList.Resultado = true; } catch (Exception ex) { ResultList.Resultado = false; } return(ResultList); }
public DTResultadoOperacionList <DTDlleViaje> generarArchivoDlleViaje(DTDlleViaje _dlleViaje) { CrearDirectorio(); DTResultadoOperacionList <DTDlleViaje> ResultList = new DTResultadoOperacionList <DTDlleViaje>(); List <DTViaje> ResultadoReporte = new List <DTViaje>(); try { ResultList.Resultado = true; int idUltimoDlleViaje = consultarIdUltimoDlleViaje(); _dlleViaje.idDetalleViaje = idUltimoDlleViaje + 1; using (StreamWriter file = new StreamWriter(NOMBRE_ARCHIVO, true)) //se crea el archivo { string cadena = parseDlleViaje2String(_dlleViaje); file.WriteLine(cadena); file.Close(); } List <DTDlleViaje> List = new List <DTDlleViaje>(); ResultList.Datos = consultarDlleViaje(_dlleViaje.idViaje).Datos; ResultList.Resultado = true; } catch (Exception ex) { ResultList.Resultado = false; } return(ResultList); }
public DTResultadoOperacionList <DTBarco> consultarBarcos() { DTResultadoOperacionList <DTBarco> ResultList = new DTResultadoOperacionList <DTBarco>(); List <DTBarco> ResultadoReporte = new List <DTBarco>(); 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) { DTBarco _barco = new DTBarco(); //write the line to console Console.WriteLine(line); _barco = barcoRegistro2Objeto(line); ResultadoReporte.Add(_barco); //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 <DTEscala> generarArchivoEscala(DTEscala _escala) { DTResultadoOperacionList <DTEscala> ResultList = new DTResultadoOperacionList <DTEscala>(); ResultList = new DMEscala().generarArchivoEscala(_escala); return(ResultList); }
public DTResultadoOperacionList <DTEscala> consultarEscalas() { DTResultadoOperacionList <DTEscala> ResultList = new DTResultadoOperacionList <DTEscala>(); ResultList = new DMEscala().consultarEscalas(); return(ResultList); }
public DTResultadoOperacionList <DTPuerto> GuardarPuertoEditado(DTPuerto _Viaje) { DTResultadoOperacionList <DTPuerto> ResultList = new DTResultadoOperacionList <DTPuerto>(); ResultList = new DMPuerto().GuardarPuertoEditado(_Viaje); return(ResultList); }
public DTResultadoOperacionList <DTMarinero> consultarMarineros() { DTResultadoOperacionList <DTMarinero> ResultList = new DTResultadoOperacionList <DTMarinero>(); ResultList = new DMMarinero().consultarMarineros(); return(ResultList); }
public DTResultadoOperacionList <DTPuerto> ConsultarUnPuerto(DTPuerto _puerto) { DTResultadoOperacionList <DTPuerto> ResultList = new DTResultadoOperacionList <DTPuerto>(); ResultList = new DMPuerto().consultarUnPuerto(_puerto); return(ResultList); }
public DTResultadoOperacionList <DTPuerto> ConsultarPuertos() { DTResultadoOperacionList <DTPuerto> ResultList = new DTResultadoOperacionList <DTPuerto>(); ResultList = new DMPuerto().consultarPuertos(); return(ResultList); }
public DTResultadoOperacionList <DTBarco> ConsultarBarcos() { DTResultadoOperacionList <DTBarco> ResultList = new DTResultadoOperacionList <DTBarco>(); ResultList = new DMBarco().consultarBarcos(); return(ResultList); }
public DTResultadoOperacionList <DTCapitan> ConsultarCapitan() { DTResultadoOperacionList <DTCapitan> ResultList = new DTResultadoOperacionList <DTCapitan>(); ResultList = new DMCapitan().consultarCapitanes(); return(ResultList); }
// GET: Barco public string GenerarArchivoBarco(DTBarco DTBarco) { DTResultadoOperacionList <DTBarco> Resultado = new DTResultadoOperacionList <DTBarco>(); Resultado = new BMBarco().GenerarArchivoBarco(DTBarco); JavaScriptSerializer serializer = new JavaScriptSerializer(); serializer.MaxJsonLength = 500000000; return(serializer.Serialize(Resultado)); }
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); }
public DTResultadoOperacionList <DTDlleViaje> ConsultarMarinerosViaje(DTDlleViaje dtDlleViaje) { DMMarinero _marinero = new DMMarinero(); DTDlleViaje _dllviaje = new DTDlleViaje(); DTResultadoOperacionList <DTDlleViaje> dllViajeLista = new DTResultadoOperacionList <DTDlleViaje>(); List <DTDlleViaje> _listDlleViaje = new List <DTDlleViaje>(); 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) { _dllviaje = viajeRegistro2Objeto(line); if (_dllviaje.idViaje == dtDlleViaje.idViaje) { _dllviaje.nombreMarinero = _marinero.consultarMarinero(_dllviaje.cedulaMarinero).nombreMarinero.ToString(); //_dllviaje.PuertoDestino = _puerto.consultarPuertoPorId(_dllviaje.idPuertoDestino).nombrePuerto; _listDlleViaje.Add(_dllviaje); //break; } else { _dllviaje = null; } //Read the next line line = file.ReadLine(); } file.Close(); } dllViajeLista.Datos = _listDlleViaje; dllViajeLista.Resultado = true; } catch (Exception ex) { Console.WriteLine("Exception: " + ex.Message); } return(dllViajeLista); }
public DTResultadoOperacionList <DTDlleViaje> consultarDlleViaje(int idViaje) { DTResultadoOperacionList <DTDlleViaje> ResultList = new DTResultadoOperacionList <DTDlleViaje>(); List <DTDlleViaje> ResultadoReporte = new List <DTDlleViaje>(); DMMarinero _marinero = new DMMarinero(); 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) { DTDlleViaje _viaje = new DTDlleViaje(); _viaje = viajeRegistro2Objeto(line); _viaje.nombreMarinero = _marinero.consultarMarinero(_viaje.cedulaMarinero).nombreMarinero; if (_viaje.idViaje == idViaje) { 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) { CrearDirectorio(); DTResultadoOperacionList <DTCapitan> ResultList = new DTResultadoOperacionList <DTCapitan>(); List <DTCapitan> ResultadoReporte = new List <DTCapitan>(); try { ResultList.Resultado = true; //GENERAR HILO PARA LA CREACIÓN DEL ARCHIVO PLANO (SI ES NECESARIO). if (!consultarCapitanPorCedula(_capitan.cedulaCapitan)) { int ultimoCapitan = consultarIdUltimoCapitan(); using (StreamWriter file = new StreamWriter(NOMBRE_ARCHIVO, true)) //se crea el archivo { //Averiguar el último consecutivo del archivo CAPITAN ultimoCapitan++; _capitan.idCapitan = ultimoCapitan.ToString(); string cadena = parseCapitan2String(_capitan); file.WriteLine(cadena); file.Close(); cargarUnCapitanEnArbol(_capitan); //LLeva el nuevo Capitán al Abrol } ResultList.Resultado = true; } else { ResultList.Resultado = false; } } catch (Exception ex) { ResultList.Resultado = false; } return(ResultList); }
public string ConsultarSolpedFiltros(DTFiltros Dt) { DTResultadoOperacionList <DTSolped> ResultadoList = new DTResultadoOperacionList <DTSolped>(); List <DTSolped> Resultado = new List <DTSolped>(); try { Resultado = new BMSolped().ConsultarSolpedFiltros(Dt); ResultadoList.Resultado = true; ResultadoList.Datos = Resultado; } catch (Exception ex) { GestorLog.RegistrarLogExcepcion(ex); } JavaScriptSerializer serializer = new JavaScriptSerializer(); serializer.MaxJsonLength = 500000000; return(serializer.Serialize(ResultadoList)); }
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); }
public string ConsultarErroresExcel() { DTResultadoOperacionList <DTErroresExcel> ResultadoList = new DTResultadoOperacionList <DTErroresExcel>(); List <DTErroresExcel> Resultado = new List <DTErroresExcel>(); try { Resultado = new BMAthena().ConsultarErroresExcel(); ResultadoList.Resultado = true; ResultadoList.Datos = Resultado; } catch (Exception ex) { GestorLog.RegistrarLogExcepcion(ex); } JavaScriptSerializer serializer = new JavaScriptSerializer(); serializer.MaxJsonLength = 500000000; return(serializer.Serialize(ResultadoList)); }
public DTResultadoOperacionList <DTMarinero> GenerarArchivoMarinero(DTMarinero _marinero) { DTResultadoOperacionList <DTMarinero> ResultList = new DTResultadoOperacionList <DTMarinero>(); //Verificar si ya existe un marinero con esa cédula bool resultadoBusqueda = ArbolMarinero.buscarNodo(Convert.ToInt32(_marinero.cedula)); if (resultadoBusqueda == true) { //La cédula ya existe. Retornar valor False ResultList.Resultado = false; } else { // //Insertar nuevo marinero en archivo // ResultList = new DMMarinero().GenerarArchivoMarinero(_marinero); } return(ResultList); }
public DTResultadoOperacionList <DTPuerto> generarArchivoPuerto(DTPuerto _puerto) { CrearDirectorio(); DTResultadoOperacionList <DTPuerto> ResultList = new DTResultadoOperacionList <DTPuerto>(); List <DTPuerto> ResultadoReporte = new List <DTPuerto>(); try { ResultList.Resultado = true; //GENERAR HILO PARA LA CREACIÓN DEL ARCHIVO PLANO (SI ES NECESARIO). if (!consultarPuertoPorNombre(_puerto.nombrePuerto)) { int idUltimoPuerto = consultarIdUltimoPuerto(); _puerto.idPuerto = idUltimoPuerto + 1; using (StreamWriter file = new StreamWriter(NOMBRE_ARCHIVO, true)) //se crea el archivo { string cadena = parsePuerto2String(_puerto); file.WriteLine(cadena); file.Close(); cargarUnPuertoEnArbol(_puerto); //LLeva el nuevo puerto al Arbol } ResultList.Resultado = true; } else { ResultList.Resultado = false; } } catch (Exception ex) { ResultList.Resultado = false; //ResultList.Mensaje = DTMensaje.ObtenerObjetoMensaje(DTCodigoMensajes.MENSAJE002); //GestorLog.RegistrarLogExcepcion(ex); } return(ResultList); }
public Boolean verificarSiBarcoZarpo(DTViaje dtViaje) { Boolean respuesta = false; DTViaje _viaje = new DTViaje(); DTResultadoOperacionList <DTDlleViaje> ReViajeLista = new DTResultadoOperacionList <DTDlleViaje>(); List <DTDlleViaje> _listDlleViaje = new List <DTDlleViaje>(); 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.idBarco == dtViaje.idBarco) { respuesta = true; //El barco ya zarpó en otro viaje break; } //Read the next line line = file.ReadLine(); } file.Close(); } } catch (Exception ex) { Console.WriteLine("Exception: " + ex.Message); } return(respuesta); }
public DTResultadoOperacionList <DTMarinero> GenerarArchivoMarinero(DTMarinero _marinero) { CrearDirectorio(); DTResultadoOperacionList <DTMarinero> ResultList = new DTResultadoOperacionList <DTMarinero>(); List <DTMarinero> ResultadoReporte = new List <DTMarinero>(); try { ResultList.Resultado = true; //GENERAR ARCHIVO PLANO: if (!consultarMarineroPorCedula(_marinero.cedula)) { int idUltimoMarinero = consultarIdUltimoMarinero(); _marinero.idMarinero = idUltimoMarinero + 1; using (StreamWriter file = new StreamWriter(NOMBRE_ARCHIVO, true)) //se crea el archivo { string cadena = parseMarinero2String(_marinero); file.WriteLine(cadena); file.Close(); cargarUnMarineroEnArbol(_marinero); //LLeva el nuevo Marinero al Arbol } ResultList.Resultado = true; } else { ResultList.Resultado = false; } } catch (Exception ex) { ResultList.Resultado = false; } return(ResultList); }
public DTResultadoOperacionList <DTBarco> generarArchivoBarco(DTBarco _barco) { CrearDirectorio(); DTResultadoOperacionList <DTBarco> ResultList = new DTResultadoOperacionList <DTBarco>(); List <DTBarco> ResultadoReporte = new List <DTBarco>(); try { ResultList.Resultado = true; //GENERAR HILO PARA LA CREACIÓN DEL ARCHIVO PLANO (SI ES NECESARIO). if (!consultarBarcoPorNombre(_barco.nombreBarco)) { int idUltimoBarco = consultarIdUltimoBarco(); _barco.idBarco = idUltimoBarco + 1; using (StreamWriter file = new StreamWriter(NOMBRE_ARCHIVO, true)) //se crea el archivo { string cadena = parseBarco2String(_barco); file.WriteLine(cadena); file.Close(); cargarUnBarcoEnArbol(_barco); //LLeva el nuevo Barco al Abrol } ResultList.Resultado = true; } else { ResultList.Resultado = false; } } catch (Exception ex) { ResultList.Resultado = false; } return(ResultList); }
public DTResultadoOperacionList <DTViaje> generarArchivoViaje(DTViaje _viaje) { CrearDirectorio(); DTResultadoOperacionList <DTViaje> ResultList = new DTResultadoOperacionList <DTViaje>(); List <DTViaje> ResultadoReporte = new List <DTViaje>(); try { ResultList.Resultado = true; //GENERAR HILO PARA LA CREACIÓN DEL ARCHIVO PLANO (SI ES NECESARIO). //if (!consultarBarcoPorNombre(_viaje.nombreBarco)) //{ int idUltimoViaje = consultarIdUltimoViaje(); _viaje.idViaje = idUltimoViaje + 1; using (StreamWriter file = new StreamWriter(NOMBRE_ARCHIVO, true)) //se crea el archivo { string cadena = parseViaje2String(_viaje); file.WriteLine(cadena); file.Close(); } ResultList.Resultado = true; //} //else //{ // ResultList.Resultado = false; //} } catch (Exception ex) { ResultList.Resultado = false; } 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); }