示例#1
0
        public void BorrarElementosMultimedia(int p_entrada, System.Collections.Generic.IList <int> p_elementomultimedia)
        {
            try
            {
                SessionInitializeTransaction();
                NuevoInmueblateGenNHibernate.EN.RedSocial.EntradaEN entradaEN = null;
                entradaEN = (EntradaEN)session.Load(typeof(EntradaEN), p_entrada);

                NuevoInmueblateGenNHibernate.EN.RedSocial.ElementoMultimediaEN elementosMultimediaENAux = null;
                if (entradaEN.ElementosMultimedia != null)
                {
                    foreach (int item in p_elementomultimedia)
                    {
                        elementosMultimediaENAux = (NuevoInmueblateGenNHibernate.EN.RedSocial.ElementoMultimediaEN)session.Load(typeof(NuevoInmueblateGenNHibernate.EN.RedSocial.ElementoMultimediaEN), item);
                        if (entradaEN.ElementosMultimedia.Contains(elementosMultimediaENAux) == true)
                        {
                            entradaEN.ElementosMultimedia.Remove(elementosMultimediaENAux);
                            elementosMultimediaENAux.Entradas.Remove(entradaEN);
                        }
                        else
                        {
                            throw new ModelException("The identifier " + item + " in p_elementomultimedia you are trying to unrelationer, doesn't exist in EntradaEN");
                        }
                    }
                }

                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();
            }
        }
示例#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 AnyadirEntradas(int p_muro, System.Collections.Generic.IList <int> p_entrada)
        {
            NuevoInmueblateGenNHibernate.EN.RedSocial.MuroEN muroEN = null;
            try
            {
                SessionInitializeTransaction();
                muroEN = (MuroEN)session.Load(typeof(MuroEN), p_muro);
                NuevoInmueblateGenNHibernate.EN.RedSocial.EntradaEN entradasENAux = null;
                if (muroEN.Entradas == null)
                {
                    muroEN.Entradas = new System.Collections.Generic.List <NuevoInmueblateGenNHibernate.EN.RedSocial.EntradaEN>();
                }

                foreach (int item in p_entrada)
                {
                    entradasENAux      = new NuevoInmueblateGenNHibernate.EN.RedSocial.EntradaEN();
                    entradasENAux      = (NuevoInmueblateGenNHibernate.EN.RedSocial.EntradaEN)session.Load(typeof(NuevoInmueblateGenNHibernate.EN.RedSocial.EntradaEN), item);
                    entradasENAux.Muro = muroEN;

                    muroEN.Entradas.Add(entradasENAux);
                }


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

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


            finally
            {
                SessionClose();
            }
        }
示例#6
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            EntradaEN t = obj as EntradaEN;

            if (t == null)
            {
                return(false);
            }
            if (Id.Equals(t.Id))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#7
0
 public EntradaEN(EntradaEN entrada)
 {
     this.init(Id, entrada.FechaPublicacion, entrada.Titulo, entrada.Cuerpo, entrada.PendienteModeracion, entrada.Muro, entrada.UsuariosMeGusta, entrada.Creador, entrada.Reportadores, entrada.Comentarios, entrada.ElementosMultimedia);
 }