Esempio n. 1
0
        public override ReportColumnMapping CreateColumnMapping(int dataSourceId, ReportColumnMapping columnMapping, IReportColumnMappingValidator columnValidator)
        {
            if (!columnValidator.FieldNameIsValid(columnMapping.FieldName))
            {
                throw new Exception("Column FieldName is invalid");
            }

            columnMapping.DataSourceTypeId = dataSourceId;
            _reportColumnMappingCreationService.InsertReportColumnMapping(columnMapping);
            return(_reportColumnMappingQueryService.GetReportColumnMappingsById(dataSourceId, new[] { columnMapping.Id }).FirstOrDefault());
        }
Esempio n. 2
0
        public override ReportColumnMapping UpdateColumnMapping(int dataSourceId, int columnId, ReportColumnMapping columnMapping, IReportColumnMappingValidator columnValidator)
        {
            if (columnMapping.Id != columnId)
            {
                throw new Exception("Column ID does not match");
            }

            if (!columnValidator.FieldNameIsValid(columnMapping.FieldName))
            {
                throw new Exception("Column FieldName is invalid");
            }

            _reportColumnMappingUpdaterService.UpdateReportColumnMapping(columnMapping);

            return(_reportColumnMappingQueryService.GetReportColumnMappingsById(dataSourceId, new[] { columnId }).FirstOrDefault());
        }