Exemple #1
0
        public System.Collections.Generic.IList <RetappGenNHibernate.EN.Retapp.RetoEN> ReadRetos(int concurso)
        {
            /*PROTECTED REGION ID(RetappGenNHibernate.CEN.Retapp_Concurso_ReadRetos) ENABLED START*/

            // Write here your custom code...
            string ConnectionString = "Data Source=ARA65;Initial Catalog=RetappGenNHibernate;Persist Security Info=True;User ID=nhibernateUser;Password=nhibernatePass";

            List <RetoEN> lista = new List <RetoEN>();

            try
            {
                SqlConnection c = new SqlConnection(ConnectionString);
                c.Open();
                SqlCommand    com    = new SqlCommand("Select idConcurso from Reto where FK_idConcurso_idConcurso = " + concurso + " ; ", c);
                SqlDataReader dr     = com.ExecuteReader();
                RetoCEN       retcen = new RetoCEN();
                while (dr.Read())
                {
                    RetoEN ret = retcen.ReadOID(dr.GetInt32(0));
                    lista.Add(ret);
                }
                dr.Close();
                c.Close();
            }

            catch (Exception ex)
            {
                Console.WriteLine("Se ha producido una excepcion al leer los retos de un concurso: " + ex);
            }

            return(lista);

            /*PROTECTED REGION END*/
        }
Exemple #2
0
        public int New_(string p_titulo, string p_descripcion, string p_tipo, double p_precio, string p_imagen, int p_usuario)
        {
            RetoEN retoEN = null;
            int    oid;

            //Initialized RetoEN
            retoEN        = new RetoEN();
            retoEN.Titulo = p_titulo;

            retoEN.Descripcion = p_descripcion;

            retoEN.Tipo = p_tipo;

            retoEN.Precio = p_precio;

            retoEN.Imagen = p_imagen;


            if (p_usuario != -1)
            {
                // El argumento p_usuario -> Property usuario es oid = false
                // Lista de oids ID
                retoEN.Usuario    = new WhateverGenNHibernate.EN.Whatever.UsuarioEN();
                retoEN.Usuario.ID = p_usuario;
            }

            //Call to RetoCAD

            oid = _IRetoCAD.New_(retoEN);
            return(oid);
        }
Exemple #3
0
        public RetoEN ReadOID(int id)
        {
            RetoEN retoEN = null;

            retoEN = _IRetoCAD.ReadOID(id);
            return(retoEN);
        }
Exemple #4
0
        public int New_(RetoEN reto)
        {
            try
            {
                SessionInitializeTransaction();
                if (reto.Usuario != null)
                {
                    // Argumento OID y no colección.
                    reto.Usuario = (WhateverGenNHibernate.EN.Whatever.UsuarioEN)session.Load(typeof(WhateverGenNHibernate.EN.Whatever.UsuarioEN), reto.Usuario.ID);

                    reto.Usuario.Reto
                    .Add(reto);
                }

                session.Save(reto);
                SessionCommit();
            }

            catch (Exception ex) {
                SessionRollBack();
                if (ex is WhateverGenNHibernate.Exceptions.ModelException)
                {
                    throw ex;
                }
                throw new WhateverGenNHibernate.Exceptions.DataLayerException("Error in RetoCAD.", ex);
            }


            finally
            {
                SessionClose();
            }

            return(reto.ID);
        }
Exemple #5
0
        public int New_(int p_concurso, string p_Nombre, string p_Descripcion, Nullable <DateTime> p_FechaFin, bool p_Active)
        {
            RetoEN retoEN = null;
            int    oid;

            //Initialized RetoEN
            retoEN = new RetoEN();

            if (p_concurso != -1)
            {
                // El argumento p_concurso -> Property concurso es oid = false
                // Lista de oids id
                retoEN.Concurso    = new RetappGenNHibernate.EN.Retapp.ConcursoEN();
                retoEN.Concurso.Id = p_concurso;
            }

            retoEN.Nombre = p_Nombre;

            retoEN.Descripcion = p_Descripcion;

            retoEN.FechaFin = p_FechaFin;

            retoEN.Active = p_Active;

            //Call to RetoCAD

            oid = _IRetoCAD.New_(retoEN);
            return(oid);
        }
