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); }
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 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); } }