This commit is contained in:
Zeeshaun
2026-04-20 14:47:24 -05:00
parent 89057eceea
commit 8b3ea92501
485 changed files with 71042 additions and 0 deletions
@@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using System.Linq;
using LCU.API.Collections.CollectionsApiLib.Models;
using LCU.Shared.Collections.RepoApiLib.Models;
namespace LCU.API.Collections.RepoApi.Domain.Extensions
{
public static class RepoAccountExtensions
{
public static bool HasAnyCollateral(this RepoAccount repoAccount)
{
return repoAccount?.Collaterals != null && repoAccount.Collaterals.Any();
}
public static IReadOnlyCollection<string> GetCollateralVinList(this RepoAccount repoAccount)
{
if (repoAccount?.Collaterals != null && repoAccount.Collaterals.Any())
{
return repoAccount.Collaterals.Select(x => x.Vin?.Trim().ToUpper()).ToList();
}
return new List<string>();
}
public static IReadOnlyCollection<int> GetUniqueAuctionAssignmentIds(this RepoAccount repoAccount)
{
var aaList = new List<int>();
if (repoAccount?.Collaterals == null || !repoAccount.Collaterals.Any()) return aaList;
foreach (var collateral in repoAccount.Collaterals)
{
if (collateral.AuctionAssignmentToCollaterals?.Any() != true) continue;
foreach (var toCollateral in collateral.AuctionAssignmentToCollaterals)
{
aaList.Add(toCollateral.AuctionAssignmentId);
}
}
return aaList;
}
public static int GetDaysInStatus(this RepoAccount repoAccount, string status)
{
if (repoAccount?.RepoStatusChanges == null || !repoAccount.RepoStatusChanges.Any())
{
return -1;
}
var lastStatus = repoAccount.RepoStatusChanges.LastOrDefault(x => x.StatusTo == status);
if (lastStatus != null)
{
return (DateTime.Now - lastStatus.ChangedDate).Days;
}
return -1;
}
public static bool IsCurrentlySkipClaim(this RepoAccount updatedRepoAccount)
{
foreach (var collateral in updatedRepoAccount.Collaterals)
{
if (collateral.RepoCompanySelections == null || !collateral.RepoCompanySelections.Any()) continue;
if (collateral.RepoCompanySelections?.OrderByDescending(x => x.DateTimeCreated).First().RepoType ==
RepoType.Skip)
{
return true;
}
}
return false;
}
}
}
@@ -0,0 +1,84 @@
using System.Linq;
using LCU.API.Collections.CollectionsApiLib.Models;
namespace LCU.API.Collections.RepoApi.Domain.Extensions
{
public static class TemenosAccountExtensions
{
public const string UserStatusFieldOld = "User Status Code 1";
public const int OpenCaseStatus = 33;
public const int CaseTypeRepossession = 7;
public static bool HasOldIntellectStatus(this TemenosAccount recoveryAccount)
{
return recoveryAccount?.CustomFieldMap != null
&& recoveryAccount.CustomFieldMap.ContainsKey(UserStatusFieldOld)
&& !string.IsNullOrWhiteSpace(recoveryAccount.CustomFieldMap[UserStatusFieldOld]);
}
/**
* CaseId of 0 corresponds to "An open case with a valid RepoStatus"
*/
public static bool HasRecoveryCase(this TemenosAccount recoveryAccount, int caseId)
{
if (recoveryAccount?.Cases == null || !recoveryAccount.Cases.Any())
{
return false;
}
return caseId == 0 ? recoveryAccount.HasOpenRecoveryCase() : recoveryAccount.HasSpecificCase(caseId);
}
public static bool HasOpenRecoveryCase(this TemenosAccount recoveryAccount)
{
TemenosCase selectedCase = null;
if (recoveryAccount?.Cases == null || !recoveryAccount.Cases.Any())
{
return false;
}
selectedCase = recoveryAccount.Cases
.FirstOrDefault(x => x.CaseStatusId == OpenCaseStatus && x.RepoStatus != RepoStatus.UNKNOWN);
return (selectedCase != null);
}
public static bool HasSpecificCase(this TemenosAccount recoveryAccount, int caseId)
{
TemenosCase selectedCase = null;
if (recoveryAccount?.Cases == null || !recoveryAccount.Cases.Any())
{
return false;
}
selectedCase = recoveryAccount.Cases.FirstOrDefault(x => x.CaseId == caseId);
return (selectedCase != null);
}
public static TemenosCase FindRecoveryCaseOrDefault(this TemenosAccount recoveryAccount, int caseId)
{
TemenosCase selectedCase = null;
if (recoveryAccount?.Cases == null || !recoveryAccount.Cases.Any())
{
return null;
}
if (caseId > 0)
{
selectedCase = recoveryAccount.Cases.FirstOrDefault(x => x.CaseId == caseId);
}
else
{
selectedCase = recoveryAccount.Cases
.Where(x => x.CaseStatusId == OpenCaseStatus && x.RepoStatus != RepoStatus.UNKNOWN
&& x.CaseTypeId == CaseTypeRepossession && x.RepoStatus != RepoStatus.INELIGIBLE)
.OrderByDescending(x => x.CreatedDate).FirstOrDefault();
}
return selectedCase;
}
}
}