Beispiel #1
0
        protected void MultiInsertCell(string schemaName, IEnumerable <Cell> cells)
        {
            var insert = new Insert(UserConnection).Into(schemaName);

            foreach (var cell in cells)
            {
                if (!SafeValidateArguments(cell))
                {
                    continue;
                }

                if (ForecastSheet.CheckForecastValueExceedMaxSize(UserConnection, cell.Value))
                {
                    LogForecastValueExceedMaxSizeWarning(cell);
                    cell.Value = 0;
                }
                insert.Values()
                .Set($"{PeriodColumnName}Id", Column.Parameter(cell.PeriodId))
                .Set($"{ForecastColumnName}Id", Column.Parameter(cell.ColumnId))
                .Set($"{SheetColumnName}Id", Column.Parameter(ForecastSheet.Id))
                .Set($"{EntityColumnName}Id", Column.Parameter(cell.EntityId))
                .Set($"{RowColumnName}Id", Column.Parameter(cell.RowId))
                .Set(ValueColumnName, Column.Parameter(cell.Value));
            }
            if (insert.ColumnValues.IsNotEmpty())
            {
                insert.Execute();
            }
        }
        private string GetEntityInCellColumnPath(ColumnSettingsData settings)
        {
            var refColumn = ForecastSheet.GetEntityReferenceColumn(UserConnection);

            if (refColumn == null)
            {
                string message = $"Reference column by schema name {ReferenceSchemaName} not found.";
                _log.Error(message);
                throw new ItemNotFoundException(message);
            }
            var    referenceParts = GetReferenceParts(settings.ReferenceColumnName);
            string columnPath     = $"{referenceParts.EntityPath}" +
                                    $"=[{EntityForecastSchema.Name}:{refColumn.Name}:{referenceParts.ColumnPath}]";

            return(columnPath);
        }
Beispiel #3
0
 private string GetEntityColumnName()
 {
     return(ForecastSheet.GetEntityReferenceColumn(UserConnection)?.Name);
 }