private void InsertarPagos() { try { CuentasPagarBL ObjetoCuenta = new CuentasPagarBL(); foreach (DataGridViewRow Item in dgvPagos.Rows) { cCuentasPagar Cuenta = new cCuentasPagar(); Cuenta.Codigo = -1; Cuenta.CodigoConcepto = Item.Cells[0].Value; Cuenta.ProveedorID = ObtenerProveedor(); Cuenta.CodigoDocumento = Item.Cells[2].Value; Cuenta.CodigoReferencia = Item.Cells[3].Value.ToString(); Cuenta.Notas = Item.Cells[6].Value.ToString(); Cuenta.FechaEmision = Convert.ToDateTime(Item.Cells[4].Value); Cuenta.FechaVencimiento = Convert.ToDateTime(Item.Cells[4].Value); Cuenta.Monto = Convert.ToDecimal(Item.Cells[5].Value.ToString()); Cuenta.Estatus = true; ObjetoCuenta.GuardarCambios(Cuenta); this.Close(); } } catch (Exception Ex) { MessageBox.Show(Ex.Message + " Error al intentar insertar transaccion", "Error al guardar cambios", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnAceptar_Click(object sender, EventArgs e) { try { CuentasPagarBL ObjetoCuenta = new CuentasPagarBL(); ObjetoCuenta.GuardarCambios(ObtenerDatos()); this.Close(); } catch (Exception Ex) { MessageBox.Show(Ex.Message, "Error al guardar cambios", MessageBoxButtons.OK, MessageBoxIcon.Error); MostrarError(Ex.Message); } }