Updating
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using LCU.Library.Internal.ArchiverApiModel.Entities;
|
||||
|
||||
namespace LCU.Library.Internal.ArchiverApiModel.Models
|
||||
{
|
||||
public class Report
|
||||
{
|
||||
public string ReportName { get; set; }
|
||||
public string QueueNumber { get; set; }
|
||||
public DateTime StopDateTime { get; set; }
|
||||
[NotMapped]
|
||||
public string DestinationQueueAndTimeStamp
|
||||
{
|
||||
get
|
||||
{
|
||||
return $"_{QueueNumber}_{ArchiveTimeStampString}";
|
||||
}
|
||||
}
|
||||
[NotMapped]
|
||||
public string ArchiveTimeStampString
|
||||
{
|
||||
get
|
||||
{
|
||||
return DateTime.Now.ToString("MMddyyyyHHmmss");
|
||||
}
|
||||
}
|
||||
[NotMapped]
|
||||
public string DisplayReportName
|
||||
{
|
||||
get
|
||||
{
|
||||
return ApplicationMapping?.DesignatedName == null ? FinalReportName : ApplicationMapping.DesignatedName;
|
||||
}
|
||||
}
|
||||
[NotMapped]
|
||||
public string FinalReportName
|
||||
{
|
||||
get
|
||||
{
|
||||
return ApplicationMapping?.ApplicationOverrideName == null ? ReportName : ApplicationMapping.ApplicationOverrideName;
|
||||
}
|
||||
}
|
||||
[NotMapped]
|
||||
public ApplicationMapping ApplicationMapping { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public bool HasRegexMapping { get
|
||||
{
|
||||
return ApplicationMapping?.RegexMappings != null && ApplicationMapping.RegexMappings.Any();
|
||||
}
|
||||
}
|
||||
|
||||
public string BuildDestinationName(string fullFileName, string extension)
|
||||
{
|
||||
var extensionIndex = fullFileName.ToUpper().IndexOf($".{extension.ToUpper()}");
|
||||
var fileName = fullFileName.Substring(0,extensionIndex);
|
||||
var destinationFileName = FinalReportName == fileName && !HasRegexMapping ? DisplayReportName : fileName;
|
||||
var destinationName = $"{destinationFileName}{DestinationQueueAndTimeStamp}.{extension}";
|
||||
return destinationName;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user