private void AgregarCantidad() { var nfi = new NumberFormatInfo { NumberDecimalSeparator = ".", NumberGroupSeparator = "," }; if (decimal.TryParse(txtMonto.Text, out decimal resultMonto)) { MontoPagos montoPagos = new MontoPagos(); montoPagos.Monto = resultMonto; montoPagos.Fecha = DateTime.Now; if (resultMonto <= _amount && resultMonto > 0) { if (resultMonto <= _amount - _amountPagado) { StaticParameters.MontoCobrar = montoPagos; DialogResult = true; } else { CustomMessageBox.Show($"Deuda total: S/.{_amount.ToString("#,##0.00", nfi)} \nDeuda cancelada: S/.{_amountPagado.ToString("#,##0.00", nfi)} \nDeuda por cancelar S/.{(_amount - _amountPagado).ToString("#,##0.00", nfi)}", CustomMessageBox.CMessageBoxTitle.Advertencia, CustomMessageBox.CMessageBoxButton.Aceptar, CustomMessageBox.CMessageBoxButton.Cancelar); } } else { CustomMessageBox.Show($"Deuda total: S/.{_amount.ToString("#,##0.00", nfi)} \nDeuda cancelada: S/.{_amountPagado.ToString("#,##0.00", nfi)} \nDeuda por cancelar S/.{(_amount - _amountPagado).ToString("#,##0.00", nfi)}", CustomMessageBox.CMessageBoxTitle.Advertencia, CustomMessageBox.CMessageBoxButton.Aceptar, CustomMessageBox.CMessageBoxButton.Cancelar); } } else { CustomMessageBox.Show($"Deuda total: S/.{_amount.ToString("#,##0.00", nfi)} \nDeuda cancelada: S/.{_amountPagado.ToString("#,##0.00", nfi)} \nDeuda por cancelar S/.{(_amount - _amountPagado).ToString("#,##0.00", nfi)}", CustomMessageBox.CMessageBoxTitle.Advertencia, CustomMessageBox.CMessageBoxButton.Aceptar, CustomMessageBox.CMessageBoxButton.Cancelar); } }
private void btnDeletePago_Click(object sender, RoutedEventArgs e) { MontoPagos montoSelected = (MontoPagos)dtgMontosPagos.SelectedItem; if (montoSelected != null) { _montosPagos.Remove(montoSelected); UpdateTotal(); btnDeletePago.IsEnabled = false; } }