Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
        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;
            }
        }