/******************************************* CARGA DE DATOS DE CHOFER *******************************************/ public string cargarNombre() { objControladorChofer = new ControladorChofer(); bool boolEntrar = true; string strNombre = ""; while (boolEntrar) { try { Console.Write("Ingrese Nombre: "); strNombre = Console.ReadLine(); if (objControladorChofer.validarNombre(strNombre) && strNombre != "") { boolEntrar = false; } else if (objControladorChofer.validarNombre(strNombre) == false) { throw new ExceptionTextoInvalido(); } else if (strNombre == "") { throw new ExceptionIngresoTextoVacio(); } } catch (ExceptionTextoInvalido e) { e.mensajeError(); } catch (ExceptionIngresoTextoVacio e) { e.mensajeError(); } } return(strNombre); }
public void asignarRecorridos() { objControladorDia = new ControladorDia(); objControladorChofer = new ControladorChofer(); objControladorOmnibus = new ControladorOmnibus(); objControladorRecorrido = new ControladorRecorrido(); Console.WriteLine("Seleccione el Chofer"); Console.WriteLine(); List <Chofer> choferesRegistrados = objControladorChofer.traerChoferes(); objControladorChofer.mostrarChoferes(choferesRegistrados); Console.WriteLine(); Chofer objChofer = seleccionChofer(choferesRegistrados); Console.Clear(); Console.WriteLine("Seleccione el Omnibus"); Console.WriteLine(); List <Omnibus> omnibusRegistrados = objControladorOmnibus.traerOmnibus(); objControladorOmnibus.mostrarOmnibus(omnibusRegistrados); Console.WriteLine(); Omnibus objOmnibus = seleccionOmnibus(omnibusRegistrados); Console.Clear(); Console.WriteLine("Seleccione el Recorrido"); Console.WriteLine(); List <Recorrido> recorridos = objControladorRecorrido.traerRecorridos(); objControladorRecorrido.mostrarRecorridos(recorridos); Console.WriteLine(); Recorrido objRecorrido = seleccionRecorrido(recorridos); Console.Clear(); Console.WriteLine("Seleccione el Dia del Recorrido"); Console.WriteLine(); List <Dia> dias = objControladorDia.traerDias(); objControladorDia.mostrarDias(dias); Console.WriteLine(); Dia objDia = seleccionDia(dias); Itinerario objItinerario = new Itinerario(); objItinerario.IdChofer = objChofer.NumeroLegajo; objItinerario.IdOmnibus = objOmnibus.NumeroUnidad; objItinerario.IdRecorrido = objRecorrido.IdRecorrido; objItinerario.IdDia = objDia.IdDia; agregarAsignacionRecorrido(objItinerario); }
/******************************************* ASIGNACION DE RECORRIDOS *******************************************/ public void asignacionDeRecorridos() { Console.Clear(); objControladorChofer = new ControladorChofer(); objControladorOmnibus = new ControladorOmnibus(); objControladorRecorrido = new ControladorRecorrido(); int intCantidadChoferesAlta = objControladorChofer.traerChoferes().Count; int intCantidadOmnibusAlta = objControladorOmnibus.traerOmnibus().Count; int intCantidadRecorridosAlta = objControladorRecorrido.traerRecorridos().Count; if (intCantidadChoferesAlta > 0 && intCantidadOmnibusAlta > 0 && intCantidadRecorridosAlta > 0) { asignarRecorridos(); } else { Console.WriteLine("Error Debe dar de Alta un Chofer - Omnibus - Recorrido Para Asignar un Recorrido."); presioneTeclaParaContinuar(); } }
/******************************************* ALTA DE CHOFER *******************************************/ public void altaChofer() { objControladorChofer = new ControladorChofer(); Chofer objChofer = new Chofer(); objChofer.Nombre = cargarNombre(); objChofer.Apellido = cargarApellido(); objChofer.DNI = cargarDNI(); List <string> dniExistentes = objControladorChofer.traerDNIChoferes(); if (objControladorChofer.validarDniExistenteRegistrado(dniExistentes, objChofer.DNI)) { objControladorChofer.agregarChofer(objChofer); Console.WriteLine(); Console.WriteLine("El Chofer se ha Dado de Alta Correctamente."); } else { Console.WriteLine("Ya Existe un Chofer con ese DNI en la Empresa."); } presioneTeclaParaContinuar(); }