Exemple #6
0
        public void Destroy(int ID
                            )
        {
            try
            {
                SessionInitializeTransaction();
                RetoEN retoEN = (RetoEN)session.Load(typeof(RetoEN), ID);
                session.Delete(retoEN);
                SessionCommit();
            }

            catch (Exception ex) {
                SessionRollBack();
                if (ex is WhateverGenNHibernate.Exceptions.ModelException)
                {
                    throw ex;
                }
                throw new WhateverGenNHibernate.Exceptions.DataLayerException("Error in RetoCAD.", ex);
            }


            finally
            {
                SessionClose();
            }
        }
Exemple #7
0
        public RetoEN ReadOIDDefault(int ID
                                     )
        {
            RetoEN retoEN = null;

            try
            {
                SessionInitializeTransaction();
                retoEN = (RetoEN)session.Get(typeof(RetoEN), ID);
                SessionCommit();
            }

            catch (Exception ex) {
                SessionRollBack();
                if (ex is WhateverGenNHibernate.Exceptions.ModelException)
                {
                    throw ex;
                }
                throw new WhateverGenNHibernate.Exceptions.DataLayerException("Error in RetoCAD.", ex);
            }


            finally
            {
                SessionClose();
            }

            return(retoEN);
        }
Exemple #8
0
        //Guarda los cambios y hace commmit en la BBDD
        //Pone active a false
        private void button2_Click(object sender, EventArgs e)
        {
            RetoCEN     retocen = new RetoCEN();
            ConcursoCEN concen  = new ConcursoCEN();

            if (reto == null)
            {
                reto             = new RetoEN();
                reto.Concurso    = campaign.Concur;
                reto.Active      = false;
                reto.Nombre      = textBox1.Text;
                reto.Descripcion = richTextBox1.Text;
                reto.FechaFin    = (DateTime)dateTimePicker1.Value;
                reto.Id          = retocen.New_(campaign.Concur.Id, textBox1.Text, richTextBox1.Text, (DateTime)dateTimePicker1.Value, false);
            }
            else
            {
                reto.FechaFin    = dateTimePicker1.Value;
                reto.Nombre      = textBox1.Text;
                reto.Descripcion = richTextBox1.Text;
                reto.Active      = false;
                retocen.get_IRetoCAD().Modify(reto);
            }
            //Actualiza la vista anterior
            this.Reto_Load(sender, e);
            campaign.Campaña_Load(sender, e);
        }
Exemple #9
0
        public Reto getReto(int id)
        {
            RetoCEN retocen = new RetoCEN();
            RetoEN  retoEN  = retocen.get_IRetoCAD().ReadOID(id);

            return(new Reto(retoEN));
        }
Exemple #10
0
        public System.Collections.Generic.IList <RetappGenNHibernate.EN.Retapp.RetoEN> ReadRetos(int concurso)
        {
            /*PROTECTED REGION ID(RetappGenNHibernate.CEN.Retapp_Concurso_ReadRetos) ENABLED START*/

            // Write here your custom code...
            NHibernate.Cfg.Configuration cfg = new NHibernate.Cfg.Configuration().Configure();
            string ConnectionString          = cfg.GetProperty(NHibernate.Cfg.Environment.ConnectionString);

            List <RetoEN> lista = new List <RetoEN>();

            try
            {
                SqlConnection c = new SqlConnection(ConnectionString);
                c.Open();
                SqlCommand    com    = new SqlCommand("Select id from Reto where FK_idConcurso_idConcurso = " + concurso + " ; ", c);
                SqlDataReader dr     = com.ExecuteReader();
                RetoCEN       retcen = new RetoCEN();
                while (dr.Read())
                {
                    RetoEN ret = retcen.ReadOID(dr.GetInt32(0));
                    lista.Add(ret);
                }
                dr.Close();
                c.Close();
            }

            catch (Exception ex)
            {
                Console.WriteLine("Se ha producido una excepcion al leer los retos de un concurso: " + ex);
            }

            return(lista);

            /*PROTECTED REGION END*/
        }
