Ejemplo n.º 1
0
        public rVehiculos()
        {
            InitializeComponent();
            this.DataContext = vehiculos;

            MarcaComboBox.ItemsSource       = MarcasBLL.GetMarcas();
            MarcaComboBox.SelectedValuePath = "MarcaId";
            MarcaComboBox.DisplayMemberPath = "Descripcion";

            CaracteristicasComboBox.ItemsSource       = CaracteristicasBLL.GetCaracteristicas();
            CaracteristicasComboBox.SelectedValuePath = "CaracteristicasId";
            CaracteristicasComboBox.DisplayMemberPath = "Descripcion";
        }
 private void EliminarButton_Click(object sender, RoutedEventArgs e)
 {
     if (CaracteristicasBLL.Eliminar(Utilidades.ToInt(CaracteristicaIdTextBox.Text)))
     {
         Limpiar();
         MessageBox.Show("Registro eliminado!", "Exito",
                         MessageBoxButton.OK, MessageBoxImage.Information);
     }
     else
     {
         MessageBox.Show("No fue posible eliminar", "Fallo",
                         MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            var Caracteristicas = CaracteristicasBLL.Buscar(Utilidades.ToInt(CaracteristicaIdTextBox.Text));

            if (Caracteristicas != null)
            {
                this.Carateristicas = Caracteristicas;
            }
            else
            {
                this.Carateristicas = new Caracteristicas();
            }

            this.DataContext = this.Carateristicas;
        }
        private void GuardarButton_Click(object sender, RoutedEventArgs e)
        {
            if (!Validar())
            {
                return;
            }

            var paso = CaracteristicasBLL.Guardar(Carateristicas);

            if (paso)
            {
                Limpiar();
                MessageBox.Show("Guardado correctamente!", "Exito",
                                MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                MessageBox.Show("Transaccion Fallida", "Fallo",
                                MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }