public void EliminarPiloto(int idpiloto)
        {
            Piloto piloto = this.DetallePiloto(idpiloto);

            this.context.Pilotos.Remove(piloto);
            this.context.SaveChanges();
        }
Beispiel #2
0
 private void btnGuardarPi_Click(object sender, EventArgs e)
 {
     if (ValiPilo())
     {
         Piloto p1 = new Piloto();
         p1.Nombre           = txtNombre.Text;
         p1.Apellido_Materno = txtApellidoMa.Text;
         p1.Apellido_Paterno = txtApellidoPa.Text;
         p1.Fecha_Nacimiento = txtFechaNacimiento.Value;
         p1.Curp             = txtCurp.Text;
         p1.Rfc             = txtRfc.Text;
         p1.Tiempo_De_Vuelo = double.Parse(txtTiempoVueloPi.Text);
         p1.Tipo_De_Nave    = txtTipoNavePi.Text;
         if (pilo != null)
         {
             p1.Id = pilo.Id;
             LPiloto.ModificarPiloto(p1);
         }
         else
         {
             LPiloto.AgregarPiloto(p1);
         }
         this.Close();
     }
 }
Beispiel #3
0
        static void Main(string[] args)
        {
            #region instance
            var piloto         = new Piloto();
            var chefeDeServico = new ChefeDeServico();
            var comissariaI    = new Comissaria();
            var comissariaII   = new Comissaria();
            var oficialI       = new Oficial();
            var oficialII      = new Oficial();
            var policial       = new Policial();
            var bandido        = new Bandido();
            var toAviao        = new DeslocamentoAoAviao();
            var toTerminal     = new DeslocamentoAoTerminal();
            #endregion

            toAviao.ShowMessages    += ShowMessages;
            toTerminal.ShowMessages += ShowMessages;
            toAviao.RealizarTravessia(policial, bandido);
            toTerminal.RealizarTravessia(policial);
            toAviao.RealizarTravessia(piloto, policial);
            toTerminal.RealizarTravessia(piloto);
            toAviao.RealizarTravessia(piloto, oficialI);
            toTerminal.RealizarTravessia(piloto);
            toAviao.RealizarTravessia(chefeDeServico, comissariaI);
            toTerminal.RealizarTravessia(chefeDeServico);
            toAviao.RealizarTravessia(piloto, oficialII);
            toTerminal.RealizarTravessia(piloto);
            toAviao.RealizarTravessia(chefeDeServico, comissariaII);
            toTerminal.RealizarTravessia(chefeDeServico);
            toAviao.RealizarTravessia(chefeDeServico, piloto);

            Console.ReadKey();
        }
        public IActionResult Put(int dorsal, [FromBody] Piloto value)
        {
            //if (value == null || value.Dorsal != dorsal)
            if (value == null)
            {
                return(BadRequest());
            }

            var piloto = _context.Pilotos.FirstOrDefault(t => t.Dorsal == dorsal);

            if (piloto == null)
            {
                return(NotFound());
            }

            if (value.Dorsal != dorsal)
            {
                _context.Pilotos.Remove(piloto);
                _context.Pilotos.Add(value);
            }
            else
            {
                piloto.Nombre   = value.Nombre;
                piloto.Apellido = value.Apellido;
                piloto.Pais     = value.Pais;

                _context.Pilotos.Update(piloto);
            }

            _context.SaveChanges();

            return(new NoContentResult());
        }
Beispiel #5
0
        public void CalcularTempoTotalDeProva_DeveRetornarASomatoriaDeTodasAsVoltasDoPiloto()
        {
            var piloto = new Piloto();

            var volta1 = new Volta();

            volta1.TempoDaVolta = TimeSpan.Parse("00:1:02.852");

            var volta2 = new Volta();

            volta2.TempoDaVolta = TimeSpan.Parse("00:1:03.170");

            var volta3 = new Volta();

            volta3.TempoDaVolta = TimeSpan.Parse("00:1:02.769");

            var volta4 = new Volta();

            volta4.TempoDaVolta = TimeSpan.Parse("00:1:02.787");

            piloto.AdicionarVolta(volta1);
            piloto.AdicionarVolta(volta2);
            piloto.AdicionarVolta(volta3);
            piloto.AdicionarVolta(volta4);

            var totalTempo = piloto.CalcularTempoTotalDeProva();

            TimeSpan expected = TimeSpan.Parse("00:04:11.5780000");

            Assert.AreEqual(expected, totalTempo);
        }
