public List<TipoServicio> obtenerServiciosDeRuta(int idRuta) { DataTable dt = new ServicioPorRuta().obtenerTodosPorIdRuta(idRuta); List<TipoServicio> tipos = new List<TipoServicio>(); foreach (DataRow row in dt.Rows) { TipoServicio ts = new TipoServicio(); ts = this.obtenerPorId(Int32.Parse(row["TIPO_SERVICIO_ID"].ToString())); if (ts != null) { tipos.Add(ts); } } return tipos; }
public TipoServicio obtenerPorId(int id) { TipoServicio ts = new TipoServicio(); string[] parametros = {"@id"}; DatosSistema datos = new DatosSistema(); DataTable dt = datos.getDatosTabla("[INFONIONIOS].[spObtenerTipoServicioPorId]", parametros,id); if (dt.Rows.Count != 0) { ts.idTipoServicio = Int32.Parse(dt.Rows[0]["TIPO_SERVICIO_ID"].ToString()); ts.nombreTipoServicio = dt.Rows[0]["TIPO_SERVICIO_NOMBRE"].ToString(); ts.porcentajeTipoServicio = Int32.Parse(dt.Rows[0]["TIPO_SERVICIO_PORCENTAJE"].ToString()); } else { return null; } return ts; }
public List<TipoServicio> obtenerTodosLista() { List<TipoServicio> tipos = new List<TipoServicio>(); DataTable dt = this.obtenerTodos(); foreach (DataRow row in dt.Rows) { TipoServicio ts = new TipoServicio(); ts.idTipoServicio = Int32.Parse(row["TIPO_SERVICIO_ID"].ToString()); ts.nombreTipoServicio = row["TIPO_SERVICIO_NOMBRE"].ToString(); ts.porcentajeTipoServicio = Int32.Parse(row["TIPO_SERVICIO_PORCENTAJE"].ToString()); tipos.Add(ts); } return tipos; }
private void totalCompra() { total = 0; Aeronave a = new Aeronave().obtenerHabilitadasLista().Find(aer => aer.idAeronave == viajeCompra.idAeronave); TipoServicio ts = new TipoServicio().obtenerPorId(a.idTipoServicio); RutaAerea ra = new RutaAerea().obtenerRutaAereaPorId(viajeCompra.idRutaAerea); precioPorPasaje = (int)ra.precioPasajeRutaAerea + ((ts.porcentajeTipoServicio / 100) * (int)ra.precioPasajeRutaAerea); precioPorPasaje = Math.Round(precioPorPasaje, 2); total = precioPorPasaje * cantPasajes; if (kgsEncomienda > 0) { precioEncomienda = ((int)ra.precioKGRutaAerea * kgsEncomienda); precioEncomienda = Math.Round(precioEncomienda, 2); total += precioEncomienda; } }