public JsonResult Create(EventoParticipante eParticipante) { SRefEventoParticipante.ServiceResponse response = new SRefEventoParticipante.ServiceResponse(); try { EventoParticipante respuestaEventoParticipante = evpClient.buscar(eParticipante.CodEvento, eParticipante.CodParticipante); if (respuestaEventoParticipante != null) { response.Message = "Participante ya se encuentra registrado en este Evento."; return(Json(response, JsonRequestBehavior.AllowGet)); } Usuario usLogeado = (Usuario)Session[Constantes.UsuarioSession]; eParticipante.CodUsuario = usLogeado.CodUsuario; response = evpClient.registrar(eParticipante); } catch (Exception ex) { response.Message = "Ha ocurrido un error inesperado, contacte al administrador del sistema."; //throw; } return(Json(response, JsonRequestBehavior.AllowGet)); }
public ServiceResponse registrar(EventoParticipante eventoParticipante) { ServiceResponse result = new ServiceResponse(); //validacion if (eventoParticipante.CodEvento == 0) { result.Message = "El campo CodEvento es requerido."; return(result); } if (eventoParticipante.CodParticipante == 0) { result.Message = "El campo CodParticipante es requerido."; return(result); } if (eventoParticipante.FechaRegistro == null) { result.Message = "El campo FechaRegistro es requerido."; return(result); } if (eventoParticipante.ParticipanteAsistio == false) { result.Message = "El campo ParticipanteAsistio es requerido."; return(result); } if (eventoParticipante.CodUsuario == 0) { result.Message = "El campo CodUsuario es requerido."; return(result); } //proceso try { if (new EventoParticipanteBll().registrar(eventoParticipante)) { result.IsSuccess = true; result.Message = " EventoParticipante registrado correctamente"; } else { result.Message = "No podemos procesar su solicitud en este momento. Disculpe las molestias. Intente de nuevo más adelante"; } } catch (Exception ex) { result.Message = "Ha ocurrido un error inesperado, contacte al administrador del sistema."; result.MessageDev = ex.Message; } return(result); }
private InscricaoViewModel Inscricao(int id) { EventoParticipante eventoParticipante = _eventoParticipanteRepository.ObterPorId(id); return(new InscricaoViewModel { EventoParticipanteId = eventoParticipante.EventoParticipanteId, Comprovativo = eventoParticipante.Comprovativo, EventoId = eventoParticipante.EventoId, ParticipanteId = eventoParticipante.ParticipanteId }); }
private async Task CreateParticipantes(EventoRequest request, int EventoId) { foreach (var item in request.Participantes) { var EventoMotivoRejeito = new EventoParticipante() { EventoId = EventoId, ParticipanteId = item.Id }; await _EventoParticipanteService.Create(EventoMotivoRejeito); } }
private async Task UpdateParticipantes(EventoRequest request, Evento entity) { foreach (var item in request.Participantes) { var EventoParticipantes = new EventoParticipante() { EventoId = entity.Id, ParticipanteId = item.Id }; await _EventoParticipanteService.Create(EventoParticipantes); } }
public ServiceResponse actualizar(EventoParticipante eventoParticipante) { ServiceResponse result = new ServiceResponse(); //mensaje de error por defecto result.Message = "Ocurio un error!!!. No se pudo realizar el actualizacion"; //validacion if (eventoParticipante.CodEvento == 0) { result.Message = "El campo CodEvento es requerido."; return(result); } if (eventoParticipante.CodParticipante == 0) { result.Message = "El campo CodParticipante es requerido."; return(result); } if (eventoParticipante.FechaRegistro == null) { result.Message = "El campo FechaRegistro es requerido."; return(result); } if (eventoParticipante.ParticipanteAsistio == false) { result.Message = "El campo ParticipanteAsistio es requerido."; return(result); } if (eventoParticipante.CodUsuario == 0) { result.Message = "El campo CodUsuario es requerido."; return(result); } //proceso try { if (new EventoParticipanteBll().actualizar(eventoParticipante)) { result.IsSuccess = true; result.Message = " Event Participante actualizado correctamente"; } } catch (Exception ex) { result.MessageDev = ex.Message; } return(result); }
public ActionResult Delete(int id, EventoParticipante collection) { try { // TODO: Add delete logic here var result = _eventoParticipanteRepository.ObterPorId(collection.EventoParticipanteId); _eventoParticipanteRepository.Remover(result); return(RedirectToAction("Listar", new { msg = "Inscrição cancelada." })); } catch { return(View()); } }
public Alerta Alerta(EventoParticipante eventoParticipante, string msg, bool destino = false) { var result = _eventoRepository.ObterPorId(eventoParticipante.EventoId); Alerta alerta = new Alerta { Messagem = msg + result.Titulo, ParticipanteId = eventoParticipante.ParticipanteId, //ComissaoCientificaId = result.ComissaoCientificaId, ComissaoOrganizadoraId = result.ComissaoOrganizadoraId, Destino = destino, Tipo = "Inscricao" }; //if(alerta != null) return(alerta); }
public EventoParticipante buscar(int CodEvento, int CodParticipante) { EventoParticipante eventoParticipante = null; //proceso try { eventoParticipante = new EventoParticipanteBll().buscar(new EventoParticipante() { CodEvento = CodEvento, CodParticipante = CodParticipante }); } catch (Exception ex) { } return(eventoParticipante); }
public void Actualizar(EventoParticipante entity) { _eventoParticipanteRepository.Actualizar(entity); }
public EventoParticipante Adicionar(EventoParticipante entity) { return(_eventoParticipanteRepository.Adicionar(entity)); }
public bool registrar(EventoParticipante eventoParticipante) { return(new EventoParticipanteRepository().registrar(eventoParticipante)); }
public EventoParticipante buscar(EventoParticipante eventoParticipante) { return(new EventoParticipanteRepository().buscar(eventoParticipante)); }
public bool eliminar(EventoParticipante eventoParticipante) { return(new EventoParticipanteRepository().eliminar(eventoParticipante)); }
public bool actualizar(EventoParticipante eventoParticipante) { return(new EventoParticipanteRepository().actualizar(eventoParticipante)); }
//Adiciona EventoParticipante public async Task Create(EventoParticipante eventoparticipante) { await _blazorefContext.EventoParticipante.AddAsync(eventoparticipante); await _blazorefContext.SaveChangesAsync(); }
public Mensaje createEventoParticipante([FromBody] UtilsJson.AEventoParticipante eventoParticipante) { Mensaje mensaje = null; try { if (eventoParticipante != null) { if (!string.IsNullOrWhiteSpace(eventoParticipante.token_string)) { if (AutenticacionToken.validateToken(eventoParticipante.token_string) == 1) { long id_inst = eventoParticipante.id_institucion; long id_pub = eventoParticipante.id_evento; Institucion institucion = _repositorio.Get <Institucion>(id_inst); Publicacion publicacion = _repositorio.Get <Publicacion>(id_pub); Expression <Func <EventoParticipante, bool> > query = (u => u.institucion.id == id_inst && u.evento.id == id_pub && u.estado == true); List <EventoParticipante> result = _repositorio.Filter <EventoParticipante>(query); if (institucion != null && publicacion != null && result.Count == 0) { if (AutenticacionToken.validateUserToken(eventoParticipante.token_string, institucion.logueo.correo_electronico)) { //datos institucion y publicacion EventoParticipante newRegistro = new EventoParticipante { institucion = institucion, evento = publicacion, fecha_ult_modificacion = DateTime.Now, estado = eventoParticipante.estado }; //Almaceno o actualizo la salaMesa _repositorio.SaveOrUpdate <EventoParticipante>(newRegistro); mensaje = new Mensaje(EnumTipoMensaje.Notificacion, "Notificación", "Institucion registrada al evento exitosamente."); } else { mensaje = new Mensaje(EnumTipoMensaje.Error, "Error", "No cuenta con los privilegios suficientes"); } } else { mensaje = new Mensaje(EnumTipoMensaje.Error, "Error", "No cuenta con los privilegios suficientes para modificar estos campos."); } } else { mensaje = new Mensaje(EnumTipoMensaje.Expiracion, "Error", "La sesion actual ha expirado. Inicie sesion"); } } else { mensaje = new Mensaje(EnumTipoMensaje.Error, "Error", "No cuenta con los privilegios suficientes"); } } else { mensaje = new Mensaje(EnumTipoMensaje.Error, "Error", "No se puede insertar un objeto nulo"); } } catch (System.Data.Entity.Validation.DbEntityValidationException ex) { var sb = new System.Text.StringBuilder(); foreach (var failure in ex.EntityValidationErrors) { sb.AppendFormat("{0} failed validation", failure.Entry.Entity.GetType()); foreach (var error in failure.ValidationErrors) { sb.AppendFormat("- {0} : {1}", error.PropertyName, error.ErrorMessage); sb.AppendLine(); } } mensaje = new Mensaje(EnumTipoMensaje.Error, "Error", sb.ToString()); SystemLog log = new SystemLog(); log.ErrorLog(sb.ToString()); throw new Exception(sb.ToString()); } return(mensaje); }
public Mensaje editAEventoParticipante([FromBody] UtilsJson.AEventoParticipante eventoParticipante) { Mensaje mensaje = null; try { if (eventoParticipante != null) { if (!string.IsNullOrWhiteSpace(eventoParticipante.token_string)) { if (AutenticacionToken.validateToken(eventoParticipante.token_string) == 1) { long id_institucion_c = eventoParticipante.id_institucion; long id_publicacion = eventoParticipante.id_evento; Institucion institucion = _repositorio.Get <Institucion>(id_institucion_c); Publicacion publicacion = _repositorio.Get <Publicacion>(id_publicacion); EventoParticipante registro = _repositorio.Get <EventoParticipante>(eventoParticipante.id_evento_institucion); if (institucion != null && publicacion != null && registro != null) { if (AutenticacionToken.validateUserToken(eventoParticipante.token_string, institucion.logueo.correo_electronico)) { registro.institucion = institucion; registro.evento = publicacion; registro.fecha_ult_modificacion = DateTime.Now; registro.estado = eventoParticipante.estado; //Almaceno o actualizo el registro _repositorio.SaveOrUpdate <EventoParticipante>(registro); mensaje = new Mensaje(EnumTipoMensaje.Notificacion, "Notificación", "Participante a evento editado exitosamente."); } else { mensaje = new Mensaje(EnumTipoMensaje.Error, "Error", "No cuenta con los privilegios suficientes"); } } else { mensaje = new Mensaje(EnumTipoMensaje.Error, "Error", "No se encontro el registro solicitada o esta asociada a otra institucion."); } } else { mensaje = new Mensaje(EnumTipoMensaje.Expiracion, "Error", "La sesion actual ha expirado. Inicie sesion"); } } else { mensaje = new Mensaje(EnumTipoMensaje.Error, "Error", "No cuenta con los privilegios suficientes"); } } else { mensaje = new Mensaje(EnumTipoMensaje.Error, "Error", "No se puede insertar un objeto nulo"); } } catch (System.Data.Entity.Validation.DbEntityValidationException ex) { var sb = new System.Text.StringBuilder(); foreach (var failure in ex.EntityValidationErrors) { sb.AppendFormat("{0} failed validation", failure.Entry.Entity.GetType()); foreach (var error in failure.ValidationErrors) { sb.AppendFormat("- {0} : {1}", error.PropertyName, error.ErrorMessage); sb.AppendLine(); } } mensaje = new Mensaje(EnumTipoMensaje.Error, "Error", sb.ToString()); SystemLog log = new SystemLog(); log.ErrorLog(sb.ToString()); throw new Exception(sb.ToString()); } return(mensaje); }
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)); } }
/// <summary> /// Elimina el registro de un participante a un evento especificado por id. /// </summary> /// <param name="eventoParticipante">The evento participante.</param> /// <returns></returns> /// <exception cref="Exception"></exception> public Mensaje deleteEventoParticipante([FromBody] UtilsJson.AEventoParticipante eventoParticipante) { Mensaje mensaje = null; try { if (eventoParticipante != null) { if (!string.IsNullOrWhiteSpace(eventoParticipante.token_string)) { if (AutenticacionToken.validateToken(eventoParticipante.token_string) == 1) { Institucion institucion = _repositorio.Get <Institucion>(eventoParticipante.id_institucion); EventoParticipante eventoParticipanteDB = _repositorio.Get <EventoParticipante>(eventoParticipante.id_evento_institucion); if (institucion != null && eventoParticipanteDB != null) { if (AutenticacionToken.validateUserToken(eventoParticipante.token_string, institucion.logueo.correo_electronico)) { _repositorio.Delete <Conferencista>(eventoParticipanteDB.id); mensaje = new Mensaje(EnumTipoMensaje.Notificacion, "Notificación", "Registro a evento eliminada exitosamente."); } else { mensaje = new Mensaje(EnumTipoMensaje.Error, "Error", "No cuenta con los privilegios suficientes"); } } else { mensaje = new Mensaje(EnumTipoMensaje.Error, "Error", "No se encontro el registro solicitada o esta asociada a otra institucion."); } } else { mensaje = new Mensaje(EnumTipoMensaje.Expiracion, "Error", "La sesion actual ha expirado. Inicie sesion"); } } else { mensaje = new Mensaje(EnumTipoMensaje.Error, "Error", "No cuenta con los privilegios suficientes"); } } else { mensaje = new Mensaje(EnumTipoMensaje.Error, "Error", "No se puede eliminar un objeto nulo"); } } catch (System.Data.Entity.Validation.DbEntityValidationException ex) { var sb = new System.Text.StringBuilder(); foreach (var failure in ex.EntityValidationErrors) { sb.AppendFormat("{0} failed validation", failure.Entry.Entity.GetType()); foreach (var error in failure.ValidationErrors) { sb.AppendFormat("- {0} : {1}", error.PropertyName, error.ErrorMessage); sb.AppendLine(); } } mensaje = new Mensaje(EnumTipoMensaje.Error, "Error", sb.ToString()); SystemLog log = new SystemLog(); log.ErrorLog(sb.ToString()); throw new Exception(sb.ToString()); } return(mensaje); }
public Mensaje createEventoParticipante([FromBody]UtilsJson.AEventoParticipante eventoParticipante) { Mensaje mensaje = null; try { if (eventoParticipante != null) { if (!string.IsNullOrWhiteSpace(eventoParticipante.token_string)) { if (AutenticacionToken.validateToken(eventoParticipante.token_string) == 1) { long id_inst = eventoParticipante.id_institucion; long id_pub = eventoParticipante.id_evento; Institucion institucion = _repositorio.Get<Institucion>(id_inst); Publicacion publicacion = _repositorio.Get<Publicacion>(id_pub); Expression<Func<EventoParticipante, bool>> query = (u => u.institucion.id == id_inst && u.evento.id==id_pub && u.estado == true); List<EventoParticipante> result = _repositorio.Filter<EventoParticipante>(query); if (institucion != null && publicacion !=null && result.Count ==0) { if (AutenticacionToken.validateUserToken(eventoParticipante.token_string, institucion.logueo.correo_electronico)) { //datos institucion y publicacion EventoParticipante newRegistro = new EventoParticipante { institucion=institucion, evento=publicacion, fecha_ult_modificacion=DateTime.Now, estado=eventoParticipante.estado }; //Almaceno o actualizo la salaMesa _repositorio.SaveOrUpdate<EventoParticipante>(newRegistro); mensaje = new Mensaje(EnumTipoMensaje.Notificacion, "Notificación", "Institucion registrada al evento exitosamente."); } else { mensaje = new Mensaje(EnumTipoMensaje.Error, "Error", "No cuenta con los privilegios suficientes"); } } else { mensaje = new Mensaje(EnumTipoMensaje.Error, "Error", "No cuenta con los privilegios suficientes para modificar estos campos."); } } else { mensaje = new Mensaje(EnumTipoMensaje.Expiracion, "Error", "La sesion actual ha expirado. Inicie sesion"); } } else { mensaje = new Mensaje(EnumTipoMensaje.Error, "Error", "No cuenta con los privilegios suficientes"); } } else { mensaje = new Mensaje(EnumTipoMensaje.Error, "Error", "No se puede insertar un objeto nulo"); } } catch (System.Data.Entity.Validation.DbEntityValidationException ex) { var sb = new System.Text.StringBuilder(); foreach (var failure in ex.EntityValidationErrors) { sb.AppendFormat("{0} failed validation", failure.Entry.Entity.GetType()); foreach (var error in failure.ValidationErrors) { sb.AppendFormat("- {0} : {1}", error.PropertyName, error.ErrorMessage); sb.AppendLine(); } } mensaje = new Mensaje(EnumTipoMensaje.Error, "Error", sb.ToString()); SystemLog log = new SystemLog(); log.ErrorLog(sb.ToString()); throw new Exception(sb.ToString()); } return mensaje; }
public void Remover(EventoParticipante entity) { _eventoParticipanteRepository.Remover(entity); }