public DataSet listarPiloto(Usuario piloto) { string rut = piloto.Rut; string UpperNombre = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(piloto.Nombre); string tipo_piloto = piloto.Licencia.TipoLicencia.NombreLicencia; Aeronave aeronave = new Aeronave(); aeronave = Sesion.GetValue <Aeronave>("aeronave"); string tipo = aeronave.TipoAeronave.NombreTipo; if (rut.Equals("")) { piloto.Rut = "%"; } else { piloto.Rut = rut + "%"; } if (UpperNombre.Equals("")) { piloto.Nombre = "%"; } else { piloto.Nombre = UpperNombre + "%"; } if (tipo_piloto.Equals("")) { piloto.Licencia.TipoLicencia.NombreLicencia = "%" + tipo + "%"; } PilotoDao listpiloto = new PilotoDao(); return(listpiloto.getPiloto(piloto)); }
public DataSet getTipoPiloto() { Aeronave aeronave = new Aeronave(); aeronave = Sesion.GetValue <Aeronave>("aeronave"); string tipo = aeronave.TipoAeronave.NombreTipo; PilotoDao piloto = new PilotoDao(); return(piloto.pilotoTipo(tipo)); }
public void calcularPromedioVueloTripulacion(Tripulacion triPiloto, Tripulacion triCopiloto, string promedioVuelo, string relacion) { double tiempoTotal = Sesion.GetValue <double>("horavuelo"); if (promedioVuelo == "50/50") { double tiempo50 = tiempoTotal * 50 / 100; triPiloto.CantidadHoras = tiempo50; triCopiloto.CantidadHoras = tiempo50; } if (promedioVuelo == "60/40") { double tiempo60 = tiempoTotal * 60 / 100; double tiempo40 = tiempoTotal * 40 / 100; if (relacion == "C/P") { triPiloto.CantidadHoras = tiempo40; triCopiloto.CantidadHoras = tiempo60; } else { triPiloto.CantidadHoras = tiempo60; triCopiloto.CantidadHoras = tiempo40; } } if (promedioVuelo == "80/20") { double tiempo80 = tiempoTotal * 80 / 100; double tiempo20 = tiempoTotal * 20 / 100; if (relacion == "C/P") { triPiloto.CantidadHoras = tiempo20; triCopiloto.CantidadHoras = tiempo80; } else { triPiloto.CantidadHoras = tiempo80; triCopiloto.CantidadHoras = tiempo20; } } }
public string calcularHoraLLegada() { double horavuelo = Sesion.GetValue <double>("horavuelo"); string horaPartida = Sesion.GetValue <string>("horaPartida"); double horaLLegada = Convert.ToDouble(horaPartida) + horavuelo; DateTime fechaPartida = Sesion.GetValue <DateTime>("fechaPartida"); DateTime fechaLlegada = new DateTime(); if (horaLLegada >= 24) { double dias = horaLLegada / 24; decimal d = Convert.ToDecimal(dias); var tsDias = TimeSpan.FromDays((double)d); // calcular cuanto dias pasaron fechaLlegada = fechaPartida.AddDays(tsDias.Days); Sesion.SetValue("fechaLlegada", fechaLlegada); horaLLegada = horaLLegada - 24; decimal h = Convert.ToDecimal(horaLLegada); var ts = TimeSpan.FromHours((double)h); if (ts.Hours.Equals(0) && ts.Minutes.ToString().Length == 1) { return(string.Format("00:0{0}", ts.Minutes)); } if (ts.Hours.Equals(0)) { return(string.Format("00:{0}", ts.Minutes)); } else if (ts.Hours.ToString().Length == 1 && ts.Minutes.ToString().Length == 1) { return(string.Format("0{0}:0{1}", ts.Hours, ts.Minutes)); } else if (ts.Hours.ToString().Length == 1) { return(string.Format("0{0}:{1}", ts.Hours, ts.Minutes)); } else if (ts.Minutes.ToString().Length == 1) { return(string.Format("{0}:0{1}", ts.Hours, ts.Minutes)); } else { return(string.Format("{0}:{1}", ts.Hours, ts.Minutes)); } } else { fechaLlegada = fechaPartida; Sesion.SetValue("fechaLlegada", fechaLlegada); decimal h = Convert.ToDecimal(horaLLegada); var ts = TimeSpan.FromHours((double)h); if (ts.Hours.Equals(0) && ts.Minutes.ToString().Length == 1) { return(string.Format("0{0}", ts.Minutes)); } if (ts.Hours.Equals(0)) { return(string.Format("{0}", ts.Minutes)); } else if (ts.Hours.ToString().Length == 1 && ts.Minutes.ToString().Length == 1) { return(string.Format("0{0}:0{1}", ts.Hours, ts.Minutes)); } else if (ts.Hours.ToString().Length == 1) { return(string.Format("0{0}:{1}", ts.Hours, ts.Minutes)); } else if (ts.Minutes.ToString().Length == 1) { return(string.Format("{0}:0{1}", ts.Hours, ts.Minutes)); } else { return(string.Format("{0}:{1}", ts.Hours, ts.Minutes)); } } }