Пример #1
0
        public SectionQueries(IDapperContext dapperContext, IIdentityService identityService, ISystemDateTimeService systemDateTimeService, IUserService userService, IMapper mapper, IGridService gridQueries)
            : base(dapperContext)
        {
            _identityService       = identityService ?? throw new ArgumentNullException(nameof(identityService));
            _systemDateTimeService = systemDateTimeService ?? throw new ArgumentNullException(nameof(systemDateTimeService));
            _userService           = userService ?? throw new ArgumentNullException(nameof(userService));
            _mapper      = mapper ?? throw new ArgumentNullException(nameof(mapper));
            _gridQueries = gridQueries ?? throw new ArgumentNullException(nameof(gridQueries));

            SqlMapper.SetTypeMap(
                typeof(SectionSummaryDto),
                new ColumnAttributeTypeMapper <SectionSummaryDto>());
            SqlMapper.SetTypeMap(
                typeof(PhysicalContractDtoDeprecated),
                new ColumnAttributeTypeMapper <PhysicalContractDtoDeprecated>());
            SqlMapper.SetTypeMap(
                typeof(TradeDto),
                new ColumnAttributeTypeMapper <TradeDto>());
            SqlMapper.SetTypeMap(
                typeof(CostDto),
                new ColumnAttributeTypeMapper <CostDto>());
            SqlMapper.SetTypeMap(
                typeof(SectionDto),
                new ColumnAttributeTypeMapper <SectionDto>());
            SqlMapper.SetTypeMap(
                typeof(TradeCostGenerateMonthEndDto),
                new ColumnAttributeTypeMapper <TradeCostGenerateMonthEndDto>());
            SqlMapper.SetTypeMap(
                typeof(FxDealDetailsGenerateMonthEndDto),
                new ColumnAttributeTypeMapper <FxDealDetailsGenerateMonthEndDto>());
        }
Пример #2
0
 public ManualDocumentMatchingCommandHandler(
     ILogger <ManualDocumentMatchingCommandHandler> logger,
     IIdentityService identityService,
     IMasterDataService masterDataService,
     IUnitOfWork unitOfWork,
     IManualDocumentMatchingRepository manualDocumentMatchingRepository,
     IManualDocumentMatchingQueries manualDocumentMatchingQueries,
     ITransactionDocumentQueries transactionDocumentQueries,
     ITransactionDocumentRepository transactionDocumentRepository,
     ISystemDateTimeService systemDateTimeService,
     IForeignExchangeRateService foreignExchangeRateService,
     IProcessMessageService processMessageService,
     IMapper mapper,
     IAuthorizationService authorizationService)
 {
     _manualDocumentMatchingRepository = manualDocumentMatchingRepository ?? throw new ArgumentNullException(nameof(manualDocumentMatchingRepository));
     _manualDocumentMatchingQueries    = manualDocumentMatchingQueries ?? throw new ArgumentNullException(nameof(manualDocumentMatchingQueries));
     _transactionDocumentQueries       = transactionDocumentQueries ?? throw new ArgumentNullException(nameof(transactionDocumentQueries));
     _transactionDocumentRepository    = transactionDocumentRepository ?? throw new ArgumentNullException(nameof(transactionDocumentRepository));
     _unitOfWork                 = unitOfWork ?? throw new ArgumentNullException(nameof(unitOfWork));
     _logger                     = logger ?? throw new ArgumentNullException(nameof(logger));
     _identityService            = identityService ?? throw new ArgumentNullException(nameof(identityService));
     _mapper                     = mapper ?? throw new ArgumentNullException(nameof(mapper));
     _systemDateTimeService      = systemDateTimeService ?? throw new ArgumentNullException(nameof(systemDateTimeService));
     _masterDataService          = masterDataService;
     _foreignExchangeRateService = foreignExchangeRateService;
     _processMessageService      = processMessageService ?? throw new ArgumentNullException(nameof(processMessageService));
     _authorizationService       = authorizationService ?? throw new ArgumentNullException(nameof(authorizationService));
 }
Пример #3
0
 public AccountingInterfaceQueries(IDapperContext dapperContext, IIdentityService identityService, ISystemDateTimeService systemDateTimeService, IMapper mapper)
     : base(dapperContext)
 {
     _identityService       = identityService ?? throw new ArgumentNullException(nameof(identityService));
     _systemDateTimeService = systemDateTimeService ?? throw new ArgumentNullException(nameof(systemDateTimeService));
     _mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));
 }
Пример #4
0
 public PhysicalDocumentsController(
     ILogger <PhysicalDocumentsController> logger,
     IPhysicalDocumentGenerationService physicalDocumentGenerationService,
     IDocumentRepository documentRepository,
     IIdentityService identityService,
     IPhysicalDocumentStorageService physicalDocumentStorageService,
     IMapper mapper,
     ISystemDateTimeService systemDateTimeService,
     IDocumentQueries documentQueries,
     IApplicationTableService applicationTableQueries,
     IMediator mediator,
     ITagServiceForContractAdvice tagService)
 {
     _logger = logger;
     _physicalDocumentGenerationService = physicalDocumentGenerationService;
     _documentRepository             = documentRepository;
     _identityService                = identityService;
     _physicalDocumentStorageService = physicalDocumentStorageService;
     _mapper = mapper;
     _systemDateTimeService   = systemDateTimeService;
     _documentQueries         = documentQueries;
     _applicationTableQueries = applicationTableQueries;
     _mediator   = mediator;
     _tagService = tagService;
 }
Пример #5
0
 public ContextInformationFilter(IIdentityService identityService, IContextInformation contextInformation, ISystemDateTimeService systemDateTimeService, IDistributedCache distributedCache)
 {
     _identityService       = identityService ?? throw new ArgumentNullException(nameof(identityService));
     _contextInformation    = contextInformation ?? throw new ArgumentNullException(nameof(contextInformation));
     _systemDateTimeService = systemDateTimeService ?? throw new ArgumentNullException(nameof(systemDateTimeService));
     _distributedCache      = distributedCache ?? throw new ArgumentNullException(nameof(distributedCache));
 }
 public CreateAccountingDocumentCommandHandler(
     ILogger <CreateAccountingDocumentCommandHandler> logger,
     IUnitOfWork unitOfWork,
     IIdentityService identityService,
     IMapper mapper,
     IAuthorizationService authorizationService,
     IAccountingDocumentQueries accountingQueries,
     IMasterDataService masterDataService,
     ISystemDateTimeService systemDateTimeService,
     IProcessMessageService processMessageService,
     IAccountingDocumentRepository accountingDocumentRepository,
     IInvoicingRepository documentMatchingRepository,
     IForeignExchangeRateService foreignExchangeRateService)
 {
     _unitOfWork                   = unitOfWork;
     _logger                       = logger;
     _mapper                       = mapper;
     _identityService              = identityService ?? throw new ArgumentNullException(nameof(identityService));
     _authorizationService         = authorizationService ?? throw new ArgumentNullException(nameof(authorizationService));
     _systemDateTimeService        = systemDateTimeService ?? throw new ArgumentNullException(nameof(systemDateTimeService));
     _processMessageService        = processMessageService ?? throw new ArgumentNullException(nameof(processMessageService));
     _accountingQueries            = accountingQueries;
     _masterDataService            = masterDataService;
     _accountingDocumentRepository = accountingDocumentRepository;
     _invoicingRepository          = documentMatchingRepository;
     _foreignExchangeRateService   = foreignExchangeRateService;
 }
Пример #7
0
 public CompaniesController(IUnitOfWork unitOfWork, ICompanyRepository companyRepository, ISystemDateTimeService systemDateTimeService, IRedisConnectionFactory cache)
 {
     _unitOfWork            = unitOfWork;
     _companyRepository     = companyRepository;
     _systemDateTimeService = systemDateTimeService;
     _cache = cache;
 }
 public PhysicalContractCommandsHandler(
     ILogger <PhysicalContractCommandsHandler> logger,
     IUnitOfWork unitOfWork,
     ITradeRepository tradeRepository,
     ISectionRepository sectionRepository,
     ICostRepository costRepository,
     IIdentityService identityService,
     IFreezeRepository freezeRepository,
     ISystemDateTimeService systemDateTimeService,
     IMapper mapper,
     IAuthorizationService authorizationService,
     IProcessMessageService processMessageService,
     IMasterDataService masterDataService,
     IUserService userService,
     ISectionQueries sectionQueries)
 {
     _unitOfWork            = unitOfWork ?? throw new ArgumentNullException(nameof(unitOfWork));
     _tradeRepository       = tradeRepository ?? throw new ArgumentNullException(nameof(tradeRepository));
     _sectionRepository     = sectionRepository ?? throw new ArgumentNullException(nameof(sectionRepository));
     _costRepository        = costRepository ?? throw new ArgumentNullException(nameof(costRepository));
     _logger                = logger ?? throw new ArgumentNullException(nameof(logger));
     _mapper                = mapper ?? throw new ArgumentNullException(nameof(mapper));
     _identityService       = identityService ?? throw new ArgumentNullException(nameof(identityService));
     _systemDateTimeService = systemDateTimeService ?? throw new ArgumentNullException(nameof(systemDateTimeService));
     _authorizationService  = authorizationService ?? throw new ArgumentNullException(nameof(authorizationService));
     _freezeRepository      = freezeRepository ?? throw new ArgumentNullException(nameof(freezeRepository));
     _processMessageService = processMessageService ?? throw new ArgumentNullException(nameof(processMessageService));
     _masterDataService     = masterDataService ?? throw new ArgumentNullException(nameof(masterDataService));
     _userService           = userService ?? throw new ArgumentNullException(nameof(userService));
     _sectionQueries        = sectionQueries ?? throw new ArgumentNullException(nameof(sectionQueries));
 }
