Last active
August 9, 2019 19:59
-
-
Save Roberto24p/e3bdca226a53078bca3b7b0e47d338ee to your computer and use it in GitHub Desktop.
Aiuda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Proyecto_Segundo_Parcial.Model; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace Proyecto_Segundo_Parcial.Control | |
{ | |
class AdmBoletos | |
{ | |
private static AdmBoletos admBoletos = null; | |
private AdmBoletos(){} | |
public static AdmBoletos getAdmBoletos() | |
{ | |
if (admBoletos == null) | |
admBoletos = new AdmBoletos(); | |
return admBoletos; | |
} | |
List<Boleto> datos = new List<Model.Boleto>(); | |
public List<Boleto> getDatos() { | |
return datos; | |
} | |
public void setDatos(List<Boleto> datos) { | |
this.datos = datos; | |
} | |
public bool verificar(string tipodevuelo, string numerodeboleto, string precio) | |
{ | |
bool bandera = false; | |
if (tipodevuelo.CompareTo("") != 0 && numerodeboleto.CompareTo("") != 0 && precio.CompareTo("") != 0) | |
{ | |
bandera = true; | |
} | |
return bandera; | |
} | |
public string guardar(string tipodevuelo, string numerodeboleto, string Sprecio, string salida, string llegada, string fsalida, string fllegada) | |
{ | |
Boleto boleto = new Boleto(); | |
double precio = double.Parse(Sprecio); | |
boleto.setClasedevuelo(tipodevuelo); | |
boleto.setNumerodevuelo(numerodeboleto); | |
boleto.setPreciobo(precio); | |
//A partir de aqui empieza el error | |
boleto.getViaje().setorigen(salida); | |
boleto.getViaje().setllegada(llegada); | |
boleto.getViaje().setsalida(Convert.ToDateTime(fsalida)); | |
boleto.getViaje().setllegada(Convert.ToDateTime(fllegada)); | |
datos.Add(boleto); | |
return boleto.toString(); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace Proyecto_Segundo_Parcial.Model | |
{ | |
class Boleto | |
{ | |
private string clasedevuelo; | |
private string numerodevuelo; | |
private double preciobo; | |
private Viaje viaje; | |
//--------Constructor por defecto------------ | |
public Boleto(){ | |
} | |
//---------Constructor Parametrizado----------- | |
public Boleto(string clasedevuelo, string numerodevuelo, double preciobo,Viaje viaje) | |
{ | |
this.clasedevuelo = clasedevuelo; | |
this.numerodevuelo = numerodevuelo; | |
this.preciobo = preciobo; | |
this.viaje = viaje; | |
} | |
//--------------Get y Set------------ | |
public Viaje getViaje() { | |
return viaje; | |
} | |
public void setViaje(Viaje viaje) { | |
this.viaje = viaje; | |
} | |
public string getClasedevuelo() { | |
return clasedevuelo; | |
} | |
public void setClasedevuelo(string clasedevuelo) { | |
this.clasedevuelo = clasedevuelo; | |
} | |
public string getNumerodevuelo() | |
{ | |
return numerodevuelo; | |
} | |
public void setNumerodevuelo(string numerodevuelo) | |
{ | |
this.numerodevuelo = numerodevuelo; | |
} | |
public double getPreciobo() | |
{ | |
return preciobo; | |
} | |
public void setPreciobo(double preciobo) | |
{ | |
this.preciobo = preciobo; | |
} | |
//----------Metodos---------- | |
/* public void IVA() { | |
double iva = 0, preciofinal; | |
iva = preciobo * 0.12; | |
preciofinal = iva + getPreciobo(); | |
Console.WriteLine("IVA-->" + iva); | |
Console.WriteLine("Precio Final-->"+preciofinal); | |
}*/ | |
public string toString() | |
{ | |
return "\nClase de vuelo-->" + getClasedevuelo() + "\nNumero de boleto-->" + getNumerodevuelo() + "\nLugar de salida-->" + "\nPrecio del boleto-->" +getPreciobo() ; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace Proyecto_Segundo_Parcial.Model | |
{ | |
class Viaje | |
{ | |
private DateTime fecha_salida; | |
private string hora_salida; | |
private DateTime fecha_llegada; | |
private string hora_llegada; | |
private string origen; | |
private string destino; | |
//constructor def | |
public Viaje() { } | |
//getters | |
public DateTime getsalida() | |
{ | |
return fecha_salida; | |
} | |
public string gethorasalida() | |
{ | |
return hora_salida; | |
} | |
public DateTime getllegada() | |
{ | |
return fecha_llegada; | |
} | |
public string gethorallegada() | |
{ | |
return hora_llegada; | |
} | |
public string getorigen() | |
{ | |
return origen; | |
} | |
public string getdestino() | |
{ | |
return destino; | |
} | |
//setters | |
public void setsalida(DateTime salida) | |
{ | |
this.fecha_salida = salida; | |
} | |
public void setllegada(string horasalida) | |
{ | |
this.hora_salida = horasalida; | |
} | |
public void setllegada(DateTime llegada) | |
{ | |
this.fecha_llegada = llegada; | |
} | |
public void sethorallegada(string horallegada) | |
{ | |
this.hora_llegada = horallegada; | |
} | |
public void setorigen(string origen) | |
{ | |
this.origen = origen; | |
} | |
public void setdestino(string destino) | |
{ | |
this.destino = destino; | |
} | |
public string toString() | |
{ | |
return "fecha salida \n " + fecha_salida + " \n hora salida \n" + hora_salida + " \n fecha llegada \n" + fecha_llegada + | |
" \n hora llegada \n" + hora_llegada + " \n origen \n" + origen + " \n destino \n" + destino ; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Muchas gracias MrDave :`)