public List <BE.Nivel> Leer(int idDeporte)
        {
            var ls = new List <BE.Nivel>();

            BE.Nivel beNivel = new BE.Nivel();

            var dt = _accesoBaseDeDatos.Seleccionar(new BE.Nivel(), false);

            foreach (DataRow row in dt.Rows)
            {
                if (Convert.ToInt32(row["IdDeporte"]) == idDeporte)
                {
                    var aNivel = new BE.Nivel
                    {
                        Id          = Convert.ToInt32(row["Id"]),
                        NombreNivel = row["NombreNivel"].ToString().Trim(),
                        Deporte     = new BE.Deporte()
                        {
                            Id = Convert.ToInt32(row["IdDeporte"])
                        },
                        ReglasDeNivel = new List <BE.NivelRegla>()
                    };
                    ls.Add(aNivel);
                }
            }

            return(ls);
        }
        public BE.Nivel ObtenerNivelPorId(int idNivel)
        {
            var dtNivel = _accesoBaseDeDatos.Seleccionar(new BE.Nivel()
            {
                Id = idNivel
            }, true, true);

            if (dtNivel.Rows.Count == 0)
            {
                return(null);
            }

            var row    = dtNivel.Rows[0];
            var aNivel = new BE.Nivel
            {
                Id          = Convert.ToInt32(row["Id"]),
                NombreNivel = row["NombreNivel"].ToString().Trim(),
                Deporte     = new BE.Deporte()
                {
                    Id = Convert.ToInt32(row["IdDeporte"])
                },
                ReglasDeNivel = new List <BE.NivelRegla>()
            };

            return(aNivel);
        }
        /// <summary>
        /// Agrega un nuevo Nivel al sistema.
        /// </summary>
        /// <param name="pNivel">Nivel a agregar.</param>
        /// <returns></returns>
        public Resultado Agregar(BE.Nivel pNivel)
        {
            var resultado = _dalManagerNivel.Insertar(pNivel);

            if (resultado == ResultadoBd.OK)
            {
                return(new Resultado(false, "Ok"));
            }

            return(new Resultado(false, "No se dio de alta el Nivel."));
        }
        /// <summary>
        /// Quita un Nivel.
        /// </summary>
        /// <param name="pNivel">Nivel a quitar.</param>
        /// <returns></returns>
        public Resultado Quitar(BE.Nivel pNivel)
        {
            ResultadoBd resultado = _dalManagerNivel.Borrar(pNivel);

            if (resultado == ResultadoBd.OK)
            {
                return(new Resultado(false, "Ok"));
            }


            return(new Resultado(false, "No se pudo borrar el Nivel."));
        }
        /// <summary>
        /// Edita un Nivel.
        /// </summary>
        /// <param name="pNivel">Nivel a editar.</param>
        /// <returns></returns>
        public Resultado Editar(BE.Nivel pNivel)
        {
            ResultadoBd resultado = _dalManagerNivel.Actualizar(pNivel);

            if (resultado == ResultadoBd.OK)
            {
                return(new Resultado(false, "Ok"));
            }


            return(new Resultado(false, "No se pudo editar el Nivel."));
        }
        public BE.Nivel ObtnerNivelPorId(int idNivel)
        {
            if (idNivel != 0)
            {
                BLL.NivelRegla bllNivelRegla = new BLL.NivelRegla();
                BLL.Deporte    bllDeporte    = new BLL.Deporte();

                BE.Nivel beNivel = _dalManagerNivel.ObtenerNivelPorId(idNivel);

                beNivel.Deporte       = bllDeporte.ObtnerDeportePorId(beNivel.Deporte.Id);
                beNivel.ReglasDeNivel = bllNivelRegla.ObtenerReglasPorNivelId(beNivel.Id);

                return(beNivel);
            }
            else
            {
                return(null);
            }
        }
 /// <summary>
 /// Borra un Nivel.
 /// </summary>
 /// <param name="pNivel">Nivel.</param>
 /// <returns></returns>
 public ResultadoBd Borrar(BE.Nivel pNivel)
 {
     return(_accesoBaseDeDatos.Borrar(pNivel));
 }
 /// <summary>
 /// Actualiza un Nivel.
 /// </summary>
 /// <param name="pNivel">Nivel.</param>
 /// <returns></returns>
 public ResultadoBd Actualizar(BE.Nivel pNivel)
 {
     return(_accesoBaseDeDatos.Actualizar(pNivel));
 }
 /// <summary>
 /// Inserta un Nivel.
 /// </summary>
 /// <param name="pNivel">Nivel.</param>
 /// <returns></returns>
 public ResultadoBd Insertar(BE.Nivel pNivel)
 {
     return(_accesoBaseDeDatos.Insertar(pNivel));
 }
Esempio n. 10
0
 public BE.Nivel ObtnerNivelReducidoPorId(int idNivel)
 {
     BE.Nivel beNivel = _dalManagerNivel.ObtenerNivelPorId(idNivel);
     return(beNivel);
 }