public int CrearGustos(GustosEN gustos) { try { SessionInitializeTransaction(); if (gustos.Usuario != null) { // Argumento OID y no colección. gustos.Usuario = (NuevoInmueblateGenNHibernate.EN.RedSocial.UsuarioEN)session.Load(typeof(NuevoInmueblateGenNHibernate.EN.RedSocial.UsuarioEN), gustos.Usuario.Id); gustos.Usuario.Gustos = gustos; } session.Save(gustos); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is NuevoInmueblateGenNHibernate.Exceptions.ModelException) { throw ex; } throw new NuevoInmueblateGenNHibernate.Exceptions.DataLayerException("Error in GustosCAD.", ex); } finally { SessionClose(); } return(gustos.Id); }
public GustosEN DameGustosPorOID(int id) { GustosEN gustosEN = null; gustosEN = _IGustosCAD.DameGustosPorOID(id); return(gustosEN); }
public GustosEN ReadOIDDefault(int id) { GustosEN gustosEN = null; try { SessionInitializeTransaction(); gustosEN = (GustosEN)session.Get(typeof(GustosEN), id); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is NuevoInmueblateGenNHibernate.Exceptions.ModelException) { throw ex; } throw new NuevoInmueblateGenNHibernate.Exceptions.DataLayerException("Error in GustosCAD.", ex); } finally { SessionClose(); } return(gustosEN); }
public void BorrarGustos(int id) { try { SessionInitializeTransaction(); GustosEN gustosEN = (GustosEN)session.Load(typeof(GustosEN), id); session.Delete(gustosEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is NuevoInmueblateGenNHibernate.Exceptions.ModelException) { throw ex; } throw new NuevoInmueblateGenNHibernate.Exceptions.DataLayerException("Error in GustosCAD.", ex); } finally { SessionClose(); } }
public static GustosEN Convert(GustosDTO dto) { GustosEN newinstance = null; try { if (dto != null) { newinstance = new GustosEN(); newinstance.Id = dto.Id; newinstance.PendienteModeracion = dto.PendienteModeracion; newinstance.Musica = dto.Musica; newinstance.Libros = dto.Libros; newinstance.Peliculas = dto.Peliculas; newinstance.Juegos = dto.Juegos; if (dto.Usuario_oid != -1) { NuevoInmueblateGenNHibernate.CAD.RedSocial.IUsuarioCAD usuarioCAD = new NuevoInmueblateGenNHibernate.CAD.RedSocial.UsuarioCAD(); newinstance.Usuario = usuarioCAD.ReadOIDDefault(dto.Usuario_oid); } } } catch (Exception ex) { throw ex; } return(newinstance); }
public void ModificarGustos(int p_oid, bool p_pendienteModeracion, System.Collections.Generic.IList <string> p_musica, System.Collections.Generic.IList <string> p_libros, System.Collections.Generic.IList <string> p_peliculas, System.Collections.Generic.IList <string> p_juegos) { GustosEN gustosEN = null; //Initialized GustosEN gustosEN = new GustosEN(); gustosEN.Id = p_oid; gustosEN.PendienteModeracion = p_pendienteModeracion; gustosEN.Musica = p_musica; gustosEN.Libros = p_libros; gustosEN.Peliculas = p_peliculas; gustosEN.Juegos = p_juegos; //Call to GustosCAD _IGustosCAD.ModificarGustos(gustosEN); }
public void ModificarGustos(GustosEN gustos) { try { SessionInitializeTransaction(); GustosEN gustosEN = (GustosEN)session.Load(typeof(GustosEN), gustos.Id); gustosEN.PendienteModeracion = gustos.PendienteModeracion; gustosEN.Musica = gustos.Musica; gustosEN.Libros = gustos.Libros; gustosEN.Peliculas = gustos.Peliculas; gustosEN.Juegos = gustos.Juegos; session.Update(gustosEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is NuevoInmueblateGenNHibernate.Exceptions.ModelException) { throw ex; } throw new NuevoInmueblateGenNHibernate.Exceptions.DataLayerException("Error in GustosCAD.", ex); } finally { SessionClose(); } }
public int CrearGustos(bool p_pendienteModeracion, int p_usuario) { GustosEN gustosEN = null; int oid; //Initialized GustosEN gustosEN = new GustosEN(); gustosEN.PendienteModeracion = p_pendienteModeracion; if (p_usuario != -1) { // El argumento p_usuario -> Property usuario es oid = false // Lista de oids id gustosEN.Usuario = new NuevoInmueblateGenNHibernate.EN.RedSocial.UsuarioEN(); gustosEN.Usuario.Id = p_usuario; } //Call to GustosCAD oid = _IGustosCAD.CrearGustos(gustosEN); return(oid); }
public static GustosDTO Convert(GustosEN en) { GustosDTO newinstance = null; if (en != null) { newinstance = new GustosDTO(); newinstance.Id = en.Id; newinstance.PendienteModeracion = en.PendienteModeracion; newinstance.Musica = en.Musica; newinstance.Libros = en.Libros; newinstance.Peliculas = en.Peliculas; newinstance.Juegos = en.Juegos; if (en.Usuario != null) { newinstance.Usuario_oid = en.Usuario.Id; } } return(newinstance); }