Пример #9
0
 public ClientDetailQueries(IDapperContext dapperContext, IIdentityService identityService, ISystemDateTimeService systemDateTimeService, IGridService gridQueries)
     : base(dapperContext)
 {
     _identityService       = identityService ?? throw new ArgumentNullException(nameof(identityService));
     _systemDateTimeService = systemDateTimeService ?? throw new ArgumentNullException(nameof(systemDateTimeService));
     _gridQueries           = gridQueries ?? throw new ArgumentNullException(nameof(gridQueries));
 }
Пример #10
0
 public CostRepository(IDapperContext dapperContext, ISystemDateTimeService systemDateTimeService)
     : base(dapperContext)
 {
     SqlMapper.SetTypeMap(
         typeof(Cost),
         new ColumnAttributeTypeMapper <Cost>());
     _systemDateTimeService = systemDateTimeService ?? throw new ArgumentNullException(nameof(systemDateTimeService));
 }
Пример #11
0
 public CharterQueries(IDapperContext dapperContext, IIdentityService identityService, ISystemDateTimeService systemDateTimeService, IMapper mapper, IGridService gridQueries)
     : base(dapperContext)
 {
     SqlMapper.SetTypeMap(typeof(CharterSummaryDto), new ColumnAttributeTypeMapper <CharterSummaryDto>());
     SqlMapper.SetTypeMap(typeof(CharterDto), new ColumnAttributeTypeMapper <CharterDto>());
     _identityService       = identityService ?? throw new ArgumentNullException(nameof(identityService));
     _systemDateTimeService = systemDateTimeService ?? throw new ArgumentNullException(nameof(systemDateTimeService));
     _mapper      = mapper ?? throw new ArgumentNullException(nameof(mapper));
     _gridQueries = gridQueries ?? throw new ArgumentNullException(nameof(gridQueries));
 }
Пример #12
0
 public TradingListAndSearch(
     IDapperContext dapperContext,
     IIdentityService identityService,
     ISystemDateTimeService systemDateTimeService,
     IUserService userService,
     IMapper mapper,
     IGridService gridQueries,
     IGridViewService gridViewQueries)
     : base(dapperContext, identityService, systemDateTimeService, userService, mapper, gridQueries, gridViewQueries)
 {
 }
Пример #13
0
        public CounterpartyQueries(IDapperContext dapperContext, IIdentityService identityService, ISystemDateTimeService systemDateTimeService, IMapper mapper)
            : base(dapperContext)
        {
            _identityService       = identityService ?? throw new ArgumentNullException(nameof(identityService));
            _systemDateTimeService = systemDateTimeService ?? throw new ArgumentNullException(nameof(systemDateTimeService));
            _mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));

            SqlMapper.SetTypeMap(
                typeof(CounterpartyDto),
                new ColumnAttributeTypeMapper <CounterpartyDto>());
        }
Пример #14
0
 public ReportCommandsHandler(
     ILogger <ReportCommandsHandler> logger,
     IIdentityService identityService,
     IUnitOfWork unitOfWork,
     IReportRepository reportRepository,
     IGridService gridQueries,
     ISystemDateTimeService systemDateTimeService)
 {
     _reportRepository      = reportRepository ?? throw new ArgumentNullException(nameof(reportRepository));
     _unitOfWork            = unitOfWork ?? throw new ArgumentNullException(nameof(unitOfWork));
     _logger                = logger ?? throw new ArgumentNullException(nameof(logger));
     _identityService       = identityService ?? throw new ArgumentNullException(nameof(identityService));
     _gridQueries           = gridQueries ?? throw new ArgumentNullException(nameof(gridQueries));
     _systemDateTimeService = systemDateTimeService ?? throw new ArgumentNullException(nameof(systemDateTimeService));
 }
