private void ConsultarButton_Click(object sender, RoutedEventArgs e) { var listado = new List <Devoluciones>(); if (CriterioTextBox.Text.Trim().Length > 0) { switch (FiltroComboBox.SelectedIndex) { case 0: try { listado = DevolucionesBLL.GetList(d => d.DevolucionId == 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 = DevolucionesBLL.GetList(d => d.UsuarioId == int.Parse(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 = DevolucionesBLL.GetList(d => d.ClienteId == int.Parse(CriterioTextBox.Text)); } catch (FormatException) { MessageBox.Show("Debes ingresar un Critero valido para aplicar este filtro.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning); } break; } } else { listado = DevolucionesBLL.GetList(c => true); } if (DesdeDatePicker.SelectedDate != null) { listado = DevolucionesBLL.GetList(c => c.Fecha.Date >= DesdeDatePicker.SelectedDate); } if (HastaDatePicker.SelectedDate != null) { listado = DevolucionesBLL.GetList(c => c.Fecha.Date <= HastaDatePicker.SelectedDate); } DatosDataGrid.ItemsSource = null; DatosDataGrid.ItemsSource = listado; }
public void GetListTest() { List <Devoluciones> lista = new List <Devoluciones>(); lista = DevolucionesBLL.GetList(l => true); Assert.IsNotNull(lista); }
public void ModificarTest() { DevolucionDetalles devolucionDetalles = new DevolucionDetalles(1, 1, "Monki", DateTime.Now); List <DevolucionDetalles> list = new List <DevolucionDetalles>(); list.Add(devolucionDetalles); Devoluciones devoluciones = new Devoluciones(1, true, 1, 1, null, 1, null, list, DateTime.Now, DateTime.Now); bool realizado = DevolucionesBLL.Guardar(devoluciones); Assert.AreEqual(true, realizado); }
//——————————————————————————————————————————————————————————————[ Eliminar ]——————————————————————————————————————————————————————————————— private void EliminarButton_Click(object sender, RoutedEventArgs e) { { if (DevolucionesBLL.Eliminar(int.Parse(DevolucionesIdTextbox.Text))) { Limpiar(); MessageBox.Show("Registro Eliminado", "Éxito", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("No se pudo eliminar el registro", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } }
//——————————————————————————————————————————————————————————————[ Buscar ]——————————————————————————————————————————————————————————————— private void BuscarButton_Click(object sender, RoutedEventArgs e) { Devoluciones encontrado = DevolucionesBLL.Buscar(devoluciones.DevolucionId); if (encontrado != null) { devoluciones = encontrado; Cargar(); } else { MessageBox.Show($"Esta Devolución no fue encontrado.\n\nAsegúrese que existe o cree una nueva.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning); Limpiar(); DevolucionesIdTextbox.SelectAll(); DevolucionesIdTextbox.Focus(); } }
private void Buscarbutton_Click(object sender, EventArgs e) { int id; Devoluciones devoluciones = new Devoluciones(); id = Convert.ToInt32(IdnumericUpDown1.Value); Limpiar(); if (id > 0) { devoluciones = DevolucionesBLL.Buscar(id); } if (devoluciones != null) { LlenaCampo(devoluciones); } }
private void EliminarButton_Click(object sender, EventArgs e) { MyerrorProvider.Clear(); int id; id = Convert.ToInt32(IdnumericUpDown1.Value); if (DevolucionesBLL.Eliminar(id)) { MessageBox.Show("Eliminado", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); LlenaCombox(); Limpiar(); } else { MyerrorProvider.SetError(IdnumericUpDown1, "No se puede eliminar registro que no existe"); } }
private void GuardarButton_Click(object sender, EventArgs e) { Devoluciones devoluciones = new Devoluciones(); bool paso = false; if (!validar()) { return; } devoluciones = LlenaClase(); if (IdnumericUpDown1.Value == 0) { LlenaCombox(); paso = DevolucionesBLL.Guardar(devoluciones); } else { if (!ExisteEnLaBaseDeDatos()) { MessageBox.Show("No se puede modificar un registro que no existe", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } paso = DevolucionesBLL.Modificar(devoluciones); } if (paso) { Limpiar(); MessageBox.Show("Guardado", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No se pudo guardar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//——————————————————————————————————————————————————————————————[ Guardar ]——————————————————————————————————————————————————————————————— private void GuardarButton_Click(object sender, RoutedEventArgs e) { { if (!Validar()) { return; } //—————————————————————————————————[ Devolución Id ]————————————————————————————————— if (DevolucionesIdTextbox.Text.Trim() == string.Empty) { MessageBox.Show("El Campo (Devolución Id) está vacío.\n\nAsigne un Id al Préstamo.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning); DevolucionesIdTextbox.Text = "0"; DevolucionesIdTextbox.Focus(); DevolucionesIdTextbox.SelectAll(); return; } //—————————————————————————————————[ Cliente Id ]————————————————————————————————— if (ClienteIdComboBox.Text == string.Empty) { MessageBox.Show("El Campo (Cliente Id) está vacío.\n\nSelecione un Cliente.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning); ClienteIdComboBox.IsDropDownOpen = true; return; } var paso = DevolucionesBLL.Guardar(this.devoluciones); if (paso) { Limpiar(); MessageBox.Show("Transacción Exitosa", "Éxito", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("Transacción Fallida", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } }
private void Button1_Click(object sender, EventArgs e) { Expression <Func <Devoluciones, bool> > filtro = a => true; int id; switch (Filtro_comboBox.SelectedIndex) { case 0: break; case 1: id = Convert.ToInt32(Criterio_textBox.Text); filtro = a => a.DevolucionId == id; break; case 2: id = Convert.ToInt32(Criterio_textBox.Text); filtro = a => a.LibroId == id; break; case 3: id = Convert.ToInt32(Criterio_textBox.Text); filtro = a => a.EstudianteId == id; break; case 4: filtro = a => a.FechaDevueltaLibro >= Desde_dateTimePicker.Value.Date && a.FechaDevueltaLibro <= Hasta_dateTimePicker.Value.Date; break; case 5: filtro = c => c.FechaDevueltaLibro > c.FechaDevolucion; break; } prestamo = DevolucionesBLL.GetList(filtro); ConsultadataGridView.DataSource = DevolucionesBLL.GetList(filtro); }
private bool ExisteEnLaBaseDeDatos() { Devoluciones devoluciones = DevolucionesBLL.Buscar((int)IdnumericUpDown1.Value); return(devoluciones != null); }
public void BuscarTest() { var encontrado = DevolucionesBLL.Buscar(2); Assert.IsNotNull(encontrado); }
public void EliminarTest() { bool realizado = DevolucionesBLL.Eliminar(1); Assert.AreEqual(realizado, true); }