aktueller stand
This commit is contained in:
@@ -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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user