public FinanceOperationViewModel(FinanceOperation source, bool isMaster) { Id = source.CommentId; ClaimId = source.ClaimId; ProjectId = source.ProjectId; Money = source.MoneyAmount; LinkedClaimId = source.LinkedClaimId; LinkedClaimName = LinkedClaimId.HasValue ? source.LinkedClaim.Name : ""; LinkedClaimUser = source.LinkedClaim?.Player; OperationType = (FinanceOperationTypeViewModel)source.OperationType; OperationState = (FinanceOperationStateViewModel)source.State; RowCssClass = source.State.ToRowClass(); Date = source.OperationDate.ToShortDateString(); ShowLinkedClaimLinkIfTransfer = isMaster; Title = OperationType.GetDescription() ?? ""; if (string.IsNullOrWhiteSpace(Title)) { Title = OperationType.GetDisplayName(); } else { Title = string.Format( Title, OperationType.GetDisplayName(), source.PaymentType?.GetDisplayName()); } switch (OperationType) { case FinanceOperationTypeViewModel.Submit when source.Approved: case FinanceOperationTypeViewModel.Submit when source.State == FinanceOperationState.Proposed: Description = OperationState.GetDisplayName(); break; case FinanceOperationTypeViewModel.Online when source.Approved: Description = OperationState.GetShortNameOrDefault() ?? ""; break; case FinanceOperationTypeViewModel.Online when source.State == FinanceOperationState.Invalid: Description = OperationState.GetDisplayName(); break; case FinanceOperationTypeViewModel.Online when source.State == FinanceOperationState.Proposed: CheckPaymentState = true; break; } }