public void InsertReportColumnMapping(ReportColumnMapping value)
        {
            using (var scope = _reportColumnMappingRepository.CreateTransaction())
            {
                _reportColumnMappingRepository.Add(value, scope);
                scope.Commit();
            }

            // reload mappings
            _columnProviderCacheService.ClearMappings(value.DataSourceTypeId, value.OrganizationId);
            _reportColumnMappingQueryService.GetReportColumnMappingsByOrganizationId(value.DataSourceTypeId, value.OrganizationId); // to ensure that all columns are reloaded
        }
Exemple #2
0
        public void UpdateReportColumnMapping(ReportColumnMapping value)
        {
            value.CalculatedValues.Clear();

            using (var scope = _reportColumnMappingRepository.CreateTransaction())
            {
                var entity = _reportColumnMappingRepository.GetReportColumnMapping(value.Id);

                entity.ActionSpecId           = value.ActionSpecId;
                entity.CanGroupBy             = value.CanGroupBy;
                entity.DataSourceTypeId       = value.DataSourceTypeId;
                entity.DbType                 = value.DbType;
                entity.DisplayName            = value.DisplayName;
                entity.FieldAggregationMethod = value.FieldAggregationMethod;
                entity.FieldName              = value.FieldName;
                entity.IsCalculated           = value.IsCalculated;
                entity.IsPrivate              = value.IsPrivate;
                entity.KnownTable             = value.KnownTable;
                entity.LifetimeFieldName      = value.LifetimeFieldName;
                entity.MainCategory           = value.MainCategory;
                entity.OrganizationId         = value.OrganizationId;
                entity.Selectable             = value.Selectable;
                entity.SubCategory            = value.SubCategory;
                entity.UniqueName             = value.UniqueName;

                UpdateMetaData(entity, value);

                _reportColumnMappingRepository.Update(entity, scope);

                scope.Commit();
            }

            // reload mappings
            _columnProviderCacheService.ClearMappings(value.DataSourceTypeId, value.OrganizationId);
            _reportColumnMappingQueryService.GetReportColumnMappingsByOrganizationId(value.DataSourceTypeId, value.OrganizationId); // to ensure that all columns are reloaded
        }
 public override void ClearCache(int dataSourceTypeId)
 {
     _columnProviderCacheService.ClearMappings(dataSourceTypeId, organizationId: null);
 }