Ejemplo n.º 1
0
 void cargarGrilla()
 {
     proxyCentros.CentroClient centro = new CentroClient();
     var dato = centro.ListarCentro();
     gvCentro.DataSource = dato;
     gvCentro.DataBind();
 }
Ejemplo n.º 2
0
        protected void btnGrabar_Click(object sender, EventArgs e)
        {
            try
            {
                lblMensaje.Text = "";

                proxyCentros.CentroClient centro = new CentroClient();
                centro.CrearCentro(txtDescripcion.Text, Convert.ToInt16(DropDownList1.SelectedValue));
                cargarGrilla();
                limpiar();
            }
            catch (Exception ex)
            {
                lblMensaje.Text = "Error registrar datos :" + ex.Message;
            }
        }
Ejemplo n.º 3
0
        protected void btnModificar_Click(object sender, EventArgs e)
        {
            try
            {
                limpiar();
                int codigoCent = int.Parse(txtCodigo.Text);
                lblMensaje.Text = "";
                proxyCentros.CentroClient centro = new CentroClient();

                var cen = centro.ModificarCentro(codigoCent, txtDescripcion.Text, Convert.ToInt16(DropDownList1.SelectedValue)).ID_CENTRO.ToString();
                cargarGrilla();
                limpiar();
            }
            catch (Exception ex)
            {
                lblMensaje.Text = "Error al modificar datos....";


            }
        }
Ejemplo n.º 4
0
        protected void btnConsultar_Click(object sender, EventArgs e)
        {
            try
            {

                int codigoCen = int.Parse(txtCodigo.Text);
                lblMensaje.Text = "";
                proxyCentros.CentroClient centro = new CentroClient();

                var cen = centro.ObtenerCentro(codigoCen);

                if (cen == null)
                {
                    lblMensaje.Text = "Centro no registrado....";
                }
                else
                {
                    txtDescripcion.Text = cen.DESCRIPCION.ToString();
                    DropDownList1.SelectedValue = cen.EMPRESA.ToString();
                }
            }
            catch (Exception ex)
            {

                lblMensaje.Text = "Error obtener datos....";


            }
        }