public void IncluirParticipante() { var participante = new Participante { Nome = "Daniel Tostes", Email = "*****@*****.**", Telefone = "99778-5791" }; servico.IncluirParticipante(participante); Assert.IsNotNull(repositorio.ObterPorId(participante.Id)); }
public Participante ObterParticipante(Guid id) { return(repositorio.ObterPorId(id)); }
public Participante ObterPorId(int id) { return(_participanteRository.ObterPorId(id)); }
public ActionResult Show() { return(View(ParticipanteViewModel(_participanteRepository.ObterPorId(SessionId())))); }
public ActionResult Create(SubmissaoViewModel collection) { try { // TODO: Add insert logic here //string [] destino = null; if (ModelState.IsValid) { if (collection.File != null) { var fileName = UploadFile(collection); Submissao submissao = new Submissao { Titulo = collection.Titulo, Descricao = collection.Descricao, Ficheiro = fileName, TipoId = collection.TipoId, ParticipanteId = SessionId(), EventoId = collection.EventoId }; var _result = _submissaoRepository.Adicionar(submissao); if (_result != null) { bool state = false; var alert = _alertaRepository.Adicionar(Alerta(_result, "Fez uma nova submissão")); if (alert != null) { var evento = _eventoRepository.ObterPorId(_result.EventoId); if (evento != null) { var result2 = _membroCientificoRepository.ObterPorComissao(evento.ComissaoCientificaId, true); if (result2 != null) { foreach (var item in result2) { var msg = $"Olá { item.Membro.Nome}. <br><br> { _participanteRepository.ObterPorId(SessionId()).Nome } " + $"fez uma nova submissão no evento: {evento.Titulo}. <br> Em enexo o documento."; var message = new Message(new string[] { item.Membro.Email }, "Nova Submissão", msg, collection.File); if (Notificar(message)) { state = true; } } } } if (state) { return(RedirectToAction("Listar", new { msg = "Submissão criada." })); } else { ModelState.AddModelError(string.Empty, "Erro ao notificar a comissão científica."); } } } } } PreencherCombobox(); return(View(collection)); } catch { PreencherCombobox(); return(View()); } }
public ActionResult Create(InscricaoViewModel collection) { try { // TODO: Add insert logic here EventoParticipante _result = null; if (_eventoParticipanteRepository.VerificarEvento(collection.EventoId, SessionId())) { ModelState.AddModelError("EventoId", $"O candidato ja esta inscrito no evento."); } if (ModelState.IsValid) { if (collection.File != null) { var fileName = UploadFile(collection); if (_eventoParticipanteRepository.VerificarEvento(collection.EventoId, SessionId(), true)) { _result = _eventoParticipanteRepository.ObterPorEventoParticipante(collection.EventoId, SessionId(), true); _result.Comprovativo = fileName; _result.Removido = false; _result.Confirmado = false; _eventoParticipanteRepository.Actualizar(_result); } else { EventoParticipante eventoParticipante = new EventoParticipante { Comprovativo = fileName, EventoId = collection.EventoId, ParticipanteId = SessionId() }; _eventoParticipanteRepository.Adicionar(eventoParticipante); } var evento = _eventoRepository.ObterPorId(collection.EventoId); if (evento != null) { var result2 = _membroOrganizadorRepository.ObterPorComissao(evento.ComissaoOrganizadoraId, true); bool state = false; if (result2 != null) { foreach (var item in result2) { var participante = _participanteRepository.ObterPorId(SessionId()); if (participante != null) { var msg = $"Olá, {item.Membro.Nome}. <br><br> { participante.Nome } fez uma nova inscrição no evento: {evento.Titulo}." + $"<br> Em anexo o comprovativo de pagamento."; var message = new Message(new string[] { item.Membro.Email }, "Nova Inscrição", msg, collection.File); if (Notificar(message)) { state = true; } } } if (state) { return(RedirectToAction("Listar", new { msg = "Inscrição criada." })); } else { ModelState.AddModelError(string.Empty, "Erro ao notificar a comissão organizadora."); } } else { ModelState.AddModelError(string.Empty, "Erro ao carregar a comissão organizadora."); } } else { ModelState.AddModelError(string.Empty, "Erro ao carregar o evento."); } } } ViewBag.EventoId = ObterEventos(); return(View(collection)); } catch { ViewBag.EventoId = ObterEventos(); return(View(collection)); } }