Beispiel #1
0
        protected void btnModificar_Click(object sender, EventArgs e)
        {
            nombre = txtNombre.Text.ToString();
            foto   = txtFoto.Text.ToString();
            estado = int.Parse(txtEstado.Text.ToString());
            precio = double.Parse(txtPrecio.Text.ToString());
            idProd = int.Parse(txtID.Text.ToString());

            ServicioProductos.Producto producto = new ServicioProductos.Producto();
            producto.idProducto = idProd;
            producto.nombre     = nombre;
            producto.foto       = foto;
            producto.estado     = estado;
            producto.precio     = precio;
            try
            {
                //LLamada al metodo modificar un producto que se encuentra en el servicio
                servicio.ModificarProducto(producto);

                limpiar();
                llenarTabla();
                btnEliminar.Enabled  = false;
                btnModificar.Enabled = false;
                txtID.Enabled        = true;
            }
            catch (Exception)
            {
            }
        }
Beispiel #2
0
        protected void btnBuscar_Click(object sender, EventArgs e)
        {
            antiguo = new Producto();

            //LLamada al metodo obtener uno que se encuentra en el servicio
            ServicioProductos.Producto prod = servicio.ObtenerUno(int.Parse(txtID.Text.ToString()));

            if (prod != null)
            {
                antiguo.idProducto = prod.idProducto;
                antiguo.nombre     = prod.nombre;
                antiguo.precio     = prod.precio;
                antiguo.estado     = prod.estado;
                antiguo.foto       = prod.foto;
            }

            if (antiguo != null)
            {
                txtID.Enabled  = false;
                txtEstado.Text = antiguo.estado + "";
                txtFoto.Text   = antiguo.foto;
                txtNombre.Text = antiguo.nombre;
                txtPrecio.Text = antiguo.precio + "";

                btnEliminar.Enabled  = true;
                btnModificar.Enabled = true;
            }
        }