Exemple #11
0
        public RetoEN GetID(int ID
                            )
        {
            RetoEN retoEN = null;

            retoEN = _IRetoCAD.GetID(ID);
            return(retoEN);
        }
Exemple #12
0
        public void BorrarUnReporte(int p_oid)
        {
            /*PROTECTED REGION ID(WhateverGenNHibernate.CP.Whatever_Reporte_borrarUnReporte) ENABLED START*/

            IReporteCAD reporteCAD = null;
            ReporteCEN  reporteCEN = null;



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



                // Write here your custom transaction ...

                EventoEN even = new EventoEN();
                even = reporteCAD.GetID(p_oid).Evento;
                RetoEN reten = new RetoEN();
                reten = reporteCAD.GetID(p_oid).Reto;
                GymkanaEN gymen = new GymkanaEN();
                gymen = reporteCAD.GetID(p_oid).Gymkana;

                if (even != null)
                {
                    reporteCAD.UnrelationerReporteEvento(p_oid, even.ID);
                    reporteCAD.Destroy(p_oid);
                }
                else if (reten != null)
                {
                    reporteCAD.UnrelationerReporteReto(p_oid, reten.ID);
                    reporteCAD.Destroy(p_oid);
                }
                else if (gymen != null)
                {
                    reporteCAD.UnrelationerReporteGymkana(p_oid, gymen.ID);
                    reporteCAD.Destroy(p_oid);
                }


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


            /*PROTECTED REGION END*/
        }
