aktueller stand
This commit is contained in:
Binary file not shown.
@@ -46,16 +46,18 @@ namespace C4IT.DataHistoryProvider
|
||||
private const string constUrlActivityGetQuickCallTemplateInfo = "m42Services/api/activity/quickcalltemplateinfo/{0}";
|
||||
private const string constUrlCreateJournalEntry = "m42Services/api/journal/Add";
|
||||
private const string constUrlFragmentsGetList = "m42Services/api/data/fragments/{0}?where={1}&columns={2}&pagesize={3}&pagenumber={4}&sort={5}";
|
||||
private const string constUrlObjectsGetObject = "m42Services/api/data/objects/{0}/{1}?full={2}";
|
||||
private const string constUrlObjectsUpdateObject = "m42Services/api/data/objects/{0}?full={1}";
|
||||
private const string constUrlTicketClose = "m42Services/api/ticket/close";
|
||||
private const string constUrlObjectsGetObject = "m42Services/api/data/objects/{0}/{1}?full={2}";
|
||||
private const string constUrlObjectsUpdateObject = "m42Services/api/data/objects/{0}?full={1}";
|
||||
private const string constUrlTicketClose = "m42Services/api/ticket/close";
|
||||
private const string constUrlActivityPause = "m42Services/api/activity/Pause";
|
||||
private const string constUrlActivityForward = "m42Services/api/activity/Forward";
|
||||
private const string constUrlActivityTrackWorkingTime = "m42Services/api/activity/trackworkingtime";
|
||||
private const string constUrlTicketTransform = "m42Services/api/ticket/transform";
|
||||
private const string constUrlActivityReopen = "m42Services/api/activity/reopen";
|
||||
private const string constUrlGenerateApiTokenForMe = "m42Services/api/apitoken/generateapitokenforme";
|
||||
private const string constUrlGenerateAccessTokenFromApiToken = "m42Services/api/apitoken/generateaccesstokenfromapitoken";
|
||||
private const string constUrlGenerateApiTokenForMe = "m42Services/api/apitoken/generateapitokenforme";
|
||||
private const string constUrlGenerateAccessTokenFromApiToken = "m42Services/api/apitoken/generateaccesstokenfromapitoken";
|
||||
private const string constActivityTypeTicket = "SPSActivityTypeTicket";
|
||||
private static readonly Guid constActivityTypeTicketTypeId = new Guid("13F950A8-F2F8-E611-E182-60E327035D31");
|
||||
|
||||
|
||||
public const string constTableNameTicketDetails = "M42Wpm-Tickets";
|
||||
@@ -3258,27 +3260,30 @@ namespace C4IT.DataHistoryProvider
|
||||
Guid.TryParse(res, out ticketId);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
await UpdateM42TicketAsync(ticketInfo, requestInfo, LogDeep + 1, token);
|
||||
if (token.IsCancellationRequested) return null;
|
||||
|
||||
ticketId = (Guid)ticketInfo.Ticket;
|
||||
}
|
||||
|
||||
bool isTicket = false;
|
||||
if (ticketInfo.AdditionalValues.TryGetValue("IsTicket", out object value) && value is bool boolValue)
|
||||
{
|
||||
isTicket = boolValue;
|
||||
if (isTicket)
|
||||
{
|
||||
await TransformM42TicketAsync(ticketInfo, requestInfo, LogDeep + 1, token);
|
||||
}
|
||||
}
|
||||
|
||||
var url = constUrlTicketClose;
|
||||
var ticket = new cApiM42TicketClosureInfo()
|
||||
{
|
||||
else
|
||||
{
|
||||
await UpdateM42TicketAsync(ticketInfo, requestInfo, LogDeep + 1, token);
|
||||
if (token.IsCancellationRequested) return null;
|
||||
|
||||
ticketId = (Guid)ticketInfo.Ticket;
|
||||
}
|
||||
|
||||
if ((!ticketInfo.Ticket.HasValue || ticketInfo.Ticket.Value == Guid.Empty) && ticketId != Guid.Empty)
|
||||
{
|
||||
ticketInfo.Ticket = ticketId;
|
||||
}
|
||||
|
||||
var isTicket = await ResolveIsTicketAsync(ticketInfo, ticketId, requestInfo, LogDeep + 1, token);
|
||||
if (token.IsCancellationRequested) return null;
|
||||
|
||||
if (isTicket)
|
||||
{
|
||||
await TransformM42TicketAsync(ticketInfo, requestInfo, LogDeep + 1, token);
|
||||
}
|
||||
|
||||
var url = constUrlTicketClose;
|
||||
var ticket = new cApiM42TicketClosureInfo()
|
||||
{
|
||||
ObjectIds = new List<Guid>() { ticketId },
|
||||
Comments = ticketInfo.SolutionHtml,
|
||||
ErrorType = (int)ticketInfo.ErrorType == -1 ? null : ticketInfo.ErrorType,
|
||||
@@ -3430,10 +3435,10 @@ namespace C4IT.DataHistoryProvider
|
||||
|
||||
return false;
|
||||
}
|
||||
public async Task<string> TransformM42TicketAsync(cApiM42Ticket ticketInfo, 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); }
|
||||
public async Task<string> TransformM42TicketAsync(cApiM42Ticket ticketInfo, 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
|
||||
@@ -3478,13 +3483,110 @@ namespace C4IT.DataHistoryProvider
|
||||
if (cPerformanceLogger.IsActive && requestInfo != null) { cPerformanceLogger.LogPerformanceEnd(LogDeep, CM, requestInfo.id, requestInfo.created, _startTime); }
|
||||
if (CM != null) LogMethodEnd(CM);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public async Task<dynamic> GetQuickCallTemplateInfoAsync(Guid quickCallId, 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); }
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private async Task<bool> IsTicketActivityAsync(Guid ticketId, 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 (ticketId == Guid.Empty)
|
||||
return false;
|
||||
|
||||
var fragments = await GetFragmentListAsync(new cDataFragmentsParams()
|
||||
{
|
||||
Columns = "TypeID",
|
||||
Ddname = "SPSCommonClassBase",
|
||||
Pagenumber = 0,
|
||||
Pagesize = 1,
|
||||
Where = string.Format("[Expression-ObjectId] = '{0}'", ticketId),
|
||||
Sort = "TypeID"
|
||||
}, requestInfo, logDeep + 1, token);
|
||||
|
||||
if (token.IsCancellationRequested || fragments == null || fragments.Count == 0)
|
||||
return false;
|
||||
|
||||
var activityTypeRawValue = fragments[0]?.TypeID;
|
||||
Guid activityTypeId = Guid.Empty;
|
||||
if (activityTypeRawValue is Guid guidValue)
|
||||
{
|
||||
activityTypeId = guidValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
var activityTypeText = Convert.ToString(activityTypeRawValue);
|
||||
Guid.TryParse(activityTypeText, out activityTypeId);
|
||||
}
|
||||
|
||||
if (activityTypeId == Guid.Empty)
|
||||
return false;
|
||||
|
||||
return activityTypeId == constActivityTypeTicketTypeId;
|
||||
}
|
||||
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 false;
|
||||
}
|
||||
|
||||
private async Task<bool> ResolveIsTicketAsync(cApiM42Ticket ticketInfo, Guid ticketId, cF4sdWebRequestInfo requestInfo, int logDeep, CancellationToken token)
|
||||
{
|
||||
if (ticketInfo != null && ticketInfo.AdditionalValues != null)
|
||||
{
|
||||
object additionalValue;
|
||||
if (ticketInfo.AdditionalValues.TryGetValue("IsTicket", out additionalValue) && additionalValue is bool boolValue && boolValue)
|
||||
return true;
|
||||
|
||||
if (ticketInfo.AdditionalValues.TryGetValue("TypeID", out additionalValue) && IsTicketActivityTypeValue(additionalValue))
|
||||
return true;
|
||||
|
||||
if (ticketInfo.AdditionalValues.TryGetValue("ActivityType", out additionalValue) && IsTicketActivityTypeValue(additionalValue))
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ticketId == Guid.Empty)
|
||||
return false;
|
||||
|
||||
return await IsTicketActivityAsync(ticketId, requestInfo, logDeep, token);
|
||||
}
|
||||
|
||||
private static bool IsTicketActivityTypeValue(object activityTypeValue)
|
||||
{
|
||||
if (activityTypeValue == null)
|
||||
return false;
|
||||
|
||||
if (activityTypeValue is Guid guidValue)
|
||||
return guidValue == constActivityTypeTicketTypeId;
|
||||
|
||||
var activityTypeText = activityTypeValue as string;
|
||||
if (string.IsNullOrWhiteSpace(activityTypeText))
|
||||
activityTypeText = Convert.ToString(activityTypeValue);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(activityTypeText))
|
||||
return false;
|
||||
|
||||
Guid activityTypeGuid;
|
||||
if (Guid.TryParse(activityTypeText, out activityTypeGuid))
|
||||
return activityTypeGuid == constActivityTypeTicketTypeId;
|
||||
|
||||
return string.Equals(activityTypeText, constActivityTypeTicket, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
public async Task<dynamic> GetQuickCallTemplateInfoAsync(Guid quickCallId, 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
|
||||
@@ -3596,27 +3698,30 @@ namespace C4IT.DataHistoryProvider
|
||||
Guid.TryParse(res, out ticketId);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
await UpdateM42TicketAsync(ticketInfo, requestInfo, LogDeep + 1, token);
|
||||
if (token.IsCancellationRequested) return null;
|
||||
|
||||
ticketId = (Guid)ticketInfo.Ticket;
|
||||
}
|
||||
|
||||
bool isTicket = false;
|
||||
if (ticketInfo.AdditionalValues.TryGetValue("IsTicket", out object value) && value is bool boolValue)
|
||||
{
|
||||
isTicket = boolValue;
|
||||
if (isTicket)
|
||||
{
|
||||
await TransformM42TicketAsync(ticketInfo, requestInfo, LogDeep + 1, token);
|
||||
}
|
||||
}
|
||||
|
||||
var url = constUrlActivityPause;
|
||||
var ticket = new cApiM42TicketPauseInfo()
|
||||
{
|
||||
else
|
||||
{
|
||||
await UpdateM42TicketAsync(ticketInfo, requestInfo, LogDeep + 1, token);
|
||||
if (token.IsCancellationRequested) return null;
|
||||
|
||||
ticketId = (Guid)ticketInfo.Ticket;
|
||||
}
|
||||
|
||||
if ((!ticketInfo.Ticket.HasValue || ticketInfo.Ticket.Value == Guid.Empty) && ticketId != Guid.Empty)
|
||||
{
|
||||
ticketInfo.Ticket = ticketId;
|
||||
}
|
||||
|
||||
var isTicket = await ResolveIsTicketAsync(ticketInfo, ticketId, requestInfo, LogDeep + 1, token);
|
||||
if (token.IsCancellationRequested) return null;
|
||||
|
||||
if (isTicket)
|
||||
{
|
||||
await TransformM42TicketAsync(ticketInfo, requestInfo, LogDeep + 1, token);
|
||||
}
|
||||
|
||||
var url = constUrlActivityPause;
|
||||
var ticket = new cApiM42TicketPauseInfo()
|
||||
{
|
||||
ObjectIds = new List<Guid>() { ticketId },
|
||||
Comments = ticketInfo.Comment,
|
||||
ReminderDate = (DateTime)ticketInfo.ReminderDate,
|
||||
|
||||
Reference in New Issue
Block a user