Exemplo n.º 1
0
        //—————————————————————————————————————————————————————————————[ TEXT CHANGED ]—————————————————————————————————————————————————————————————

        //——————————————————————————————————————————[ ProductoId ]——————————————————————————————————————————
        private void ProductoIdTextbox_TextChanged(object sender, TextChangedEventArgs e)
        {
            try
            {
                if (ProductoIdTextBox.Text.Trim() != string.Empty)
                {
                    int.Parse(ProductoIdTextBox.Text);
                }
            }
            catch
            {
                MessageBox.Show($"El valor digitado en el campo (Producto Id) no es un número.\n\nPor favor, digite un número.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                ProductoIdTextBox.Text = "0";
                ProductoIdTextBox.Focus();
                ProductoIdTextBox.SelectAll();
            }
        }
Exemplo n.º 2
0
        //——————————————————————————————————————————————————————————————[ Buscar ]———————————————————————————————————————————————————————————————
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            Productos encontrado = ProductosBLL.Buscar(Utiidades.ToInt(ProductoIdTextBox.Text));

            if (encontrado != null)
            {
                this.productos = encontrado;
                Cargar();
            }
            else
            {
                this.productos   = new Productos();
                this.DataContext = this.productos;
                MessageBox.Show($"Este Producto no fue encontrado.\n\nAsegúrese que existe o cree una nuevo.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                Limpiar();
                ProductoIdTextBox.SelectAll();
                ProductoIdTextBox.Focus();
            }
        }
Exemplo n.º 3
0
        //——————————————————————————————————————————————————————————————[ Guardar ]———————————————————————————————————————————————————————————————
        private void GuardarButton_Click(object sender, RoutedEventArgs e)
        {
            {
                if (!Validar())
                {
                    return;
                }

                //———————————————————————————————————————————————————————[ VALIDAR SI ESTA VACIO ]———————————————————————————————————————————————————————
                //—————————————————————————————————[ Producto Id ]—————————————————————————————————
                if (ProductoIdTextBox.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("El Campo (Producto Id) está vacío.\n\nAsigne un Id al Libro.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    ProductoIdTextBox.Text = "0";
                    ProductoIdTextBox.Focus();
                    ProductoIdTextBox.SelectAll();
                    return;
                }

                //—————————————————————————————————[ Nombre ]—————————————————————————————————
                if (NombrePTextBox.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("El Campo (Nombre producto) está vacío.\n\nEscriba un Nombre.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    NombrePTextBox.Clear();
                    NombrePTextBox.Focus();
                    return;
                }

                //—————————————————————————————————[ Marca Id ]—————————————————————————————————
                if (MarcaIdComboBox.Text == string.Empty)
                {
                    MessageBox.Show("El Campo (Marca Id) está vacío.\n\nPorfavor, Seleccione una marca .", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    MarcaIdComboBox.IsDropDownOpen = true;
                    return;
                }

                //—————————————————————————————————[ Precio ]—————————————————————————————————
                if (PrecioTextBox.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("El Campo (Precio) está vacío.\n\nEscriba un de Precio.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    PrecioTextBox.Clear();
                    PrecioTextBox.Focus();
                    return;
                }

                //—————————————————————————————————[ ITBIS ]—————————————————————————————————
                if (ItebisTextBox.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("El Campo (ITBIS) está vacío.\n\nEscriba un Itbis.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    ItebisTextBox.Focus();
                    ItebisTextBox.SelectAll();
                    return;
                }

                //—————————————————————————————————[ Fecha ]—————————————————————————————————
                if (FechaPDatePicker.Text.Trim() == string.Empty)
                {
                    MessageBox.Show($"El Campo (Fecha) está vacío.\n\nSeleccione una fecha.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    FechaPDatePicker.Focus();
                    return;
                }

                //—————————————————————————————————[ Existencia ]—————————————————————————————————
                if (DescripcionTextBox.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("El Campo (Descripcion) está vacío.\n\nRealice una despcricion  .", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);


                    DescripcionTextBox.Focus();
                    DescripcionTextBox.SelectAll();
                    return;
                }


                //———————————————————————————————————————————————————————[ VALIDAR SI ESTA VACIO - FIN ]———————————————————————————————————————————————————————
                var paso = ProductosBLL.Guardar(productos);
                if (paso)
                {
                    Limpiar();
                    MessageBox.Show("Transacción Exitosa", "Éxito", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                else
                {
                    MessageBox.Show("Transaccion Fallida", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }