Exemplo n.º 1
0
        public int VerVoto(int id_usuario, int id_gym, int id_reto)
        {
            /*PROTECTED REGION ID(WhateverGenNHibernate.CEN.Whatever_Puntuacion_verVoto) ENABLED START*/

            // Write here your custom code...

            if (id_gym != -1 && id_reto == -1)
            {
                PuntuacionCEN punt            = new PuntuacionCEN();
                PuntuacionEN  puntuacionBuena = new PuntuacionEN();

                System.Collections.Generic.IList <PuntuacionEN> listaP;
                listaP = FiltrarEvento(id_gym, id_usuario);
                foreach (PuntuacionEN element in listaP)
                {
                    return(element.Puntuacion);
                }
                return(-1);
            }
            else
            {
                PuntuacionCEN punt            = new PuntuacionCEN();
                PuntuacionEN  puntuacionBuena = new PuntuacionEN();

                System.Collections.Generic.IList <PuntuacionEN> listaP;
                listaP = FiltrarReto(id_reto, id_usuario);
                foreach (PuntuacionEN element in listaP)
                {
                    return(element.Puntuacion);
                }
                return(-1);
            }
            /*PROTECTED REGION END*/
        }
        public float VerMedia(int id_gym, int id_reto)
        {
            /*PROTECTED REGION ID(WhateverGenNHibernate.CEN.Whatever_Puntuacion_verMedia) ENABLED START*/

            // Write here your custom code...

            float media = 0;
            int   cont  = 0;

            if (id_gym == -1)
            {
                PuntuacionCEN puntuacion = new PuntuacionCEN();
                RetoCEN       reto       = new RetoCEN();
                System.Collections.Generic.IList <PuntuacionEN> puntuaciones;
                puntuaciones = FiltrarMediaReto(id_reto);
                foreach (PuntuacionEN element in puntuaciones)
                {
                    media = media + element.Puntuacion;
                    cont++;
                }
                return(media = media / cont);
            }
            else if (id_reto == -1)
            {
                PuntuacionCEN puntuacion = new PuntuacionCEN();
                EventoCEN     evento     = new EventoCEN();
                System.Collections.Generic.IList <PuntuacionEN> puntuaciones;
                puntuaciones = FiltrarMediaEvento(id_gym);
                foreach (PuntuacionEN element in puntuaciones)
                {
                    media = media + element.Puntuacion;
                    cont++;
                }
                return(media = media / cont);
            }
            return(-1);
            /*PROTECTED REGION END*/
        }