mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 13:03:12 +00:00
Do not project VendorId/VendorName for Cancelled, Canceled, or Refused primary dispatches, and expose PrimaryDispatchStatus on the board DTO.
28 lines
924 B
C#
28 lines
924 B
C#
namespace SeaHaven.DataServices.Helpers
|
|
{
|
|
/// <summary>
|
|
/// SH-183: a cancelled or refused primary dispatch is not a live vendor assignment.
|
|
/// Verified/Completed remain live — the company that did the work.
|
|
/// </summary>
|
|
public static class WorkOrderBoardDispatchAssignment
|
|
{
|
|
public static bool IsInactivePrimaryDispatch(string? status)
|
|
{
|
|
var normalized = (status ?? string.Empty).Trim().ToLowerInvariant();
|
|
return normalized is "cancelled" or "canceled" or "refused";
|
|
}
|
|
|
|
public static (int? VendorId, string? VendorName) LiveVendor(
|
|
int? vendorId,
|
|
string? vendorName,
|
|
string? primaryDispatchStatus)
|
|
{
|
|
if (IsInactivePrimaryDispatch(primaryDispatchStatus))
|
|
{
|
|
return (null, null);
|
|
}
|
|
|
|
return (vendorId, vendorName);
|
|
}
|
|
}
|
|
}
|