public CreditTransactionPageViewModel() { _FillListCreditTransaction(); _openListItem = new Command(x => { try { if (CurrentItem != null) { CreditTransactionViewModel vm; using (var service = ServiceClientProvider.GetCreditTransaction()) { var transaction = service.GetCreditTransaction(CurrentItem.Id); using (var printeService = ServiceClientProvider.GetPrintedDocument()) { var response = printeService.GetPrintedList(DocumentType.CreditTransaction); var lst = response.Select(p => new PrintItem() { Name = p.Name, Type = DocumentType.CreditTransaction, Document = transaction }); var responseInfo = service.GetCreditTransactionInfo(); vm = new CreditTransactionViewModel(transaction, lst, responseInfo.Creditors, responseInfo.Requisits); } CreditTransactionView CreditTransactionView = new CreditTransactionView(vm); CreditTransactionView.ShowDialog(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Не удалось открыть сделку"); } }); }
private void _FillListCreditTransaction() { try { using (var service = ServiceClientProvider.GetCreditTransaction()) { var response = service.GetCreditTransactions(); var lst = response .Select(x => new CreditTransactionListItemViewModel() { Id = x.Id, DocumentBuyerId = x.DocumentBuyerId, DocumentSellerId = x.DocumentSellerId, PtsId = x.PtsId, BuyerFullName = x.BuyerFullName, Date = x.Date.ToString(AimpDataFormats.DateFormat), TrancportFullName = x.TrancportFullName, Number = x.Number, NumberProxy = x.NumberProxy, SellerFullName = x.SellerFullName, PhotoSellerId = x.PhotoSellerId, PhotoBuyerId = x.PhotoBuyerId, DkpId = x.DkpId, AdId = x.AdId }); List = new ObservableCollection <CreditTransactionListItemViewModel>(lst); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Не удалось получить список"); } }