private void ReceivePayments(ListInvoiceItemsViewModel invoiceItem) { if (!CanReceivePayments) { MessageBox.Show("Sorry, you do not have sufficient rights to perform this action.", "Distributr: Payments Module", MessageBoxButton.OK); return; } else { if (invoiceItem.HasUnconfirmedPayment) { MessageBox.Show("NOTE: \nThere are unconfirmed payments for this invoice.", "Distributr: Payments Module", MessageBoxButton.OK); } Submitpayments(invoiceItem); } }
void Submitpayments(ListInvoiceItemsViewModel invoiceItem) { PaymentInfoList.Clear(); try { using (var container = NestedContainer) { BasicConfig config = container.GetInstance<IConfigService>().Load(); var payInfo = Using<IPaymentPopup>(container).GetPayments(invoiceItem.AmountDue, invoiceItem.InvoiceOrderId); foreach (var paymentInfo in payInfo) { if (!PaymentInfoList.Contains(paymentInfo)) PaymentInfoList.Add(paymentInfo); } var order = Using<IMainOrderRepository>(container).GetById(invoiceItem.InvoiceOrderId); var posWorkflow = Using<IOrderPosWorkflow>(container); if (order != null) { foreach (var paymentInfo in PaymentInfoList.Where(p => p.PaymentModeUsed != PaymentMode.Credit)) { paymentInfo.InvoiceId = invoiceItem.Id; order.AddPayment(paymentInfo); } posWorkflow.Submit(order,config); RunLoadInvoices(); } } } catch (Exception ex) { throw ex; } }
private void ViewSelectedInvoice(ListInvoiceItemsViewModel selectedItem) { const string uri = "/views/invoicedocument/invoicedocument.xaml"; Messenger.Default.Send<ViewModelMessage>(new ViewModelMessage { Id = selectedItem.InvoiceOrderId }); NavigateCommand.Execute(uri); }