Пример #15
0
 public PaymentRequestCommandsHandler(
     ILogger <PaymentRequestCommandsHandler> logger,
     IUnitOfWork unitOfWork,
     IPaymentRequestRepository paymentRequestRepository,
     IPaymentRequestService paymentRequestService,
     IProcessMessageService processMessageService,
     ISystemDateTimeService systemDateTimeService,
     IInterfaceEventLogService interfaceEventLogService)
 {
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
     _paymentRequestRepository = paymentRequestRepository ?? throw new ArgumentNullException(nameof(paymentRequestRepository));
     _unitOfWork               = unitOfWork ?? throw new ArgumentNullException(nameof(unitOfWork));
     _paymentRequestService    = paymentRequestService ?? throw new ArgumentNullException(nameof(paymentRequestService));
     _processMessageService    = processMessageService ?? throw new ArgumentNullException(nameof(processMessageService));
     _systemDateTimeService    = systemDateTimeService ?? throw new ArgumentNullException(nameof(systemDateTimeService));
     _interfaceEventLogService = interfaceEventLogService ?? throw new ArgumentNullException(nameof(interfaceEventLogService));
 }
Пример #16
0
 public BaseListAndSearch(
     IDapperContext dapperContext,
     IIdentityService identityService,
     ISystemDateTimeService systemDateTimeService,
     IUserService userService,
     IMapper mapper,
     IGridService gridQueries,
     IGridViewService gridViewQueries)
     : base(dapperContext)
 {
     _identityService       = identityService ?? throw new ArgumentNullException(nameof(identityService));
     _systemDateTimeService = systemDateTimeService ?? throw new ArgumentNullException(nameof(systemDateTimeService));
     _userService           = userService ?? throw new ArgumentNullException(nameof(userService));
     _mapper          = mapper ?? throw new ArgumentNullException(nameof(mapper));
     _gridQueries     = gridQueries ?? throw new ArgumentNullException(nameof(gridQueries));
     _gridViewQueries = gridViewQueries ?? throw new ArgumentNullException(nameof(gridViewQueries));
 }
Пример #17
0
 public DocumentQueries(
     IDapperContext dapperContext,
     IIdentityService identityService,
     ISystemDateTimeService systemDateTimeService,
     IMapper mapper,
     IUserService userService,
     IGridService gridQueries)
     : base(dapperContext)
 {
     SqlMapper.SetTypeMap(
         typeof(ContractAdviceInfoDto),
         new ColumnAttributeTypeMapper <ContractAdviceInfoDto>());
     _identityService       = identityService ?? throw new ArgumentNullException(nameof(identityService));
     _systemDateTimeService = systemDateTimeService ?? throw new ArgumentNullException(nameof(systemDateTimeService));
     _mapper      = mapper ?? throw new ArgumentNullException(nameof(mapper));
     _userService = userService ?? throw new ArgumentNullException(nameof(userService));
     _gridQueries = gridQueries ?? throw new ArgumentNullException(nameof(gridQueries));
 }
Пример #18
0
        public InvoiceQueries(IDapperContext dapperContext, IIdentityService identityService, ISystemDateTimeService systemDateTimeService, IMapper mapper, IUserService userService, IGridService gridQueries)
            : base(dapperContext)
        {
            _identityService       = identityService ?? throw new ArgumentNullException(nameof(identityService));
            _systemDateTimeService = systemDateTimeService ?? throw new ArgumentNullException(nameof(systemDateTimeService));
            _mapper      = mapper ?? throw new ArgumentNullException(nameof(mapper));
            _userService = userService ?? throw new ArgumentNullException(nameof(userService));
            _gridQueries = gridQueries ?? throw new ArgumentNullException(nameof(gridQueries));

            SqlMapper.SetTypeMap(
                typeof(InvoiceDetailsDto),
                new ColumnAttributeTypeMapper <InvoiceDetailsDto>());
            SqlMapper.SetTypeMap(
                typeof(ContractToBeInvoicedSearchResultDto),
                new ColumnAttributeTypeMapper <ContractToBeInvoicedSearchResultDto>());
            SqlMapper.SetTypeMap(
                typeof(InvoiceHomeSearch),
                new ColumnAttributeTypeMapper <InvoiceHomeSearch>());
        }
Пример #19
0
 public DocumentCommandHandlers(
     IPhysicalDocumentGenerationService physicalDocumentGenerationService,
     IPhysicalDocumentStorageService physicalDocumentStorageService,
     IIdentityService identityService,
     ISystemDateTimeService systemDateTimeService,
     IDocumentRepository documentRepository,
     ILogger <DocumentCommandHandlers> logger,
     IAuthorizationService authorizationService,
     IMapper mapper)
 {
     _physicalDocumentGenerationService = physicalDocumentGenerationService;
     _physicalDocumentStorageService    = physicalDocumentStorageService;
     _identityService       = identityService;
     _systemDateTimeService = systemDateTimeService;
     _documentRepository    = documentRepository;
     _logger = logger;
     _authorizationService = authorizationService;
     _mapper = mapper;
 }