Beispiel #6
0
        public void CalcularVelocidadeMedia_DeveRetornarAVelocidadeMediaDuranteACorridaDoPiloto()
        {
            var piloto = new Piloto();

            var volta1 = new Volta();

            volta1.VelocidadeMediaDaVolta = 45.31;

            var volta2 = new Volta();

            volta2.VelocidadeMediaDaVolta = 43.1;

            var volta3 = new Volta();

            volta3.VelocidadeMediaDaVolta = 40;

            var volta4 = new Volta();

            volta4.VelocidadeMediaDaVolta = 44.89;

            piloto.AdicionarVolta(volta1);
            piloto.AdicionarVolta(volta2);
            piloto.AdicionarVolta(volta3);
            piloto.AdicionarVolta(volta4);

            double expected = 43.325;

            double current = piloto.CalcularVelocidadeMedia();

            Assert.AreEqual(expected, current, 0.0001);
        }
        public void Os_dados_do_piloto_estao_preenchidos()
        {
            var piloto = new Piloto(99, "Caio");

            Assert.AreEqual(99, piloto.Numero);
            Assert.AreEqual("Caio", piloto.Nome);
        }
Beispiel #8
0
 public IActionResult Cadastrar(Piloto p, Usuario u)
 {
     if (!string.IsNullOrEmpty(p.Cdh))
     {
         //Piloto
         if (ModelState.IsValid)
         {
             if (_pessoaDAO.Cadastrar(p))
             {
                 return(RedirectToAction("PaginaPiloto"));
             }
         }
         ModelState.AddModelError("", "Hoo man, já existe esse cadastro!");
         return(View(p));
     }
     else
     {
         //Usuário
         if (ModelState.IsValid)
         {
             if (_pessoaDAO.Cadastrar(u))
             {
                 return(RedirectToAction("PaginaUsuario"));
             }
         }
         ModelState.AddModelError("", "Hoo man, já existe esse cadastro!");
         return(View(u));
     }
 }
Beispiel #9
0
        public ActionResult AgregarPiloto(int idCategoria, int dni)
        {
            //Verifico que el piloto no este agreagado ya a la categoria
            Categoria_Piloto CatPiloto;

            CatPiloto = db.Categoria_Piloto.Where(cp => cp.dniPiloto == dni && cp.idCategoria == idCategoria).FirstOrDefault();

            if (CatPiloto == null)
            {
                //El piloto no esta agregado
                CatPiloto             = new Categoria_Piloto();
                CatPiloto.idCategoria = idCategoria;
                CatPiloto.dniPiloto   = dni;

                db.Categoria_Piloto.Add(CatPiloto);
                Categoria categoria = db.Categoria.Find(idCategoria);

                db.SaveChanges();
                return(RedirectToAction("GetOne", "Torneo", new { id = categoria.Torneo.idTorneo }));
            }
            else
            {
                //El piloto ya esta agregado
                Piloto    piloto    = db.Piloto.Find(dni);
                Categoria categoria = db.Categoria.Find(idCategoria);
                string    msj       = string.Format("El Piloto {0} {1} ya se encuentra agregado a la categoría {2} ", piloto.nombre, piloto.apellido, categoria.nombre);
                TempData["alert"] = Constante.alertDanger(msj);

                return(RedirectToAction("AgregarPiloto", new { idCategoria = categoria.idTorneo }));
            }
        }
Beispiel #10
0
        public int inserir(Piloto piloto)
        {
            OdbcCommand   comando;
            int           result   = 0;
            String        comand   = "INSERT INTO piloto(nome, cht, dataNasc) VALUES(?, ?, ?)";
            OdbcParameter nome     = new OdbcParameter("?", piloto.Nome);
            OdbcParameter cht      = new OdbcParameter("?", piloto.Cht);
            OdbcParameter dataNasc = new OdbcParameter("?", piloto.DataNasc);

            try
            {
                comando = new OdbcCommand(comand, conexao);
                comando.Connection.Open();
                comando.Parameters.Add(nome);
                comando.Parameters.Add(cht);
                comando.Parameters.Add(dataNasc);
                result = comando.ExecuteNonQuery();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
            finally
            {
                conexao.Close();
            }
            return(result);
        }
Beispiel #11
0
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            try
            {
                //System.IO.MemoryStream ms = new System.IO.MemoryStream();

                //Piloto_img.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);

                OpenFileDialog dialog = new OpenFileDialog();
                Piloto         pilo   = new Piloto()
                {
                    Nombre       = txtnombre.Text,
                    Apellido     = txtapellido.Text,
                    Fecha_naci   = txtFechaNacimiento.Value,
                    Lugar_Naci   = txtlugarNaci.Text,
                    Telefono     = Convert.ToInt32(txttelefono.Text),
                    Correo       = txtcorreo.Text,
                    Nacionalidad = txtnacionalidad.Text,
                    idPiloto     = Convert.ToInt32(txtidPiloto.Text),
                    Cedula       = txtCedula.Text,
                    //Imagen = Convert.ToByte(ms.GetBuffer())
                    Imagen = Piloto_img.ImageLocation
                };
                Singleton.opPiloto.ActualizarPilotos(pilo);
                limpiarcampos();
                MessageBox.Show("Piloto Actualizado", "Actualización", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtCedula.Focus();
            }
            catch
            {
                MessageBox.Show("Hubo un error", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #12
0
        public void RetornarPosicaoPiloto(int codigoPiloto, int posicaoEsperada)
        {
            var piloto  = new Piloto(codigoPiloto);
            var posicao = _corrida.VerificarPosicaoPiloto(piloto);

            Assert.Equal(posicaoEsperada, posicao);
        }
        public void Initialize()
        {
            equipe      = new Equipe();
            equipe.Id   = 1;
            equipe.Nome = "EquipeTeste";
            equipe.CodigoIdentificador = "JKL";


            piloto1      = new Piloto();
            piloto1.Id   = 1;
            piloto1.Nome = "Joao";

            piloto2      = new Piloto();
            piloto2.Id   = 2;
            piloto2.Nome = "Maria";

            piloto3      = new Piloto();
            piloto3.Id   = 3;
            piloto3.Nome = "";

            equipe.AdicionarPiloto(piloto1);
            equipe.AdicionarPiloto(piloto2);
            equipe.AdicionarPiloto(piloto3);

            piloto1Retorno = equipe.ObterPorId(piloto1.Id);
            piloto2Retorno = equipe.ObterPorId(piloto2.Id);
            piloto3Retorno = equipe.ObterPorId(piloto3.Id);
        }
Beispiel #14
0
        public void ActualizarPilotos(Piloto pilo)
        {
            try
            {
                OracleConnection ora = new OracleConnection("DATA SOURCE=TOSHIBA-PC:1521/XE;PASSWORD=ORACLE01;USER ID=DESARROLLO");
                ora.Open();
                OracleCommand comando = new OracleCommand("sp_ACTUALIZARPILOTO", ora);
                comando.CommandType = CommandType.StoredProcedure;
                comando.Parameters.Add("IDPILOTO", OracleDbType.Int32).Value        = Convert.ToInt32(pilo.idPiloto);
                comando.Parameters.Add("CEDULA", OracleDbType.Varchar2).Value       = pilo.Cedula;
                comando.Parameters.Add("APELLIDO", OracleDbType.Varchar2).Value     = pilo.Apellido;
                comando.Parameters.Add("NOMBRE", OracleDbType.Varchar2).Value       = pilo.Nombre;
                comando.Parameters.Add("FECHA_NACI", OracleDbType.Date).Value       = pilo.Fecha_naci;
                comando.Parameters.Add("LUGAR_NACI", OracleDbType.Varchar2).Value   = pilo.Lugar_Naci;
                comando.Parameters.Add("TELEFONO", OracleDbType.Int32).Value        = Convert.ToInt32(pilo.Telefono);
                comando.Parameters.Add("CORREO", OracleDbType.Varchar2).Value       = pilo.Correo;
                comando.Parameters.Add("NACIONALIDAD", OracleDbType.Varchar2).Value = pilo.Nacionalidad;
                comando.Parameters.Add("IMAGEN", OracleDbType.Varchar2).Value       = pilo.Imagen;
                comando.ExecuteNonQuery();
                ora.Close();
            }

            catch
            {
            }
        }
Beispiel #15
0
 public bool ExistePiloto(string correo)
 {
     try
     {
         Piloto pilo = _db.Select <Piloto>(x => x.Correo == correo).FirstOrDefault();
         if (pilo.Correo == correo)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         if (ex.Message == "Referencia a objeto no establecida como una instancia de un objeto")
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
        public async Task <IActionResult> PutPiloto([FromRoute] int id, [FromBody] Piloto piloto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != piloto.PilotoId)
            {
                return(BadRequest());
            }

            _context.Entry(piloto).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PilotoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #17
0
        public static void CargaInicial(IServiceProvider serviceProvider)
        {
            using (var context = new RallyDbContexto(serviceProvider.GetRequiredService <DbContextOptions <RallyDbContexto> >()))
            {
                var temporada = new Temporada();
                temporada.Id   = 1;
                temporada.Nome = "Temporada2020";
                //temporada.DataInicio = DateTime.Now.AddDays(20); Inicia daqui a 20 dias
                temporada.DataInicio = DateTime.Now;

                var equipe = new Equipe();
                equipe.Id   = 1;
                equipe.Nome = "Azul";
                equipe.CodigoIdentificador = "AZL";

                var pilotoPedro = new Piloto();
                pilotoPedro.Id   = 1;
                pilotoPedro.Nome = "Pedro";


                var pilotoCarlos = new Piloto();
                pilotoCarlos.Id   = 2;
                pilotoCarlos.Nome = "Carlos";

                equipe.AdicionarPiloto(pilotoPedro);
                equipe.AdicionarPiloto(pilotoCarlos);

                temporada.AdicionarEquipe(equipe);

                context.Temporadas.Add(temporada);
                context.SaveChanges();
            }
        }
Beispiel #18
0
        // STATIC: TODAS AS INSTÂNCIAS DA CLASSE BaseDados TERÃO O MESMO VALOR PARA ESTE MÉTODO.
        // ESTA CLASSE É INSTANCIADA EM PROGRAM.CS, LOGO CADA INSTANCIA TERÁ O MESMO VALOR REFERENTE A ESTE MÉTODO

        /* A static method in C# is a method that keeps only one copy of the method at the Type level, not the object level.
         * That means, all instances of the class share the same copy of the method and its data. The last updated value of the method
         * is shared among all objects of that Type. Static methods are called by using the class name, not the instance of the class.
         */

        public static void CargaInicial(IServiceProvider serviceProvider)
        {
            // adiciona carga inicial na memória
            using (var context = new RallyDbContexto(serviceProvider.GetRequiredService <DbContextOptions <RallyDbContexto> >()))
            {
                var temporada = new Temporada();
                temporada.Id         = 1;
                temporada.Nome       = "Temporada20";
                temporada.DataInicio = DateTime.Now;
                var equipe = new Equipe();
                equipe.Id   = 1;
                equipe.Nome = "Ferrari";
                equipe.CodigoIdentificador = "FER";

                var piloto = new Piloto();
                piloto.Id   = 1;
                piloto.Nome = "schumacher";

                var piloto2 = new Piloto();
                piloto2.Id   = 2;
                piloto2.Nome = "Rubens";

                equipe.AdicionarPiloto(piloto);
                equipe.AdicionarPiloto(piloto2);

                temporada.AdicionarEquipe(equipe);

                context.Temporadas.Add(temporada);
                context.SaveChanges(); //salva em memória
            }
        }
Beispiel #19
0
        public void Atualizar(Piloto piloto)
        {
            //O objeto piloto foi recebido pelo cliente pelo PUT, portanto se trata de uma instância não gerenciada...
            //...pelo EntityFrameweork, por ser apenas uma instância que está em memória que veio de fora
            //O Attach faz com que a instância passe a ser gerenciada pelo EntityFramework
            //Sem o Attach o EntityFramework entenderia como um objeto a ser adicionado ao executar o SaveChanges, ao invés de um objeto a ser atualizado
            //Após o Attach, está para alterar o "state", onde o entity framework altera as propriedades da classe para "Modified"

            //Durante o Patch é feita uma busca pelo piloto, portanto não precisa fazer o attach e o entry, pois utilizamos uma...
            //... instância já gerenciada pelo EntityFramework, por isso tem aquele if que verifica se o state é datached

            if (_rallyDbContexto.Entry(piloto).State == Microsoft.EntityFrameworkCore.EntityState.Detached) //QUANDO FOR PUT
            {
                _rallyDbContexto.Attach(piloto);                                                            //Após essa linha, o state é alterado de Dettached para Unchanged
                _rallyDbContexto.Entry(piloto).State = Microsoft.EntityFrameworkCore.EntityState.Modified;  //Após essa linha, o state é alterado para Modified, para que o EntityFramework gere um update ao invés de um insert
            }
            else //QUANDO FOR PATCH
            {
                _rallyDbContexto.Update(piloto);
            }

            _rallyDbContexto.SaveChanges();

            //Detached: Não gerenciado pelo EntityFramework
        }
Beispiel #20
0
        public IActionResult DeleteByID(int ID) // não precisa utlizar o AutoMapper aqui, pois o parâmetro é apenas o ID e o objeto encontrado (classe do repositório) é passado para o método interno.
        {
            try
            {
                /* O EF possui um mecanismo de cache, então pode ser que o piloto que está sendo manipulado,
                 * já esteja em memória, assim, posso fazer melhor:
                 */
                // ANTES:
                //if (!_pilotoRepository.ExistByID(ID))
                //  return StatusCode(StatusCodes.Status404NotFound, "Piloto não encontrado.");
                //DEPOIS:
                Piloto piloto = _pilotoRepository.GetByID(ID);
                if (piloto == null)
                {
                    return(StatusCode(StatusCodes.Status404NotFound, "Piloto não encontrado."));
                }

                _pilotoRepository.Delete(piloto);

                return(StatusCode(StatusCodes.Status204NoContent, "Exclusão realizada com sucesso."));
            }
            catch (Exception)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, "Erro. Entrar em contato com o suporte!!!"));
            }
        }
Beispiel #21
0
 public static void AgregarPiloto(Piloto p1)
 {
     using (EscuelaEntities db = new EscuelaEntities())
     {
         db.Piloto.Add(p1);
         db.SaveChanges();
     }
 }
Beispiel #22
0
 public static void ModificarPiloto(Piloto p1)
 {
     using (EscuelaEntities db = new EscuelaEntities())
     {
         db.Entry(p1).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
        public ActionResult DeleteConfirmed(int id)
        {
            Piloto piloto = db.Piloto.Find(id);

            piloto.Ativo           = false;
            db.Entry(piloto).State = EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #24
0
        public static IVoltaCorrida VoltaCorridaMapper(string voltaCorrida)
        {
            var elementos_volta = Regex.Split(voltaCorrida, "\\s{2,}");

            //verifica se numero de colunas é igual a 5. Caso contrário termina programa
            if (elementos_volta.Length != 5)
            {
                throw new Exception("Arquivo de entrada com formato diferente do especificado. Lembre-se separe colunas por no mínimo 2 espaços e a informação" +
                                    " de cada coluna como a identificação completa do pilto (numero - nome) por exemplo, deve estar separada por apenas 1 espaço.");
            }


            var horaVolta = TimeSpan.Parse(elementos_volta[0]);

            var piloto = new Piloto(Convert.ToInt32(elementos_volta[1].Split(" – ")[0]), elementos_volta[1].Split(" – ")[1]);

            var numeroVolta = Convert.ToInt32(elementos_volta[2]);

            Func <string, string> FormataTimeString = (pTimeStr) =>
            {
                var HMSTempoVolta = elementos_volta[3].Split(":");

                if (HMSTempoVolta.Length > 3)
                {
                    if (HMSTempoVolta[0].Length == 1)
                    {
                        return("0" + pTimeStr);
                    }
                    else
                    {
                        return(pTimeStr);
                    }
                }
                else
                {
                    if (HMSTempoVolta[0].Length == 1)
                    {
                        return("00:0" + pTimeStr);
                    }
                    else
                    {
                        return("00:" + pTimeStr);
                    }
                }
            };

            //obtem Tempo Volta. em horas, minutos, segundos

            var tempoVolta = TimeSpan.Parse(FormataTimeString(elementos_volta[3]));

            //obtem Velocidade média da volta. OBS: (linha abaixo verifica se velocidade está separada por virgula. Se sim, substitui por ponto (.)
            String velocidade = (elementos_volta[4].Contains(",")) ? elementos_volta[4].Replace(",", ".") : elementos_volta[4];
            var    velMedia   = float.Parse(velocidade);

            return(new VoltaCorrida(horaVolta, piloto, numeroVolta, tempoVolta, velMedia));
        }
Beispiel #25
0
 public PilotoDados(Piloto piloto)
 {
     Id          = piloto.Id;
     Nome        = piloto.Nome;
     NomeGuerra  = piloto.NomeGuerra;
     Sigla       = piloto.Sigla;
     NumeroCarro = piloto.NumeroCarro;
     PaisOrigem  = piloto.PaisOrigem;
     Ativo       = piloto.Ativo;
 }
 public ActionResult Edit([Bind(Include = "IdPiloto,Nome,RG,CPFCNPJ,DataNascimento,NumeroLicenca,Ativo")] Piloto piloto)
 {
     if (ModelState.IsValid)
     {
         db.Entry(piloto).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(piloto));
 }
Beispiel #27
0
        public ActionResult DetallePiloto(int idpiloto)
        {
            Piloto piloto    = this.repo.DetallePiloto(idpiloto);
            String categoria = this.repo.GetNombreCategoria(piloto.Categoria);
            String equipo    = this.repo.GetNombreEquipo(piloto.Equipo);

            ViewBag.Categoria = categoria;
            ViewBag.Equipo    = equipo;
            return(View(piloto));
        }
 public ActionResult Edit([Bind(Include = "nombre,apellido,dni,email")] Piloto piloto)
 {
     if (ModelState.IsValid)
     {
         db.Entry(piloto).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(piloto));
 }
        // Extrai as informações do arquivo de entrada e retornar uma Lista
        public static List <Piloto> ExtractRacingLog()
        {
            // Recuperando Caminho do Arquivo de Entrada
            string path = ConfigurationManager.AppSettings["InputFileLocation"];

            // Leitura do Arquivo de Entrada
            List <string> linhas = File.ReadAllLines(path).ToList();

            // Criação de Nova Lista de Pilotos
            List <Piloto> piloto = new List <Piloto>();

            foreach (string linha in linhas)
            {
                // Split das colunas da linha por " " (espaços)
                string[] entradas = linha.Split(new Char[] { ' ' });

                Piloto PilotoNovo = new Piloto();

                // Formatação da Coluna HORA
                string formatoHoraLog = @"hh\:mm\:ss\.fff";

                // Formatação da Coluna Tempo de Volta
                string formatoTempoVolta = @"m\:ss\.fff";

                try
                {
                    // Set da Hora - Convertida para TimeSpan
                    PilotoNovo.hora = TimeSpan.ParseExact(entradas[0].ToString(), formatoHoraLog, null);

                    // Set do Código do Piloto
                    PilotoNovo.codigoPiloto = Convert.ToInt32(entradas[1]);

                    // Set do Nome do Piloto
                    PilotoNovo.nomePiloto = entradas[3];

                    // Set do Numero de Volta
                    PilotoNovo.numeroVolta = Convert.ToInt32(entradas[4]);

                    // Set da Velocidade Média Volta
                    PilotoNovo.velocidadeMediaVolta = Convert.ToDouble(entradas[6]);

                    // Set Tempo Volta
                    PilotoNovo.tempoVolta = TimeSpan.ParseExact(entradas[5].ToString(), formatoTempoVolta, null);

                    // Adicionar na Lista
                    piloto.Add(PilotoNovo);
                }
                catch (Exception e)
                {
                    throw e;
                }
            }
            return(piloto);
        }
Beispiel #30
0
 public Voo(Piloto piloto, List <Passageiro> passageiros, Aviao aviao, string linha, string origem, string destino, DateTime partida, DateTime retorno)
 {
     _piloto         = piloto;
     listaPassageiro = passageiros;
     _aviao          = aviao;
     Linha           = linha;
     Origem          = origem;
     Destino         = destino;
     Partida         = partida;
     Retorno         = retorno;
 }