Example #1
0
 public Viaje()
 {
     fecha     = new Fecha();
     Vehiculo  = new Vehiculo();
     Chofer    = new Chofer();
     coneccion = new Conexion();
 }
Example #2
0
        public void asignarChofer(int NumeroPersonas)
        {
            Chofer chofer = new Chofer();
            int    cont   = 0;

            if (NumeroPersonas <= 5)
            {
                foreach (string line in File.ReadLines(@"Choferes.txt"))
                {
                    Char     delimiter  = ';';
                    String[] substrings = line.Split(delimiter);

                    if (substrings[1] == "B" && cont == 0)
                    {
                        chofer.NombreChofer = substrings[0];
                        chofer.TipoLicencia = substrings[1];
                        cont += 1;
                    }
                }
            }
            else if (NumeroPersonas > 5)
            {
                foreach (string line in File.ReadLines(@"Choferes.txt"))
                {
                    Char     delimiter  = ';';
                    String[] substrings = line.Split(delimiter);

                    if (substrings[1] == "C" && cont == 0)
                    {
                        chofer.NombreChofer = substrings[0];
                        chofer.TipoLicencia = substrings[1];
                        cont += 1;
                    }
                }
            }
            string lineAux = chofer.NombreChofer + ";" + chofer.TipoLicencia + ";";

            Console.WriteLine(chofer.NombreChofer + chofer.TipoLicencia);
            File.AppendAllText(@"reservacion.txt", lineAux);
        }