public async Task <IndicatorEntity> GetLastIndicatorFromTable(string idUser)
        {
            var cloudTable = await _tableStorage.GetTableReference(_indicatorsTable);

            TableQuery <IndicatorEntity> query = new TableQuery <IndicatorEntity>()
                                                 .Where(TableQuery.GenerateFilterCondition("IdUser", QueryComparisons.Equal, idUser));
            TableContinuationToken tableContinuationToken = new TableContinuationToken();
            var result = await cloudTable.ExecuteQuerySegmentedAsync(query, tableContinuationToken);

            List <IndicatorEntity> entityList     = result.Results.ToList();
            IndicatorEntity        lastIndicators = entityList.OrderByDescending(x => x.IndicatorsModelData.ChangeDate).FirstOrDefault();

            return(lastIndicators);
        }
Exemplo n.º 2
0
        public ExportExcelFeatureDetailRp(IndicatorEntity indicator)
        {
            FeatureEntity feature = indicator.Feature;

            this.FeatureId = feature.Id.Value;
            this.SourceId  = indicator.SourceId;
            this.Feature   = feature.Name;
            this.Source    = indicator.Source.Name;
            var measure = indicator.Source.Measure();

            this.Availability = measure.Availability;
            this.Experience   = measure.Experience;
            this.Latency      = measure.Latency;
        }
        public async Task InsertIndicatorsIntoTable(IndicatorModel model)
        {
            var table = await _tableStorage.GetTableReference(_indicatorsTable);

            var entity = new IndicatorEntity()
            {
                PartitionKey        = Guid.NewGuid().ToString(),
                RowKey              = new Guid().ToString(),
                IndicatorsModelData = model
            };

            var tableOperation = TableOperation.InsertOrMerge(entity);
            await table.ExecuteAsync(tableOperation);
        }