예제 #1
0
        public void BorrarRetos(int p_oid)
        {
            /*PROTECTED REGION ID(WhateverGenNHibernate.CP.Whatever_Admin_borrarRetos) ENABLED START*/

            IAdminCAD adminCAD = null;
            AdminCEN  adminCEN = null;



            try
            {
                SessionInitializeTransaction();
                adminCAD = new AdminCAD(session);
                adminCEN = new  AdminCEN(adminCAD);


                RetoCAD reto = new RetoCAD(session);
                reto.Destroy(p_oid);


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


            /*PROTECTED REGION END*/
        }
예제 #2
0
        //
        // GET: /Reto/

        public ActionResult Index()
        {
            SessionInitialize();
            RetoCAD cad = new RetoCAD(session);
            var     aux = cad.GetAll(0, 0);


            return(View(aux));
        }
        public void BorrarUsuario(int p_oid)
        {
            /*PROTECTED REGION ID(WhateverGenNHibernate.CEN.Whatever_Usuario_BorrarUsuario) ENABLED START*/

            // Write here your custom code...

            UsuarioCAD    usu  = new UsuarioCAD();
            EventoCAD     eve  = new EventoCAD();
            EventoCEN     evec = new EventoCEN();
            RetoCAD       ret  = new RetoCAD();
            RetoCEN       retc = new RetoCEN();
            PuntuacionCAD pun  = new PuntuacionCAD();
            ReporteCAD    rep  = new ReporteCAD();
            ComentarioCAD com  = new ComentarioCAD();

            System.Collections.Generic.IList <EventoEN>     eventos;
            System.Collections.Generic.IList <RetoEN>       retos;
            System.Collections.Generic.IList <PuntuacionEN> puntuaciones;
            System.Collections.Generic.IList <ReporteEN>    reportes;
            System.Collections.Generic.IList <ComentarioEN> comentarios;

            usu.Destroy(p_oid);

            eventos = eve.FiltrarPorUsuario(p_oid);
            foreach (EventoEN element in eventos)
            {
                evec.BorrarEvento(element.ID);
            }

            retos = ret.FiltrarPorUsuario(p_oid);
            foreach (RetoEN element in retos)
            {
                retc.BorrarReto(element.ID);
            }

            puntuaciones = pun.FiltrarPorUsuario(p_oid);
            foreach (PuntuacionEN element in puntuaciones)
            {
                pun.Destroy(element.Id);
            }

            reportes = rep.FiltrarPorUsuario(p_oid);
            foreach (ReporteEN element in reportes)
            {
                rep.Destroy(element.ID);
            }

            comentarios = com.FiltrarPorUsuario(p_oid);
            foreach (ComentarioEN element in comentarios)
            {
                rep.Destroy(element.ID);
            }

            /*PROTECTED REGION END*/
        }
예제 #4
0
        //
        // GET: /Reto/Details/5

        public ActionResult Details(int id)
        {
            Reto ret = null;

            SessionInitialize();
            RetoEN retEN = new RetoCAD(session).ReadOIDDefault(id);

            ret = new AssemblerReto().ConvertENToModelUI(retEN);
            SessionClose();
            return(View(ret));
        }
예제 #5
0
        //
        // GET: /Reto/List

        public ActionResult List()
        {
            SessionInitialize();
            RetoCAD    cad    = new RetoCAD(session);
            UsuarioCAD usucad = new UsuarioCAD(session);
            UsuarioEN  usuen  = usucad.FiltrarUsuarioPorNombre(User.Identity.Name);
            var        aux    = cad.FiltrarRetoPorUsuario(usuen.ID);

            SessionClose();

            return(View(aux));
        }
예제 #6
0
        //
        // GET: /Reto/Edit/5

        public ActionResult Edit(int id)
        {
            Reto ret = null;

            SessionInitialize();
            RetoEN    reten = new RetoCAD(session).ReadOIDDefault(id);
            UsuarioEN usu   = reten.Usuario;

            ret = new AssemblerReto().ConvertENToModelUI(reten);
            if (User.Identity.Name != usu.Nombre && !Roles.IsUserInRole("admin"))
            {
                return(RedirectToAction("Details", new { id = id }));
            }
            SessionClose();
            return(View(ret));
        }
예제 #7
0
        public ActionResult Index()
        {
            SessionInitialize();
            EventoCAD  evt  = new EventoCAD(session);
            var        aux  = evt.GetAll(0, 0);
            RetoCAD    ret  = new RetoCAD(session);
            var        aux2 = ret.GetAll(0, 0);
            GymkanaCAD gym  = new GymkanaCAD(session);
            var        aux3 = gym.GetAll(0, 0);

            ViewData["Eventos"]  = aux;
            ViewData["Retos"]    = aux2;
            ViewData["Gymkanas"] = aux3;

            SessionClose();

            return(View());
        }
예제 #8
0
        public ActionResult CreateReto(Reporte rep)
        {
            try
            {
                UsuarioCAD usucad = new UsuarioCAD();
                UsuarioEN  usuen  = usucad.FiltrarUsuarioPorNombre(User.Identity.Name);
                ReporteCP  repcp  = new ReporteCP();
                RetoCAD    retcad = new RetoCAD();
                RetoEN     reten  = retcad.GetID(rep.idReto);

                repcp.ReportarReto(usuen.ID, reten.ID, rep.Motivo);

                return(RedirectToAction("IndexReto", new { id = rep.idReto }));
            }
            catch
            {
                return(View());
            }
        }
예제 #9
0
        public ActionResult CreateReto(Comentario com)
        {
            try
            {
                UsuarioCAD   usucad = new UsuarioCAD();
                UsuarioEN    usuen  = usucad.FiltrarUsuarioPorNombre(User.Identity.Name);
                ComentarioCP comcp  = new ComentarioCP();
                RetoCAD      retcad = new RetoCAD();
                RetoEN       reten  = retcad.GetID(com.id);

                comcp.CrearComentarioParaReto(reten.ID, com.Texto, usuen.ID);

                return(RedirectToAction("ComentarioReto", new { id = com.id }));
            }
            catch
            {
                return(View());
            }
        }
예제 #10
0
        public ActionResult CreateReto(Puntuacion punt)
        {
            try
            {
                UsuarioCAD   usucad = new UsuarioCAD();
                UsuarioEN    usuen  = usucad.FiltrarUsuarioPorNombre(User.Identity.Name);
                PuntuacionCP puntcp = new PuntuacionCP();
                RetoCAD      retcad = new RetoCAD();
                RetoEN       reten  = retcad.GetID(punt.id);

                puntcp.CrearPuntuacionParaReto(reten.ID, punt.Puntos, usuen.ID);

                return(RedirectToAction("PuntuacionReto", new { id = punt.id }));
            }
            catch
            {
                return(View());
            }
        }
예제 #11
0
        public void BorrarReto(int p_oid)
        {
            /*PROTECTED REGION ID(WhateverGenNHibernate.CP.Whatever_Reto_borrarReto) ENABLED START*/

            IRetoCAD retoCAD = null;
            RetoCEN  retoCEN = null;



            try
            {
                SessionInitializeTransaction();
                retoCAD = new RetoCAD(session);
                retoCEN = new  RetoCEN(retoCAD);


                PuntuacionCP punt = new PuntuacionCP(session);
                ReporteCP    rep  = new ReporteCP(session);
                ComentarioCP com  = new ComentarioCP(session);

                punt.BorrarPuntuacionReto(p_oid);
                rep.BorrarReportesReto(p_oid);
                com.BorrarComentariosReto(p_oid);

                retoCAD.Destroy(p_oid);



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


            /*PROTECTED REGION END*/
        }
예제 #12
0
        public Resultado inscribirse(String gaccount, int idConcurso)
        {
            Resultado res = new Resultado();

            res.result = true;
            res.msg    = "Inscripción realizada con éxito.";

            UsuarioCAD usuarioCAD = new UsuarioCAD();
            UsuarioEN  usuarioEN  = usuarioCAD.ReadOID(gaccount);

            if (usuarioEN == null)
            {
                res.result = false;
                res.msg    = "El usuario no existe.";
            }
            else
            {
                RetoCAD       retoCAD     = new RetoCAD();
                List <RetoEN> listaRetoEN = new List <RetoEN>(retoCAD.ReadAll(0, 0));
                //listaRetoEN = listaRetoEN.Where(r => r.Concurso.Id == idConcurso).ToList<RetoEN>();
                listaRetoEN = listaRetoEN.Where(r => r.Concurso.Id == idConcurso && r.Active == true).ToList <RetoEN>();

                foreach (RetoEN retoEN in listaRetoEN)
                {
                    ParticipacionCAD participacionCAD = new ParticipacionCAD();
                    ParticipacionEN  participacionEN  = new ParticipacionEN();
                    participacionEN.Fecha     = DateTime.Now;
                    participacionEN.Valor     = 0;
                    participacionEN.Prueba    = "";
                    participacionEN.Votos     = 0;
                    participacionEN.Reportes  = 0;
                    participacionEN.Reto      = retoEN;
                    participacionEN.Usuario_0 = usuarioEN;
                    participacionCAD.New_(participacionEN);
                }
            }

            return(res);
        }
예제 #13
0
        public void BorrarUsuario(int p_oid)
        {
            /*PROTECTED REGION ID(WhateverGenNHibernate.CP.Whatever_Usuario_BorrarUsuario) ENABLED START*/

            IUsuarioCAD usuarioCAD = null;
            UsuarioCEN  usuarioCEN = null;



            try
            {
                SessionInitializeTransaction();
                usuarioCAD = new UsuarioCAD(session);
                usuarioCEN = new  UsuarioCEN(usuarioCAD);


                EventoCAD  eve  = new EventoCAD(session);
                EventoCP   evec = new EventoCP(session);
                RetoCAD    ret  = new RetoCAD(session);
                RetoCP     retc = new RetoCP(session);
                GymkanaCAD gym  = new GymkanaCAD(session);
                GymkanaCP  gymc = new GymkanaCP(session);

                System.Collections.Generic.IList <EventoEN>  eventos;
                System.Collections.Generic.IList <RetoEN>    retos;
                System.Collections.Generic.IList <GymkanaEN> gymkanas;


                eventos = eve.FiltrarEventoPorUsuario(p_oid);
                foreach (EventoEN element in eventos)
                {
                    evec.BorrarEvento(element.ID);
                }

                retos = ret.FiltrarRetoPorUsuario(p_oid);
                foreach (RetoEN element in retos)
                {
                    retc.BorrarReto(element.ID);
                }

                gymkanas = gym.FiltrarGymkanaPorUsuario(p_oid);
                foreach (GymkanaEN element in gymkanas)
                {
                    gymc.BorrarGymkana(element.ID);
                }


                usuarioCAD.Destroy(p_oid);

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


            /*PROTECTED REGION END*/
        }
예제 #14
0
        public static void InitializeData()
        {
            /*PROTECTED REGION ID(initializeDataMethod) ENABLED START*/
            try
            {
                // Insert the initilizations of entities using the CEN classes
                UsuarioCAD usu    = new UsuarioCAD();
                UsuarioCEN usucen = new UsuarioCEN(usu);
                UsuarioEN  usuen  = new UsuarioEN();
                UsuarioCP  usucp  = new UsuarioCP();

                UsuarioCAD usu2    = new UsuarioCAD();
                UsuarioCEN usucen2 = new UsuarioCEN(usu2);
                UsuarioEN  usuen2  = new UsuarioEN();
                UsuarioCP  usucp2  = new UsuarioCP();

                AdminCAD adm    = new AdminCAD();
                AdminCEN admcen = new AdminCEN(adm);
                AdminEN  admen  = new AdminEN();
                AdminCP  admcp  = new AdminCP();

                EventoCAD eve    = new EventoCAD();
                EventoCEN evecen = new EventoCEN(eve);
                EventoEN  even   = new EventoEN();
                EventoCP  evecp  = new EventoCP();

                RetoCAD ret    = new RetoCAD();
                RetoCEN retcen = new RetoCEN(ret);
                RetoEN  reten  = new RetoEN();
                RetoCP  retcp  = new RetoCP();

                ReporteCAD rep    = new ReporteCAD();
                ReporteCEN repcen = new ReporteCEN(rep);
                ReporteEN  repen  = new ReporteEN();
                ReporteCP  repcp  = new ReporteCP();

                MapaCAD map    = new MapaCAD();
                MapaCEN mapcen = new MapaCEN(map);
                MapaEN  mapen  = new MapaEN();
                MapaCP  mapcp  = new MapaCP();

                MapaCAD map2    = new MapaCAD();
                MapaCEN mapcen2 = new MapaCEN(map);
                MapaEN  mapen2  = new MapaEN();
                MapaCP  mapcp2  = new MapaCP();

                MapaCAD map3    = new MapaCAD();
                MapaCEN mapcen3 = new MapaCEN(map);
                MapaEN  mapen3  = new MapaEN();
                MapaCP  mapcp3  = new MapaCP();

                PuntuacionCAD punt    = new PuntuacionCAD();
                PuntuacionCEN puntcen = new PuntuacionCEN(punt);
                PuntuacionEN  punten  = new PuntuacionEN();
                PuntuacionCP  puntcp  = new PuntuacionCP();

                PuntuacionCAD punt2    = new PuntuacionCAD();
                PuntuacionCEN puntcen2 = new PuntuacionCEN(punt);
                PuntuacionEN  punten2  = new PuntuacionEN();
                PuntuacionCP  puntcp2  = new PuntuacionCP();

                PasoCAD pas    = new PasoCAD();
                PasoCEN pascen = new PasoCEN(pas);
                PasoEN  pasen  = new PasoEN();
                PasoCP  pascp  = new PasoCP();

                ComentarioCAD com    = new ComentarioCAD();
                ComentarioCEN comcen = new ComentarioCEN(com);
                ComentarioEN  comen  = new ComentarioEN();
                ComentarioCP  comcp  = new ComentarioCP();

                ComentarioCAD com2    = new ComentarioCAD();
                ComentarioCEN comcen2 = new ComentarioCEN(com);
                ComentarioEN  comen2  = new ComentarioEN();
                ComentarioCP  comcp2  = new ComentarioCP();

                ComentarioCAD com3    = new ComentarioCAD();
                ComentarioCEN comcen3 = new ComentarioCEN(com);
                ComentarioEN  comen3  = new ComentarioEN();
                ComentarioCP  comcp3  = new ComentarioCP();


                GymkanaCAD gym    = new GymkanaCAD();
                GymkanaCEN gymcen = new GymkanaCEN(gym);
                GymkanaEN  gymen  = new GymkanaEN();
                GymkanaCP  gymcp  = new GymkanaCP();



                //insertamos valores en el usuarioEN
                usuen.Nombre     = "Admin";
                usuen.Edad       = 20;
                usuen.Sexo       = "Hombre";
                usuen.Facebook   = "face";
                usuen.Instagram  = "insta";
                usuen.Twitter    = "twitter";
                usuen.Contrasena = "123456";
                usuen.Email      = "*****@*****.**";
                usuen.Foto       = "si";

                usucen.Registro(usuen);


                //creamos admin
                var aux = usucp.HacerAdmin(usuen.ID, usuen.Nombre);

                /*
                 *
                 *
                 *
                 *
                 *
                 *  //insertamos valores en el usuarioEN
                 *  usuen2.Nombre = "Javier";
                 *  usuen2.Edad = 10;
                 *  usuen2.Sexo = "Hombre";
                 *  usuen2.Facebook = "face";
                 *  usuen2.Instagram = "insta";
                 *  usuen2.Twitter = "twitter";
                 *  usuen2.Contrasena = "123";
                 *  usuen2.Email = "*****@*****.**";
                 *  usuen2.Foto = "si";
                 *
                 *  usucen2.Registro (usuen2);
                 *
                 *
                 *
                 *
                 *  //creamos el evento
                 *  even.Titulo = "quedada para ruta de la tapa";
                 *  even.Descripcion = "la idea es ir un grupo grande de gente de bar en bar";
                 *  even.Usuario = usuen;
                 *  even.Precio = 0;
                 *  even.Fecha = new DateTime (2008, 5, 1, 8, 30, 52);
                 *
                 *  evecp.CrearEvento (even, 27, 28, 8);
                 *
                 *
                 *  //creamos un reto
                 *  reten.Titulo = "no hay huevos a venir a clase desnudo";
                 *  reten.Descripcion = "pues eso, venir a clase y demostrarme tu valentia";
                 *  reten.Precio = 0;
                 *  reten.Imagen = "";
                 *  reten.Tipo = "";
                 *  reten.Usuario = usuen;
                 *
                 *  retcen.CrearReto (reten);
                 *
                 *
                 *  //creamos gymkana
                 *  gymen.Titulo = "quedada para ruta de la tapa";
                 *  gymen.Descripcion = "la idea es ir un grupo grande de gente de bar en bar";
                 *  gymen.Usuario = usuen;
                 *  gymen.Precio = 0;
                 *  gymen.Fecha = new DateTime (2008, 5, 1, 8, 30, 52);
                 *  gymen.NumPasos = 5;
                 *
                 *  gymcp.CrearGymkana (gymen, 27, 29, 8);
                 *
                 *
                 *  //creamos los comentarios
                 *
                 *  var id_comen = comcp.CrearComentarioParaReto (reten.ID, "pos ta wapo el reto", usuen.ID);
                 *  //   var aux = com.GetAll(0, -1);
                 *  var id_comen2 = comcp2.CrearComentarioParaEvento (even.ID, "pos ta wapo el evento", usuen2.ID);
                 *
                 *
                 *  //creamos una puntuacion
                 *  var id_punt = puntcp.CrearPuntuacionParaEvento (even.ID, 5, usuen.ID);
                 *  var id_punt2 = puntcp2.CrearPuntuacionParaReto (reten.ID, 10, usuen.ID);
                 *
                 *
                 *  //creamos un reporte
                 *  var id_repor = repcp.ReportarEvento (usuen.ID, even.ID, "porque si");
                 *  var id_repor2 = repcp.ReportarReto (usuen.ID, reten.ID, "porque no");
                 *
                 *
                 *  //creamos el mapa de un paso
                 *  mapen3.Latitud = 39.5;
                 *  mapen3.Longitud = -1.5;
                 *  mapen3.Zoom = 16;
                 *
                 *  //creamos paso
                 *  pasen.Descripcion = "paso hola";
                 *  pasen.Gymkana = gymen;
                 *  pasen.Mapa = mapen3;
                 *  gymcp.AnadirPaso (pasen, mapen3, gymen);
                 *
                 *
                 *
                 *
                 *  var debugPoint = usucen.GetAll (0, 0);
                 *  var debugPoint2 = comcen.GetAll (0, 0);
                 *  var debugPoint3 = comcen2.GetAll (0, 0);
                 *  var debugPoint4 = evecen.GetAll (0, 0);
                 *  var debugPoint5 = gymcen.GetAll (0, 0);
                 *  var debugPoint6 = mapcen.GetAll (0, 0);
                 *  var debugPoint7 = pascen.GetAll (0, 0);
                 *  var debugPoint8 = puntcen.GetID (punten.Id);
                 *  var debugPoint9 = puntcen2.GetID (punten2.Id);
                 *  var debugPoint10 = retcen.GetAll (0, 0);
                 *  var debugPoint11 = admcen.GetAll (0, 0);
                 *
                 *  ///////////////////////CUSTOM//////////////////////
                 *
                 *  //USUARIO
                 *  var debugPoint15 = usucen.RecuperarContasena (usuen.Email, usuen.Nombre);
                 *
                 *  //EVENTO
                 *  evecen.VerEvento (even.ID);
                 *  var debugPoint16 = evecen.GetID (even.ID);
                 *
                 *  //PASO
                 *  var debugPoint12 = pascen.GetAll (0, 0);
                 *  for (int i = 0; i < debugPoint12.Count; i++) {
                 *          pascen.VerPaso (i);
                 *  }
                 *  pascen.VerPasos (gymen.ID);
                 *
                 *
                 *  //GYMKANA.
                 *  var debugPoint13 = gymcen.VerPasos (gymen.ID);
                 *
                 *  //PUNTUACIONES
                 *  var aux = puntcen.VerMediaEvento (even.ID);
                 *  var aux2 = puntcen.VerMediaReto (reten.ID);
                 *  //var aux3 = puntcen.FiltrarPuntuacionPorEventoYUsuario (usuen.ID, even.ID);
                 *  //var aux4 = puntcen.FiltrarPuntuacionPorUsuarioYReto (usuen.ID, reten.ID);
                 *
                 *  //REPORTE
                 *  repcen.ConsultarReporte (usuen.ID, reten.ID, -1);
                 *
                 *  repcen.ConsultarReporte (usuen.ID, -1, even.ID);
                 *
                 *
                 *  //////////////////////MODIFY//////////////////////
                 *  //Usuario
                 *  usucen.CambiarContrasena (usuen.ID, "456");
                 *  debugPoint = usucen.GetAll (0, 0);
                 *  usucen.CambiarCorreo (usuen.ID, "*****@*****.**");
                 *  debugPoint = usucen.GetAll (0, 0);
                 *  usucen.CambiarFoto (usuen.ID, "Foto2");
                 *  debugPoint = usucen.GetAll (0, 0);
                 *  usucen.ModificarRedesSociales ("insta2", "face2", "twitter2", usuen.ID);
                 *  debugPoint = usucen.GetAll (0, 0);
                 *
                 *  //COMENTARIO
                 *  comcen.ModificarComentario ("MOTIVO NUEVO", id_comen);
                 *  debugPoint2 = comcen.GetAll (0, 0);
                 *  comcen2.ModificarComentario ("MOTIVO NUEVO 2", id_comen2);
                 *  debugPoint3 = comcen2.GetAll (0, 0);
                 *
                 *
                 *  //EVENTO
                 *  even.Descripcion = "Nueva descripcion evento";
                 *  evecp.ModificarEvento (mapen, even);
                 *  debugPoint4 = evecen.GetAll (0, 0);
                 *
                 *
                 *  //GYMKANA
                 *  gymen.Descripcion = "Nueva descripcion gymkana";
                 *  gymcp.ModificarGymkana (gymen, mapen);
                 *  debugPoint5 = gymcen.GetAll (0, 0);
                 *
                 *
                 *  //MAPA
                 *  //var mapa = mapcen.FiltrarMapa (40, -1, 10);
                 *  debugPoint6 = mapcen.GetAll (0, 0);
                 *
                 *
                 *  //PASO
                 *  pasen.Descripcion = "Nueva Descripcion Paso";
                 *  pascp.ModificarPaso (pasen, mapen3);
                 *  debugPoint7 = pascen.GetAll (0, 0);
                 *
                 *
                 *  //PUNTUACION
                 *  puntcen.ModificarPuntuacion (521552, id_punt);
                 *  debugPoint8 = puntcen.GetID (id_punt);
                 *
                 *  puntcen2.ModificarPuntuacion (21, id_punt2);
                 *  debugPoint9 = puntcen2.GetID (id_punt2);
                 *
                 *  //RETO
                 *  reten.Descripcion = "NUEVA DESCRIPCION RETO";
                 *  retcen.ModificarReto (reten);
                 *  debugPoint10 = retcen.GetAll (0, 0);
                 *
                 *  ///////////////////////CUSTOM//////////////////////
                 *
                 *  //USUARIO
                 *  //debugPoint15 = usucen.RecuperarContasena (usuen.Email, usuen.Nombre);
                 *
                 *  //EVENTO
                 *  evecen.VerEvento (even.ID);
                 *  debugPoint16 = evecen.GetID (even.ID);
                 *
                 *  //PASO
                 *  debugPoint12 = pascen.GetAll (0, 0);
                 *  for (int i = 0; i < debugPoint12.Count; i++) {
                 *          pascen.VerPaso (i);
                 *  }
                 *  var aux7 = pascen.VerPasos (gymen.ID);
                 *
                 *
                 *  //GYMKANA.
                 *  debugPoint13 = gymcen.VerPasos (gymen.ID);
                 *
                 *  //PUNTUACIONES
                 *  puntcen.VerMediaEvento (even.ID);
                 *  puntcen.VerMediaReto (reten.ID);
                 *  //puntcen.VerVoto (usuen.ID, gymen.ID, -1);
                 *  //puntcen.VerVoto (usuen.ID, -1, reten.ID);
                 *
                 *  //REPORTE
                 *  var ver = repcen.ConsultarReporte (usuen.ID, reten.ID, -1);
                 *  var ver2 = repcen.ConsultarReporte (usuen.ID, -1, even.ID);
                 *
                 *  /////////////////////DESTROY/////////////////////
                 *
                 *  //usucp.BorrarUsuario (usuen.ID);
                 *  var a = usucen.GetAll (0, 0);
                 *  //admcp.BorrarEvento (admen.ID);
                 *  var b = evecen.GetAll (0, 0);
                 *  //   evecp.CrearEvento (even, 50, 30, 10);
                 *  b = evecen.GetAll (0, 0);
                 *  // admcp.BorrarRetos (admen.ID);
                 *  var c = retcen.GetAll (0, 0);
                 *  //retcen.CrearReto (reten);
                 *  c = retcen.GetAll (0, 0);
                 *  var d = retcen.GetAll (0, 0);
                 *  var co = comcen.GetAll (0, 0);
                 *  //admcp.DeshacerAdmin (admen.ID);
                 *  //var u= admcen.GetAll (0, 0);
                 *
                 *
                 *  //    comcen.BorrarComentario (comen.ID);
                 *  var e = comcen.GetAll (0, 0);
                 *
                 *  evecp.BorrarEvento (even.ID);;
                 *  b = evecen.GetAll (0, 0);
                 *
                 *  //pascp.BorrarPaso (pasen.ID);
                 *  var g = pascen.GetAll (0, 0);
                 *
                 *  gymcp.BorrarGymkana (gymen.ID);
                 *  var f = gymcen.GetAll (0, 0);
                 *
                 *  var h = repcen.GetAll (0, 0);
                 *  repcp.BorrarReportesEvento (even.ID);
                 *  h = repcen.GetAll (0, 0);
                 *
                 *  repcp.BorrarReportesReto (reten.ID);
                 *  var y = repcen.GetAll (0, 0);
                 *
                 *  retcp.BorrarReto (repen.ID);
                 *  var k = retcen.GetAll (0, 0);
                 *
                 */

                /*PROTECTED REGION END*/
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex.InnerException);
                throw ex;
            }
        }
예제 #15
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*/
        }