public int Votacion(int p_puntuacion, string p_usuario, string p_lugar) { VotoEN votoEN = null; int oid; //Initialized VotoEN votoEN = new VotoEN(); votoEN.Puntuacion = p_puntuacion; if (p_usuario != null) { votoEN.Usuario = new LugaresInteresGenNHibernate.EN.LugaresInteres.UsuarioEN(); votoEN.Usuario.Email = p_usuario; } if (p_lugar != null) { votoEN.Lugar = new LugaresInteresGenNHibernate.EN.LugaresInteres.LugarEN(); votoEN.Lugar.Nombre = p_lugar; } //Call to VotoCAD oid = _IVotoCAD.Votacion(votoEN); return(oid); }
public void Cambiarvoto(VotoEN voto) { try { SessionInitializeTransaction(); VotoEN votoEN = (VotoEN)session.Load(typeof(VotoEN), voto.Id); votoEN.Puntuacion = voto.Puntuacion; session.Update(votoEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is LugaresInteresGenNHibernate.Exceptions.ModelException) { throw ex; } throw new LugaresInteresGenNHibernate.Exceptions.DataLayerException("Error in VotoCAD.", ex); } finally { SessionClose(); } }
public VotoEN ReadOIDDefault(int id) { VotoEN votoEN = null; try { SessionInitializeTransaction(); votoEN = (VotoEN)session.Get(typeof(VotoEN), id); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is LugaresInteresGenNHibernate.Exceptions.ModelException) { throw ex; } throw new LugaresInteresGenNHibernate.Exceptions.DataLayerException("Error in VotoCAD.", ex); } finally { SessionClose(); } return(votoEN); }
public void Borrar(int id) { try { SessionInitializeTransaction(); VotoEN votoEN = (VotoEN)session.Load(typeof(VotoEN), id); session.Delete(votoEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is LugaresInteresGenNHibernate.Exceptions.ModelException) { throw ex; } throw new LugaresInteresGenNHibernate.Exceptions.DataLayerException("Error in VotoCAD.", ex); } finally { SessionClose(); } }
public void Cambiarvoto(int p_Voto_OID, int p_puntuacion) { VotoEN votoEN = null; //Initialized VotoEN votoEN = new VotoEN(); votoEN.Id = p_Voto_OID; votoEN.Puntuacion = p_puntuacion; //Call to VotoCAD _IVotoCAD.Cambiarvoto(votoEN); }
public int Votacion(VotoEN voto) { try { SessionInitializeTransaction(); if (voto.Usuario != null) { voto.Usuario = (LugaresInteresGenNHibernate.EN.LugaresInteres.UsuarioEN)session.Load(typeof(LugaresInteresGenNHibernate.EN.LugaresInteres.UsuarioEN), voto.Usuario.Email); voto.Usuario.Voto.Add(voto); } if (voto.Lugar != null) { voto.Lugar = (LugaresInteresGenNHibernate.EN.LugaresInteres.LugarEN)session.Load(typeof(LugaresInteresGenNHibernate.EN.LugaresInteres.LugarEN), voto.Lugar.Nombre); voto.Lugar.Voto.Add(voto); } session.Save(voto); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is LugaresInteresGenNHibernate.Exceptions.ModelException) { throw ex; } throw new LugaresInteresGenNHibernate.Exceptions.DataLayerException("Error in VotoCAD.", ex); } finally { SessionClose(); } return(voto.Id); }