private void ConsultarButton_Click(object sender, RoutedEventArgs e) { var lista = new List <Cotizaciones>(); if (CriterioTextBox.Text.Trim().Length > 0) { switch (FiltroComboBox.SelectedIndex) { case 0: //TODO lista = CotizacionesBLL.GetList(x => true); break; case 1: //ID int id = int.Parse(CriterioTextBox.Text); lista = CotizacionesBLL.GetList(x => x.CotizacionId == id); break; case 3: //FECHA DateTime fecha = Convert.ToDateTime(CriterioTextBox.Text); lista = CotizacionesBLL.GetList(x => x.Fecha == fecha); break; } } else { lista = CotizacionesBLL.GetList(x => true); } ConsultarDataGrig.ItemsSource = null; ConsultarDataGrig.ItemsSource = lista; }
public void EliminarTest() { int idcotizaciones = CotizacionesBLL.GetList(x => true)[0].CotizacionId; bool paso = CotizacionesBLL.Eliminar(idcotizaciones); Assert.AreEqual(true, paso); }
public void BuscarTest() { int idcotizaciones = CotizacionesBLL.GetList(x => true)[0].CotizacionId; Cotizaciones cotizaciones = CotizacionesBLL.Buscar(idcotizaciones); bool paso = cotizaciones.Detalle.Count > 0; Assert.AreEqual(true, paso); }
public void ModificarTest() { int idcotizaciones = CotizacionesBLL.GetList(x => true)[0].CotizacionId; Cotizaciones cotizaciones = CotizacionesBLL.Buscar(idcotizaciones); //agregtar otro cotizaciones.Detalle.Add(new DetalleCotizaciones(0, cotizaciones.CotizacionId, 2, 4, 50f, 2f, 100f)); bool paso = CotizacionesBLL.Modificar(cotizaciones); Assert.AreEqual(true, paso); }
public JsonResult Buscar(int id) { Cotizaciones cotizacion = CotizacionesBLL.Buscar(id); if (cotizacion != null) { return(Json(cotizacion)); } else { return(Json(0)); } }
private void BuscarCotizacionButton_Click(object sender, EventArgs e) { Co = CotizacionesBLL.Buscar((int)CotIdNumericUpDown.Value); if (Co == null) { MessageBox.Show("La cotizacion no existe."); } else { MessageBox.Show("Se encontro la cotizacion."); } }
private void BtnEliminar_Click(object sender, EventArgs e) { int id = Convert.ToInt32(CotizacionIdnumericUpDown.Value); //validar que exista if (CotizacionesBLL.Eliminar(id)) { MessageBox.Show("Eliminado!!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No se pudo eliminar!!", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void GuardarTest() { Cotizaciones cotizaciones = new Cotizaciones { Fecha = DateTime.Now, Observaciones = "Producto bueno" }; cotizaciones.Detalle.Add(new DetalleCotizaciones(0, 0, 1, 1, 2f, 50f, 100f)); cotizaciones.Detalle.Add(new DetalleCotizaciones(0, 0, 2, 3, 4f, 10f, 40f)); bool paso = CotizacionesBLL.Guardar(cotizaciones); Assert.AreEqual(true, paso); }
private void BtnBuscar_Click(object sender, EventArgs e) { int id = Convert.ToInt32(CotizacionIdnumericUpDown.Value); Cotizaciones Cotizacion = CotizacionesBLL.Buscar(id); if (Cotizacion != null) { LlenarCampos(Cotizacion); } else { MessageBox.Show("No se encontro!", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void EliminarBtn(object sender, RoutedEventArgs e) { int id; int.TryParse(cotizacionIdTextBox.Text, out id); if (CotizacionesBLL.Eliminar(id)) { MessageBox.Show("Eliminado con exito!!!", "ELiminado", MessageBoxButton.OK, MessageBoxImage.Information); Limpiar(); } else { MessageBox.Show(" No eliminado !!!", "Informacion", MessageBoxButton.OK, MessageBoxImage.Warning); } }
public JsonResult Guardar(Cotizaciones nueva) { int id = 0; if (ModelState.IsValid) { if (CotizacionesBLL.Guardar(nueva)) { id = nueva.CotizacionId; } } else { id = +1; } return(Json(id)); }
private void BuscarBtn(object sender, RoutedEventArgs e) { Cotizaciones anterior = CotizacionesBLL.Buscar(int.Parse(cotizacionIdTextBox.Text)); if (anterior != null) { cotizaciones = anterior; this.cotizacionesDetalles = anterior.CotizacionesDetalles; Actualizar(); Lista(); Calcular(); } else { MessageBox.Show("No encontrado"); } }
public JsonResult Save(Cotizaciones cotizacion) { int id = 0; if (ModelState.IsValid) { if (CotizacionesBLL.Insertar(cotizacion)) { id = cotizacion.CotizacionId; } } else { id = +1; } return(Json(id, JsonRequestBehavior.AllowGet)); }
private void BtnGuardar_Click(object sender, EventArgs e) { Cotizaciones cotizacion; bool Paso = false; if (HayErrores()) { MessageBox.Show("Favor revisar todos los campos", "ValidaciĆ³n", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } cotizacion = LlenaClase(); //Determinar si es Guardar o Modificar if (CotizacionIdnumericUpDown.Value == 0) { Paso = CotizacionesBLL.Guardar(cotizacion); } else { //validar que exista. Paso = CotizacionesBLL.Modificar(cotizacion); } //Informar el resultado if (Paso) { BtnNuevo.PerformClick(); MessageBox.Show("Guardado!!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No se pudo guardar!!", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void BuscarButton_Click(object sender, EventArgs e) { if (FiltrarComboBox.SelectedIndex == 0) { int id = 0; int.TryParse(CriterioTextBox.Text, out id); lista = CotizacionesBLL.GetList(Cot => Cot.CotizacionesId == id); } else if (FiltrarComboBox.SelectedIndex == 1) { string comentario = CriterioTextBox.Text; lista = CotizacionesBLL.GetList(Cot => Cot.Comentario.Contains(comentario)); } else if (FiltrarComboBox.SelectedIndex == 2) { decimal monto = 0; decimal.TryParse(CriterioTextBox.Text, out monto); lista = CotizacionesBLL.GetList(Cot => Cot.Monto == monto); } CotizacionesDataGridView.DataSource = lista; }
private void GuardarBtn(object sender, RoutedEventArgs e) { bool paso = false; Clientes cliente = (Clientes)clienteComboBox.SelectedValue; cotizaciones.ClienteId = cliente.ClienteId; if (!Validar()) { return; } if (String.IsNullOrEmpty(cotizacionIdTextBox.Text) || cotizacionIdTextBox.Text == "0") { paso = CotizacionesBLL.Guardar(cotizaciones); } else { if (!Existe()) { MessageBox.Show("No existe el en la Base de datos", "Informacion", MessageBoxButton.OK, MessageBoxImage.Information); return; } paso = CotizacionesBLL.Modificar(cotizaciones); } if (paso) { MessageBox.Show("Guardado!!", "EXITO", MessageBoxButton.OK, MessageBoxImage.Information); Limpiar(); } else { MessageBox.Show(" No guardado!!", "Informacion", MessageBoxButton.OK, MessageBoxImage.Information); } }
private bool Existe() { Cotizaciones cotizaciones = CotizacionesBLL.Buscar(Convert.ToInt32(cotizacionIdTextBox.Text)); return(cotizaciones != null); }