//ELIMINAR
 private void EliminarButton_Click(object sender, RoutedEventArgs e)
 {
     {
         if (CuidadesBLL.Eliminar(Utilidades.ToInt(CiudadIdTextbox.Text)))
         {
             Limpiar();
             MessageBox.Show("Registro Eliminado!", "Exito", MessageBoxButton.OK, MessageBoxImage.Information);
         }
         else
         {
             MessageBox.Show("No fue posible eliminar", "Fallo", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
 }
        //BUSCAR
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            var usuarios = CuidadesBLL.Buscar(Utilidades.ToInt(CiudadIdTextbox.Text));

            if (ciudades != null)
            {
                this.ciudades = usuarios;
            }
            else
            {
                this.ciudades = new Cuidades();
            }

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

                var paso = CuidadesBLL.Guardar(ciudades);
                if (paso)
                {
                    Limpiar();
                    MessageBox.Show("Transaccion Exitosa!", "Exito", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                else
                {
                    MessageBox.Show("Transaccion Fallida", "Fallo", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
        private void ConsultarButton_Click(object sender, RoutedEventArgs e)
        {
            var listado = new List <Cuidades>();

            if (CriterioTextBox.Text.Trim().Length > 0)
            {
                switch (FiltroComboBox.SelectedIndex)
                {
                case 0:
                    try
                    {
                        listado = CuidadesBLL.GetList(c => c.CuidadId == Utilidades.ToInt(CriterioTextBox.Text));
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show("Debes ingresar un Critero valido para aplicar este filtro.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                    break;

                case 1:
                    try
                    {
                        listado = CuidadesBLL.GetList(n => n.Nombre.Contains(CriterioTextBox.Text));
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show("Debes ingresar un Critero valido para aplicar este filtro.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                    break;
                }
            }
            else
            {
                listado = CuidadesBLL.GetList(c => true);
            }

            DatosDataGrid.ItemsSource = null;
            DatosDataGrid.ItemsSource = listado;
        }