Example #1
0
        private void ButtonGuardar_Click(object sender, RoutedEventArgs e)
        {
            ClassProducto Logica = new ClassProducto();
            string        resp;

            resp = Logica.NuevoProducto(TextNombreProduc.Text, Convert.ToSingle(TextPrecio.Text), TextDescripcion.Text, Convert.ToSingle(TextDescuento.Text), Convert.ToInt32(TextExistencia.Text), Convert.ToInt32(comboTipo.SelectedValue), Convert.ToInt32(comboPresentacion.SelectedValue), Convert.ToInt32(comboProveedor.SelectedValue));
            if (resp.ToUpper().Contains("ERROR"))
            {
                MessageBox.Show(resp, "Error al registrar el proveedor");
            }
            else
            {
                MessageBox.Show(resp);

                /*buttonAgregar.Visibility = Visibility.Visible;
                 * buttonGrabar.Visibility = Visibility.Hidden;
                 * buttonListar.IsEnabled = true;
                 * buttonCancelar.IsEnabled = false;*/
                TextPresentacion.Clear();
                TextProductoId.Clear();
                TextNombreProduc.Clear();
                TextExistencia.Clear();
                TextDescripcion.Clear();
                TextDescuento.Clear();
                TextProveedor.Clear();
                TextPrecio.Clear();
                TextTipoProducto.Clear();
            }
        }
Example #2
0
 private void ButtonCancelar_Click(object sender, RoutedEventArgs e)
 {
     buttonActualizar.IsEnabled = false;
     buttonGuardar.IsEnabled    = true;
     TextPresentacion.Clear();
     TextProductoId.Clear();
     TextNombreProduc.Clear();
     TextExistencia.Clear();
     TextDescripcion.Clear();
     TextDescuento.Clear();
     TextProveedor.Clear();
     TextPrecio.Clear();
     TextTipoProducto.Clear();
 }
Example #3
0
        private void ButtonActualizar_Click(object sender, RoutedEventArgs e)
        {
            if (TextProductoId.Text != "")
            {
                string        resp       = "Datos correctamente actualizados";
                ClassProducto Logica     = new ClassProducto();
                Producto      InfoEstado = new Producto();
                InfoEstado.productoID         = Convert.ToInt32(TextProductoId.Text);
                InfoEstado.nombreProducto     = TextNombreProduc.Text;
                InfoEstado.PrecioVenta        = Convert.ToSingle(TextPrecio.Text);
                InfoEstado.Descripcion        = TextDescripcion.Text;
                InfoEstado.descuentoProducto  = Convert.ToSingle(TextDescuento.Text);
                InfoEstado.existenciaProducto = Convert.ToInt32(TextExistencia.Text);
                InfoEstado.tipopID            = Convert.ToInt32(comboTipo.SelectedValue);
                InfoEstado.PresentacionID     = Convert.ToInt32(comboPresentacion.SelectedValue);
                InfoEstado.proveedorID        = Convert.ToInt32(comboProveedor.SelectedValue);
                resp = Logica.ActualizarProducto(InfoEstado);
                MessageBox.Show(resp);

                /*MessageBox.Show(TextCodigo.Text);
                 * MessageBox.Show(TextNombreEstado.Text);*/
                TextPresentacion.Clear();
                TextProductoId.Clear();
                TextNombreProduc.Clear();
                TextExistencia.Clear();
                TextDescripcion.Clear();
                TextDescuento.Clear();
                TextProveedor.Clear();
                TextPrecio.Clear();
                TextTipoProducto.Clear();
            }
            else
            {
                MessageBox.Show("Marque el registro a modificar", "Error al Editar",
                                MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
            }
            buttonGuardar.IsEnabled = true;
        }