public void Unirgrupo(string p_Grupo_OID, string p_usuario_OID) { LugaresInteresGenNHibernate.EN.LugaresInteres.GrupoEN grupoEN = null; try { SessionInitializeTransaction(); grupoEN = (GrupoEN)session.Load(typeof(GrupoEN), p_Grupo_OID); grupoEN.Usuario = (LugaresInteresGenNHibernate.EN.LugaresInteres.UsuarioEN)session.Load(typeof(LugaresInteresGenNHibernate.EN.LugaresInteres.UsuarioEN), p_usuario_OID); grupoEN.Usuario.Grupo.Add(grupoEN); session.Update(grupoEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is LugaresInteresGenNHibernate.Exceptions.ModelException) { throw ex; } throw new LugaresInteresGenNHibernate.Exceptions.DataLayerException("Error in GrupoCAD.", ex); } finally { SessionClose(); } }
public override bool Equals(object obj) { if (obj == null) { return(false); } GrupoEN t = obj as GrupoEN; if (t == null) { return(false); } if (Nombre.Equals(t.Nombre)) { return(true); } else { return(false); } }
public void Salirgrupo(string p_Grupo_OID, string p_usuario_OID) { try { SessionInitializeTransaction(); LugaresInteresGenNHibernate.EN.LugaresInteres.GrupoEN grupoEN = null; grupoEN = (GrupoEN)session.Load(typeof(GrupoEN), p_Grupo_OID); if (grupoEN.Usuario.Email == p_usuario_OID) { grupoEN.Usuario = null; } else { throw new ModelException("The identifier " + p_usuario_OID + " in p_usuario_OID you are trying to unrelationer, doesn't exist in GrupoEN"); } session.Update(grupoEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is LugaresInteresGenNHibernate.Exceptions.ModelException) { throw ex; } throw new LugaresInteresGenNHibernate.Exceptions.DataLayerException("Error in GrupoCAD.", ex); } finally { SessionClose(); } }
public GrupoEN(GrupoEN grupo) { this.init(grupo.Nombre, grupo.Descripcion, grupo.Usuario, grupo.Comentario, grupo.Actividad); }