protected void Page_Load(object sender, EventArgs e) { if ((MA_USUARIO)Session["usuario"] != null) { MA_USUARIO usuario = (MA_USUARIO)Session["usuario"]; //Coloca a informação com o email do usuário logado no cabeçalho this.labelUsuarioEmail.Text = usuario.e_mail; this.labelAcesso.Text = usuario.MA_ACESSO.nome; if (GestorDeParticipante.VerificarSeUsuarioJaTemVinculoComAlgumParticipante(usuario.cod_usuario)) { //Coloca a informação com o nome do Participante no cabeçalho this.labelParticipanteNome.Text = GestorDeParticipante.ObterParticipantePorIdDeUsuario(usuario.cod_usuario).nome; this.labelParticipanteNome.Hidden = false; } if (GestorDeNac.VerificarSeNacTemAlgumParticipanteComMesmoUsuario(usuario.cod_usuario)) { //Coloca a informação com o nome do representante do NAC no cabeçalho this.labelNACNomeRepresentante.Text = GestorDeNac.ObterNacPorIdDeUsuario(usuario.cod_usuario).nome_representante; this.labelNACNomeRepresentante.Hidden = false; } } else { Response.Redirect("~/Login.aspx"); } }
public ActionResult List() { List <MA_PARTICIPANTE> listaparticipanteoriginal = GestorDeParticipante.ObterTodosOsParticipantes(); List <Participante> listaparticipante = new List <Participante>(); foreach (MA_PARTICIPANTE pt in listaparticipanteoriginal) { Participante participante = new Participante(); participante.cod_participante = pt.cod_participante; participante.cod_usuario = pt.cod_usuario; participante.cod_campus = pt.cod_participante; participante.nome = pt.nome; participante.telefone = pt.telefone; participante.dt_nascimento = pt.dt_nascimento; participante.latitude = pt.geolocalizacao.Latitude; participante.longitude = pt.geolocalizacao.Longitude; listaparticipante.Add(participante); } JsonResult jsonResult = Json(new { data = listaparticipante }, JsonRequestBehavior.AllowGet); jsonResult.MaxJsonLength = int.MaxValue; return(jsonResult); }
public ActionResult Update(List <Participante> listaparticipante) { JsonResult jsonResult; //Verifica se o registro é inválido e se sim, retorna com erro. if (listaparticipante == null) { jsonResult = Json(new { codigo = -1 }, JsonRequestBehavior.AllowGet); } else { MA_PARTICIPANTE participante = new MA_PARTICIPANTE(); participante.cod_participante = listaparticipante[0].CodParticipante; participante.cod_usuario = listaparticipante[0].CodUsuario; participante.cod_campus = listaparticipante[0].CodCampus; participante.nome = listaparticipante[0].Nome; participante.telefone = listaparticipante[0].Telefone; participante.dt_nascimento = (DateTime)listaparticipante[0].DtNascimento; participante.geolocalizacao = DbGeography.FromText("POINT(" + GestorDeAplicacao.RetornaDadoSemVigurla(listaparticipante[0].Latitude.ToString()) + " " + GestorDeAplicacao.RetornaDadoSemVigurla(listaparticipante[0].Longitude.ToString()) + ")"); try { Boolean resultado = GestorDeParticipante.AtualizarParticipanteComRetorno(participante); if (resultado) { jsonResult = Json(new { codigo = participante.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 Update(List <Participante> listaparticipante) { JsonResult jsonResult; //Verifica se o registro é inválido e se sim, retorna com erro. if (listaparticipante == null) { jsonResult = Json(new { success = false }, JsonRequestBehavior.AllowGet); jsonResult.MaxJsonLength = int.MaxValue; return(jsonResult); } foreach (Participante pt in listaparticipante) { MA_PARTICIPANTE participante = new MA_PARTICIPANTE(); participante.cod_participante = pt.cod_participante; participante.cod_usuario = pt.cod_usuario; participante.cod_campus = pt.cod_campus; participante.nome = pt.nome; participante.telefone = pt.telefone; participante.dt_nascimento = (DateTime)pt.dt_nascimento; participante.geolocalizacao = DbGeography.FromText("POINT(" + GestorDeAplicacao.RetornaDadoSemVigurla(pt.latitude.ToString()) + " " + GestorDeAplicacao.RetornaDadoSemVigurla(pt.longitude.ToString()) + ")"); GestorDeParticipante.AtualizarParticipante(participante); } jsonResult = Json(new { success = true }, JsonRequestBehavior.AllowGet); jsonResult.MaxJsonLength = int.MaxValue; return(jsonResult); }
public ParticipanteController() { GestorDeParticipante = new GestorDeParticipante(); GestorDeAplicacao = new GestorDeAplicacao(); }
public LoginController() { this.GestorDeUsuario = new GestorDeUsuario(); this.GestorDeParticipante = new GestorDeParticipante(); }
public ActionResult Delete(List <Participante> listaparticipante) { JsonResult jsonResult; //Verifica se o registro é inválido e se sim, retorna com erro. if (listaparticipante == null) { jsonResult = Json(new { codigo = -1 }, JsonRequestBehavior.AllowGet); } else { MA_PARTICIPANTE participante = new MA_PARTICIPANTE(); participante.cod_participante = listaparticipante[0].CodParticipante; try { if (GestorDeParticipante.VerificarSeExisteParticipantePorId(participante.cod_participante)) { participante = GestorDeParticipante.ObterParticipantePorId(participante.cod_participante); MA_USUARIO usuario = GestorDeUsuario.ObterUsuarioPorId(participante.cod_usuario); //Inativa o usuário associado a este Participante usuario.cod_status = 2; Boolean resultado = GestorDeUsuario.AtualizarUsuarioComRetorno(usuario); if (resultado) { jsonResult = Json(new { codigo = participante.cod_participante }, JsonRequestBehavior.AllowGet); } else { jsonResult = Json(new { 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); } } jsonResult.MaxJsonLength = int.MaxValue; return(jsonResult); }
public ActionResult Get(List <Participante> listaparticipante) { JsonResult jsonResult; List <ParticipanteGet> listaparticipanteretorno = new List <ParticipanteGet>(); //Verifica se o registro é inválido e se sim, retorna com erro. if (listaparticipante == null) { jsonResult = Json(new { participante = listaparticipanteretorno }, JsonRequestBehavior.AllowGet); } else { if (GestorDeParticipante.VerificarSeParticipanteExiste(listaparticipante[0].CodParticipante)) { try { MA_PARTICIPANTE participante = GestorDeParticipante.ObterParticipantePorId(listaparticipante[0].CodParticipante); ParticipanteGet pg = new ParticipanteGet(); pg.CodParticipante = participante.cod_participante; pg.NomeParticipante = participante.nome; pg.CodCampus = participante.cod_campus; pg.NomeCampus = participante.MA_CAMPUS.local; pg.CodUsuario = participante.cod_usuario; pg.EMail = participante.MA_USUARIO.e_mail; pg.Telefone = participante.telefone; pg.DtNascimento = participante.dt_nascimento.ToString(); pg.Latitude = participante.geolocalizacao.Latitude.ToString(); pg.Longitude = participante.geolocalizacao.Longitude.ToString(); listaparticipanteretorno.Add(pg); jsonResult = Json(new { participante = listaparticipanteretorno }, JsonRequestBehavior.AllowGet); } catch (Exception e) { jsonResult = Json(new { erro = e.InnerException.ToString(), participante = "" }, JsonRequestBehavior.AllowGet); } } else { jsonResult = Json(new { participante = listaparticipanteretorno }, JsonRequestBehavior.AllowGet); } } jsonResult.MaxJsonLength = int.MaxValue; return(jsonResult); }
public ImagemParticipanteController() { this.GestorDeImagemDeParticipante = new GestorDeImagemDeParticipante(); this.GestorDeParticipante = new GestorDeParticipante(); }