Esempio n. 1
0
        public ActionResult CreateGymkana(Reporte rep)
        {
            try
            {
                UsuarioCAD usucad = new UsuarioCAD();
                UsuarioEN  usuen  = usucad.FiltrarUsuarioPorNombre(User.Identity.Name);
                ReporteCP  repcp  = new ReporteCP();
                GymkanaCAD gymcad = new GymkanaCAD();
                GymkanaEN  gymen  = gymcad.GetID(rep.idGymkana);

                repcp.ReportarGymkana(usuen.ID, gymen.ID, rep.Motivo);

                return(RedirectToAction("IndexGymkana", new { id = rep.idGymkana }));
            }
            catch
            {
                return(View());
            }
        }
Esempio n. 2
0
        public ActionResult CreateGymkana(Comentario com)
        {
            try
            {
                UsuarioCAD   usucad = new UsuarioCAD();
                UsuarioEN    usuen  = usucad.FiltrarUsuarioPorNombre(User.Identity.Name);
                ComentarioCP comcp  = new ComentarioCP();
                GymkanaCAD   gymcad = new GymkanaCAD();
                GymkanaEN    gymen  = gymcad.GetID(com.id);

                comcp.CrearComentarioParaGymkana(gymen.ID, com.Texto, usuen.ID);

                return(RedirectToAction("ComentarioGymkana", new { id = com.id }));
            }
            catch
            {
                return(View());
            }
        }
Esempio n. 3
0
        public ActionResult CreateGymkana(Puntuacion punt)
        {
            try
            {
                UsuarioCAD   usucad = new UsuarioCAD();
                UsuarioEN    usuen  = usucad.FiltrarUsuarioPorNombre(User.Identity.Name);
                PuntuacionCP puntcp = new PuntuacionCP();
                GymkanaCAD   gymcad = new GymkanaCAD();
                GymkanaEN    gymen  = gymcad.GetID(punt.id);

                puntcp.CrearPuntuacionParaGymkana(gymen.ID, punt.Puntos, usuen.ID);

                return(RedirectToAction("PuntuacionGymkana", new { id = punt.id }));
            }
            catch
            {
                return(View());
            }
        }
Esempio n. 4
0
        public ActionResult Create(Paso pas)
        {
            try
            {
                UsuarioCAD cad    = new UsuarioCAD();
                GymkanaCP  cp     = new GymkanaCP();
                GymkanaCAD gymcad = new GymkanaCAD();
                PasoEN     en     = new PasoEN();
                MapaEN     mapen  = new MapaEN();
                GymkanaEN  gymen  = gymcad.GetID(pas.id);
                mapen.Latitud  = pas.Latitud;
                mapen.Longitud = pas.Longitud;
                mapen.Zoom     = pas.Zoom;

                en.Descripcion = pas.Descripcion;
                cp.AnadirPaso(en, mapen, gymen);
                return(RedirectToAction("Index", new { id = gymen.ID }));
            }
            catch
            {
                return(View());
            }
        }
Esempio n. 5
0
        public void Reportar(int id_usuario, int id_gym, int id_reto, string motivo)
        {
            /*PROTECTED REGION ID(WhateverGenNHibernate.CP.Whatever_Reporte_Reportar) ENABLED START*/

            IReporteCAD reporteCAD = null;
            ReporteCEN  reporteCEN = null;



            try
            {
                SessionInitializeTransaction();
                reporteCAD = new ReporteCAD(session);
                reporteCEN = new  ReporteCEN(reporteCAD);



                ReporteEN  repor    = new ReporteEN();
                ReporteCAD reporcad = new ReporteCAD(session);
                AdminCAD   admincad = new AdminCAD(session);
                AdminCEN   admincen = new AdminCEN(admincad);
                GymkanaEN  gymen    = new GymkanaEN();
                GymkanaCAD gymcad   = new GymkanaCAD(session);
                RetoCAD    retocad  = new RetoCAD(session);
                RetoEN     retoen   = new RetoEN();
                UsuarioEN  usuen    = new UsuarioEN();
                UsuarioCAD usucad   = new UsuarioCAD(session);

                System.Collections.Generic.IList <AdminEN>   admin        = new System.Collections.Generic.List <AdminEN>();
                System.Collections.Generic.IList <AdminEN>   numadmins    = new System.Collections.Generic.List <AdminEN>();
                System.Collections.Generic.IList <ReporteEN> listareporte = new System.Collections.Generic.List <ReporteEN>();
                listareporte = reporcad.GetAll(0, 0);
                //int aux = 0;

                foreach (AdminEN element in admin)
                {
                    numadmins.Add(element);
                }
                admin = admincen.GetAll(0, 0);
                //aux = listareporte [listareporte.Count - 1].ID;

                repor.Admin_reporte = numadmins;
                repor.Motivo        = motivo;
                if (id_gym != -1)
                {
                    gymen = gymcad.GetID(id_gym);
                }
                else
                {
                    gymen = null;
                }
                repor.Reporte = gymen;
                if (id_reto != -1)
                {
                    retoen = retocad.GetID(id_reto);
                }
                else
                {
                    retoen = null;
                }
                repor.Reporte_reto2 = retoen;
                usuen = usucad.GetID(id_usuario);
                repor.Usuario_reporte = usuen;


                reporcad.New_(repor);


                SessionCommit();
            }
            catch (Exception ex)
            {
                SessionRollBack();
                throw ex;
            }
            finally
            {
                SessionClose();
            }


            /*PROTECTED REGION END*/
        }