public MoneyInfoForUserViewModel(Project project,
                                         IReadOnlyCollection <MoneyTransfer> transfers,
                                         User master,
                                         IUriService urlHelper,
                                         IReadOnlyCollection <FinanceOperation> operations,
                                         PaymentTypeSummaryViewModel[] payments,
                                         int currentUserId)
        {
            Transfers = transfers
                        .OrderBy(f => f.Id)
                        .Select(f => new MoneyTransferListItemViewModel(f, currentUserId)).ToArray();
            ProjectId   = project.ProjectId;
            UserDetails = new UserProfileDetailsViewModel(master, AccessReason.CoMaster);

            Operations = new FinOperationListViewModel(project, urlHelper, operations);

            Balance = new MasterBalanceViewModel(master, project.ProjectId, operations, transfers);

            PaymentTypeSummary = payments;
        }
Пример #2
0
        public MoneyInfoTotalViewModel(Project project,
                                       IReadOnlyCollection <MoneyTransfer> transfers,
                                       IUriService urlHelper,
                                       IReadOnlyCollection <FinanceOperation> operations,
                                       PaymentTypeSummaryViewModel[] payments,
                                       int currentUserId)
        {
            var masters = operations.Select(fo => fo.PaymentType?.User)
                          .Union(transfers.Select(mt => mt.Receiver))
                          .Union(transfers.Select(mt => mt.Sender))
                          .Distinct();

            ProjectId = project.ProjectId;

            Operations = new FinOperationListViewModel(project, urlHelper, operations);

            Balance = MasterBalanceBuilder.ToMasterBalanceViewModels(operations, transfers, project.ProjectId);

            Transfers = transfers.Select(transfer =>
                                         new MoneyTransferListItemViewModel(transfer, currentUserId)).ToArray();

            PaymentTypeSummary = payments;
        }