public void AnyadirParticipante(int p_Evento_OID, string p_crea_OID) { Fight4FitGenNHibernate.EN.Fight4Fit.EventoEN eventoEN = null; try { SessionInitializeTransaction(); eventoEN = (EventoEN)session.Load(typeof(EventoEN), p_Evento_OID); eventoEN.Crea = (Fight4FitGenNHibernate.EN.Fight4Fit.UsuarioEN)session.Load(typeof(Fight4FitGenNHibernate.EN.Fight4Fit.UsuarioEN), p_crea_OID); eventoEN.Crea.Evento.Add(eventoEN); session.Update(eventoEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is Fight4FitGenNHibernate.Exceptions.ModelException) { throw ex; } throw new Fight4FitGenNHibernate.Exceptions.DataLayerException("Error in EventoCAD.", ex); } finally { SessionClose(); } }
public void DesapuntarseAEvento(string p_Usuario_OID, System.Collections.Generic.IList <int> p_evento_OIDs) { try { SessionInitializeTransaction(); Fight4FitGenNHibernate.EN.Fight4Fit.UsuarioEN usuarioEN = null; usuarioEN = (UsuarioEN)session.Load(typeof(UsuarioEN), p_Usuario_OID); Fight4FitGenNHibernate.EN.Fight4Fit.EventoEN eventoENAux = null; if (usuarioEN.Evento != null) { foreach (int item in p_evento_OIDs) { eventoENAux = (Fight4FitGenNHibernate.EN.Fight4Fit.EventoEN)session.Load(typeof(Fight4FitGenNHibernate.EN.Fight4Fit.EventoEN), item); if (usuarioEN.Evento.Contains(eventoENAux) == true) { usuarioEN.Evento.Remove(eventoENAux); eventoENAux.Crea = null; } else { throw new ModelException("The identifier " + item + " in p_evento_OIDs you are trying to unrelationer, doesn't exist in UsuarioEN"); } } } session.Update(usuarioEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is Fight4FitGenNHibernate.Exceptions.ModelException) { throw ex; } throw new Fight4FitGenNHibernate.Exceptions.DataLayerException("Error in UsuarioCAD.", ex); } finally { SessionClose(); } }
public void ApuntarseAEvento(string p_Usuario_OID, System.Collections.Generic.IList <int> p_evento_OIDs) { Fight4FitGenNHibernate.EN.Fight4Fit.UsuarioEN usuarioEN = null; try { SessionInitializeTransaction(); usuarioEN = (UsuarioEN)session.Load(typeof(UsuarioEN), p_Usuario_OID); Fight4FitGenNHibernate.EN.Fight4Fit.EventoEN eventoENAux = null; if (usuarioEN.Evento == null) { usuarioEN.Evento = new System.Collections.Generic.List <Fight4FitGenNHibernate.EN.Fight4Fit.EventoEN>(); } foreach (int item in p_evento_OIDs) { eventoENAux = new Fight4FitGenNHibernate.EN.Fight4Fit.EventoEN(); eventoENAux = (Fight4FitGenNHibernate.EN.Fight4Fit.EventoEN)session.Load(typeof(Fight4FitGenNHibernate.EN.Fight4Fit.EventoEN), item); eventoENAux.Crea = usuarioEN; usuarioEN.Evento.Add(eventoENAux); } session.Update(usuarioEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is Fight4FitGenNHibernate.Exceptions.ModelException) { throw ex; } throw new Fight4FitGenNHibernate.Exceptions.DataLayerException("Error in UsuarioCAD.", ex); } finally { SessionClose(); } }
public override bool Equals(object obj) { if (obj == null) { return(false); } EventoEN t = obj as EventoEN; if (t == null) { return(false); } if (Id.Equals(t.Id)) { return(true); } else { return(false); } }
public void EliminarParticipante(int p_Evento_OID, string p_crea_OID) { try { SessionInitializeTransaction(); Fight4FitGenNHibernate.EN.Fight4Fit.EventoEN eventoEN = null; eventoEN = (EventoEN)session.Load(typeof(EventoEN), p_Evento_OID); if (eventoEN.Crea.Email == p_crea_OID) { eventoEN.Crea = null; } else { throw new ModelException("The identifier " + p_crea_OID + " in p_crea_OID you are trying to unrelationer, doesn't exist in EventoEN"); } session.Update(eventoEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is Fight4FitGenNHibernate.Exceptions.ModelException) { throw ex; } throw new Fight4FitGenNHibernate.Exceptions.DataLayerException("Error in EventoCAD.", ex); } finally { SessionClose(); } }
public EventoEN(EventoEN evento) { this.init(Id, evento.Nombre, evento.Crea, evento.Categoria, evento.Reporte, evento.Galeria, evento.Descripcion, evento.Comentario, evento.Tipo, evento.NumeroParticipantes, evento.MaxParticipantes, evento.Fecha, evento.Localizacion, evento.Latitud, evento.Longitud, evento.Usuario_0); }