public async Task <ICustomerChecksInfo> DeleteAsync(string clientId)
        {
            var partitionKey = CustomerChecksInfoEntity.GeneratePartitionKey(clientId);
            var rowKey       = CustomerChecksInfoEntity.GenerateRowKey(clientId);

            return(await _tableStorage.DeleteAsync(partitionKey, rowKey));
        }
Beispiel #2
0
        public static CustomerChecksInfoEntity Create(string clientId, bool?pep, bool?crime, bool?sanction)
        {
            var entity = new CustomerChecksInfoEntity
            {
                PartitionKey = GeneratePartitionKey(clientId),
                RowKey       = GenerateRowKey(clientId),
            };

            if (pep != null)
            {
                entity.IsPepCheckRequired = pep.Value;
                entity.MarkValueTypePropertyAsDirty(nameof(IsPepCheckRequired));
            }

            if (crime != null)
            {
                entity.IsCrimeCheckRequired = crime.Value;
                entity.MarkValueTypePropertyAsDirty(nameof(IsCrimeCheckRequired));
            }

            if (sanction != null)
            {
                entity.IsSanctionCheckRequired = sanction.Value;
                entity.MarkValueTypePropertyAsDirty(nameof(IsSanctionCheckRequired));
            }

            return(entity);
        }
        public async Task <IEnumerable <ICustomerChecksInfo> > GetBatch(int count, string separatingClientId = null)
        {
            if (separatingClientId == null)
            {
                return(await _tableStorage.WhereAsync(new TableQuery <CustomerChecksInfoEntity>().Take(count)));
            }

            var partitionKey = CustomerChecksInfoEntity.GeneratePartitionKey(separatingClientId);
            var rowKey       = CustomerChecksInfoEntity.GenerateRowKey(separatingClientId);

            var query = new TableQuery <CustomerChecksInfoEntity>()
                        .Where(TableQuery.CombineFilters(
                                   TableQuery.GenerateFilterCondition(
                                       nameof(ITableEntity.PartitionKey),
                                       QueryComparisons.GreaterThanOrEqual,
                                       partitionKey),
                                   TableOperators.And,
                                   TableQuery.GenerateFilterCondition(
                                       nameof(ITableEntity.RowKey),
                                       QueryComparisons.GreaterThan,
                                       rowKey)
                                   )).Take(count);

            return(await _tableStorage.WhereAsync(query));
        }
        public async Task <ICustomerChecksInfo> UpdateCheckIdsAsync(string clientId, string pepCheckId = null, string crimeCheckId = null, string sanctionCheckId = null)
        {
            var entity = CustomerChecksInfoEntity.Create(clientId, pepCheckId, crimeCheckId, sanctionCheckId);
            await _tableStorage.InsertOrMergeAsync(entity);

            return(entity);
        }
        public async Task <ICustomerChecksInfo> UpdateCheckStatesAsync(string clientId, bool?pep = null, bool?crime = null, bool?sanction = null)
        {
            var entity = CustomerChecksInfoEntity.Create(clientId, pep, crime, sanction);
            await _tableStorage.InsertOrMergeAsync(entity);

            return(entity);
        }
        public async Task <ICustomerChecksInfo> AddAsync(ICustomerChecksInfo entity)
        {
            var newEntity = CustomerChecksInfoEntity.Create(entity);
            await _tableStorage.InsertOrReplaceAsync(newEntity);

            return(newEntity);
        }
Beispiel #7
0
        public static CustomerChecksInfoEntity Create(ICustomerChecksInfo src)
        {
            var entity = new CustomerChecksInfoEntity
            {
                PartitionKey = GeneratePartitionKey(src.CustomerId),
                RowKey       = GenerateRowKey(src.CustomerId),

                LatestPepCheckId      = src.LatestPepCheckId,
                LatestCrimeCheckId    = src.LatestCrimeCheckId,
                LatestSanctionCheckId = src.LatestSanctionCheckId,

                IsPepCheckRequired      = src.IsPepCheckRequired,
                IsCrimeCheckRequired    = src.IsCrimeCheckRequired,
                IsSanctionCheckRequired = src.IsSanctionCheckRequired
            };

            entity.MarkValueTypePropertyAsDirty(nameof(IsPepCheckRequired));
            entity.MarkValueTypePropertyAsDirty(nameof(IsCrimeCheckRequired));
            entity.MarkValueTypePropertyAsDirty(nameof(IsSanctionCheckRequired));

            return(entity);
        }