43 lines
1.4 KiB
C#
43 lines
1.4 KiB
C#
using System.Collections.Generic;
|
|
using Microsoft.EntityFrameworkCore.Internal;
|
|
|
|
namespace LCU.API.Internal.RepoApi.Repos.Models.AutoIms
|
|
{
|
|
public class ImportResultRow
|
|
{
|
|
public bool Success { get; set; }
|
|
public List<string> Messages { get; set; }
|
|
public string Description { get; set; }
|
|
public ImsAutoFileData Data { get; set; }
|
|
public RepoAccount RepoAccount { get; set; }
|
|
|
|
public string BuildStatusReport(string repoManagerUrl)
|
|
{
|
|
var report = new List<string>();
|
|
var success = Success ? "Success" : "Failure";
|
|
if (RepoAccount != null)
|
|
{
|
|
report.Add(CreateRepoLink(RepoAccount, repoManagerUrl));
|
|
}
|
|
if(RepoAccount == null && Data != null)
|
|
{
|
|
report.Add($"Auto IMS Update for {Data.VIN}, no Repo Account.");
|
|
}
|
|
report.Add($"{success} : {Description}");
|
|
if (Messages != null && Messages.Any())
|
|
{
|
|
report.AddRange(Messages);
|
|
}
|
|
|
|
return report.ToString();
|
|
}
|
|
|
|
public static string CreateRepoLink(RepoAccount account, string repoManagerUrl)
|
|
{
|
|
var url = repoManagerUrl + account.RepoId;
|
|
var link = string.Format("<a href={0}>{1}</a>", url, $"Account {account.RepoId} ({account.AccountNo})") ;
|
|
return link;
|
|
}
|
|
}
|
|
}
|