Esempio n. 1
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            if (!validaciones())
            {
                return;
            }

            try
            {
                Producto prod = (Producto)productoBindingSource.Current;
                prod.Stock = Int32.Parse(waterMarkTextBox1.Text);

                if (MessageBox.Show("Esta seguro de querer descontar esta cantidad" + " [ " + prod.Stock + " ] " + " del stock de este producto" + " [ " + prod.Nombre + " ] " + "?", "Reposicion de Stock", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
                {
                    int cantidadDesc = Convert.ToInt32(label3.Text) - Convert.ToInt32(waterMarkTextBox1.Text);
                    DatosProducto.ActualizarStock(((Producto)productoBindingSource.Current).IdProducto, cantidadDesc);

                    MessageBox.Show("El monto" + " [ " + prod.Stock + " ] " + " se desconto del stock con exito!!", "Confirmacion");
                    Actualizar();
                    this.Close();
                }
            }
            catch
            {
                //return result;

                //DialogResult result = MessageBox.Show("Ingrese todos los campos, !Son Obligatorios!!", "Verificacion", MessageBoxButtons.RetryCancel, MessageBoxIcon.Asterisk);
                //if (result == DialogResult.Cancel)
                //{
                //    this.Close();
                //}

                //else if (result == DialogResult.Retry)
                //{
                //    return;

                //}
            }
        }