Пример #20
0
 public CharterCommandsHandler(
     ILogger <CharterCommandsHandler> logger,
     IIdentityService identityService,
     IUnitOfWork unitOfWork,
     ICharterRepository charterRepository,
     IFreezeRepository freezeRepository,
     ISystemDateTimeService systemDateTimeService,
     IProcessMessageService processMessageService,
     IAuthorizationService authorizationService)
 {
     _charterRepository     = charterRepository ?? throw new ArgumentNullException(nameof(charterRepository));
     _freezeRepository      = freezeRepository ?? throw new ArgumentNullException(nameof(freezeRepository));
     _unitOfWork            = unitOfWork ?? throw new ArgumentNullException(nameof(unitOfWork));
     _logger                = logger ?? throw new ArgumentNullException(nameof(logger));
     _identityService       = identityService ?? throw new ArgumentNullException(nameof(identityService));
     _systemDateTimeService = systemDateTimeService ?? throw new ArgumentNullException(nameof(systemDateTimeService));
     _processMessageService = processMessageService ?? throw new ArgumentNullException(nameof(processMessageService));
     _authorizationService  = authorizationService ?? throw new ArgumentNullException(nameof(authorizationService));
 }
Пример #21
0
 public CounterpartyCommandsHandler(
     ILogger <CounterpartyCommandsHandler> logger,
     IUnitOfWork unitOfWork,
     ICounterpartyRepository counterpartyRepository,
     IIdentityService identityService,
     ISystemDateTimeService systemDateTimeService,
     IMapper mapper,
     IAuthorizationService authorizationService,
     IProcessMessageService processMessageService)
 {
     _unitOfWork             = unitOfWork ?? throw new ArgumentNullException(nameof(unitOfWork));
     _counterpartyRepository = counterpartyRepository ?? throw new ArgumentNullException(nameof(counterpartyRepository));
     _logger                = logger ?? throw new ArgumentNullException(nameof(logger));
     _mapper                = mapper ?? throw new ArgumentNullException(nameof(mapper));
     _identityService       = identityService ?? throw new ArgumentNullException(nameof(identityService));
     _systemDateTimeService = systemDateTimeService ?? throw new ArgumentNullException(nameof(systemDateTimeService));
     _authorizationService  = authorizationService ?? throw new ArgumentNullException(nameof(authorizationService));
     _processMessageService = processMessageService ?? throw new ArgumentNullException(nameof(processMessageService));
 }
 public AccountingInterfaceCommandsHandler(
     ILogger <AccountingInterfaceCommandsHandler> logger,
     IUnitOfWork unitOfWork,
     IAccountingInterfaceRepository accountingInterfaceRepository,
     IESBService esbService,
     ISystemDateTimeService systemDateTimeService,
     IIdentityService identityService,
     IAuthorizationService authorizationService,
     IInterfaceEventLogService interfaceEventLogService)
 {
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
     _accountingInterfaceRepository = accountingInterfaceRepository ?? throw new ArgumentNullException(nameof(accountingInterfaceRepository));
     _unitOfWork               = unitOfWork ?? throw new ArgumentNullException(nameof(unitOfWork));
     _esbService               = esbService ?? throw new ArgumentNullException(nameof(esbService));
     _systemDateTimeService    = systemDateTimeService ?? throw new ArgumentNullException(nameof(systemDateTimeService));
     _identityService          = identityService ?? throw new ArgumentNullException(nameof(identityService));
     _authorizationService     = authorizationService ?? throw new ArgumentNullException(nameof(authorizationService));
     _interfaceEventLogService = interfaceEventLogService ?? throw new ArgumentNullException(nameof(interfaceEventLogService));
 }
 public UpdateFxDealSectionsCommandHandler(
     ILogger <UpdateFxDealSectionsCommandHandler> logger,
     IUnitOfWork unitOfWork,
     IFxDealRepository fxDealRepository,
     IMapper mapper,
     IMasterDataService masterDataService,
     IIdentityService identityService,
     ISystemDateTimeService systemDateTimeService,
     IUserService userService,
     IFxDealQueries fxDealQueries)
 {
     _fxDealRepository      = fxDealRepository ?? throw new ArgumentNullException(nameof(fxDealRepository));
     _unitOfWork            = unitOfWork ?? throw new ArgumentNullException(nameof(unitOfWork));
     _logger                = logger ?? throw new ArgumentNullException(nameof(logger));
     _mapper                = mapper ?? throw new ArgumentNullException(nameof(mapper));
     _masterDataService     = masterDataService ?? throw new ArgumentNullException(nameof(masterDataService));
     _identityService       = identityService ?? throw new ArgumentNullException(nameof(identityService));
     _systemDateTimeService = systemDateTimeService ?? throw new ArgumentNullException(nameof(systemDateTimeService));
     _userService           = userService ?? throw new ArgumentNullException(nameof(userService));
     _fxDealQueries         = fxDealQueries ?? throw new ArgumentNullException(nameof(fxDealQueries));
 }
