public AddEditPaymentModal(Model.Payment paymentToUpdate, PaymentType paymentType, PaymentControl paymentControl, Model.Bank bank) { this.InitializeComponent(); _bank = bank; _paymentControl = paymentControl; _paymentType = paymentType; _paymentToUpdate = paymentToUpdate; _isUpdatePayment = _paymentToUpdate != null; FillBanks(); AdjustWindowForPaymentType(); if (_isUpdatePayment) { PrepareWindowForUpdates(); } this.Title += " (" + paymentType.ToString() + ")"; }
private void FillPayments() { List<Model.Payment> payments = _statement.Payments .OrderByDescending(p => p.PaymentDate) .ToList(); foreach (var payment in payments) { PaymentControl paymentControl = new PaymentControl(payment, null) { Width = Double.NaN }; spPayments.Children.Add(paymentControl); } }
private void btnAddPayment_Click(object sender, System.Windows.RoutedEventArgs e) { if (_selectedPatient == null) { MessageBox.Show("Seleccione un paciente", "Información", MessageBoxButton.OK, MessageBoxImage.Information); } else { PaymentControl paymentControl = new PaymentControl(); paymentControl.OnPaymentDeleted += paymentControl_OnPaymentDeleted; paymentControl.OnPaymentEdited += paymentControl_OnPaymentEdited; new AddEditPaymentModal(null, (Controllers.PaymentType)Enum.Parse(typeof(Controllers.PaymentType), (sender as Button).Tag.ToString(), true), paymentControl, null).ShowDialog(); if (paymentControl.Payment != null) { spPayments.Children.Insert(0, paymentControl); UpdateTotals(); CheckIfTransactionCanBeFinished(); } } }
private void UpdatePositiveBalances() { RemoveAllPositiveBalances(); if (_selectedPatient != null) { List<Model.PositiveBalance> activePositiveBalances = _selectedPatient.PositiveBalances .Where(pb => pb.AppliedDate == null) .ToList(); foreach (var item in activePositiveBalances) { Model.Payment paymentToAdd = new Model.Payment() { PaymentDate = DateTime.Now, Amount = item.Amount, Type = PaymentType.Efectivo.ToString(), Observation = "Saldo a favor" }; PaymentControl paymentControl = new PaymentControl(paymentToAdd, item) { Width = Double.NaN }; spPayments.Children.Add(paymentControl); } } }