Example #1
0
        protected override void OnAddInvoiceLine(object obj)
        {
            if (PaymentNotice == null)
            {
                MessageAlert("请选择一条付款通知记录!");
                return;
            }

            selectInvoicesWindow = new SelectInvoices();
            selectInvoicesWindow.ViewModel.InitData(PaymentNotice);
            selectInvoicesWindow.ShowDialog();

            //var maintainInvoiceLine = new PaymentNoticeLineDTO
            //{
            //    PaymentNoticeLineId = RandomHelper.Next(),
            //};

            //PaymentNotice.PaymentNoticeLines.Add(maintainInvoiceLine);
        }
Example #2
-1
        public SelectInvoicesVm(SelectInvoices selectInvoicesWindow, IPaymentService service)
            : base(service)
        {
            SelectInvoicesWindow = selectInvoicesWindow;
            CommitCommand = new DelegateCommand<object>(OnCommitExecute, CanCommitExecute);
            CancelCommand = new DelegateCommand<object>(OnCancelExecute, CanCancelExecute);
            Suppliers = new QueryableDataServiceCollectionView<SupplierDTO>(service.Context, service.Context.Suppliers);
            Currencies = new QueryableDataServiceCollectionView<CurrencyDTO>(service.Context, service.Context.Currencies);
            _supplierFilter = new FilterDescriptor("SupplierId", FilterOperator.IsEqualTo, 0);
            #region 发票
            Invoices = new QueryableDataServiceCollectionView<BaseInvoiceDTO>(service.Context, service.Context.Invoices);
            Invoices.FilterDescriptors.Add(_supplierFilter);
            Invoices.LoadedData += (e, o) =>
            {
                InvoiceList = new ObservableCollection<BaseInvoiceDTO>();
                Invoices.ToList().ForEach(InvoiceList.Add);

                SelectInvoices = new ObservableCollection<BaseInvoiceDTO>();
                if (!InvoiceList.Any()) return;
                _paymentNotice.PaymentNoticeLines.ToList().ForEach(p =>
                {
                    if (InvoiceList.Any(t => t.InvoiceId == p.InvoiceId))
                        SelectInvoices.Add(InvoiceList.FirstOrDefault(t => t.InvoiceId == p.InvoiceId));
                });
            };
            #endregion
        }