protected void gvDetalhamento_PreRender(object sender, EventArgs e) { if (lbCodInternacao.Text != "") { int _item = Convert.ToInt32(lbCodInternacao.Text); gvDetalhamento.DataSource = AnotacaoDAO.listaAnotacaoInternacao(_item); gvDetalhamento.DataBind(); } }
protected void btnGravaAnotacao_Click(object sender, EventArgs e) { Anotacao a = new Anotacao(); a.cod_internacao = Convert.ToInt32(lbCodInternacao.Text); a.usuario_anotacao = System.Web.HttpContext.Current.User.Identity.Name; a.diagnostico = txbDiagnostico.Text; a.detalhamento = txbDetalhamento.Text; a.aguarda = txbAguarda.Text; AnotacaoDAO.GravaAnotacaoInternacao(a.cod_internacao, a.usuario_anotacao, a.diagnostico, a.detalhamento, a.aguarda); txbDiagnostico.Text = ""; txbDetalhamento.Text = ""; txbAguarda.Text = ""; }
protected void btnAtualizaAnotacao_Click(object sender, EventArgs e) { Anotacao a = new Anotacao(); a.cod_anotacao = Convert.ToInt32(lbCodAnotacao.Text); a.diagnostico = txbDiagnostico.Text; a.detalhamento = txbDetalhamento.Text; a.aguarda = txbAguarda.Text; AnotacaoDAO.AtualizaAnotacaoInternacao(a.cod_anotacao, a.diagnostico, a.detalhamento, a.aguarda); txbDiagnostico.Text = ""; txbDetalhamento.Text = ""; txbAguarda.Text = ""; lbCodAnotacao.Text = ""; btnGravar.Visible = true; btnAtualizar.Visible = false; }
protected void grdMain_RowCommand(object sender, GridViewCommandEventArgs e) { int index; int _cod_anotacao; if (e.CommandName.Equals("editAnotacao")) { Anotacao a = new Anotacao(); index = Convert.ToInt32(e.CommandArgument); // necessário um index único _cod_anotacao = Convert.ToInt32(gvDetalhamento.DataKeys[index].Value.ToString()); GridViewRow row = gvDetalhamento.Rows[index]; a.diagnostico = HttpUtility.HtmlDecode(row.Cells[1].Text); a.detalhamento = HttpUtility.HtmlDecode(row.Cells[2].Text); a.aguarda = HttpUtility.HtmlDecode(row.Cells[3].Text); lbCodAnotacao.Text = row.Cells[0].Text; txbDiagnostico.Text = a.diagnostico; txbDetalhamento.Text = a.detalhamento; txbAguarda.Text = a.aguarda; btnGravar.Visible = false; btnAtualizar.Visible = true; } if (e.CommandName.Equals("deletaAnotacao")) { index = Convert.ToInt32(e.CommandArgument); // necessário um index único _cod_anotacao = Convert.ToInt32(gvDetalhamento.DataKeys[index].Value.ToString()); GridViewRow row = gvDetalhamento.Rows[index]; AnotacaoDAO.DeletaAnotacaoInternacao(_cod_anotacao); } }