Пример #24
0
 public CreateFxDealCommandHandler(
     ILogger <CreateFxDealCommandHandler> logger,
     IUnitOfWork unitOfWork,
     IFxDealRepository fxDealRepository,
     IMapper mapper,
     IMasterDataService masterDataService,
     IIdentityService identityService,
     ISystemDateTimeService systemDateTimeService,
     IUserService userService,
     ITransactionDocumentService transactionDocumentService)
 {
     _fxDealRepository           = fxDealRepository ?? throw new ArgumentNullException(nameof(fxDealRepository));
     _unitOfWork                 = unitOfWork ?? throw new ArgumentNullException(nameof(unitOfWork));
     _logger                     = logger ?? throw new ArgumentNullException(nameof(logger));
     _mapper                     = mapper ?? throw new ArgumentNullException(nameof(mapper));
     _masterDataService          = masterDataService ?? throw new ArgumentNullException(nameof(masterDataService));
     _identityService            = identityService ?? throw new ArgumentNullException(nameof(identityService));
     _systemDateTimeService      = systemDateTimeService ?? throw new ArgumentNullException(nameof(systemDateTimeService));
     _userService                = userService ?? throw new ArgumentNullException(nameof(userService));
     _transactionDocumentService = transactionDocumentService ?? throw new ArgumentNullException(nameof(transactionDocumentService));
 }
Пример #25
0
 public AuthorizeForPostingCommandHandler(
     ILogger <AuthorizeForPostingCommandHandler> logger,
     IUnitOfWork unitOfWork,
     IIdentityService identityService,
     IAuthorizationService authorizationService,
     IAccountingDocumentQueries accountingQueries,
     ISystemDateTimeService systemDateTimeService,
     IProcessMessageService processMessageService,
     IAccountingDocumentRepository accountingDocumentRepository,
     IForeignExchangeRateService foreignExchangeRateService)
 {
     _unitOfWork                   = unitOfWork;
     _logger                       = logger;
     _identityService              = identityService ?? throw new ArgumentNullException(nameof(identityService));
     _authorizationService         = authorizationService ?? throw new ArgumentNullException(nameof(authorizationService));
     _systemDateTimeService        = systemDateTimeService ?? throw new ArgumentNullException(nameof(systemDateTimeService));
     _processMessageService        = processMessageService ?? throw new ArgumentNullException(nameof(processMessageService));
     _accountingQueries            = accountingQueries;
     _accountingDocumentRepository = accountingDocumentRepository;
     _foreignExchangeRateService   = foreignExchangeRateService;
 }
