protected void grdProductos_RowUpdating(object sender, GridViewUpdateEventArgs e) { //Buscar los datos del edititemplate String s_Idproc = ((Label)grdProductos.Rows[e.RowIndex].FindControl("lblet_Cod_pro")).Text; String s_pu = ((TextBox)grdProductos.Rows[e.RowIndex].FindControl("txtEi_PU_Pro")).Text; String s_stock = ((TextBox)grdProductos.Rows[e.RowIndex].FindControl("txt_Stock")).Text; //String s_categoria = ((TextBox)grdProductos.Rows[e.RowIndex].FindControl("txtet_Categoria")).Text; //String s_descripcion = ((TextBox)grdProductos.Rows[e.RowIndex].FindControl("txtei_Descripcion")).Text; String s_imagen = ((TextBox)grdProductos.Rows[e.RowIndex].FindControl("TextBox1")).Text; NegocioProducto neg = new NegocioProducto(); //lblSelecciono.Text = s_Idproc + s_pu + s_stock + s_imagen; int stock = Convert.ToInt32(s_stock); bool estado = false; decimal Precio = Convert.ToDecimal(s_pu); estado = neg.actualizarProducto(s_Idproc, Precio, stock, s_imagen); if (estado == true) { lblSelecciono.Text = "SE Actaulizo el producto corrrectamente "; } else { lblSelecciono.Text = "NO SE PUDO ACTUALIZAR "; } //GestionLibros glibros = new GestionLibros(); //glibros.ActualizarLibro(lib); grdProductos.EditIndex = -1; cargarGridView(); }
private void btnGuardar_Click(object sender, EventArgs e) { try { string respuesta = ""; if (this.txtCantidad.Text == string.Empty || this.txtPrecioCompra.Text == string.Empty || this.txtPrecioVenta.Text == string.Empty) { MensajeError("Falta ingresar algunos datos"); } else { int nuevoStock; nuevoStock = this.actualizarStock(); respuesta = NegocioProducto.actualizarProducto(this.txtCodigo.Text.ToUpper(), nuevoStock, float.Parse(this.txtPrecioCompra.Text), float.Parse(this.txtPrecioVenta.Text), this.pickerFechaRegistroCompra.Text, this.pickerFechaRegistroVenta.Text); this.MensajeOK("Registro actualizado exitosamente"); this.limpiarCampos(); this.bloquearCampos(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }