aktueller stand

This commit is contained in:
Meik
2026-01-28 12:24:39 +01:00
parent 8b7c4ce480
commit 82984f769b
48 changed files with 1122 additions and 495 deletions

View File

@@ -46,21 +46,21 @@ namespace C4IT.DataHistoryProvider
public abstract class cDataHistoryCollectorModule
{
public cDataHistoryCollector Collector { get; protected set; }
public readonly List<eDataHistoryOrigin> Origins;
public readonly List<enumDataHistoryOrigin> Origins;
public readonly string Name = "";
public readonly Guid LicenseId = Guid.Empty;
public cDataHistoryCollectorModule(cDataHistoryCollector Collector, eDataHistoryOrigin Origin, string Name, string LicenseId)
public cDataHistoryCollectorModule(cDataHistoryCollector Collector, enumDataHistoryOrigin Origin, string Name, string LicenseId)
{
this.Name = Name;
Guid.TryParse(LicenseId, out this.LicenseId);
this.Collector = Collector;
this.Origins = new List<eDataHistoryOrigin>() { Origin };
this.Origins = new List<enumDataHistoryOrigin>() { Origin };
}
public cDataHistoryCollectorModule(cDataHistoryCollector Collector, List<eDataHistoryOrigin> Origin, string Name, string LicenseId)
public cDataHistoryCollectorModule(cDataHistoryCollector Collector, List<enumDataHistoryOrigin> Origin, string Name, string LicenseId)
{
this.Name = Name;
Guid.TryParse(LicenseId, out this.LicenseId);
@@ -251,7 +251,7 @@ namespace C4IT.DataHistoryProvider
private DateTime GlobalParametersConfigTimestamp = DateTime.MinValue;
private object GlobalParametersConfigLock = new object();
public readonly Dictionary<eDataHistoryOrigin, cDataHistoryCollectorModule> Connectors = new Dictionary<eDataHistoryOrigin, cDataHistoryCollectorModule>();
public readonly Dictionary<enumDataHistoryOrigin, cDataHistoryCollectorModule> Connectors = new Dictionary<enumDataHistoryOrigin, cDataHistoryCollectorModule>();
public readonly cDataHistoryCollectorActiveDirectory ActiveDirectory = null;
public readonly cDataHistoryCollectorClientAgent F4sdAgent = null;
public cDataHistoryCollectorM42Wpm M42WpmCollector { get; private set; } = null;
@@ -303,14 +303,14 @@ namespace C4IT.DataHistoryProvider
public cDataHistoryConfigSqlConnection mainDbConnection { get; private set; } = null;
public cDataHistoryCollector(bool autoConnectionCheck, cF4sdWebRequestInfo requestInfo, int LogDeep) : base(null, eDataHistoryOrigin.Main, constConnectorName, constLicenseId)
public cDataHistoryCollector(bool autoConnectionCheck, cF4sdWebRequestInfo requestInfo, int LogDeep) : base(null, enumDataHistoryOrigin.Main, constConnectorName, constLicenseId)
{
this.Collector = this;
this.autoConnectionCheck = autoConnectionCheck;
TokenCache = new cDataHistoryCollectorTokenCache(this, requestInfo, LogDeep + 1);
Connectors.Add(eDataHistoryOrigin.Main, this);
Connectors.Add(enumDataHistoryOrigin.Main, this);
try
{
@@ -329,14 +329,14 @@ namespace C4IT.DataHistoryProvider
if (cF4SDLicense.Instance.Modules.ContainsKey(_ActiveDirectory.LicenseId))
{
ActiveDirectory = _ActiveDirectory;
Connectors.Add(eDataHistoryOrigin.ActiveDirectory, ActiveDirectory);
Connectors.Add(enumDataHistoryOrigin.ActiveDirectory, ActiveDirectory);
}
var _F4sdAgent = new cDataHistoryCollectorClientAgent(this);
if (cF4SDLicense.Instance.Modules.ContainsKey(_F4sdAgent.LicenseId))
{
F4sdAgent = _F4sdAgent;
Connectors.Add(eDataHistoryOrigin.F4sdAgent, F4sdAgent);
Connectors.Add(enumDataHistoryOrigin.F4sdAgent, F4sdAgent);
}
}
@@ -489,7 +489,7 @@ namespace C4IT.DataHistoryProvider
if (cF4SDLicense.Instance.Modules.ContainsKey(_M42WpmCollector.LicenseId))
{
M42WpmCollector = _M42WpmCollector;
Connectors.Add(eDataHistoryOrigin.M42Wpm, M42WpmCollector);
Connectors.Add(enumDataHistoryOrigin.M42Wpm, M42WpmCollector);
RegisterSearchRelationProvider(_M42WpmCollector);
}
}
@@ -501,7 +501,7 @@ namespace C4IT.DataHistoryProvider
if (cF4SDLicense.Instance.Modules.ContainsKey(_NxqlCollector.LicenseId))
{
NxqlCollector = _NxqlCollector;
Connectors.Add(eDataHistoryOrigin.NexthinkNxql, NxqlCollector);
Connectors.Add(enumDataHistoryOrigin.NexthinkNxql, NxqlCollector);
}
}
@@ -512,14 +512,14 @@ namespace C4IT.DataHistoryProvider
//if (cF4SDLicense.Instance.Modules.ContainsKey(_CitrixCollector.LicenseId))
//{
CitrixCollector = _CitrixCollector;
Connectors.Add(eDataHistoryOrigin.Citrix, _CitrixCollector);
Connectors.Add(enumDataHistoryOrigin.Citrix, _CitrixCollector);
RegisterSearchRelationProvider(_CitrixCollector);
//}
}
if(HasIntuneConfig)
{
Connectors.Add(eDataHistoryOrigin.Intune, ActiveDirectory);
Connectors.Add(enumDataHistoryOrigin.Intune, ActiveDirectory);
RegisterSearchRelationProvider(ActiveDirectory);
}
@@ -4537,7 +4537,7 @@ namespace C4IT.DataHistoryProvider
var Ids = await getConntectorIds(Identities, Token, requestInfo, LogDeep + 1).ConfigureAwait(false);
var dicVirtualTables = new Dictionary<eDataHistoryOrigin, List<cDataHistoryConfigTable>>();
var dicVirtualTables = new Dictionary<enumDataHistoryOrigin, List<cDataHistoryConfigTable>>();
var lstDbTables = new List<cDataHistoryConfigTable>();
foreach (var strTable in _tables)
@@ -4729,7 +4729,7 @@ namespace C4IT.DataHistoryProvider
{
var Ids = await getConntectorIds(Identities, Token, requestInfo, LogDeep + 1).ConfigureAwait(false);
var dicVirtualTables = new Dictionary<eDataHistoryOrigin, List<cDataHistoryConfigTable>>();
var dicVirtualTables = new Dictionary<enumDataHistoryOrigin, List<cDataHistoryConfigTable>>();
var lstDbTables = new List<cDataHistoryConfigTable>();
foreach (var strTable in Tables)
{
@@ -4892,10 +4892,11 @@ namespace C4IT.DataHistoryProvider
if (_reader.FieldCount > 2)
{
var retVal = new cF4SDHealthCardRawData.cHealthCardTable
var retVal = new cF4SDHealthCardRawData.cHealthCardTable()
{
Name = tableConfig.Name,
InformationClass = tableConfig.ParentCluster.InformationClass,
Origin = tableConfig.ParentCluster.Origin,
StartingIndex = int.MaxValue,
IsStatic = false,
TableType = tableConfig.Type
@@ -4908,13 +4909,13 @@ namespace C4IT.DataHistoryProvider
var _propName = _reader.GetName(i);
if (tableConfig.Columns.TryGetValue(_propName, out var _col))
{
var _ci = new cF4SDHealthCardRawData.cHealthCardTableColumn() { ColumnName = _col.Name };
var _ci = new cF4SDHealthCardRawData.cHealthCardTableColumn(retVal) { ColumnName = _col.Name };
Cols[i] = _ci;
retVal.Columns[_col.Name] = _ci;
}
if (tableConfig.Columns.TryGetValue(_propName + "_bin", out var _col2))
{
var _ci = new cF4SDHealthCardRawData.cHealthCardTableColumn() { ColumnName = _col.Name + "_bin" };
var _ci = new cF4SDHealthCardRawData.cHealthCardTableColumn(retVal) { ColumnName = _col.Name + "_bin" };
Cols[i] = _ci;
retVal.Columns[_col.Name + "_bin"] = _ci;
}
@@ -5032,11 +5033,12 @@ namespace C4IT.DataHistoryProvider
{
var objVal = objValues[i] == DBNull.Value ? null : objValues[i];
var strCol = _reader.GetName(i);
RetVal.Columns.Add(strCol, new cF4SDHealthCardRawData.cHealthCardTableColumn() { ColumnName = strCol, Values = new List<object>() { objVal } });
RetVal.Columns.Add(strCol, new cF4SDHealthCardRawData.cHealthCardTableColumn(RetVal) { ColumnName = strCol, Values = new List<object>() { objVal } });
}
RetVal.Name = tableConfig.Name;
RetVal.InformationClass = tableConfig.ParentCluster.InformationClass;
RetVal.Origin = tableConfig.ParentCluster.Origin;
RetVal.IsStatic = tableConfig.Type == eDataHistoryTableType.Static;
RetVal.TableType = tableConfig.Type;
@@ -5116,10 +5118,11 @@ namespace C4IT.DataHistoryProvider
}
var RetValHistoric = new cF4SDHealthCardRawData.cHealthCardTable
var RetValHistoric = new cF4SDHealthCardRawData.cHealthCardTable()
{
Name = tableConfig.Name,
InformationClass = tableConfig.ParentCluster.InformationClass,
Origin = tableConfig.ParentCluster.Origin,
IsStatic = false,
TableType = eDataHistoryTableType.History
};
@@ -5129,7 +5132,7 @@ namespace C4IT.DataHistoryProvider
{
var agg = arrColAgg[i];
var col = new cF4SDHealthCardRawData.cHealthCardTableColumn()
var col = new cF4SDHealthCardRawData.cHealthCardTableColumn(RetValHistoric)
{
ColumnName = agg.Column.Name,
Values = agg.getValues()
@@ -5165,7 +5168,7 @@ namespace C4IT.DataHistoryProvider
var myTables = new List<cDataHistoryConfigTable>();
foreach (var Table in Tables)
{
if (Table.ParentCluster.Origin != eDataHistoryOrigin.Main)
if (Table.ParentCluster.Origin != enumDataHistoryOrigin.Main)
continue;
if (!Table.LateDelivery)
@@ -5207,6 +5210,7 @@ namespace C4IT.DataHistoryProvider
{
Name = tableConfig.Name,
InformationClass = enumFasdInformationClass.Ticket,
Origin = tableConfig.ParentCluster.Origin,
IsIncomplete = true
}
};

View File

@@ -30,7 +30,7 @@ namespace C4IT.DataHistoryProvider
public const string constConnectorName = "MS Active Directory, Entra ID & Intune connector";
public const string constLicenseId = "B2D48023-56E8-44D5-AB77-BE1DCF4EA4EB";
public const string constMsGraphUserList = "users?$top={0}&$select=id,displayName,onPremisesSyncEnabled,onPremisesSecurityIdentifier&$filter=onPremisesSyncEnabled eq true";
public const string constMsGraphUserList = "users?$top={0}&$count=true&$select=id,displayName,onPremisesSyncEnabled,onPremisesSecurityIdentifier&$filter=onPremisesSyncEnabled eq true";
public const string constMsGraphUserEntry = "users/{0}";
public const string constMsGraphUserDeviceEntry = "users/{0}";
public const int constMsGraphUserPaging = 100;
@@ -42,7 +42,7 @@ namespace C4IT.DataHistoryProvider
public const string constMsGraphManagedDeviceEntry = "deviceManagement/managedDevices/{0}?$select=id,complianceState,userPrincipalName,userDisplayName,managementState,lastSyncDateTime";
public const string constMsGraphManagedDeviceAllEntry = "deviceManagement/managedDevices/{0}";
public const string constMsGraphManagedDeviceSyncDevice = "deviceManagement/managedDevices/{0}/syncDevice";
public const string constMsGraphManagedDeviceDetectedApps = "deviceManagement/managedDevices/{0}?$select=id&$expand=detectedApps";
public const string constMsGraphManagedDeviceDetectedApps = "deviceManagement/managedDevices/{0}/detectedApps";
public const string constMsGraphManagedDeviceCount = "users/{0}/managedDevices?$select=operatingSystem";
public const string constMsGraphManagedUserDeviceEntry = "users/{0}/managedDevices?$select=id,deviceName,model,operatingSystem,manufacturer,serialNumber";
public const string constMsGraphManagedDeviceChangeManagedStatus = "deviceManagement/managedDevices/{0}/{1}";
@@ -102,7 +102,7 @@ namespace C4IT.DataHistoryProvider
}
public cDataHistoryCollectorActiveDirectory(cDataHistoryCollector Collector)
: base(Collector, new List<eDataHistoryOrigin>() { eDataHistoryOrigin.ActiveDirectory, eDataHistoryOrigin.Intune }, constConnectorName, constLicenseId)
: base(Collector, new List<enumDataHistoryOrigin>() { enumDataHistoryOrigin.ActiveDirectory, enumDataHistoryOrigin.Intune }, constConnectorName, constLicenseId)
{
_collector = Collector;
}
@@ -1289,7 +1289,7 @@ namespace C4IT.DataHistoryProvider
{
foreach (var DataCluster in Collector.ClusterConfig.Clusters.Values)
{
if (DataCluster.Origin != eDataHistoryOrigin.ActiveDirectory || DataCluster.InformationClass != InformationClass)
if (DataCluster.Origin != enumDataHistoryOrigin.ActiveDirectory || DataCluster.InformationClass != InformationClass)
continue;
foreach (var Table in DataCluster.Tables.Values)
@@ -1544,11 +1544,15 @@ namespace C4IT.DataHistoryProvider
}
var strUrl = string.Format(constMsGraphUserList, constMsGraphUserPaging);
var Result = await MsGraph.RequestListAsync(strUrl, UseBeta: false, retryForbidden: false, loadPaged: true);
if (!string.IsNullOrEmpty(Tenant.ScanFilter))
strUrl += " and (" + Tenant.ScanFilter + ")";
var Result = await MsGraph.RequestListAsync(strUrl, UseBeta: false, retryForbidden: false, loadPaged: true, ConsistencyLevelEventual: Tenant.UseConsistencyLevelEventual);
var Count = 0;
var Updated = 0;
while (Result != null == Result.Count > 0)
while (Result != null && Result.Count > 0)
{
foreach (var Entry in Result)
{
@@ -2073,9 +2077,9 @@ namespace C4IT.DataHistoryProvider
try
{
var bDeviceExists = Tables.Exists(v => v.Name == constTableNameIntuneDeviceDetails && v.ParentCluster?.Origin == eDataHistoryOrigin.Intune);
var bUserDeviceExists = Tables.Exists(v => v.Name == constTableNameIntuneUserDeviceCount && v.ParentCluster?.Origin == eDataHistoryOrigin.Intune);
var bMobileDeviceExists = Tables.Exists(v => v.Name == constTableNameIntuneMobileDeviceDetails && v.ParentCluster?.Origin == eDataHistoryOrigin.Intune);
var bDeviceExists = Tables.Exists(v => v.Name == constTableNameIntuneDeviceDetails && v.ParentCluster?.Origin == enumDataHistoryOrigin.Intune);
var bUserDeviceExists = Tables.Exists(v => v.Name == constTableNameIntuneUserDeviceCount && v.ParentCluster?.Origin == enumDataHistoryOrigin.Intune);
var bMobileDeviceExists = Tables.Exists(v => v.Name == constTableNameIntuneMobileDeviceDetails && v.ParentCluster?.Origin == enumDataHistoryOrigin.Intune);
if (!Identities.TryGetValue(enumFasdInformationClass.Computer, out var computer) && computer?.intuneId != Guid.Empty)
@@ -2101,6 +2105,7 @@ namespace C4IT.DataHistoryProvider
{
Name = constTableNameIntuneDeviceDetails,
InformationClass = enumFasdInformationClass.Computer,
Origin = enumDataHistoryOrigin.Intune,
IsIncomplete = true
});
@@ -2115,6 +2120,7 @@ namespace C4IT.DataHistoryProvider
{
Name = constTableNameIntuneMobileDeviceDetails,
InformationClass = enumFasdInformationClass.MobileDevice,
Origin = enumDataHistoryOrigin.Intune,
IsIncomplete = true
});
@@ -2129,6 +2135,7 @@ namespace C4IT.DataHistoryProvider
{
Name = constTableNameIntuneUserDeviceCount,
InformationClass = enumFasdInformationClass.User,
Origin = enumDataHistoryOrigin.Intune,
IsIncomplete = true
});
}
@@ -2168,7 +2175,7 @@ namespace C4IT.DataHistoryProvider
try
{
var bUserDeviceDetailExists = Tables.Exists(v => v.Name == constTableNameIntuneUserDeviceCountDetail && v.ParentCluster?.Origin == eDataHistoryOrigin.Intune);
var bUserDeviceDetailExists = Tables.Exists(v => v.Name == constTableNameIntuneUserDeviceCountDetail && v.ParentCluster?.Origin == enumDataHistoryOrigin.Intune);
if (!Identities.TryGetValue(enumFasdInformationClass.User, out var userIds))
{
@@ -2238,6 +2245,7 @@ namespace C4IT.DataHistoryProvider
{
Name = constTableNameIntuneDeviceDetails,
InformationClass = enumFasdInformationClass.Computer,
Origin = enumDataHistoryOrigin.Intune,
IsStatic = true,
TableType = eDataHistoryTableType.Static
};
@@ -2272,7 +2280,7 @@ namespace C4IT.DataHistoryProvider
objVal = ConvertToF4sdType(objVal, colInfo.ValueType);
var _col = new cF4SDHealthCardRawData.cHealthCardTableColumn() { ColumnName = colInfo.Name, Values = new List<object>(1) { objVal } };
var _col = new cF4SDHealthCardRawData.cHealthCardTableColumn(retVal) { ColumnName = colInfo.Name, Values = new List<object>(1) { objVal } };
retVal.Columns[colInfo.Name] = _col;
}
catch { }
@@ -2325,6 +2333,7 @@ namespace C4IT.DataHistoryProvider
{
Name = constTableNameIntuneUserDeviceCount,
InformationClass = enumFasdInformationClass.User,
Origin = enumDataHistoryOrigin.Intune,
IsStatic = true,
TableType = eDataHistoryTableType.Static
};
@@ -2385,7 +2394,7 @@ namespace C4IT.DataHistoryProvider
objVal = ConvertToF4sdType(objVal, colInfo.ValueType);
var _col = new cF4SDHealthCardRawData.cHealthCardTableColumn() { ColumnName = colInfo.Name, Values = new List<object>(1) { objVal } };
var _col = new cF4SDHealthCardRawData.cHealthCardTableColumn(retVal) { ColumnName = colInfo.Name, Values = new List<object>(1) { objVal } };
retVal.Columns[colInfo.Name] = _col;
}
catch { }
@@ -2598,6 +2607,7 @@ namespace C4IT.DataHistoryProvider
{
Name = constTableNameIntuneMobileDeviceDetails,
InformationClass = enumFasdInformationClass.MobileDevice,
Origin = enumDataHistoryOrigin.Intune,
IsStatic = true,
TableType = eDataHistoryTableType.Static
};
@@ -2632,7 +2642,7 @@ namespace C4IT.DataHistoryProvider
objVal = ConvertToF4sdType(objVal, colInfo.ValueType);
var _col = new cF4SDHealthCardRawData.cHealthCardTableColumn() { ColumnName = colInfo.Name, Values = new List<object>(1) { objVal } };
var _col = new cF4SDHealthCardRawData.cHealthCardTableColumn(retVal) { ColumnName = colInfo.Name, Values = new List<object>(1) { objVal } };
retVal.Columns[colInfo.Name] = _col;
}
catch { }
@@ -2831,7 +2841,7 @@ namespace C4IT.DataHistoryProvider
public async Task<dynamic> GetManagedApps(List<cF4sdIdentityEntry> identities, cF4sdWebRequestInfo requestInfo, CancellationToken Token)
{
var Ids = await Collector.getConntectorIds(identities, Token, requestInfo, 1);
if (!Ids.TryGetValue(enumFasdInformationClass.User, out var _ids))
if (!Ids.TryGetValue(enumFasdInformationClass.Computer, out var _ids))
return null;
var strUrl = string.Format(constMsGraphManagedDeviceDetectedApps, _ids.intuneId);
@@ -2842,7 +2852,7 @@ namespace C4IT.DataHistoryProvider
var Result = await MsGraph.RequestAsync(strUrl, UseBeta: true, retryForbidden: false);
if (Result != null)
{
var ResultJson = Result.Result["detectedApps"] as JArray;
var ResultJson = Result.Result["value"] as JArray;
if (ResultJson != null)
{
Collector.DoProcessUiMessage(3, $" properties of selected '{ResultJson}' with {ResultJson.Count} properties could be read.");
@@ -3417,7 +3427,7 @@ namespace C4IT.DataHistoryProvider
foreach (var DataCluster in Collector.ClusterConfig.Clusters.Values)
{
if (DataCluster.Origin != eDataHistoryOrigin.ActiveDirectory || DataCluster.InformationClass != InformationClass)
if (DataCluster.Origin != enumDataHistoryOrigin.ActiveDirectory || DataCluster.InformationClass != InformationClass)
continue;
foreach (var Table in DataCluster.Tables.Values)
@@ -3441,7 +3451,7 @@ namespace C4IT.DataHistoryProvider
public override bool CheckIfLateDelivery(cDataHistoryConfigTable Table)
{
if (Table?.ParentCluster?.Origin == eDataHistoryOrigin.Intune)
if (Table?.ParentCluster?.Origin == enumDataHistoryOrigin.Intune)
return true;
return false;
}

View File

@@ -45,6 +45,7 @@ namespace C4IT.DataHistoryProvider
public const string constCitrixSessionMachine = "monitorodata/Sessions?$select=SessionKey&$filter=SessionKey eq {0}&$expand=Machine($expand=CurrentLoadIndex,Catalog,DesktopGroup($select=Name)),Machine";
public const string constCitrixSessionCurrentConnection = "monitorodata/Sessions?$select=SessionKey&$filter=SessionKey eq {0}&$expand=CurrentConnection,LogOnMetrics";
public const string constCitrixSessionConnections = "monitorodata/Sessions?$select=SessionKey&$filter=SessionKey eq {0}&$expand=Connection";
public const string constCitrixUserConnections = "monitorodata/Sessions?$filter=UserId in ({0})&$expand=Connection";
public const string constCitrixSessionUser = "monitorodata/Sessions?$select=SessionKey&$filter=SessionKey eq {0}&$expand=User";
public const string constCitrixSessionLogoff = "cvad/manage/Sessions/{0}/$logoff";
public const string constCitrixSessionHide = "cvad/manage/Sessions/{0}/$hide";
@@ -75,7 +76,7 @@ namespace C4IT.DataHistoryProvider
};
private Dictionary<string, cCitrixCommunication> tenantCitrixCache = new Dictionary<string, cCitrixCommunication>();
private readonly cDataHistoryCollector _collector;
public cDataHistoryCollectorCitrix(cDataHistoryCollector Collector) : base(Collector, eDataHistoryOrigin.Citrix, constConnectorName, constLicenseId)
public cDataHistoryCollectorCitrix(cDataHistoryCollector Collector) : base(Collector, enumDataHistoryOrigin.Citrix, constConnectorName, constLicenseId)
{
_collector = Collector;
}
@@ -333,6 +334,7 @@ namespace C4IT.DataHistoryProvider
{
Name = constTableNameSessionMetrics,
InformationClass = enumFasdInformationClass.VirtualSession,
Origin = enumDataHistoryOrigin.Citrix,
IsStatic = true,
TableType = eDataHistoryTableType.Static
};
@@ -440,7 +442,7 @@ namespace C4IT.DataHistoryProvider
if (table.Columns.TryGetValue(columnName, out var columnValues))
columnValues.Values.Add(value);
else
table.Columns.Add(columnName, new cF4SDHealthCardRawData.cHealthCardTableColumn() { ColumnName = columnName, Values = new List<object>() { value } });
table.Columns.Add(columnName, new cF4SDHealthCardRawData.cHealthCardTableColumn(table) { ColumnName = columnName, Values = new List<object>() { value } });
}
}
@@ -1682,6 +1684,7 @@ namespace C4IT.DataHistoryProvider
{
Name = constTableNameSession,
InformationClass = enumFasdInformationClass.VirtualSession,
Origin = enumDataHistoryOrigin.Citrix,
IsStatic = true,
TableType = eDataHistoryTableType.Static
};
@@ -1714,7 +1717,7 @@ namespace C4IT.DataHistoryProvider
objVal = ConvertToF4sdType(objVal, colInfo.ValueType);
var _col = new cF4SDHealthCardRawData.cHealthCardTableColumn() { ColumnName = colInfo.Name, Values = new List<object>(1) { objVal } };
var _col = new cF4SDHealthCardRawData.cHealthCardTableColumn(retVal) { ColumnName = colInfo.Name, Values = new List<object>(1) { objVal } };
retVal.Columns[colInfo.Name] = _col;
}
catch { }
@@ -1764,6 +1767,7 @@ namespace C4IT.DataHistoryProvider
{
Name = constTableNameSessionUser,
InformationClass = enumFasdInformationClass.VirtualSession,
Origin = enumDataHistoryOrigin.Citrix,
IsStatic = true,
TableType = eDataHistoryTableType.Static
};
@@ -1804,7 +1808,7 @@ namespace C4IT.DataHistoryProvider
objVal = ConvertToF4sdType(objVal, colInfo.ValueType);
var _col = new cF4SDHealthCardRawData.cHealthCardTableColumn() { ColumnName = colInfo.Name, Values = new List<object>(1) { objVal } };
var _col = new cF4SDHealthCardRawData.cHealthCardTableColumn(retVal) { ColumnName = colInfo.Name, Values = new List<object>(1) { objVal } };
retVal.Columns[colInfo.Name] = _col;
}
catch { }
@@ -1855,6 +1859,7 @@ namespace C4IT.DataHistoryProvider
{
Name = constTableNameSessionMachine,
InformationClass = enumFasdInformationClass.VirtualSession,
Origin = enumDataHistoryOrigin.Citrix,
IsStatic = true,
TableType = eDataHistoryTableType.Static
};
@@ -1900,7 +1905,7 @@ namespace C4IT.DataHistoryProvider
}
objVal = ConvertToF4sdType(objVal, colInfo.ValueType);
var _col = new cF4SDHealthCardRawData.cHealthCardTableColumn() { ColumnName = colInfo.Name, Values = new List<object>(1) { objVal } };
var _col = new cF4SDHealthCardRawData.cHealthCardTableColumn(retVal) { ColumnName = colInfo.Name, Values = new List<object>(1) { objVal } };
retVal.Columns[colInfo.Name] = _col;
}
catch { }
@@ -1950,6 +1955,7 @@ namespace C4IT.DataHistoryProvider
{
Name = constTableNameSessionCurrentConnection,
InformationClass = enumFasdInformationClass.VirtualSession,
Origin = enumDataHistoryOrigin.Citrix,
IsStatic = true,
TableType = eDataHistoryTableType.Static
};
@@ -2020,7 +2026,7 @@ namespace C4IT.DataHistoryProvider
objVal = ConvertToF4sdType(objVal, colInfo.ValueType);
var _col = new cF4SDHealthCardRawData.cHealthCardTableColumn() { ColumnName = colInfo.Name, Values = new List<object>(1) { objVal } };
var _col = new cF4SDHealthCardRawData.cHealthCardTableColumn(retVal) { ColumnName = colInfo.Name, Values = new List<object>(1) { objVal } };
retVal.Columns[colInfo.Name] = _col;
}
catch { }
@@ -2070,6 +2076,7 @@ namespace C4IT.DataHistoryProvider
{
Name = constTableNameSessionConnection,
InformationClass = enumFasdInformationClass.VirtualSession,
Origin = enumDataHistoryOrigin.Citrix,
IsStatic = true,
TableType = eDataHistoryTableType.Static
};
@@ -2110,7 +2117,7 @@ namespace C4IT.DataHistoryProvider
objVal = ConvertToF4sdType(objVal, colInfo.ValueType);
var _col = new cF4SDHealthCardRawData.cHealthCardTableColumn() { ColumnName = colInfo.Name, Values = new List<object>(1) { objVal } };
var _col = new cF4SDHealthCardRawData.cHealthCardTableColumn(retVal) { ColumnName = colInfo.Name, Values = new List<object>(1) { objVal } };
retVal.Columns[colInfo.Name] = _col;
}
catch { }
@@ -2143,18 +2150,18 @@ namespace C4IT.DataHistoryProvider
try
{
var bIcaRttMSDetailExists = Tables.Exists(v => v.Name == constTableNameSessionDetailsIcaRttMS && v.ParentCluster?.Origin == eDataHistoryOrigin.Citrix);
var bIcaLatencyDetailExists = Tables.Exists(v => v.Name == constTableNameSessionDetailsIcaLatency && v.ParentCluster?.Origin == eDataHistoryOrigin.Citrix);
var bClientL7LatencyDetailExists = Tables.Exists(v => v.Name == constTableNameSessionDetailsClientL7Latency && v.ParentCluster?.Origin == eDataHistoryOrigin.Citrix);
var bServerL7LatencyDetailExists = Tables.Exists(v => v.Name == constTableNameSessionDetailsServerL7Latency && v.ParentCluster?.Origin == eDataHistoryOrigin.Citrix);
var bInputBandwidthUsedDetailExists = Tables.Exists(v => v.Name == constTableNameSessionDetailsInputBandwidthUsed && v.ParentCluster?.Origin == eDataHistoryOrigin.Citrix);
var bOutputBandwidthUsedDetailExists = Tables.Exists(v => v.Name == constTableNameSessionDetailsOutputBandwidthUsed && v.ParentCluster?.Origin == eDataHistoryOrigin.Citrix);
var bOutputBandwidthAvailableDetailExists = Tables.Exists(v => v.Name == constTableNameSessionDetailsOutputBandwidthAvailable && v.ParentCluster?.Origin == eDataHistoryOrigin.Citrix);
var bFpsDetailExists = Tables.Exists(v => v.Name == constTableNameSessionDetailsFps && v.ParentCluster?.Origin == eDataHistoryOrigin.Citrix);
var bInputFpsDetailExists = Tables.Exists(v => v.Name == constTableNameSessionDetailsInputFps && v.ParentCluster?.Origin == eDataHistoryOrigin.Citrix);
var bOutputFpsDetailExists = Tables.Exists(v => v.Name == constTableNameSessionDetailsOutputFps && v.ParentCluster?.Origin == eDataHistoryOrigin.Citrix);
var bWanLatencyDetailExists = Tables.Exists(v => v.Name == constTableNameSessionDetailsWanLatency && v.ParentCluster?.Origin == eDataHistoryOrigin.Citrix);
var bDcLatencyDetailExists = Tables.Exists(v => v.Name == constTableNameSessionDetailsDcLatency && v.ParentCluster?.Origin == eDataHistoryOrigin.Citrix);
var bIcaRttMSDetailExists = Tables.Exists(v => v.Name == constTableNameSessionDetailsIcaRttMS && v.ParentCluster?.Origin == enumDataHistoryOrigin.Citrix);
var bIcaLatencyDetailExists = Tables.Exists(v => v.Name == constTableNameSessionDetailsIcaLatency && v.ParentCluster?.Origin == enumDataHistoryOrigin.Citrix);
var bClientL7LatencyDetailExists = Tables.Exists(v => v.Name == constTableNameSessionDetailsClientL7Latency && v.ParentCluster?.Origin == enumDataHistoryOrigin.Citrix);
var bServerL7LatencyDetailExists = Tables.Exists(v => v.Name == constTableNameSessionDetailsServerL7Latency && v.ParentCluster?.Origin == enumDataHistoryOrigin.Citrix);
var bInputBandwidthUsedDetailExists = Tables.Exists(v => v.Name == constTableNameSessionDetailsInputBandwidthUsed && v.ParentCluster?.Origin == enumDataHistoryOrigin.Citrix);
var bOutputBandwidthUsedDetailExists = Tables.Exists(v => v.Name == constTableNameSessionDetailsOutputBandwidthUsed && v.ParentCluster?.Origin == enumDataHistoryOrigin.Citrix);
var bOutputBandwidthAvailableDetailExists = Tables.Exists(v => v.Name == constTableNameSessionDetailsOutputBandwidthAvailable && v.ParentCluster?.Origin == enumDataHistoryOrigin.Citrix);
var bFpsDetailExists = Tables.Exists(v => v.Name == constTableNameSessionDetailsFps && v.ParentCluster?.Origin == enumDataHistoryOrigin.Citrix);
var bInputFpsDetailExists = Tables.Exists(v => v.Name == constTableNameSessionDetailsInputFps && v.ParentCluster?.Origin == enumDataHistoryOrigin.Citrix);
var bOutputFpsDetailExists = Tables.Exists(v => v.Name == constTableNameSessionDetailsOutputFps && v.ParentCluster?.Origin == enumDataHistoryOrigin.Citrix);
var bWanLatencyDetailExists = Tables.Exists(v => v.Name == constTableNameSessionDetailsWanLatency && v.ParentCluster?.Origin == enumDataHistoryOrigin.Citrix);
var bDcLatencyDetailExists = Tables.Exists(v => v.Name == constTableNameSessionDetailsDcLatency && v.ParentCluster?.Origin == enumDataHistoryOrigin.Citrix);
if (!Identities.TryGetValue(enumFasdInformationClass.VirtualSession, out var session) || session?.Id is null)
return null;
@@ -2385,7 +2392,7 @@ namespace C4IT.DataHistoryProvider
if (!Identities.TryGetValue(enumFasdInformationClass.User, out var userIds) || userIds?.citrixTenantId is null)
return null;
var citrixTableNames = new HashSet<string>(Tables.Where(t => t?.ParentCluster?.Origin == eDataHistoryOrigin.Citrix).Select(t => t.Name), StringComparer.Ordinal);
var citrixTableNames = new HashSet<string>(Tables.Where(t => t?.ParentCluster?.Origin == enumDataHistoryOrigin.Citrix).Select(t => t.Name), StringComparer.Ordinal);
bool Has(string tableName) => tableName != null && citrixTableNames.Contains(tableName);
@@ -2569,7 +2576,7 @@ namespace C4IT.DataHistoryProvider
try
{
if (!Always)
if (Always)
{
var scanInfo = await Collector.CitrixCollector.GetScanTimeInfoAsync(requestInfo, LogDeep + 1, Token);
if (scanInfo == null)

View File

@@ -78,6 +78,19 @@ namespace C4IT.DataHistoryProvider
}
}
private class cMeasureCodeInformation
{
internal List<cHistoricAggregationEntry> Entries = new List<cHistoricAggregationEntry>();
internal bool needsJson = false;
internal void AddEntry(cHistoricAggregationEntry entry)
{
Entries.Add(entry);
if (entry.Column.SourceJsonColumn >=0 || !string.IsNullOrEmpty(entry.Column.SourceJsonField))
needsJson = true;
}
}
private cEventTablesInfo EventTablesInfo = new cEventTablesInfo();
public override void TablePostConfig(cDataHistoryConfigTable Table)
@@ -102,7 +115,7 @@ namespace C4IT.DataHistoryProvider
}
}
public cDataHistoryCollectorClientAgent(cDataHistoryCollector Collector) : base(Collector, eDataHistoryOrigin.F4sdAgent, constConnectorName, constLicenseId)
public cDataHistoryCollectorClientAgent(cDataHistoryCollector Collector) : base(Collector, enumDataHistoryOrigin.F4sdAgent, constConnectorName, constLicenseId)
{
}
@@ -863,15 +876,16 @@ namespace C4IT.DataHistoryProvider
if (!(userInfo?.agentId is int id))
return null;
var RetVal = new cF4SDHealthCardRawData.cHealthCardTable
var RetVal = new cF4SDHealthCardRawData.cHealthCardTable()
{
Name = constAgentUserTableName,
InformationClass = enumFasdInformationClass.Unknown,
InformationClass = enumFasdInformationClass.User,
Origin = enumDataHistoryOrigin.F4sdAgent,
IsStatic = true,
TableType = eDataHistoryTableType.Static
};
RetVal.Columns.Add("id", new cF4SDHealthCardRawData.cHealthCardTableColumn() { ColumnName = "id", Values = new List<object>() { id } });
RetVal.Columns.Add("accountType", new cF4SDHealthCardRawData.cHealthCardTableColumn() { ColumnName = "accountType", Values = new List<object>() { userInfo.accountType.ToString() } });
RetVal.Columns.Add("id", new cF4SDHealthCardRawData.cHealthCardTableColumn(RetVal) { ColumnName = "id", Values = new List<object>() { id } });
RetVal.Columns.Add("accountType", new cF4SDHealthCardRawData.cHealthCardTableColumn(RetVal) { ColumnName = "accountType", Values = new List<object>() { userInfo.accountType.ToString() } });
return RetVal;
}
@@ -922,8 +936,12 @@ namespace C4IT.DataHistoryProvider
if (Reader.HasRows)
{
var dicCols = Table.Columns.Values.Where(x => x.SourceName != null).ToDictionary<cDataHistoryConfigColumnBase, string>(x => x.SourceName);
var RetVal = new cF4SDHealthCardRawData.cHealthCardTable();
RetVal.Columns.Add("id", new cF4SDHealthCardRawData.cHealthCardTableColumn() { ColumnName = "id", Values = new List<object>() { id } });
var RetVal = new cF4SDHealthCardRawData.cHealthCardTable()
{
InformationClass = enumFasdInformationClass.Computer,
Origin = enumDataHistoryOrigin.F4sdAgent
};
RetVal.Columns.Add("id", new cF4SDHealthCardRawData.cHealthCardTableColumn(RetVal) { ColumnName = "id", Values = new List<object>() { id } });
while (await Reader.ReadAsync())
{
try
@@ -933,7 +951,7 @@ namespace C4IT.DataHistoryProvider
if (dicCols.TryGetValue(Name, out var Column))
{
var objValue = cDataHistoryCollector.getJsonValueFromString(JsonValue, Column.ValueType);
RetVal.Columns.Add(Column.Name, new cF4SDHealthCardRawData.cHealthCardTableColumn() { ColumnName = Column.Name, Values = new List<object>() { objValue } });
RetVal.Columns.Add(Column.Name, new cF4SDHealthCardRawData.cHealthCardTableColumn(RetVal) { ColumnName = Column.Name, Values = new List<object>() { objValue } });
}
}
catch (Exception E)
@@ -1257,7 +1275,7 @@ namespace C4IT.DataHistoryProvider
return retVal;
}
private static object GetValueFromDbField(object val)
private static object GetValueFromDbField(object val, bool needJsonDecode)
{
try
{
@@ -1267,9 +1285,9 @@ namespace C4IT.DataHistoryProvider
{
if (strValue.StartsWith("\""))
val = JsonConvert.DeserializeObject<string>(strValue);
else if (strValue.StartsWith("["))
else if (needJsonDecode && strValue.StartsWith("["))
val = JsonConvert.DeserializeObject<object[]>(strValue);
else if (strValue.StartsWith("{"))
else if (needJsonDecode &&strValue.StartsWith("{"))
val = JsonConvert.DeserializeObject<cDataHistoryCustomJsonMeasure>(strValue);
else
val = strValue;
@@ -1288,7 +1306,7 @@ namespace C4IT.DataHistoryProvider
return Table.HasLateDelivery;
}
private async Task getHistoricEventDataTotal(int AgentId, string TableType, string mcFilter, Dictionary<int, List<cHistoricAggregationEntry>> McColumns, int MaxAge, DateTime RefTime, CancellationToken Token, cF4sdWebRequestInfo requestInfo, int LogDeep)
private async Task getHistoricEventDataTotal(int AgentId, string TableType, string mcFilter, Dictionary<int, cMeasureCodeInformation> McColumns, int MaxAge, DateTime RefTime, CancellationToken Token, cF4sdWebRequestInfo requestInfo, int LogDeep)
{
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
if (cPerformanceLogger.IsActive && requestInfo != null) { if (CM == null) CM = MethodBase.GetCurrentMethod(); cPerformanceLogger.LogPerformanceStart(LogDeep, CM, requestInfo.id, requestInfo.created); }
@@ -1329,11 +1347,11 @@ namespace C4IT.DataHistoryProvider
{
var _MC = Reader.GetInt32(0);
var _EventTime = Reader.GetDateTime(1);
object Value = GetValueFromDbField(Reader.GetValue(2));
var _EventDuration = Reader.IsDBNull(3) ? 1 : Reader.GetInt32(3);
if (McColumns.TryGetValue(_MC, out var aggEntry))
{
foreach (var aggValEntry in aggEntry)
object Value = GetValueFromDbField(Reader.GetValue(2), aggEntry.needsJson);
foreach (var aggValEntry in aggEntry.Entries)
aggValEntry.addValue(Value, _EventTime, RefTime, _EventDuration);
}
}
@@ -1368,7 +1386,7 @@ namespace C4IT.DataHistoryProvider
}
}
private async Task getHistoricEventDataDaily(int AgentId, string TableName, string mcFilter, Dictionary<int, List<cHistoricAggregationEntry>> McColumns, int MaxAge, DateTime RefTime, CancellationToken Token, cF4sdWebRequestInfo requestInfo, int LogDeep)
private async Task getHistoricEventDataDaily(int AgentId, string TableName, string mcFilter, Dictionary<int, cMeasureCodeInformation> McColumns, int MaxAge, DateTime RefTime, CancellationToken Token, cF4sdWebRequestInfo requestInfo, int LogDeep)
{
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
if (cPerformanceLogger.IsActive && requestInfo != null) { if (CM == null) CM = MethodBase.GetCurrentMethod(); cPerformanceLogger.LogPerformanceStart(LogDeep, CM, requestInfo.id, requestInfo.created); }
@@ -1407,15 +1425,19 @@ namespace C4IT.DataHistoryProvider
while (await Reader.ReadAsync())
{
var _MC = Reader.GetInt32(0);
if (_MC == 24)
{
}
var _EventTime = Reader.GetDateTime(1);
if (_EventTime < RefTime - TimeSpan.FromDays(MaxAge))
continue;
object Value = GetValueFromDbField(Reader.GetValue(2));
var _EventDuration = Reader.IsDBNull(3) ? 1 : Reader.GetInt32(3);
if (McColumns.TryGetValue(_MC, out var aggEntry))
{
foreach (var aggValEntry in aggEntry)
object Value = GetValueFromDbField(Reader.GetValue(2), aggEntry.needsJson);
foreach (var aggValEntry in aggEntry.Entries)
aggValEntry.addValue(Value, _EventTime, RefTime, _EventDuration);
}
}
@@ -1452,7 +1474,7 @@ namespace C4IT.DataHistoryProvider
}
private async Task getHistoricEventDataDailyUsage(int AgentId, string TableName, List<cHistoricAggregationEntry> aggEntry, int MaxAge, DateTime RefTime, CancellationToken Token, cF4sdWebRequestInfo requestInfo, int LogDeep)
private async Task getHistoricEventDataDailyUsage(int AgentId, string TableName, cMeasureCodeInformation aggEntry, int MaxAge, DateTime RefTime, CancellationToken Token, cF4sdWebRequestInfo requestInfo, int LogDeep)
{
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
if (cPerformanceLogger.IsActive && requestInfo != null) { if (CM == null) CM = MethodBase.GetCurrentMethod(); cPerformanceLogger.LogPerformanceStart(LogDeep, CM, requestInfo.id, requestInfo.created); }
@@ -1495,9 +1517,9 @@ namespace C4IT.DataHistoryProvider
if (_EventTime < RefTime - TimeSpan.FromDays(MaxAge))
continue;
object Value = GetValueFromDbField(Reader.GetValue(2));
var _EventDuration = Reader.IsDBNull(3) ? 1 : Reader.GetInt32(3);
foreach (var aggValEntry in aggEntry)
object Value = GetValueFromDbField(Reader.GetValue(2), aggEntry.needsJson);
foreach (var aggValEntry in aggEntry.Entries)
aggValEntry.addValue(Value, _EventTime, RefTime, _EventDuration);
}
}
@@ -1556,7 +1578,7 @@ namespace C4IT.DataHistoryProvider
try
{
var McColumns = new Dictionary<int, List<cHistoricAggregationEntry>>();
var McColumns = new Dictionary<int, cMeasureCodeInformation>();
foreach (var _Entry in Table.Columns.Values)
{
if (!(_Entry is cDataHistoryConfigColumn col))
@@ -1583,11 +1605,11 @@ namespace C4IT.DataHistoryProvider
if (!McColumns.TryGetValue(_mc.MeasureCode, out var _colList))
{
_colList = new List<cHistoricAggregationEntry>();
_colList = new cMeasureCodeInformation();
McColumns[_mc.MeasureCode] = _colList;
}
var AE = new cHistoricAggregationEntry(col, MaxAge + 1, JsonSettings);
_colList.Add(AE);
_colList.AddEntry(AE);
}
var mcFilter = "";
@@ -1647,18 +1669,20 @@ namespace C4IT.DataHistoryProvider
await Task.WhenAll(_listTask).ConfigureAwait(false);
var RetValLatest = new cF4SDHealthCardRawData.cHealthCardTable
var RetValLatest = new cF4SDHealthCardRawData.cHealthCardTable()
{
Name = Table.Name + "-latest",
InformationClass = Table.ParentCluster.InformationClass,
Origin = Table.ParentCluster.Origin,
IsStatic = true,
TableType = eDataHistoryTableType.Static
};
var RetValHistoric = new cF4SDHealthCardRawData.cHealthCardTable
var RetValHistoric = new cF4SDHealthCardRawData.cHealthCardTable()
{
Name = Table.Name,
InformationClass = Table.ParentCluster.InformationClass,
Origin = Table.ParentCluster.Origin,
IsStatic = false,
TableType = eDataHistoryTableType.History,
AlternateStaticTable = RetValLatest.Name
@@ -1669,9 +1693,9 @@ namespace C4IT.DataHistoryProvider
if (Entry.Key == 29)
{
}
foreach (var subEntry in Entry.Value)
foreach (var subEntry in Entry.Value.Entries)
{
var col = new cF4SDHealthCardRawData.cHealthCardTableColumn()
var col = new cF4SDHealthCardRawData.cHealthCardTableColumn(RetValHistoric)
{
ColumnName = subEntry.Column.Name,
Values = subEntry.getValues()
@@ -1684,7 +1708,7 @@ namespace C4IT.DataHistoryProvider
else
Value2 = subEntry.LatestValue;
var col2 = new cF4SDHealthCardRawData.cHealthCardTableColumn()
var col2 = new cF4SDHealthCardRawData.cHealthCardTableColumn(RetValLatest)
{
ColumnName = subEntry.Column.Name,
Values = new List<object> { Value2 }
@@ -1699,12 +1723,12 @@ namespace C4IT.DataHistoryProvider
{
if (_col.LateDelivery)
{
RetValHistoric.Columns.Add(_col.Name, new cF4SDHealthCardRawData.cHealthCardTableColumn()
RetValHistoric.Columns.Add(_col.Name, new cF4SDHealthCardRawData.cHealthCardTableColumn(RetValHistoric)
{
ColumnName = _col.Name,
IsIncomplete = true
});
RetValLatest.Columns.Add(_col.Name, new cF4SDHealthCardRawData.cHealthCardTableColumn()
RetValLatest.Columns.Add(_col.Name, new cF4SDHealthCardRawData.cHealthCardTableColumn(RetValLatest)
{
ColumnName = _col.Name,
IsIncomplete = true
@@ -1861,13 +1885,25 @@ namespace C4IT.DataHistoryProvider
return null;
}
internal class cHistoricEventRowInfos
{
internal List<cEventDetailsColumnInfo> rows = new List<cEventDetailsColumnInfo>();
internal bool needJson = false;
internal void AddEntry(cEventDetailsColumnInfo row)
{
rows.Add(row);
if (row.JsonIndex >= 0)
needJson = true;
}
}
internal class cHistoricEventDetailsInfo
{
internal cDataHistoryConfigTable Table;
internal cF4SDHealthCardRawData.cHealthCardDetailsTable Result;
internal SortedList<int, SortedDictionary<DateTime, object[]>> _values;
internal List<List<cEventDetailsColumnInfo>> rows;
internal List<cHistoricEventRowInfos> rows;
internal int valueCount;
internal string[] _jsonFields;
internal cDataHistoryConfigColumnBase colTime;
@@ -1904,7 +1940,7 @@ namespace C4IT.DataHistoryProvider
{
for (int i = 0; i < Reader.FieldCount; i++)
{
List<cEventDetailsColumnInfo> _rows = null;
cHistoricEventRowInfos _rows = null;
var colName = Reader.GetName(i);
if (!string.IsNullOrWhiteSpace(colName))
{
@@ -1923,7 +1959,7 @@ namespace C4IT.DataHistoryProvider
if (column.SourceName == colName)
{
if (_rows == null)
_rows = new List<cEventDetailsColumnInfo>();
_rows = new cHistoricEventRowInfos();
_info.Result.Columns.Add(column.Name);
var JsonIndex = -1;
@@ -1937,7 +1973,7 @@ namespace C4IT.DataHistoryProvider
}
}
_rows.Add(new cEventDetailsColumnInfo() { index = _info.Result.Columns.Count - 1, JsonIndex = JsonIndex, column = column });
_rows.AddEntry(new cEventDetailsColumnInfo() { index = _info.Result.Columns.Count - 1, JsonIndex = JsonIndex, column = column });
}
}
@@ -1967,11 +2003,11 @@ namespace C4IT.DataHistoryProvider
for (int i = 0; i < Reader.FieldCount; i++)
{
var listCols = _info.rows[i];
if (listCols != null && listCols.Count > 0)
if (listCols != null && listCols.rows.Count > 0)
{
var val = GetValueFromDbField(arrVals[i]);
var val = GetValueFromDbField(arrVals[i], listCols.needJson);
object resVal = null;
foreach (var Entry in listCols)
foreach (var Entry in listCols.rows)
{
if (Entry.column == _info.colTime && (val is DateTime evt))
EventTime = evt;
@@ -2073,7 +2109,7 @@ namespace C4IT.DataHistoryProvider
Values = new Dictionary<int, List<object[]>>()
},
_values = new SortedList<int, SortedDictionary<DateTime, object[]>>(),
rows = new List<List<cEventDetailsColumnInfo>>(),
rows = new List<cHistoricEventRowInfos>(),
valueCount = 0,
_jsonFields = _jsonFields,
colTime = colTime,

View File

@@ -1,5 +1,6 @@
using C4IT.FASD.Base;
using C4IT.Logging;
using C4IT.F4SD.SupportCaseProtocoll.Models;
using C4IT.FASD.Base;
using C4IT.Logging;
using C4IT.Matrix42.WebClient;
using C4IT.XML;
using C4IT_DataHistoryProvider_Base.DataSources;
@@ -27,16 +28,19 @@ namespace C4IT.DataHistoryProvider
public const string constLicenseId = "9CE1A6BE-6A0C-4A27-94A5-44AB997B8E62";
private const string constUrlIsAlive = "m42Services/api/c4itf4sdwebapi/isalive";
private const string constUrlGetTickets = "m42Services/api/c4itf4sdwebapi/getticketlist?sid={0}&hours={1}&queueoption={2}&queues={3}";
private const string constUrlGetTickets = "m42Services/api/c4itf4sdwebapi/getticketlist?sid={0}&hours={1}&queueoption={2}";
private const string constUrlGetTicketsQueuesParam = "&queues={0}";
private const string constUrlGetTicketDetails = "m42Services/api/c4itf4sdwebapi/getticketdetails?objectid={0}";
private const string constUrlGetTicketHistory = "m42Services/api/c4itf4sdwebapi/gettickethistory?objectid={0}";
private const string constUrlGetCreateTicket = "m42Services/api/c4itf4sdwebapi/getdirectlinkcreateticket?sid={0}{1}";
private const string constUrlGetCreateTicketAssetParam = "&assetname={0}";
private const string constUrlUpdateSolution = "m42Services/api/c4itf4sdwebapi/updateactivitysolution/{0}/";
private const string constUrlGetPickupValues = "m42Services/api/c4itf4sdwebapi/getpickup/{0}?group={1}";
private const string constUrlGetRoleMeberships = "m42services/api/c4itf4sdwebapi/getrolememberships/?sid={0}";
private const string constUrlGetDataQueryRelationItems = "m42Services/api/dataquery/relationitems";
private const string constUrlGetDataQueryRelationItemsCount = "m42Services/api/dataquery/relationitems/count";
private const string constUrlGetPickupValues = "m42Services/api/c4itf4sdwebapi/getpickup/{0}?group={1}";
private const string constUrlGetRoleMeberships = "m42services/api/c4itf4sdwebapi/getrolememberships/?sid={0}";
private const string constUrlGetTicketOverviewCounts = "m42Services/api/c4itf4sdwebapi/getticketoverviewcounts?sid={0}&scope={1}&keys={2}";
private const string constUrlGetTicketOverviewRelations = "m42Services/api/c4itf4sdwebapi/getticketoverviewrelations?sid={0}&scope={1}&key={2}&count={3}";
private const string constUrlGetDataQueryRelationItems = "m42Services/api/dataquery/relationitems";
private const string constUrlGetDataQueryRelationItemsCount = "m42Services/api/dataquery/relationitems/count";
private const string constUrlCreateTicket = "m42Services/api/ticket/create?activitytype={0}";
private const string constUrlActivityGetQuickCallTemplateInfo = "m42Services/api/activity/quickcalltemplateinfo/{0}";
private const string constUrlCreateJournalEntry = "m42Services/api/journal/Add";
@@ -106,7 +110,7 @@ namespace C4IT.DataHistoryProvider
public int ExpirationDays { get; set; }
}
public cDataHistoryCollectorM42Wpm(cDataHistoryCollector Collector) : base(Collector, eDataHistoryOrigin.M42Wpm, constConnectorName, constLicenseId)
public cDataHistoryCollectorM42Wpm(cDataHistoryCollector Collector) : base(Collector, enumDataHistoryOrigin.M42Wpm, constConnectorName, constLicenseId)
{
if (Collector.InfrastructureConfig.M42Wpm.Server == null)
return;
@@ -464,18 +468,26 @@ namespace C4IT.DataHistoryProvider
if (!await CheckOnline())
return null;
var objSid = new SecurityIdentifier(UserId.sid, 0);
var strSid = objSid.ToString();
string encodedQueues = string.Join("|",
Collector.InfrastructureConfig.M42Wpm.ActivityQueues.Select(q =>
string.Format("{0}:{1}",
HttpUtility.UrlEncode(q.QueueName),
HttpUtility.UrlEncode(q.QueueID.ToString())
)
)
);
var strUrl = string.Format(constUrlGetTickets, strSid, Collector.InfrastructureConfig.M42Wpm.ClosedTicketHistory, (int)Collector.InfrastructureConfig.M42Wpm.ActivityQueueFilterOption, encodedQueues);
var objSid = new SecurityIdentifier(UserId.sid, 0);
var strSid = objSid.ToString();
var queueOption = (int)Collector.InfrastructureConfig.M42Wpm.ActivityQueueFilterOption;
var strUrl = string.Format(constUrlGetTickets,
strSid,
Collector.InfrastructureConfig.M42Wpm.ClosedTicketHistory,
queueOption);
if (queueOption != 0)
{
var encodedQueues = string.Join("|",
Collector.InfrastructureConfig.M42Wpm.ActivityQueues.Select(q =>
string.Format("{0}:{1}",
HttpUtility.UrlEncode(q.QueueName),
HttpUtility.UrlEncode(q.QueueID.ToString())
)
)
);
strUrl += string.Format(constUrlGetTicketsQueuesParam, encodedQueues);
}
var _wc = await GetWebClient(requestInfo, Token);
var res = await _wc.HttpEnh.GetAsync(strUrl);
@@ -509,11 +521,11 @@ namespace C4IT.DataHistoryProvider
return null;
}
public async Task<List<cF4sdApiSearchResultRelation>> getTicketUsage(List<cF4sdConnectorIds> lstTicketIds, CancellationToken Token, cF4sdWebRequestInfo requestInfo, int LogDeep)
{
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
if (cPerformanceLogger.IsActive && requestInfo != null) { if (CM == null) CM = MethodBase.GetCurrentMethod(); cPerformanceLogger.LogPerformanceStart(LogDeep, CM, requestInfo.id, requestInfo.created); }
var _startTime = DateTime.UtcNow;
public async Task<List<cF4sdApiSearchResultRelation>> getTicketUsage(List<cF4sdConnectorIds> lstTicketIds, CancellationToken Token, cF4sdWebRequestInfo requestInfo, int LogDeep)
{
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
if (cPerformanceLogger.IsActive && requestInfo != null) { if (CM == null) CM = MethodBase.GetCurrentMethod(); cPerformanceLogger.LogPerformanceStart(LogDeep, CM, requestInfo.id, requestInfo.created); }
var _startTime = DateTime.UtcNow;
try
{
@@ -585,9 +597,136 @@ namespace C4IT.DataHistoryProvider
if (cPerformanceLogger.IsActive && requestInfo != null) { cPerformanceLogger.LogPerformanceEnd(LogDeep, CM, requestInfo.id, requestInfo.created, _startTime); }
if (CM != null) LogMethodEnd(CM);
}
return null;
}
return null;
}
public async Task<Dictionary<string, int>> GetTicketOverviewCountsAsync(IEnumerable<string> keys, bool useRoleScope, cF4sdWebRequestInfo requestInfo, int LogDeep, CancellationToken Token)
{
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
if (cPerformanceLogger.IsActive && requestInfo != null) { if (CM == null) CM = MethodBase.GetCurrentMethod(); cPerformanceLogger.LogPerformanceStart(LogDeep, CM, requestInfo.id, requestInfo.created); }
var _startTime = DateTime.UtcNow;
try
{
if (!await CheckOnline())
return new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
var sid = requestInfo?.userInfo?.AdSid;
if (string.IsNullOrWhiteSpace(sid))
return new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
var scope = useRoleScope ? "role" : "personal";
var normalizedKeys = (keys ?? Enumerable.Empty<string>())
.Where(k => !string.IsNullOrWhiteSpace(k))
.Distinct(StringComparer.OrdinalIgnoreCase)
.ToList();
var keyParam = normalizedKeys.Count > 0
? HttpUtility.UrlEncode(string.Join(",", normalizedKeys))
: string.Empty;
var url = string.Format(constUrlGetTicketOverviewCounts, HttpUtility.UrlEncode(sid), scope, keyParam);
var wc = await GetWebClient(requestInfo, Token);
var res = await wc.HttpEnh.GetAsync(url, Token);
if (Token.IsCancellationRequested)
return new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
if (res?.IsSuccessStatusCode == true)
{
var json = await res.Content.ReadAsStringAsync();
if (!string.IsNullOrWhiteSpace(json))
{
var root = JsonConvert.DeserializeObject<JObject>(json);
var countsToken = root?["counts"] as JObject;
var counts = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
if (countsToken != null)
{
foreach (var prop in countsToken.Properties())
{
if (prop?.Name == null)
continue;
var value = prop.Value?.Type == JTokenType.Integer
? prop.Value.Value<int>()
: int.TryParse(prop.Value?.ToString(), out var parsed) ? parsed : 0;
counts[prop.Name] = value;
}
}
return counts;
}
}
StartOnlineValidation();
}
catch (Exception E)
{
LogException(E);
}
finally
{
if (cPerformanceLogger.IsActive && requestInfo != null) { cPerformanceLogger.LogPerformanceEnd(LogDeep, CM, requestInfo.id, requestInfo.created, _startTime); }
if (CM != null) LogMethodEnd(CM);
}
return new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
}
public async Task<List<cF4sdApiSearchResultRelation>> GetTicketOverviewRelationsAsync(string key, bool useRoleScope, int count, cF4sdWebRequestInfo requestInfo, int LogDeep, CancellationToken Token)
{
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
if (cPerformanceLogger.IsActive && requestInfo != null) { if (CM == null) CM = MethodBase.GetCurrentMethod(); cPerformanceLogger.LogPerformanceStart(LogDeep, CM, requestInfo.id, requestInfo.created); }
var _startTime = DateTime.UtcNow;
try
{
if (!await CheckOnline())
return new List<cF4sdApiSearchResultRelation>();
if (string.IsNullOrWhiteSpace(key))
return new List<cF4sdApiSearchResultRelation>();
var sid = requestInfo?.userInfo?.AdSid;
if (string.IsNullOrWhiteSpace(sid))
return new List<cF4sdApiSearchResultRelation>();
var scope = useRoleScope ? "role" : "personal";
var url = string.Format(
constUrlGetTicketOverviewRelations,
HttpUtility.UrlEncode(sid),
scope,
HttpUtility.UrlEncode(key),
Math.Max(0, count)
);
var wc = await GetWebClient(requestInfo, Token);
var res = await wc.HttpEnh.GetAsync(url, Token);
if (Token.IsCancellationRequested)
return new List<cF4sdApiSearchResultRelation>();
if (res?.IsSuccessStatusCode == true)
{
var json = await res.Content.ReadAsStringAsync();
if (!string.IsNullOrWhiteSpace(json))
{
var relations = JsonConvert.DeserializeObject<List<cF4sdApiSearchResultRelation>>(json);
if (relations != null)
return relations;
}
}
StartOnlineValidation();
}
catch (Exception E)
{
LogException(E);
}
finally
{
if (cPerformanceLogger.IsActive && requestInfo != null) { cPerformanceLogger.LogPerformanceEnd(LogDeep, CM, requestInfo.id, requestInfo.created, _startTime); }
if (CM != null) LogMethodEnd(CM);
}
return new List<cF4sdApiSearchResultRelation>();
}
public override async Task<List<cF4SDHealthCardRawData.cHealthCardTable>> GetTableResultsVirtualAsync(List<cDataHistoryConfigTable> Tables, Dictionary<enumFasdInformationClass, cF4sdConnectorIds> Identities, DateTime RefTime, int MaxAge, bool instantly, Guid? CacheId, CancellationToken Token, cF4sdWebRequestInfo requestInfo, int LogDeep)
{
@@ -600,10 +739,10 @@ namespace C4IT.DataHistoryProvider
if (!await CheckOnline())
return null;
var bMainExists = Tables.Exists(v => v.Name == constTableNameTicketDetails && v.ParentCluster?.Origin == eDataHistoryOrigin.M42Wpm);
var bHistoryExists = Tables.Exists(v => v.Name == constTableNameTicketHistory && v.ParentCluster?.Origin == eDataHistoryOrigin.M42Wpm);
var bUserInfoExists = Tables.Exists(v => v.Name == constTableNameUserTicket && v.ParentCluster?.Origin == eDataHistoryOrigin.M42Wpm);
var bPickupsExists = Tables.Exists(v => v.ParentCluster?.Origin == eDataHistoryOrigin.M42Wpm && v.SubTables?.Count == 1 && v.SubTables.Values.First().Template is cDataHistoryConfigQueryTemplateM42Pickup);
var bMainExists = Tables.Exists(v => v.Name == constTableNameTicketDetails && v.ParentCluster?.Origin == enumDataHistoryOrigin.M42Wpm);
var bHistoryExists = Tables.Exists(v => v.Name == constTableNameTicketHistory && v.ParentCluster?.Origin == enumDataHistoryOrigin.M42Wpm);
var bUserInfoExists = Tables.Exists(v => v.Name == constTableNameUserTicket && v.ParentCluster?.Origin == enumDataHistoryOrigin.M42Wpm);
var bPickupsExists = Tables.Exists(v => v.ParentCluster?.Origin == enumDataHistoryOrigin.M42Wpm && v.SubTables?.Count == 1 && v.SubTables.Values.First().Template is cDataHistoryConfigQueryTemplateM42Pickup);
if (!bMainExists && !bHistoryExists && !bUserInfoExists && !bPickupsExists)
return null;
@@ -629,7 +768,7 @@ namespace C4IT.DataHistoryProvider
{
foreach (var _table in Tables)
{
if (_table.ParentCluster?.Origin != eDataHistoryOrigin.M42Wpm)
if (_table.ParentCluster?.Origin != enumDataHistoryOrigin.M42Wpm)
continue;
if (!(_table.SubTables.Values.First()?.Template is cDataHistoryConfigQueryTemplateM42Pickup))
continue;
@@ -653,12 +792,13 @@ namespace C4IT.DataHistoryProvider
{
Name = constTableNameTicketHistory,
InformationClass = enumFasdInformationClass.Ticket,
Origin = enumDataHistoryOrigin.M42Wpm,
IsIncomplete = true
});
foreach (var _table in Tables)
{
if (_table.ParentCluster?.Origin != eDataHistoryOrigin.M42Wpm)
if (_table.ParentCluster?.Origin != enumDataHistoryOrigin.M42Wpm)
continue;
if (!(_table.SubTables.Values.First()?.Template is cDataHistoryConfigQueryTemplateM42Pickup))
continue;
@@ -667,6 +807,7 @@ namespace C4IT.DataHistoryProvider
{
Name = _table.Name,
InformationClass = _table.ParentCluster.InformationClass,
Origin = _table.ParentCluster.Origin,
IsIncomplete = true
});
}
@@ -721,6 +862,7 @@ namespace C4IT.DataHistoryProvider
{
Name = constTableNameTicketDetails,
InformationClass = enumFasdInformationClass.Ticket,
Origin = enumDataHistoryOrigin.M42Wpm,
IsStatic = true,
TableType = eDataHistoryTableType.Static
};
@@ -757,7 +899,7 @@ namespace C4IT.DataHistoryProvider
objVal = ConvertToF4sdType(objVal, colInfo.ValueType);
var _col = new cF4SDHealthCardRawData.cHealthCardTableColumn() { ColumnName = colInfo.Name, Values = new List<object>(1) { objVal } };
var _col = new cF4SDHealthCardRawData.cHealthCardTableColumn(retVal) { ColumnName = colInfo.Name, Values = new List<object>(1) { objVal } };
if (colInfo.IsWritable && colInfo.SourceName == "SolutionHtml")
_col.IsWritable = true;
@@ -875,6 +1017,7 @@ namespace C4IT.DataHistoryProvider
{
Name = constTableNameTicketHistory,
InformationClass = enumFasdInformationClass.Ticket,
Origin = enumDataHistoryOrigin.M42Wpm,
IsStatic = false,
TableType = eDataHistoryTableType.HistoryEvents
};
@@ -884,7 +1027,7 @@ namespace C4IT.DataHistoryProvider
foreach (var colInfo in M42TableDetails.Columns.Values)
{
retVal.Columns[colInfo.Name] = new cF4SDHealthCardRawData.cHealthCardTableColumn()
retVal.Columns[colInfo.Name] = new cF4SDHealthCardRawData.cHealthCardTableColumn(retVal)
{
ColumnName = colInfo.Name,
Values = new List<object>(hLength)
@@ -989,6 +1132,7 @@ namespace C4IT.DataHistoryProvider
{
Name = constTableNameUserTicket,
InformationClass = enumFasdInformationClass.User,
Origin = enumDataHistoryOrigin.M42Wpm,
IsStatic = true,
TableType = eDataHistoryTableType.Static
};
@@ -1023,7 +1167,7 @@ namespace C4IT.DataHistoryProvider
objVal = ConvertToF4sdType(objVal, colInfo.ValueType);
retVal.Columns[colInfo.Name] = new cF4SDHealthCardRawData.cHealthCardTableColumn() { ColumnName = colInfo.Name, Values = new List<object>(1) { objVal } };
retVal.Columns[colInfo.Name] = new cF4SDHealthCardRawData.cHealthCardTableColumn(retVal) { ColumnName = colInfo.Name, Values = new List<object>(1) { objVal } };
}
catch { }
}
@@ -1088,6 +1232,7 @@ namespace C4IT.DataHistoryProvider
{
Name = TableConfig.Name,
InformationClass = enumFasdInformationClass.User,
Origin = enumDataHistoryOrigin.M42Wpm,
IsStatic = true,
TableType = eDataHistoryTableType.Static
};
@@ -1100,7 +1245,7 @@ namespace C4IT.DataHistoryProvider
var _i = 0;
foreach (var _colInfo in TableConfig.Columns.Values)
{
var _col = new cF4SDHealthCardRawData.cHealthCardTableColumn() { ColumnName = _colInfo.Name };
var _col = new cF4SDHealthCardRawData.cHealthCardTableColumn(retVal) { ColumnName = _colInfo.Name };
retVal.Columns[_colInfo.Name] = _col;
_dicColInfo[_colInfo.SourceName] = _colInfo;
_dicIndex[_colInfo.SourceName] = _i;
@@ -1693,6 +1838,7 @@ namespace C4IT.DataHistoryProvider
{
Name = Table.Name,
InformationClass = Table.ParentCluster.InformationClass,
Origin = Table.ParentCluster.Origin,
IsStatic = false,
TableType = Table.Type
};
@@ -1700,7 +1846,7 @@ namespace C4IT.DataHistoryProvider
var _dicColInfo = Table.Columns.ToDictionary(v => v.Value.SourceName, v => v.Value);
foreach (var colInfo in Table.Columns.Values)
{
retVal.Columns[colInfo.Name] = new cF4SDHealthCardRawData.cHealthCardTableColumn() { ColumnName = colInfo.Name, Values = new List<object>(_valueCount) };
retVal.Columns[colInfo.Name] = new cF4SDHealthCardRawData.cHealthCardTableColumn(retVal) { ColumnName = colInfo.Name, Values = new List<object>(_valueCount) };
}
foreach (var _entry in ticketInfos)
@@ -2114,22 +2260,124 @@ namespace C4IT.DataHistoryProvider
await CreateM42JournalAsync(journalEntry, requestInfo, LogDeep + 1, token);
if (token.IsCancellationRequested) return null;
if (ticketInfo.QuickActionHistory != null)
foreach (var entry in ticketInfo.QuickActionHistory)
try
{
if (ticketInfo.SupportCaseProtocollEntries != null)
{
cCreateJournalEntryInfo _entry = null;
switch (entry.ResultCode)
{
case -1:
case 1:
case 0:
var entryType = entry.wasRunningOnAffectedDevice ? 20602 : 20601;
_entry = new cCreateJournalEntryInfo()
await ProtocollSupportCaseProtocollEntries(ticketInfo.SupportCaseProtocollEntries, TicketId, requestInfo, LogDeep, token);
}
else if (ticketInfo.QuickActionHistory != null)
{
await ProtocollSupportCaseQuickActionHistory(ticketInfo.QuickActionHistory, TicketId, requestInfo, LogDeep, token);
}
if (token.IsCancellationRequested)
return null;
}
catch (TaskCanceledException)
{
return null;
}
ticketInfo.Ticket = TicketId;
await UpdateM42TicketUnreadAsync(ticketInfo, requestInfo, LogDeep + 1, token);
return TicketId.ToString();
}
}
catch (Exception e)
{
LogException(e);
}
finally
{
if (cPerformanceLogger.IsActive && requestInfo != null) { cPerformanceLogger.LogPerformanceEnd(LogDeep, CM, requestInfo.id, requestInfo.created, _startTime); }
if (CM != null) LogMethodEnd(CM);
}
return null;
}
private async Task ProtocollSupportCaseProtocollEntries(List<ProtocollEntryBase> supportCaseProtocollEntries, Guid ticketId, cF4sdWebRequestInfo requestInfo, int logDeep, CancellationToken token)
{
foreach (var protocollEntry in supportCaseProtocollEntries)
{
if (!(protocollEntry is QuickActionProtocollEntry entry))
continue;
cCreateJournalEntryInfo _entry = null;
switch (entry.ResultCode)
{
case -1:
case 1:
case 0:
var entryType = entry.WasRunningOnAffectedDevice ? 20602 : 20601;
_entry = new cCreateJournalEntryInfo()
{
Comments = "",
ObjectId = ticketId,
EntryType = entryType,
Parameters = new List<cCreateJournalEntryInfo.Parameter>() { new cCreateJournalEntryInfo.Parameter()
{
Comments = "",
ObjectId = TicketId,
EntryType = entryType,
Parameters = new List<cCreateJournalEntryInfo.Parameter>() { new cCreateJournalEntryInfo.Parameter()
Name = "result",
Value = entry.HtmlContent ?? entry.MeasureValues ?? entry.ErrorMessage
},
new cCreateJournalEntryInfo.Parameter()
{
Name = "quickActionName",
Value = entry.Name
},
new cCreateJournalEntryInfo.Parameter()
{
Name = "QuickActionId",
Value = entry.Id
},
new cCreateJournalEntryInfo.Parameter()
{
Name = "quickActionExecutionType",
Value = entry.ExecutionTypeId
},
new cCreateJournalEntryInfo.Parameter()
{
Name = "ExecutionTime",
Value = entry.Time
},
new cCreateJournalEntryInfo.Parameter()
{
Name = "AffectedDeviceName",
Value = entry.AffectedDeviceName
},}
};
break;
default:
break;
}
if (_entry != null)
{
await CreateM42JournalAsync(_entry, requestInfo, logDeep + 1, token);
if (token.IsCancellationRequested) return;
}
}
}
private async Task ProtocollSupportCaseQuickActionHistory(List<cQuickActionResult> quickActionHistory, Guid ticketId, cF4sdWebRequestInfo requestInfo, int logDeep, CancellationToken token)
{
foreach (var entry in quickActionHistory)
{
cCreateJournalEntryInfo _entry = null;
switch (entry.ResultCode)
{
case -1:
case 1:
case 0:
var entryType = entry.wasRunningOnAffectedDevice ? 20602 : 20601;
_entry = new cCreateJournalEntryInfo()
{
Comments = "",
ObjectId = ticketId,
EntryType = entryType,
Parameters = new List<cCreateJournalEntryInfo.Parameter>() { new cCreateJournalEntryInfo.Parameter()
{
Name = "result",
Value = entry.Output ?? entry.MeasureValues ?? entry.ErrorMessage
@@ -2159,35 +2407,17 @@ namespace C4IT.DataHistoryProvider
Name = "AffectedDeviceName",
Value = entry.AffectedDeviceName
},}
};
break;
default:
break;
}
if (_entry != null)
{
await CreateM42JournalAsync(_entry, requestInfo, LogDeep + 1, token);
if (token.IsCancellationRequested) return null;
}
}
ticketInfo.Ticket = TicketId;
await UpdateM42TicketUnreadAsync(ticketInfo, requestInfo, LogDeep + 1, token);
return TicketId.ToString();
};
break;
default:
break;
}
if (_entry != null)
{
await CreateM42JournalAsync(_entry, requestInfo, logDeep + 1, token);
if (token.IsCancellationRequested) return;
}
}
catch (Exception e)
{
LogException(e);
}
finally
{
if (cPerformanceLogger.IsActive && requestInfo != null) { cPerformanceLogger.LogPerformanceEnd(LogDeep, CM, requestInfo.id, requestInfo.created, _startTime); }
if (CM != null) LogMethodEnd(CM);
}
return null;
}
public async Task<string> UpdateM42TicketAsync(cApiM42Ticket ticketInfo, cF4sdWebRequestInfo requestInfo, int LogDeep, CancellationToken token)
@@ -2332,16 +2562,19 @@ namespace C4IT.DataHistoryProvider
await CreateM42JournalAsync(_entry, requestInfo, LogDeep + 1, token);
if (token.IsCancellationRequested) return null;
}
if (ticketInfo.QuickActionHistory != null)
if (ticketInfo.SupportCaseProtocollEntries != null)
{
foreach (var entry in ticketInfo.QuickActionHistory)
foreach (var protocollEntry in ticketInfo.SupportCaseProtocollEntries)
{
if (!(protocollEntry is QuickActionProtocollEntry entry))
continue;
switch (entry.ResultCode)
{
case -1:
case 1:
case 0:
var entryType = entry.wasRunningOnAffectedDevice ? 20602 : 20601;
var entryType = entry.WasRunningOnAffectedDevice ? 20602 : 20601;
_entry = new cCreateJournalEntryInfo()
{
Comments = "",
@@ -2350,27 +2583,27 @@ namespace C4IT.DataHistoryProvider
Parameters = new List<cCreateJournalEntryInfo.Parameter>() { new cCreateJournalEntryInfo.Parameter()
{
Name = "result",
Value = entry.Output ?? entry.MeasureValues ?? entry.ErrorMessage
Value = entry.HtmlContent ?? entry.MeasureValues ?? entry.ErrorMessage
},
new cCreateJournalEntryInfo.Parameter()
{
Name = "quickActionName",
Value = entry.QuickActionName
Value = entry.Name
},
new cCreateJournalEntryInfo.Parameter()
{
Name = "QuickActionId",
Value = entry.QuickActionId
Value = entry.Id
},
new cCreateJournalEntryInfo.Parameter()
{
Name = "quickActionExecutionType",
Value = entry.QuickActionExecutionType
Value = entry.ExecutionTypeId
},
new cCreateJournalEntryInfo.Parameter()
{
Name = "ExecutionTime",
Value = entry.ExecutionTime
Value = entry.Time
},
new cCreateJournalEntryInfo.Parameter()
{

View File

@@ -22,7 +22,7 @@ namespace C4IT.DataHistoryProvider
public cNxqlColumnsValidationResult LastValidationResults = null;
public cDataHistoryCollectorNxql(cDataHistoryCollector Collector) : base(Collector, eDataHistoryOrigin.NexthinkNxql, constConnectorName, constLicenseId)
public cDataHistoryCollectorNxql(cDataHistoryCollector Collector) : base(Collector, enumDataHistoryOrigin.NexthinkNxql, constConnectorName, constLicenseId)
{
}
@@ -644,6 +644,7 @@ namespace C4IT.DataHistoryProvider
{
Name = Table.Name,
InformationClass = Table.ParentCluster.InformationClass,
Origin = Table.ParentCluster.Origin,
IsIncomplete = true
}); ;
}
@@ -769,7 +770,7 @@ namespace C4IT.DataHistoryProvider
}
else
{
SqlValueEntry = new cF4SDHealthCardRawData.cHealthCardTableColumn()
SqlValueEntry = new cF4SDHealthCardRawData.cHealthCardTableColumn(SqlValues)
{
ColumnName = DailyValueEntry.Key,
Values = new List<object>(1) { DailyValueEntry.Value }
@@ -822,10 +823,11 @@ namespace C4IT.DataHistoryProvider
else
{
if (DefaultLogger.IsDebug) LogEntry($"No valid SQL data found for NXQL results for table '{TableName}', creating a new table result with todays values only", LogLevels.Debug);
var TableResult = new cF4SDHealthCardRawData.cHealthCardTable
var TableResult = new cF4SDHealthCardRawData.cHealthCardTable()
{
Name = TableName,
InformationClass = DailyValues.InformationClass,
Origin = enumDataHistoryOrigin.NexthinkNxql,
IsIncomplete = true,
IsStatic = false,
TableType = eDataHistoryTableType.History,
@@ -836,7 +838,7 @@ namespace C4IT.DataHistoryProvider
foreach (var ColEntry in DailyValues)
{
var _col = new cF4SDHealthCardRawData.cHealthCardTableColumn
var _col = new cF4SDHealthCardRawData.cHealthCardTableColumn(TableResult)
{
ColumnName = ColEntry.Key,
Values = new List<object>(1) { ColEntry.Value }
@@ -901,7 +903,7 @@ namespace C4IT.DataHistoryProvider
var indexServer = 0;
foreach (var Table in Collector.ClusterConfig.Tables.Values)
{
if (Table.ParentCluster.Origin != eDataHistoryOrigin.NexthinkNxql)
if (Table.ParentCluster.Origin != enumDataHistoryOrigin.NexthinkNxql)
continue;
foreach (var SubTable in Table.SubTables.Values)
@@ -1182,7 +1184,7 @@ namespace C4IT.DataHistoryProvider
foreach (var Table in Collector.ClusterConfig.Tables.Values)
{
if (Table.ParentCluster.Origin != eDataHistoryOrigin.NexthinkNxql)
if (Table.ParentCluster.Origin != enumDataHistoryOrigin.NexthinkNxql)
continue;
foreach (var SubTable in Table.SubTables.Values)
@@ -1435,7 +1437,7 @@ namespace C4IT.DataHistoryProvider
foreach (var Table in Tables)
{
if (!(Table.ParentCluster.Origin == eDataHistoryOrigin.NexthinkNxql))
if (!(Table.ParentCluster.Origin == enumDataHistoryOrigin.NexthinkNxql))
continue;
if (Table.ParentCluster.InformationClass != InfoClass)
@@ -1804,7 +1806,7 @@ namespace C4IT.DataHistoryProvider
{
foreach (var Table in Collector.ClusterConfig.Tables.Values)
{
if (!(Table.ParentCluster.Origin == eDataHistoryOrigin.NexthinkNxql))
if (!(Table.ParentCluster.Origin == enumDataHistoryOrigin.NexthinkNxql))
continue;
if (Table.Cached == eDataHistoryTableCached.No && FileSavePath == null)

View File

@@ -511,6 +511,9 @@ namespace C4IT.DataHistoryProvider
public bool ScanIntuneDevices { get; private set; } = false;
public bool WithMobileDevices { get; private set; } = false;
public string ScanFilter { get; private set; } = "";
public bool UseConsistencyLevelEventual { get; private set; } = false;
internal cDataHistoryAzureTenant(XmlElement XNode, Dictionary<string, cCredential> Credentials, cXmlParser Parser)
{
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
@@ -544,6 +547,22 @@ namespace C4IT.DataHistoryProvider
ScanIntuneDevices = cXmlParser.GetBoolFromXmlAttribute(XNode, "ScanIntuneDevices");
WithMobileDevices = cXmlParser.GetBoolFromXmlAttribute(XNode, "WithMobileDevices");
var XFilterNode = XNode.SelectSingleNode("Azure-Scan-Filter");
if (XFilterNode is XmlElement XFilter)
{
Parser.EnterElement("Azure-AD");
try
{
ScanFilter = XFilter.SelectSingleNode("text()")?.Value;
UseConsistencyLevelEventual = cXmlParser.GetBoolFromXmlAttribute(XFilter, "UseConsistencyLevelEventual");
}
finally
{
Parser.LeaveElement("Azure-AD");
}
}
IsValid = true;
}
catch (Exception E)

View File

@@ -16,19 +16,6 @@ using static C4IT.Logging.cLogManager;
namespace C4IT.DataHistoryProvider
{
public enum eDataHistoryOrigin
{
Unknown = 0,
Main = 1,
F4sdAgent = 2,
NexthinkNxql = 3,
ActiveDirectory = 4,
AzureAD = 5,
M42Wpm = 6,
Intune= 7,
Citrix = 8
}
public enum eDataHistoryTableCached { Default = 0, Yes = 1, No = 2 };
public enum eDataHistoryQueryType { Query = 0, Static = 1 }
@@ -645,7 +632,7 @@ namespace C4IT.DataHistoryProvider
[JsonIgnore]
public cDataHistoryConfigClusters ParentConfig { get; protected set; } = null;
public eDataHistoryOrigin Origin { get; protected set; } = eDataHistoryOrigin.Unknown;
public enumDataHistoryOrigin Origin { get; protected set; } = enumDataHistoryOrigin.Unknown;
public enumFasdInformationClass InformationClass { get; protected set; } = enumFasdInformationClass.Unknown;
@@ -675,8 +662,8 @@ namespace C4IT.DataHistoryProvider
return;
}
Origin = cXmlParser.GetEnumFromAttribute<eDataHistoryOrigin>(XNode, "Origin", eDataHistoryOrigin.Unknown);
if (Origin == eDataHistoryOrigin.Unknown)
Origin = cXmlParser.GetEnumFromAttribute<enumDataHistoryOrigin>(XNode, "Origin", enumDataHistoryOrigin.Unknown);
if (Origin == enumDataHistoryOrigin.Unknown)
{
Parser.AddMessage(XNode, $"The <DataCluster> element with Name='{Name}' has no valid 'Type' attribute.", LogLevels.Error);
return;
@@ -787,7 +774,7 @@ namespace C4IT.DataHistoryProvider
IsValid = true;
Name = "Main";
Origin = eDataHistoryOrigin.Main;
Origin = enumDataHistoryOrigin.Main;
InformationClass = enumFasdInformationClass.Main;
ParentConfig = Config;
@@ -892,10 +879,10 @@ namespace C4IT.DataHistoryProvider
ParentCluster = Cluster;
if (Cluster.Origin == eDataHistoryOrigin.Main && XNode.Name == "InformationClass")
if (Cluster.Origin == enumDataHistoryOrigin.Main && XNode.Name == "InformationClass")
IsBuildInTable = true;
if (Cluster.Origin == eDataHistoryOrigin.F4sdAgent || Cluster.Origin == eDataHistoryOrigin.M42Wpm || Cluster.Origin == eDataHistoryOrigin.Intune || Cluster.Origin == eDataHistoryOrigin.Citrix)
if (Cluster.Origin == enumDataHistoryOrigin.F4sdAgent || Cluster.Origin == enumDataHistoryOrigin.M42Wpm || Cluster.Origin == enumDataHistoryOrigin.Intune || Cluster.Origin == enumDataHistoryOrigin.Citrix)
IsVirtual = true;
Name = cXmlParser.GetStringFromXmlAttribute(XNode, "Name");

View File

@@ -301,7 +301,7 @@ namespace C4IT.DataHistoryProvider
RetVal |= DoXmlInsertElement(XmlRoot
, "TicketConfiguration"
, "OverviewPollingRole"
, $"<OverviewPollingRole Policy=\"Hidden\" Value=\"{cF4sdTicketConfig.DefaultOverviewPollingRoles}\" />"
, $"<OverviewPollingRole Policy=\"Hidden\" Value=\"{cF4sdTicketConfig.DefaultOverviewPollingRole}\" />"
);
#pragma warning disable CS0618 // Type or member is obsolete
var oldShowDocumentCaseDialog = InfrastructureConfig?.M42Wpm?.ShowDocumentCaseDialog ?? enumShowDocumentCaseDialog.ifRequired;

View File

@@ -162,18 +162,25 @@
</COMReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="C4IT.F4SD.DisplayFormatting" Version="1.0.0" />
<PackageReference Include="C4IT.F4SD.SupportCaseProtocoll" Version="1.0.0" />
<PackageReference Include="MaterialIcons" Version="1.0.3" NoWarn="NU1701" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.1.0" />
<PackageReference Include="Microsoft.Bcl.TimeProvider" Version="10.0.2" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.1.4" />
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.DirectoryServices" Version="9.0.7" />
<PackageReference Include="System.DirectoryServices.AccountManagement" Version="9.0.7" />
<PackageReference Include="System.DirectoryServices.Protocols" Version="9.0.7" />
<PackageReference Include="System.Drawing.Common" Version="9.0.7" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.13.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="System.DirectoryServices" Version="10.0.2" />
<PackageReference Include="System.DirectoryServices.AccountManagement" Version="10.0.2" />
<PackageReference Include="System.DirectoryServices.Protocols" Version="10.0.2" />
<PackageReference Include="System.Drawing.Common" Version="10.0.2" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.15.0" />
<PackageReference Include="System.IO.Pipelines" Version="10.0.2" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.1.2" />
<PackageReference Include="System.Security.Permissions" Version="9.0.7" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="9.0.7" />
<PackageReference Include="System.Security.Permissions" Version="10.0.2" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="10.0.2" />
<PackageReference Include="System.Text.Encodings.Web" Version="10.0.2" />
<PackageReference Include="System.Text.Json" Version="10.0.2" />
<PackageReference Include="System.ValueTuple" Version="4.6.1" />
</ItemGroup>
<Target Name="AfterBuild" AfterTargets="Build">
<PropertyGroup>