Пример #26
0
        internal static async Task ValidatePhysicalContract(CreatePhysicalFixedPricedContractCommand command, IIdentityService identityService, IMasterDataService masterDataService, IUserService userService, ISystemDateTimeService systemDateTimeService)
        {
            // department
            var departments = await masterDataService.GetDepartmentsAsync(command.CompanyId);

            if (!departments.Any(d => d.DepartmentId == command.DepartmentId))
            {
                throw new AtlasBusinessException($"The department {command.DepartmentId} does not belong to the {command.CompanyId} company.");
            }

            // trader
            if (command.TraderId != null)
            {
                var trader = await userService.GetUserByIdAsync(command.TraderId.Value);

                if (trader == null && !command.FieldsConfigurations.FirstOrDefault(field => field?.DisplayName == "TraderId").IsMandatory)
                {
                    throw new NotFoundException("User", command.TraderId);
                }
            }

            // counterparties - buyer and seller
            var counterparties = await masterDataService.GetCounterpartiesAsync(command.CompanyId);

            if (!counterparties.Any(c => c.CounterpartyCode == command.BuyerCode) && command.FieldsConfigurations.FirstOrDefault(field => field?.DisplayName == "BuyerId").IsMandatory)
            {
                throw new AtlasBusinessException($"The buyer {command.BuyerCode} does not belong to the {command.CompanyId} company.");
            }

            if (!counterparties.Any(c => c.CounterpartyCode == command.SellerCode) && command.FieldsConfigurations.FirstOrDefault(field => field?.DisplayName == "SellerId").IsMandatory)
            {
                throw new AtlasBusinessException($"The seller {command.SellerCode} does not belong to the {command.CompanyId} company.");
            }

            // commodity
            var commodities = await masterDataService.GetCommoditiesAsync(command.CompanyId);

            if (!commodities.Any(c => c.CommodityId == command.CommodityId) && command.FieldsConfigurations.FirstOrDefault(field => field?.DisplayName == "CommodityId").IsMandatory)
            {
                throw new AtlasBusinessException($"The commodity {command.CommodityId} does not belong to the {command.CompanyId} company.");
            }

            // quantity code
            var weightUnits = await masterDataService.GetWeightUnitsAsync(command.CompanyId);

            if (!weightUnits.Any(w => w.WeightUnitId == command.WeightUnitId) && command.FieldsConfigurations.DefaultIfEmpty().FirstOrDefault(field => field?.DisplayName == "WeightUnitId").IsMandatory)
            {
                throw new AtlasBusinessException($"The quantity code {command.WeightUnitId} does not belong to the {command.CompanyId} company.");
            }

            // contract term
            var contractTerms = await masterDataService.GetContractTermsAsync(command.CompanyId);

            if (!contractTerms.Any(c => c.ContractTermCode == command.ContractTerms) && command.FieldsConfigurations.FirstOrDefault(field => field?.DisplayName == "ContractTermId").IsMandatory)
            {
                throw new AtlasBusinessException($"The contract term {command.ContractTerms} does not belong to the {command.CompanyId} company.");
            }

            // port term
            var ports = await masterDataService.GetPortsAsync(command.CompanyId);

            if (!ports.Any(p => p.PortCode == command.ContractTermsLocation) && command.FieldsConfigurations.FirstOrDefault(field => field?.DisplayName == "ContractTermLocationId").IsMandatory)
            {
                throw new AtlasBusinessException($"The port term {command.ContractTermsLocation} does not belong to the {command.CompanyId} company.");
            }

            // port of origin
            if (command.PortOfOrigin != null)
            {
                if (!ports.Any(p => p.PortCode == command.PortOfOrigin))
                {
                    throw new AtlasBusinessException($"The port of origin {command.PortOfOrigin} does not belong to the {command.CompanyId} company.");
                }
            }

            // port of destination
            if (command.PortOfDestination != null)
            {
                if (!ports.Any(p => p.PortCode == command.PortOfDestination))
                {
                    throw new AtlasBusinessException($"The port of destination {command.PortOfDestination} does not belong to the {command.CompanyId} company.");
                }
            }

            // arbitration
            if (command.Arbitration != null)
            {
                var arbitrations = await masterDataService.GetArbitrationsAsync(command.CompanyId);

                if (!arbitrations.Any(a => a.ArbitrationCode == command.Arbitration))
                {
                    throw new AtlasBusinessException($"The arbitration {command.Arbitration} does not belong to the {command.CompanyId} company.");
                }
            }

            // currency
            var currencies = await masterDataService.GetCurrenciesAsync();

            if (!currencies.Any(c => c.CurrencyCode == command.CurrencyCode) && command.FieldsConfigurations.FirstOrDefault(field => field?.DisplayName == "CurrencyCode").IsMandatory)
            {
                throw new AtlasBusinessException($"The currency {command.CurrencyCode} does not belong to the {command.CompanyId} company.");
            }

            // price code
            var priceUnits = await masterDataService.GetPriceUnitsAsync(command.CompanyId);

            if (!priceUnits.Any(p => p.PriceUnitId == command.PriceUnitId) && command.FieldsConfigurations.FirstOrDefault(field => field?.DisplayName == "PricingMethodId").IsMandatory)
            {
                throw new AtlasBusinessException($"The price code {command.PriceUnitId} does not belong to the {command.CompanyId} company.");
            }

            // payment term
            var paymentTerms = await masterDataService.GetPaymentTermsAsync(command.CompanyId);

            if (!paymentTerms.Any(p => p.PaymentTermsCode == command.PaymentTerms) && command.FieldsConfigurations.FirstOrDefault(field => field?.DisplayName == "PaymentTermId").IsMandatory)
            {
                throw new AtlasBusinessException($"The payment term {command.PaymentTerms} does not belong to the {command.CompanyId} company.");
            }

            // period type
            var periodTypes = await masterDataService.GetPeriodTypesAsync(command.CompanyId);

            if (!periodTypes.Any(p => p.PeriodTypeId == command.PeriodTypeId) && command.FieldsConfigurations.FirstOrDefault(field => field?.DisplayName == "PeriodTypeId").IsMandatory)
            {
                throw new AtlasBusinessException($"The period type {command.PeriodTypeId} does not belong to the {command.CompanyId} company.");
            }
        }
