private void ConsultarButton_Click(object sender, RoutedEventArgs e) { var listado = new List <EntradaProductos>(); if (CriterioTextBox.Text.Trim().Length > 0) { switch (FiltroComboBox.SelectedIndex) { case 0: try { listado = EntradaProductosBLL.GetList(u => u.EntradaProductoId == int.Parse(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 = EntradaProductosBLL.GetList(u => u.NombreProvedor.Contains(CriterioTextBox.Text)); } catch (FormatException) { MessageBox.Show("Debes ingresar un Critero valido para aplicar este filtro.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning); } break; case 2: try { listado = EntradaProductosBLL.GetList(u => u.Cantidad == float.Parse(CriterioTextBox.Text)); } catch (FormatException) { MessageBox.Show("Debes ingresar un Critero valido para aplicar este filtro.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning); } break; } } else { listado = EntradaProductosBLL.GetList(c => true); } if (DesdeDatePicker.SelectedDate != null) { listado = EntradaProductosBLL.GetList(c => c.FechaEntrada.Date >= DesdeDatePicker.SelectedDate); } if (HastaDatePicker.SelectedDate != null) { listado = EntradaProductosBLL.GetList(c => c.FechaEntrada.Date <= HastaDatePicker.SelectedDate); } DatosDataGrid.ItemsSource = null; DatosDataGrid.ItemsSource = listado; }
public void GetListTest() { EntradaProductosBLL productosBLL = new EntradaProductosBLL(); var Listar = productosBLL.GetList(x => true); Assert.IsNotNull(Listar); }
private void BuscarFiltrobutton_Click(object sender, EventArgs e) { int Id; switch (FiltrarcomboBox.SelectedIndex) { case 0: //EntrdaId Id = Convert.ToInt32(FiltrartextBox.Text); filtral = x => x.EntradaId == Id && (x.Fecha >= DesdedateTimePicker.Value && x.Fecha <= HastadateTimePicker.Value); break; case 1: //Cantidad Id = Convert.ToInt32(FiltrartextBox.Text); filtral = x => x.Cantidad == Id && (x.Fecha >= DesdedateTimePicker.Value && x.Fecha <= HastadateTimePicker.Value); break; case 2: //Todos filtral = x => true; break; } ConsultadataGridView.DataSource = EntradaProductosBLL.GetList(filtral); }
private void ButtonBuscar_Click(object sender, EventArgs e) { switch (FiltroComboBox.SelectedIndex) { case 0: //EntradaId if (Validar(1)) { MessageBox.Show("Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Ingrese un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { int id = Convert.ToInt32(CriterioTextBox.Text); if (FechaCheckBox.Checked == true) { filtro = x => x.EntradapId == id && (x.Fecha >= DesdeDateTimePicker.Value.Date && x.Fecha <= HastaDateTimePicker.Value.Date); } else { filtro = x => x.EntradapId == id; } if (EntradaProductosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("No Hay Existencia", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } break; case 1: //ProductoId if (Validar(1)) { MessageBox.Show("Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Ingrese un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { int productoId = Convert.ToInt32(CriterioTextBox.Text); if (FechaCheckBox.Checked == true) { filtro = x => x.ProductoId == productoId && (x.Fecha >= DesdeDateTimePicker.Value.Date && x.Fecha <= HastaDateTimePicker.Value.Date); } else { filtro = x => x.ProductoId == productoId; } if (EntradaProductosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("No Hay Existencia", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case 2: //Cantidad if (Validar(1)) { MessageBox.Show("Llenar Casilla ", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Validar(2)) { MessageBox.Show("Ingrese un Numero!", "Fallido", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { int cantidad = Convert.ToInt32(CriterioTextBox.Text); if (FechaCheckBox.Checked == true) { filtro = x => x.Cantidad == cantidad && (x.Fecha >= DesdeDateTimePicker.Value.Date && x.Fecha <= HastaDateTimePicker.Value.Date); } else { filtro = x => x.Cantidad == cantidad; } if (EntradaProductosBLL.GetList(filtro).Count() == 0) { MessageBox.Show("No Hay Existencia", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; case 3: //Todos filtro = x => true; break; } EntradaProductosDataGridView.DataSource = EntradaProductosBLL.GetList(filtro); CriterioTextBox.Clear(); GeneralErrorProvider.Clear(); }
private void ButtonNuevo_Click(object sender, EventArgs e) { vEntradaProducto ver = new vEntradaProducto(EntradaProductosBLL.GetList(filtro)); ver.Show(); }
public void GetListTest() { var Listar = EntradaProductosBLL.GetList(x => true); Assert.IsNotNull(Listar); }