Clarify SAP OData source mapping
This commit is contained in:
@@ -195,7 +195,7 @@
|
|||||||
{
|
{
|
||||||
<MudText Typo="Typo.h6" Class="mb-2">@GetMappingSectionTitle()</MudText>
|
<MudText Typo="Typo.h6" Class="mb-2">@GetMappingSectionTitle()</MudText>
|
||||||
<MudAlert Severity="Severity.Info" Dense="true" Variant="Variant.Outlined" Class="mb-3">
|
<MudAlert Severity="Severity.Info" Dense="true" Variant="Variant.Outlined" Class="mb-3">
|
||||||
Quellen und Feldmappings werden grafisch gepflegt. Bei SAP Gateway sind Quellen Entity Sets; bei HANA sind Quellen Tabellen oder Views im gewaehlten Schema.
|
Quellen und Feldmappings werden grafisch gepflegt. Bei SAP OData sind Quellen Entity Sets; bei HANA sind Quellen Tabellen oder Views im gewaehlten Schema.
|
||||||
</MudAlert>
|
</MudAlert>
|
||||||
@if (IsSapSite())
|
@if (IsSapSite())
|
||||||
{
|
{
|
||||||
@@ -768,7 +768,7 @@
|
|||||||
private bool UsesHanaConnection() => IsHanaSourceSystem(_editingSite.SourceSystem);
|
private bool UsesHanaConnection() => IsHanaSourceSystem(_editingSite.SourceSystem);
|
||||||
|
|
||||||
private string GetMappingSectionTitle()
|
private string GetMappingSectionTitle()
|
||||||
=> IsSapSite() ? "SAP Gateway Mapping" : "HANA Quellen und Feldmapping";
|
=> IsSapSite() ? "SAP OData Mapping" : "HANA Quellen und Feldmapping";
|
||||||
|
|
||||||
private string GetSourceSystemLabel(SourceSystemDefinition definition)
|
private string GetSourceSystemLabel(SourceSystemDefinition definition)
|
||||||
=> string.IsNullOrWhiteSpace(definition.DisplayName) ? definition.Code : $"{definition.DisplayName} ({definition.Code})";
|
=> string.IsNullOrWhiteSpace(definition.DisplayName) ? definition.Code : $"{definition.DisplayName} ({definition.Code})";
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class DatabaseSeedService : IDatabaseSeedService
|
|||||||
EnsureSourceSystemDefinitions(db);
|
EnsureSourceSystemDefinitions(db);
|
||||||
EnsureCentralHanaServerRecords(db);
|
EnsureCentralHanaServerRecords(db);
|
||||||
EnsureSpainManualExcelSite(db);
|
EnsureSpainManualExcelSite(db);
|
||||||
EnsureSapHanaDachSite(db);
|
EnsureSapODataDachSite(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SeedIfEmpty(AppDbContext db)
|
private static void SeedIfEmpty(AppDbContext db)
|
||||||
@@ -173,8 +173,8 @@ public class DatabaseSeedService : IDatabaseSeedService
|
|||||||
{
|
{
|
||||||
var defaults = new[]
|
var defaults = new[]
|
||||||
{
|
{
|
||||||
new SourceSystemDefinition { Code = "SAP", DisplayName = "SAP", ConnectionKind = SourceSystemConnectionKinds.SapGateway, IsActive = true },
|
new SourceSystemDefinition { Code = "SAP", DisplayName = "SAP OData", ConnectionKind = SourceSystemConnectionKinds.SapGateway, IsActive = true },
|
||||||
new SourceSystemDefinition { Code = "SAP_HANA", DisplayName = "SAP HANA", ConnectionKind = SourceSystemConnectionKinds.Hana, IsActive = true },
|
new SourceSystemDefinition { Code = "SAP_HANA", DisplayName = "SAP HANA Tables/Views", ConnectionKind = SourceSystemConnectionKinds.Hana, IsActive = true },
|
||||||
new SourceSystemDefinition { Code = "BI1", DisplayName = "BI1", ConnectionKind = SourceSystemConnectionKinds.Hana, IsActive = true },
|
new SourceSystemDefinition { Code = "BI1", DisplayName = "BI1", ConnectionKind = SourceSystemConnectionKinds.Hana, IsActive = true },
|
||||||
new SourceSystemDefinition { Code = "SAGE", DisplayName = "SAGE", ConnectionKind = SourceSystemConnectionKinds.Hana, IsActive = true },
|
new SourceSystemDefinition { Code = "SAGE", DisplayName = "SAGE", ConnectionKind = SourceSystemConnectionKinds.Hana, IsActive = true },
|
||||||
new SourceSystemDefinition { Code = "MANUAL_EXCEL", DisplayName = "Manual Excel", ConnectionKind = SourceSystemConnectionKinds.ManualExcel, IsActive = true }
|
new SourceSystemDefinition { Code = "MANUAL_EXCEL", DisplayName = "Manual Excel", ConnectionKind = SourceSystemConnectionKinds.ManualExcel, IsActive = true }
|
||||||
@@ -199,6 +199,12 @@ public class DatabaseSeedService : IDatabaseSeedService
|
|||||||
current.DisplayName = item.DisplayName;
|
current.DisplayName = item.DisplayName;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
else if ((current.Code == "SAP" && current.DisplayName == "SAP") ||
|
||||||
|
(current.Code == "SAP_HANA" && current.DisplayName == "SAP HANA"))
|
||||||
|
{
|
||||||
|
current.DisplayName = item.DisplayName;
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(current.ConnectionKind))
|
if (string.IsNullOrWhiteSpace(current.ConnectionKind))
|
||||||
{
|
{
|
||||||
@@ -278,7 +284,7 @@ public class DatabaseSeedService : IDatabaseSeedService
|
|||||||
db.SaveChanges();
|
db.SaveChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void EnsureSapHanaDachSite(AppDbContext db)
|
private static void EnsureSapODataDachSite(AppDbContext db)
|
||||||
{
|
{
|
||||||
if (db.Sites.Count() <= 1)
|
if (db.Sites.Count() <= 1)
|
||||||
return;
|
return;
|
||||||
@@ -306,16 +312,17 @@ public class DatabaseSeedService : IDatabaseSeedService
|
|||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(existing.SourceSystem))
|
if (string.IsNullOrWhiteSpace(existing.SourceSystem) ||
|
||||||
|
string.Equals(existing.SourceSystem, "SAP_HANA", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
existing.SourceSystem = "SAP_HANA";
|
existing.SourceSystem = "SAP";
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changed)
|
if (changed)
|
||||||
db.SaveChanges();
|
db.SaveChanges();
|
||||||
|
|
||||||
EnsureSapHanaDachMapping(db, existing.Id);
|
EnsureSapODataDachMapping(db, existing.Id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,19 +331,33 @@ public class DatabaseSeedService : IDatabaseSeedService
|
|||||||
Schema = string.Empty,
|
Schema = string.Empty,
|
||||||
TSC = "ZSCHWEIZ",
|
TSC = "ZSCHWEIZ",
|
||||||
Land = "Schweiz/Oesterreich",
|
Land = "Schweiz/Oesterreich",
|
||||||
SourceSystem = "SAP_HANA",
|
SourceSystem = "SAP",
|
||||||
IsActive = false
|
IsActive = false
|
||||||
};
|
};
|
||||||
db.Sites.Add(site);
|
db.Sites.Add(site);
|
||||||
db.SaveChanges();
|
db.SaveChanges();
|
||||||
EnsureSapHanaDachMapping(db, site.Id);
|
EnsureSapODataDachMapping(db, site.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void EnsureSapHanaDachMapping(AppDbContext db, int siteId)
|
private static void EnsureSapODataDachMapping(AppDbContext db, int siteId)
|
||||||
{
|
{
|
||||||
if (db.SapSourceDefinitions.Any(x => x.SiteId == siteId) ||
|
var existingSources = db.SapSourceDefinitions.Where(x => x.SiteId == siteId).ToList();
|
||||||
db.SapFieldMappings.Any(x => x.SiteId == siteId))
|
var existingMappings = db.SapFieldMappings.Where(x => x.SiteId == siteId).ToList();
|
||||||
|
|
||||||
|
if (existingSources.Count > 0 || existingMappings.Count > 0)
|
||||||
{
|
{
|
||||||
|
var changed = false;
|
||||||
|
foreach (var source in existingSources.Where(x =>
|
||||||
|
string.Equals(x.Alias, "Z", StringComparison.OrdinalIgnoreCase) &&
|
||||||
|
string.Equals(x.EntitySet, "ZSCHWEIZ", StringComparison.OrdinalIgnoreCase)))
|
||||||
|
{
|
||||||
|
source.EntitySet = "ZSCHWEIZSet";
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed)
|
||||||
|
db.SaveChanges();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,7 +365,7 @@ public class DatabaseSeedService : IDatabaseSeedService
|
|||||||
{
|
{
|
||||||
SiteId = siteId,
|
SiteId = siteId,
|
||||||
Alias = "Z",
|
Alias = "Z",
|
||||||
EntitySet = "ZSCHWEIZ",
|
EntitySet = "ZSCHWEIZSet",
|
||||||
IsPrimary = true,
|
IsPrimary = true,
|
||||||
IsActive = true,
|
IsActive = true,
|
||||||
SortOrder = 0
|
SortOrder = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user