Exemple #13
0
        public void BorrarUnComentario(int id_comentario)
        {
            /*PROTECTED REGION ID(WhateverGenNHibernate.CP.Whatever_Comentario_borrarUnComentario) ENABLED START*/

            IComentarioCAD comentarioCAD = null;
            ComentarioCEN  comentarioCEN = null;



            try
            {
                SessionInitializeTransaction();
                comentarioCAD = new ComentarioCAD(session);
                comentarioCEN = new  ComentarioCEN(comentarioCAD);



                // Write here your custom transaction ...

                EventoEN even = new EventoEN();
                even = comentarioCAD.GetID(id_comentario).Evento;
                RetoEN reten = new RetoEN();
                reten = comentarioCAD.GetID(id_comentario).Reto;
                GymkanaEN gymen = new GymkanaEN();
                gymen = comentarioCAD.GetID(id_comentario).Gymkana;
                if (even != null)
                {
                    comentarioCAD.UnrelationerComentarioEvento(id_comentario, even.ID);
                    comentarioCAD.Destroy(id_comentario);
                }
                else if (reten != null)
                {
                    comentarioCAD.UnrelationerComentarioReto(id_comentario, reten.ID);
                    comentarioCAD.Destroy(id_comentario);
                }
                else if (gymen != null)
                {
                    comentarioCAD.UnrelationerComentarioGymkana(id_comentario, gymen.ID);
                    comentarioCAD.Destroy(id_comentario);
                }


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


            /*PROTECTED REGION END*/
        }
        public WhateverGenNHibernate.EN.Whatever.RetoEN VerReto(int p_oid)
        {
            /*PROTECTED REGION ID(WhateverGenNHibernate.CEN.Whatever_Reto_verReto) ENABLED START*/

            // Write here your custom code...

            RetoEN salida = new RetoEN();

            salida = GetID(p_oid);

            return(salida);
            /*PROTECTED REGION END*/
        }
        public Reto ConvertENToModelUI(RetoEN reten)
        {
            if (reten != null)
            {
                AssemblerReporte    assR = new AssemblerReporte();
                AssemblerPuntuacion assP = new AssemblerPuntuacion();
                ComentarioCEN       c    = new ComentarioCEN();
                PuntuacionCEN       p    = new PuntuacionCEN();
                Reto reto = new Reto();
                reto.Titulo      = reten.Titulo;
                reto.Descripcion = reten.Descripcion;
                reto.Tipo        = reten.Tipo;
                reto.Precio      = reten.Precio;
                reto.Imagen      = reten.Imagen;
                reto.Creador     = reten.Usuario.Nombre;


                //puntuacion
                reto.Puntuaciones = null;
                if (reten.Puntuacion != null)
                {
                    reto.Puntuaciones = assP.ConvertListENToModel(reten.Puntuacion);
                }

                //comentarios
                IList <ComentarioEN> listafiltro = new List <ComentarioEN>();
                listafiltro = c.FiltrarComentarioPorReto(reten.ID);

                AssemblerComentario ass = new AssemblerComentario();
                reto.Comentarios = ass.ConvertListENToModel(listafiltro);

                //atributos ocultos del model
                reto.id      = reten.ID;
                reto.usuario = reten.Usuario;

                //reportes
                reto.Reportes = null;
                if (reten.Reporte != null)
                {
                    reto.Reportes = assR.ConvertListENToModel(reten.Reporte);
                }

                return(reto);
            }
            else
            {
                return(null);
            }
        }
Exemple #16
0
        public void Modify(int p_Reto_OID, string p_Nombre, string p_Descripcion, Nullable <DateTime> p_FechaFin, bool p_Active)
        {
            RetoEN retoEN = null;

            //Initialized RetoEN
            retoEN             = new RetoEN();
            retoEN.Id          = p_Reto_OID;
            retoEN.Nombre      = p_Nombre;
            retoEN.Descripcion = p_Descripcion;
            retoEN.FechaFin    = p_FechaFin;
            retoEN.Active      = p_Active;
            //Call to RetoCAD

            _IRetoCAD.Modify(retoEN);
        }
Exemple #17
0
        public void Activar(int p_oid)
        {
            /*PROTECTED REGION ID(RetappGenNHibernate.CEN.Retapp_Reto_Activar) ENABLED START*/

            // Write here your custom code...

            try
            {
                RetoEN ret = ReadOID(p_oid);
                ret.Active = true;
                this.Modify(ret.Id, ret.Nombre, ret.Descripcion, ret.FechaFin, ret.Active);
            }
            catch (Exception ex) { Console.WriteLine("Se ha producido una excepci�n al activar el reto: " + ex); }
            /*PROTECTED REGION END*/
        }
Exemple #18
0
        public void Modify(int p_Reto_OID, string p_titulo, string p_descripcion, string p_tipo, double p_precio, string p_imagen)
        {
            RetoEN retoEN = null;

            //Initialized RetoEN
            retoEN             = new RetoEN();
            retoEN.ID          = p_Reto_OID;
            retoEN.Titulo      = p_titulo;
            retoEN.Descripcion = p_descripcion;
            retoEN.Tipo        = p_tipo;
            retoEN.Precio      = p_precio;
            retoEN.Imagen      = p_imagen;
            //Call to RetoCAD

            _IRetoCAD.Modify(retoEN);
        }
        public ActionResult Edit(Reto ret, HttpPostedFileBase file)
        {
            string fileName = "", path = "";

            // Verify that the user selected a file
            if (file != null && file.ContentLength > 0)
            {
                // extract only the fielname
                fileName = Path.GetFileName(file.FileName);
                // store the file inside ~/App_Data/uploads folder
                path = Path.Combine(Server.MapPath("~/Images/Uploads"), fileName);
                //string pathDef = path.Replace(@"\\", @"\");
                file.SaveAs(path);
            }

            try
            {
                RetoCEN cen   = new RetoCEN();
                RetoEN  reten = new RetoEN();
                reten.ID          = ret.id;
                reten.Descripcion = ret.Descripcion;
                reten.Imagen      = ret.Imagen;
                fileName          = "/Images/Uploads/" + fileName;
                if (ret.Imagen != fileName && fileName != "/Images/Uploads/")
                {
                    reten.Imagen = fileName;
                }
                else
                {
                    reten.Imagen = ret.Imagen;
                }
                reten.Precio  = ret.Precio;
                reten.Tipo    = ret.Tipo;
                reten.Titulo  = ret.Titulo;
                reten.Usuario = ret.usuario;


                cen.ModificarReto(reten);
                ;               return(RedirectToAction("List"));
            }
            catch
            {
                return(View());
            }
        }
Exemple #20
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());
            }
        }
