Example #1
0
        protected void btnInsertar_Click(object sender, EventArgs e)
        {
            string respuesta= "";

            if (txtId.Text == "")
            {

                ServicioMantNotas elServicio = new ServicioMantNotas();
                respuesta = elServicio.InsertarNotas(txtNota.Text, txtDescripcion.Text, int.Parse(cmbEstado.SelectedValue.ToString()));
                if (respuesta.Equals(Global.elGlobal.RespuestaCorrecta))
                {
                    CargarNotas();

                    lblmensaje1.Text = "Datos Insertados Correctamente!";

                    pnlMantenimientoNot.Visible = false;
                 }
                else
                {
                    lblmensaje2.Text = "Error al Isertar los Datos" + respuesta;
                }
            }
              else{

                  ServicioMantNotas elServicio = new ServicioMantNotas();
                  respuesta = elServicio.ModificarNotas(int.Parse(txtId.Text), txtNota.Text, txtDescripcion.Text, int.Parse(cmbEstado.SelectedValue.ToString()));

                  if (respuesta.Equals(Global.elGlobal.RespuestaCorrecta))
                  {
                      CargarNotas();

                      lblmensaje1.Text = "Datos Modificados Correctamente!";

                      pnlMantenimientoNot.Visible = false;
                  }

                  else
                  {
                      lblmensaje2.Text = "Error en Modificación" + respuesta;
                  }

            }
        }
Example #2
0
 protected void grdNotas_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
 {
     HiddenField GridIdHF = this.grdNotas.Rows[e.NewSelectedIndex].Cells[0].FindControl("GridIdHF") as HiddenField;
     DataTable dtNotas = null;
     DataRow drNotas = null;
     ServicioMantNotas Notas = new ServicioMantNotas();
     txtId.Text = GridIdHF.Value;
     dtNotas = Notas.UnicaNota(int.Parse(txtId.Text));
     CargarNotas();
     drNotas = dtNotas.Rows[0];
     txtId.Text = drNotas["i_PK_idNota"].ToString();
     txtNota.Text = drNotas["vc_nombreNota"].ToString();
     txtDescripcion.Text = drNotas["vc_descripcionNota"].ToString();
     cmbEstado.SelectedValue = drNotas["i_activoNota"].ToString();
     cmbEstado.DataBind();
     pnlMantenimientoNot.Visible = true;
     btnInsertar.Text = "Modificar";
 }
Example #3
0
 private void CargarNotas()
 {
     DataTable dtNotas = null;
     using (ServicioMantNotas elServicio = new ServicioMantNotas())
         dtNotas = elServicio.ListarNotas(txtFiltro.Text);
         grdNotas.DataSource = dtNotas;
         grdNotas.DataBind();
 }