コード例 #1
0
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            var listado = new List <Entradas>();

            if (CriterioTextBox.Text.Trim().Length > 0)
            {
                switch (FiltroComboBox.SelectedIndex)
                {
                case 0:     //EntradaId
                    listado = EntradasBLL.GetAmigos(a => a.EntradaId == Utilidades.ToInt(CriterioTextBox.Text));
                    break;

                case 1:     //JuegoId
                    listado = EntradasBLL.GetAmigos(a => a.JuegoId == Utilidades.ToInt(CriterioTextBox.Text));
                    break;

                case 2:     //Cantidad
                    listado = EntradasBLL.GetAmigos(a => a.Cantidad == Utilidades.ToInt(CriterioTextBox.Text));
                    break;
                }
            }
            else
            {
                listado = EntradasBLL.GetAmigos(c => true);
            }

            if (DesdeDataPicker.SelectedDate != null)
            {
                listado = EntradasBLL.GetAmigos(c => c.Fecha.Date >= DesdeDataPicker.SelectedDate);
            }

            if (HastaDatePicker.SelectedDate != null)
            {
                listado = EntradasBLL.GetAmigos(c => c.Fecha.Date <= HastaDatePicker.SelectedDate);
            }

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