Ejemplo n.º 1
0
        public TipoCambioAppService(IRepository <TipoCambio, int> repository, ITCManager tcManager) : base(repository)
        {
            _tcManager        = tcManager;
            GetListPolicyName = ContaPermissions.Cotizacion.Default;
            GetPolicyName     = ContaPermissions.Cotizacion.Default;

            CreatePolicyName = ContaPermissions.Cotizacion.CreateEdit;
            UpdatePolicyName = ContaPermissions.Cotizacion.CreateEdit;
            DeletePolicyName = ContaPermissions.Cotizacion.Delete;
        }
 public CommandHandler(IDataProtector protector,
                       ICosmosManager cosmosManager,
                       ISecretManager secretManager,
                       ITokenManager tokenManager,
                       ITCManager tcDataManager)
 {
     _protector     = protector;
     _cosmosManager = cosmosManager;
     _secretManager = secretManager;
     _tokenManager  = tokenManager;
     _tcDataManager = tcDataManager;
 }
        public CommandController(
            IConfiguration configuration,
            IHttpClientFactory factory,
            IDataProtectionProvider provider,
            ISecretManager secretManager,
            ICosmosManager cosmosManager,
            ITokenManager tokenManager,
            ITCManager dataManager
            )
        {
#pragma warning disable CA2208 // Instantiate argument exceptions correctly
            if (provider is null)
            {
                var message = "IDataProtectionProvider";
                throw new ArgumentNullException(message);
            }

            if (factory is null)
            {
                throw new ArgumentNullException("IHttpClientFactory");
            }

            if (secretManager is null)
            {
                throw new ArgumentNullException("ISecretManager");
            }
#pragma warning restore CA2208 // Instantiate argument exceptions correctly

            _configuration = configuration;
            _protector     = provider.CreateProtector("UUIDProtector");
            _secretManager = secretManager;
            _cosmosManager = cosmosManager;
            _httpClient    = factory.CreateClient("BotClient");
            _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", _secretManager.GetSecret("Slack-SlackbotOAuthAccessToken"));
            _tokenManager  = tokenManager;
            _tcDataManager = dataManager;

            _commandHandler = new CommandHandler(_protector, _cosmosManager, _secretManager, _tokenManager, _tcDataManager);
        }
        public ModalController(
            IConfiguration configuration,
            IHttpClientFactory factory,
            IDataProtectionProvider provider,
            ISecretManager secretManager,
            ICosmosManager cosmosManager,
            ITokenManager tokenManager,
            ITCManager dataManager
            )
        {
#pragma warning disable CA2208 // Instantiate argument exceptions correctly
            if (provider is null)
            {
                var message = "IDataProtectionProvider";
                throw new ArgumentNullException(message);
            }

            if (factory is null)
            {
                throw new ArgumentNullException("IHttpClientFactory");
            }

            if (secretManager is null)
            {
                throw new ArgumentNullException("ISecretManager");
            }
#pragma warning restore CA2208 // Instantiate argument exceptions correctly

            _configuration = configuration;
            _protector     = provider.CreateProtector("UUIDProtector");
            _secretManager = secretManager;
            _cosmosManager = cosmosManager;
            _httpClient    = factory.CreateClient("BotClient");
            _tokenManager  = tokenManager;
            _tcDataManager = dataManager;

            _commandHandler = new CommandHandler(_protector, _cosmosManager, _secretManager, _tokenManager, _tcDataManager);
        }