//Cadastro do participante no banco protected void Save(object sender, DirectEventArgs e) { MA_PARTICIPANTE_APRENDER aprenderparticipante = new MA_PARTICIPANTE_APRENDER(); aprenderparticipante.cod_participante = Int32.Parse(cod_participanteId.SelectedItem.Value); aprenderparticipante.cod_item = Int32.Parse(cod_itemId.SelectedItem.Value); aprenderparticipante.cod_s_relacao = Int32.Parse(cod_s_relacaoId.SelectedItem.Value); //Caso o form não possui código, será inserido um novo aprender de participante if (cod_p_aprenderId.Text == "") { this.GestorDeParticipanteAprender.InserirNovoAprendizadoDeParticipante(aprenderparticipante); ParticipanteAprenderWindowId.Close(); LimpaForm(); } //Caso contrário, o form será atualizado else { aprenderparticipante.cod_p_aprender = Int32.Parse(cod_p_aprenderId.Text); this.GestorDeParticipanteAprender.AtualizarAprendizadoDeParticipante(aprenderparticipante); ParticipanteAprenderWindowId.Close(); LimpaForm(); } }
public void AtualizarAprendizadoDeParticipanteSemConferencia(MA_PARTICIPANTE_APRENDER participanteaprender) { MIMACHEREntities contexto = new MIMACHEREntities(); contexto.Entry(participanteaprender).State = EntityState.Modified; contexto.SaveChanges(); }
public ActionResult Update(List <ParticipanteAprender> listaparticipanteaprender) { JsonResult jsonResult; //Verifica se o registro é inválido e se sim, retorna com erro. if (listaparticipanteaprender == null) { jsonResult = Json(new { success = false }, JsonRequestBehavior.AllowGet); jsonResult.MaxJsonLength = int.MaxValue; return(jsonResult); } foreach (ParticipanteAprender pe in listaparticipanteaprender) { MA_PARTICIPANTE_APRENDER participanteaprender = new MA_PARTICIPANTE_APRENDER(); participanteaprender.cod_p_aprender = pe.cod_p_aprender; participanteaprender.cod_participante = pe.cod_participante; participanteaprender.cod_item = pe.cod_item; participanteaprender.cod_s_relacao = pe.cod_s_relacao; GestorDeParticipanteAprender.InserirNovoAprendizadoDeParticipante(participanteaprender); } jsonResult = Json(new { success = true }, JsonRequestBehavior.AllowGet); jsonResult.MaxJsonLength = int.MaxValue; return(jsonResult); }
//Exclui determinado participante do banco de dados protected void Delete(object sender, DirectEventArgs e) { MA_PARTICIPANTE_APRENDER aprenderparticipante = this.GestorDeParticipanteAprender.ObterAprendizadoDoParticipantePorId(Int32.Parse(cod_p_aprenderId.Text)); this.GestorDeParticipanteAprender.RemoverAprendizadoDeParticipante(aprenderparticipante); LimpaForm(); }
public Boolean VerificarSeExisteRelacaoDeParticipanteAprender(MA_PARTICIPANTE_APRENDER participanteaprender) { if (ObterAprendizadoDeParticipantePorItemEParticipante(participanteaprender) != null) { return(true); } return(false); }
public ActionResult Add(List <ParticipanteAprender> listaparticipanteaprender) { JsonResult jsonResult; //Verifica se o registro é inválido e se sim, retorna com erro. if (listaparticipanteaprender == null) { jsonResult = Json(new { codigo = -1 }, JsonRequestBehavior.AllowGet); jsonResult.MaxJsonLength = int.MaxValue; return(jsonResult); } else { MA_PARTICIPANTE_APRENDER participanteaprender = new MA_PARTICIPANTE_APRENDER(); participanteaprender.cod_participante = listaparticipanteaprender[0].CodParticipante; participanteaprender.cod_item = listaparticipanteaprender[0].CodItem; //Informa que a relação estará ativa participanteaprender.cod_status = 1; try { Boolean resultado = GestorDeParticipanteAprender.InserirNovoAprendizadoDeParticipanteComRetorno(participanteaprender); if (resultado) { jsonResult = Json(new { codigo = participanteaprender.cod_participante }, JsonRequestBehavior.AllowGet); } else { jsonResult = Json(new { codigo = -1 }, JsonRequestBehavior.AllowGet); } } catch (Exception e) { jsonResult = Json(new { erro = e.InnerException.ToString(), codigo = -1 }, JsonRequestBehavior.AllowGet); } } jsonResult.MaxJsonLength = int.MaxValue; return(jsonResult); }
public ActionResult Delete(List <ParticipanteAprender> listaparticipanteaprender) { JsonResult jsonResult; //Verifica se o registro é inválido e se sim, retorna com erro. if (listaparticipanteaprender == null) { jsonResult = Json(new { codigo = -1 }, JsonRequestBehavior.AllowGet); jsonResult.MaxJsonLength = int.MaxValue; return(jsonResult); } else { foreach (ParticipanteAprender pa in listaparticipanteaprender) { if (pa.cod_s_relacao == 2) { MA_PARTICIPANTE_APRENDER participanteaprender = new MA_PARTICIPANTE_APRENDER(); participanteaprender.cod_p_aprender = pa.cod_p_aprender; participanteaprender.cod_participante = pa.cod_participante; participanteaprender.cod_item = pa.cod_item; participanteaprender.cod_s_relacao = pa.cod_s_relacao; this.GestorDeParticipanteAprender.InserirNovoAprendizadoDeParticipante(participanteaprender); jsonResult = Json(new { codigo = participanteaprender.cod_p_aprender }, JsonRequestBehavior.AllowGet); jsonResult.MaxJsonLength = int.MaxValue; return(jsonResult); } } jsonResult = Json(new { codigo = -1 }, JsonRequestBehavior.AllowGet); jsonResult.MaxJsonLength = int.MaxValue; return(jsonResult); } }
public void AtualizarAprendizadoDeParticipante(MA_PARTICIPANTE_APRENDER participanteaprender) { if (!VerificarSeExisteRelacaoDeParticipanteAprender(participanteaprender)) { AtualizarAprendizadoDeParticipanteSemConferencia(participanteaprender); } else { MA_PARTICIPANTE_APRENDER participanteaprenderconferencia = ObterAprendizadoDeParticipantePorItemEParticipante(participanteaprender); if (participanteaprenderconferencia.cod_status != participanteaprender.cod_status) { AtualizarAprendizadoDeParticipanteSemConferencia(participanteaprender); } } }
public void InserirNovoAprendizadoDeParticipante(MA_PARTICIPANTE_APRENDER participanteaprender) { if (!VerificarSeExisteRelacaoDeParticipanteAprender(participanteaprender)) { this.Contexto.MA_PARTICIPANTE_APRENDER.Add(participanteaprender); this.Contexto.SaveChanges(); } else { MA_PARTICIPANTE_APRENDER participanteaprenderconferencia = ObterAprendizadoDeParticipantePorItemEParticipante(participanteaprender); if (participanteaprenderconferencia.cod_status != participanteaprender.cod_status) { AtualizarAprendizadoDeParticipanteSemConferencia(participanteaprender); } } }
public Boolean InserirNovoAprendizadoDeParticipanteComRetorno(MA_PARTICIPANTE_APRENDER participanteaprender) { if (!VerificarSeExisteRelacaoDeParticipanteAprender(participanteaprender)) { this.Contexto.MA_PARTICIPANTE_APRENDER.Add(participanteaprender); this.Contexto.SaveChanges(); return(true); } else { MA_PARTICIPANTE_APRENDER participanteaprenderconferencia = ObterAprendizadoDeParticipantePorItemEParticipante(participanteaprender); if (participanteaprenderconferencia.cod_status != participanteaprender.cod_status) { return(AtualizarAprendizadoDeParticipanteComRetorno(participanteaprender)); } else { return(false); } } }
public Boolean AtualizarAprendizadoDeParticipanteComRetorno(MA_PARTICIPANTE_APRENDER participanteaprender) { if (!VerificarSeExisteRelacaoDeParticipanteAprender(participanteaprender)) { AtualizarAprendizadoDeParticipanteSemConferencia(participanteaprender); return(true); } else { MA_PARTICIPANTE_APRENDER participanteaprenderconferencia = ObterAprendizadoDeParticipantePorItemEParticipante(participanteaprender.cod_item, participanteaprender.cod_participante); if (participanteaprenderconferencia.cod_status != participanteaprender.cod_status) { AtualizarAprendizadoDeParticipanteSemConferencia(participanteaprender); return(true); } else { return(false); } } }
public List <MA_PARTICIPANTE_APRENDER> ObterTodosOsAprendizadoDeParticipantePorPorItemPaginadosPorVinteRegistros(MA_PARTICIPANTE_APRENDER participanteaprender) { return(this.RepositorioDeAprendizadoDeParticipante.ObterTodosOsAprendizadoDeParticipantePorPorItemPaginadosPorVinteRegistros(participanteaprender)); }
public void InserirNovoAprendizadoDeParticipante(MA_PARTICIPANTE_APRENDER participanteaprender) { this.RepositorioDeAprendizadoDeParticipante.InserirNovoAprendizadoDeParticipante(participanteaprender); }
public List <MA_PARTICIPANTE_APRENDER> ObterTodosOsAprendizadoDeParticipantePorPorItemPaginadosPorVinteRegistros(MA_PARTICIPANTE_APRENDER participanteaprender) { return(this.Contexto.MA_PARTICIPANTE_APRENDER.Where(l => l.cod_item == participanteaprender.cod_item && l.cod_status == 1).Skip(participanteaprender.cod_p_aprender).Take(20).ToList()); }
public MA_PARTICIPANTE_APRENDER ObterAprendizadoDeParticipantePorItemEParticipante(MA_PARTICIPANTE_APRENDER participanteaprender) { return(this.Contexto.MA_PARTICIPANTE_APRENDER.Where(l => l.cod_participante == participanteaprender.cod_participante && l.cod_item == participanteaprender.cod_item).SingleOrDefault()); }
public void AtualizarAprendizadoDeParticipante(MA_PARTICIPANTE_APRENDER participanteaprender) { this.RepositorioDeAprendizadoDeParticipante.AtualizarAprendizadoDeParticipante(participanteaprender); }
public ActionResult Delete(List <ParticipanteAprender> listaparticipanteaprender) { JsonResult jsonResult; //Verifica se o registro é inválido e se sim, retorna com erro. if (listaparticipanteaprender == null) { jsonResult = Json(new { codigo = -1 }, JsonRequestBehavior.AllowGet); } else { if (this.GestorDeParticipanteAprender.VerificarSeExisteRelacaoUsuarioPorItemEParticipante(listaparticipanteaprender[0].CodItem, listaparticipanteaprender[0].CodParticipante)) { try { MA_PARTICIPANTE_APRENDER participanteaprender = this.GestorDeParticipanteAprender.ObterAprendizadoDeParticipantePorItemEParticipante(listaparticipanteaprender[0].CodItem, listaparticipanteaprender[0].CodParticipante); if (participanteaprender.cod_status == 1) { MA_PARTICIPANTE_APRENDER participanteaprendermodificado = new MA_PARTICIPANTE_APRENDER(); participanteaprendermodificado.cod_p_aprender = participanteaprender.cod_p_aprender; participanteaprendermodificado.cod_participante = participanteaprender.cod_participante; participanteaprendermodificado.cod_item = participanteaprender.cod_item; //Marca a relação como inativa participanteaprendermodificado.cod_status = 2; try { Boolean resultado = this.GestorDeParticipanteAprender.AtualizarAprendizadoDeParticipanteComRetorno(participanteaprendermodificado); if (resultado) { jsonResult = Json(new { codigo = participanteaprendermodificado.cod_p_aprender }, JsonRequestBehavior.AllowGet); } else { jsonResult = Json(new { codigo = -1 }, JsonRequestBehavior.AllowGet); } } catch (Exception e) { jsonResult = Json(new { erro = e.InnerException.ToString(), codigo = -1 }, JsonRequestBehavior.AllowGet); } } else { jsonResult = Json(new { codigo = -1 }, JsonRequestBehavior.AllowGet); } } catch (Exception e) { jsonResult = Json(new { erro = e.InnerException.ToString(), codigo = -1 }, JsonRequestBehavior.AllowGet); } } else { jsonResult = Json(new { codigo = -1 }, JsonRequestBehavior.AllowGet); } } jsonResult.MaxJsonLength = int.MaxValue; return(jsonResult); }
public Boolean AtualizarAprendizadoDeParticipanteComRetorno(MA_PARTICIPANTE_APRENDER participanteaprender) { return(this.RepositorioDeAprendizadoDeParticipante.AtualizarAprendizadoDeParticipanteComRetorno(participanteaprender)); }
public void RemoverAprendizadoDeParticipante(MA_PARTICIPANTE_APRENDER participanteaprender) { this.Contexto.MA_PARTICIPANTE_APRENDER.Remove(participanteaprender); this.Contexto.SaveChanges(); }