Пример #27
0
        internal static async Task ValidateFxDeal(FxDeal fxDeal, IIdentityService identityService, IMasterDataService masterDataService, IUserService userService, ISystemDateTimeService systemDateTimeService)
        {
            var departments = await masterDataService.GetDepartmentsAsync(fxDeal.CompanyId);

            if (!departments.Any(d => d.DepartmentId == fxDeal.DepartmentId))
            {
                throw new AtlasBusinessException($"The department {fxDeal.DepartmentId} does not belong to the {fxDeal.CompanyId} company.");
            }

            var trader = await userService.GetUserByIdAsync(fxDeal.TraderId);

            if (trader == null)
            {
                throw new NotFoundException("User", fxDeal.TraderId);
            }

            if (!trader.Permissions.Any(p => p.CompanyId == fxDeal.CompanyId && p.IsTrader))
            {
                throw new AtlasBusinessException($"The user {fxDeal.TraderId} is not configured as a trader for company {fxDeal.CompanyId}.");
            }

            var companyDate = await systemDateTimeService.GetCompanyDate(fxDeal.CompanyId);

            // The date entered in the Contract date field by the user is not in the future.
            if (fxDeal.ContractDate.Date > companyDate.Date)
            {
                throw new AtlasBusinessException($"The contract date cannot be in the future. Company date: {companyDate.Date}");
            }

            // The department code must belong to the list of departments attached to the user’s account.
            var user = await userService.GetUserByIdAsync(identityService.GetUserAtlasId());

            var companyPermissions = user.Permissions
                                     .FirstOrDefault(p => p.CompanyId == fxDeal.CompanyId);

            var userDepartments = companyPermissions.Departments
                                  .Select(department => department.DepartmentId).ToList();

            if (!companyPermissions.AllDepartments && !userDepartments.Contains(fxDeal.DepartmentId))
            {
                throw new AtlasBusinessException($"The department {fxDeal.DepartmentId} does not belong to the list of departments attached to the user’s account.");
            }

            // The FX Deal type must belong to the Deal type master data
            var fxTradeTypes = await masterDataService.GetFxTradeTypes(fxDeal.CompanyId);

            if (!fxTradeTypes.Any(n => n.FxTradeTypeId == fxDeal.FxTradeTypeId))
            {
                throw new AtlasBusinessException($"The FX Deal type {fxDeal.FxTradeTypeId} does not belong to the company {fxDeal.CompanyId}.");
            }

            // Settled amount calculation
            // The value is calculated by multiplying or dividing (depending on M/D field) the “Dealt amount” field’s value by the “Spot ROE” field’s value.
            var settledAmount = fxDeal.Amount * (fxDeal.SpotRateType == "D" ? 1 / fxDeal.SpotRate : fxDeal.SpotRate);

            // TODO: tolerance band on Spot ROE

            // Traded ROE field is the sum of the “Spot ROE” and “FW Points”
            var tradedRoe = fxDeal.SpotRate + fxDeal.FwPoints;

            // The Nominal account (Deal) must belong to the Nominal account master data assigned to the company.
            var nominalAccounts = await masterDataService.GetNominalAccountsAsync(fxDeal.CompanyId);

            if (!nominalAccounts.Any(n => n.NominalAccountId == fxDeal.NominalAccountId))
            {
                throw new AtlasBusinessException($"The Nominal account (Deal) {fxDeal.NominalAccountId} does not belong to the company {fxDeal.CompanyId}.");
            }

            // The Nominal account (Settlement) must belong to the Nominal account master data assigned to the company.
            if (!nominalAccounts.Any(n => n.NominalAccountId == fxDeal.SettlementNominalAccountId))
            {
                throw new AtlasBusinessException($"The Nominal account (Settlement) {fxDeal.NominalAccountId} does not belong to the company {fxDeal.CompanyId}.");
            }

            // The Bank/broker” must belong to the the list of counterparties assigned to the company and having the value “Bank” in “Account type” field
            var counterparties = await masterDataService.GetCounterpartiesAsync(fxDeal.CompanyId);

            if (!counterparties.Any(c => c.CounterpartyID == fxDeal.CounterpartyId))
            {
                throw new AtlasBusinessException($"The counterparty {fxDeal.CounterpartyId} does not belong to the company {fxDeal.CounterpartyId}.");
            }
        }