Пример #1
0
        public void BorrarReportadores(int p_comentario, System.Collections.Generic.IList <int> p_superusuario)
        {
            try
            {
                SessionInitializeTransaction();
                NuevoInmueblateGenNHibernate.EN.RedSocial.ComentarioEN comentarioEN = null;
                comentarioEN = (ComentarioEN)session.Load(typeof(ComentarioEN), p_comentario);

                NuevoInmueblateGenNHibernate.EN.RedSocial.SuperUsuarioEN reportadoresENAux = null;
                if (comentarioEN.Reportadores != null)
                {
                    foreach (int item in p_superusuario)
                    {
                        reportadoresENAux = (NuevoInmueblateGenNHibernate.EN.RedSocial.SuperUsuarioEN)session.Load(typeof(NuevoInmueblateGenNHibernate.EN.RedSocial.SuperUsuarioEN), item);
                        if (comentarioEN.Reportadores.Contains(reportadoresENAux) == true)
                        {
                            comentarioEN.Reportadores.Remove(reportadoresENAux);
                            reportadoresENAux.ComentariosReportados.Remove(comentarioEN);
                        }
                        else
                        {
                            throw new ModelException("The identifier " + item + " in p_superusuario you are trying to unrelationer, doesn't exist in ComentarioEN");
                        }
                    }
                }

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

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


            finally
            {
                SessionClose();
            }
        }
Пример #2
0
        public void BorrarEntradasReportadas(int p_SuperUsuario_OID, System.Collections.Generic.IList <int> p_entradasReportadas_OIDs)
        {
            try
            {
                SessionInitializeTransaction();
                NuevoInmueblateGenNHibernate.EN.RedSocial.SuperUsuarioEN superUsuarioEN = null;
                superUsuarioEN = (SuperUsuarioEN)session.Load(typeof(SuperUsuarioEN), p_SuperUsuario_OID);

                NuevoInmueblateGenNHibernate.EN.RedSocial.EntradaEN entradasReportadasENAux = null;
                if (superUsuarioEN.EntradasReportadas != null)
                {
                    foreach (int item in p_entradasReportadas_OIDs)
                    {
                        entradasReportadasENAux = (NuevoInmueblateGenNHibernate.EN.RedSocial.EntradaEN)session.Load(typeof(NuevoInmueblateGenNHibernate.EN.RedSocial.EntradaEN), item);
                        if (superUsuarioEN.EntradasReportadas.Contains(entradasReportadasENAux) == true)
                        {
                            superUsuarioEN.EntradasReportadas.Remove(entradasReportadasENAux);
                            entradasReportadasENAux.Reportadores.Remove(superUsuarioEN);
                        }
                        else
                        {
                            throw new ModelException("The identifier " + item + " in p_entradasReportadas_OIDs you are trying to unrelationer, doesn't exist in SuperUsuarioEN");
                        }
                    }
                }

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

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


            finally
            {
                SessionClose();
            }
        }
Пример #3
0
        public void AnyadirEntradasReportadas(int p_SuperUsuario_OID, System.Collections.Generic.IList <int> p_entradasReportadas_OIDs)
        {
            NuevoInmueblateGenNHibernate.EN.RedSocial.SuperUsuarioEN superUsuarioEN = null;
            try
            {
                SessionInitializeTransaction();
                superUsuarioEN = (SuperUsuarioEN)session.Load(typeof(SuperUsuarioEN), p_SuperUsuario_OID);
                NuevoInmueblateGenNHibernate.EN.RedSocial.EntradaEN entradasReportadasENAux = null;
                if (superUsuarioEN.EntradasReportadas == null)
                {
                    superUsuarioEN.EntradasReportadas = new System.Collections.Generic.List <NuevoInmueblateGenNHibernate.EN.RedSocial.EntradaEN>();
                }

                foreach (int item in p_entradasReportadas_OIDs)
                {
                    entradasReportadasENAux = new NuevoInmueblateGenNHibernate.EN.RedSocial.EntradaEN();
                    entradasReportadasENAux = (NuevoInmueblateGenNHibernate.EN.RedSocial.EntradaEN)session.Load(typeof(NuevoInmueblateGenNHibernate.EN.RedSocial.EntradaEN), item);
                    entradasReportadasENAux.Reportadores.Add(superUsuarioEN);

                    superUsuarioEN.EntradasReportadas.Add(entradasReportadasENAux);
                }


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

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


            finally
            {
                SessionClose();
            }
        }
Пример #4
0
        public void AnyadirUsuariosMeGusta(int p_entrada, System.Collections.Generic.IList <int> p_superusuario)
        {
            NuevoInmueblateGenNHibernate.EN.RedSocial.EntradaEN entradaEN = null;
            try
            {
                SessionInitializeTransaction();
                entradaEN = (EntradaEN)session.Load(typeof(EntradaEN), p_entrada);
                NuevoInmueblateGenNHibernate.EN.RedSocial.SuperUsuarioEN usuariosMeGustaENAux = null;
                if (entradaEN.UsuariosMeGusta == null)
                {
                    entradaEN.UsuariosMeGusta = new System.Collections.Generic.List <NuevoInmueblateGenNHibernate.EN.RedSocial.SuperUsuarioEN>();
                }

                foreach (int item in p_superusuario)
                {
                    usuariosMeGustaENAux = new NuevoInmueblateGenNHibernate.EN.RedSocial.SuperUsuarioEN();
                    usuariosMeGustaENAux = (NuevoInmueblateGenNHibernate.EN.RedSocial.SuperUsuarioEN)session.Load(typeof(NuevoInmueblateGenNHibernate.EN.RedSocial.SuperUsuarioEN), item);
                    usuariosMeGustaENAux.EntradasMeGusta.Add(entradaEN);

                    entradaEN.UsuariosMeGusta.Add(usuariosMeGustaENAux);
                }


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

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


            finally
            {
                SessionClose();
            }
        }
Пример #5
0
        public void AnyadirReportador(int p_comentario, System.Collections.Generic.IList <int> p_superusuario)
        {
            NuevoInmueblateGenNHibernate.EN.RedSocial.ComentarioEN comentarioEN = null;
            try
            {
                SessionInitializeTransaction();
                comentarioEN = (ComentarioEN)session.Load(typeof(ComentarioEN), p_comentario);
                NuevoInmueblateGenNHibernate.EN.RedSocial.SuperUsuarioEN reportadoresENAux = null;
                if (comentarioEN.Reportadores == null)
                {
                    comentarioEN.Reportadores = new System.Collections.Generic.List <NuevoInmueblateGenNHibernate.EN.RedSocial.SuperUsuarioEN>();
                }

                foreach (int item in p_superusuario)
                {
                    reportadoresENAux = new NuevoInmueblateGenNHibernate.EN.RedSocial.SuperUsuarioEN();
                    reportadoresENAux = (NuevoInmueblateGenNHibernate.EN.RedSocial.SuperUsuarioEN)session.Load(typeof(NuevoInmueblateGenNHibernate.EN.RedSocial.SuperUsuarioEN), item);
                    reportadoresENAux.ComentariosReportados.Add(comentarioEN);

                    comentarioEN.Reportadores.Add(reportadoresENAux);
                }


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

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


            finally
            {
                SessionClose();
            }
        }
Пример #6
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            SuperUsuarioEN t = obj as SuperUsuarioEN;

            if (t == null)
            {
                return(false);
            }
            if (Id.Equals(t.Id))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #7
0
 public SuperUsuarioEN(SuperUsuarioEN superUsuario)
 {
     this.init(Id, superUsuario.Muro, superUsuario.Grupos, superUsuario.MensajesEnviados, superUsuario.MensajesRecibidos, superUsuario.ValoracionEmitida, superUsuario.ValoracionRecibida, superUsuario.EntradasMeGusta, superUsuario.Entradas, superUsuario.EntradasReportadas, superUsuario.Comentarios, superUsuario.ComentariosReportados, superUsuario.Nombre, superUsuario.Telefono, superUsuario.Email, superUsuario.Direccion, superUsuario.Poblacion, superUsuario.CodigoPostal, superUsuario.Pais, superUsuario.Password, superUsuario.ValoracionMedia);
 }