public virtual void AgregarParticipante(Profesional profesional, Rol rol, DateTime?desde, DateTime?hasta) { Participantes.ToList <EstudioParticipante>().ForEach(delegate(EstudioParticipante estParticipante) { if (estParticipante.Profesional == profesional) { throw new ApplicationException(string.Format("El Participante {0} ya existe en el estudio {1}", profesional.NombreCompleto, this.Descripcion)); } }); EstudioParticipante estudioParticipante = new EstudioParticipante(); estudioParticipante.Estudio = this; estudioParticipante.Profesional = profesional; estudioParticipante.Rol = rol; if (desde.HasValue) { estudioParticipante.Desde = desde.Value; } if (hasta.HasValue) { estudioParticipante.Hasta = hasta.Value; } Participantes.Add(estudioParticipante); }
public virtual void EliminarParticipante(EstudioParticipante participante) { Participantes.ToList <EstudioParticipante>().ForEach(delegate(EstudioParticipante estParticipante) { if (estParticipante == participante) { Participantes.Remove(estParticipante); } }); }
public virtual EstudioParticipante ObtenerParticipante(int idParticipante) { EstudioParticipante participanteReturn = null; Participantes.ToList <EstudioParticipante>().ForEach(delegate(EstudioParticipante estParticipante) { if (estParticipante.Id == idParticipante) { participanteReturn = estParticipante; } }); return(participanteReturn); }
public virtual void AgregarParticipante(EstudioParticipante participante) { if (participante.Id == -1) { Participantes.ToList <EstudioParticipante>().ForEach(delegate(EstudioParticipante estParticipante) { if (estParticipante.Profesional == participante.Profesional) { throw new ApplicationException(string.Format("El Participante {0} ya existe en el estudio {1}", participante.Profesional.NombreCompleto, this.Descripcion)); } }); } participante.Estudio = this; Participantes.Add(participante); }