示例#1
0
    protected void BtnAlta_Click(object sender, EventArgs e)
    {
        try
        {
            WSArticulos.Articulo art = new WSArticulos.Articulo();

            art.Codigo = Convert.ToInt32(txtCodigo.Text);
            art.Nombre = txtNombre.Text;
            art.Precio = Convert.ToDecimal(txtPrecio.Text);

            WSArticulos.ServicioArticulos Service = new WSArticulos.ServicioArticulos();

            Service.AltaArticulo(art);

            lblError.Text = "Alta correcta";
            BtnListar_Click(null, null);
        }
        catch (SoapException ex)
        {
            lblError.Text = ex.Detail.InnerText;
        }
        catch (Exception ex)
        {
            lblError.Text = ex.Message;
        }
    }
示例#2
0
    protected void BtnBuscar_Click(object sender, EventArgs e)
    {
        try
        {
            txtNombre.Text = "";
            txtPrecio.Text = "";

            WSArticulos.ServicioArticulos Service = new WSArticulos.ServicioArticulos();

            WSArticulos.Articulo art = Service.BuscarArticulo(Convert.ToInt32(txtCodigo.Text));

            if (art != null)
            {
                txtNombre.Text       = art.Nombre;
                txtPrecio.Text       = art.Precio.ToString();
                BtnBaja.Enabled      = true;
                BtnModificar.Enabled = true;
                BtnAlta.Enabled      = false;
            }
            else
            {
                BtnBaja.Enabled      = false;
                BtnModificar.Enabled = false;
                BtnAlta.Enabled      = true;
            }
        }
        catch (SoapException ex)
        {
            lblError.Text = ex.Detail.InnerText;
        }
        catch (Exception ex)
        {
            lblError.Text = ex.Message;
        }
    }