Exemple #21
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());
            }
        }
Exemple #22
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());
            }
        }
Exemple #23
0
// Modify default (Update all attributes of the class)

        public void ModifyDefault(RetoEN reto)
        {
            try
            {
                SessionInitializeTransaction();
                RetoEN retoEN = (RetoEN)session.Load(typeof(RetoEN), reto.ID);

                retoEN.Titulo = reto.Titulo;


                retoEN.Descripcion = reto.Descripcion;


                retoEN.Tipo = reto.Tipo;


                retoEN.Precio = reto.Precio;


                retoEN.Imagen = reto.Imagen;



                session.Update(retoEN);
                SessionCommit();
            }

            catch (Exception ex) {
                SessionRollBack();
                if (ex is WhateverGenNHibernate.Exceptions.ModelException)
                {
                    throw ex;
                }
                throw new WhateverGenNHibernate.Exceptions.DataLayerException("Error in RetoCAD.", ex);
            }


            finally
            {
                SessionClose();
            }
        }
        public ActionResult Create(Reto ret, HttpPostedFileBase file)
        {
            string fileName = "", path = "";

            // Verify that the user selected a file
            if (file != null && file.ContentLength > 0)
            {
                // extract only the fielname
                fileName = Path.GetFileName(file.FileName);
                // store the file inside ~/App_Data/uploads folder
                path = Path.Combine(Server.MapPath("~/Images/Uploads"), fileName);
                //string pathDef = path.Replace(@"\\", @"\");
                file.SaveAs(path);
            }


            try
            {
                RetoCEN    cen   = new RetoCEN();
                UsuarioCAD cad   = new UsuarioCAD();
                RetoEN     reten = new RetoEN();
                reten.Descripcion = ret.Descripcion;
                fileName          = "/Images/Uploads/" + fileName;
                reten.Imagen      = fileName;
                reten.Precio      = ret.Precio;
                reten.Tipo        = ret.Tipo;
                reten.Titulo      = ret.Titulo;
                reten.Usuario     = cad.FiltrarUsuarioPorNombre(User.Identity.Name);
                //cen.New_(reten.Titulo, reten.Descripcion, reten.Tipo, reten.Precio, reten.Imagen, reten.Usuario.ID);
                cen.CrearReto(reten);

                return(RedirectToAction("List"));
            }
            catch
            {
                return(View());
            }
        }
Exemple #25
0
        public void Modify(RetoEN reto)
        {
            try
            {
                SessionInitializeTransaction();
                RetoEN retoEN = (RetoEN)session.Load(typeof(RetoEN), reto.Id);

                retoEN.Nombre = reto.Nombre;


                retoEN.Descripcion = reto.Descripcion;


                retoEN.FechaFin = reto.FechaFin;


                retoEN.Active = reto.Active;

                session.Update(retoEN);
                SessionCommit();
            }

            catch (Exception ex) {
                SessionRollBack();
                if (ex is RetappGenNHibernate.Exceptions.ModelException)
                {
                    throw ex;
                }
                throw new RetappGenNHibernate.Exceptions.DataLayerException("Error in RetoCAD.", ex);
            }


            finally
            {
                SessionClose();
            }
        }
Exemple #26
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;
            }
        }
Exemple #27
0
 public Reto(RetoEN reto)
 {
     this.init(reto.Id, reto.Nombre, reto.Descripcion, reto.FechaFin, reto.Active);
 }
Exemple #28
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*/
        }