only undeleted berths and ships to select, but display all
This commit is contained in:
parent
99c798bfe0
commit
305cc0d3e1
@ -21,8 +21,10 @@ namespace BreCalClient
|
|||||||
private static readonly List<Participant> terList = new();
|
private static readonly List<Participant> terList = new();
|
||||||
|
|
||||||
private static List<Berth> _berths = new();
|
private static List<Berth> _berths = new();
|
||||||
|
private static List<Berth> _allBerths = new();
|
||||||
private static List<Participant> _participants = new();
|
private static List<Participant> _participants = new();
|
||||||
private static List<Ship> _ships = new();
|
private static List<Ship> _ships = new();
|
||||||
|
private static List<Ship> _allShips = new();
|
||||||
|
|
||||||
private readonly static ConcurrentDictionary<int, Ship> _shipLookupDict = new();
|
private readonly static ConcurrentDictionary<int, Ship> _shipLookupDict = new();
|
||||||
private readonly static ConcurrentDictionary<int, Berth> _berthLookupDict = new();
|
private readonly static ConcurrentDictionary<int, Berth> _berthLookupDict = new();
|
||||||
@ -69,15 +71,25 @@ namespace BreCalClient
|
|||||||
public static List<Participant> Participants { get { return _participants; } }
|
public static List<Participant> Participants { get { return _participants; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// All berths
|
/// All active berths
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static List<Berth> Berths { get { return _berths; } }
|
public static List<Berth> Berths { get { return _berths; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// All ships
|
/// All active berths
|
||||||
|
/// </summary>
|
||||||
|
public static List<Berth> AllBerths { get { return _allBerths; } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// All active ships
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static List<Ship> Ships { get { return _ships; } }
|
public static List<Ship> Ships { get { return _ships; } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// All active berths
|
||||||
|
/// </summary>
|
||||||
|
public static List<Ship> AllShips { get { return _allShips; } }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region methods
|
#region methods
|
||||||
@ -106,15 +118,23 @@ namespace BreCalClient
|
|||||||
internal static void InitializeBerths(List<Berth> berths)
|
internal static void InitializeBerths(List<Berth> berths)
|
||||||
{
|
{
|
||||||
foreach (var berth in berths)
|
foreach (var berth in berths)
|
||||||
|
{
|
||||||
_berthLookupDict[berth.Id] = berth;
|
_berthLookupDict[berth.Id] = berth;
|
||||||
_berths = berths;
|
if(!berth.Deleted)
|
||||||
|
_berths.Add(berth);
|
||||||
|
}
|
||||||
|
_allBerths = berths;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void InitializeShips(List<Ship> ships)
|
internal static void InitializeShips(List<Ship> ships)
|
||||||
{
|
{
|
||||||
foreach (var ship in ships)
|
foreach (var ship in ships)
|
||||||
|
{
|
||||||
_shipLookupDict[ship.Id] = ship;
|
_shipLookupDict[ship.Id] = ship;
|
||||||
_ships = ships;
|
if (!ship.Deleted)
|
||||||
|
_ships.Add(ship);
|
||||||
|
}
|
||||||
|
_allShips = ships;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -160,9 +160,9 @@ namespace BreCalClient
|
|||||||
public string? GetBerthText(Times times)
|
public string? GetBerthText(Times times)
|
||||||
{
|
{
|
||||||
string? berthText = null;
|
string? berthText = null;
|
||||||
if ((BreCalLists.Berths != null) && times.BerthId.HasValue && (this.Shipcall?.Type != (int)Extensions.TypeEnum.Shifting))
|
if ((BreCalLists.AllBerths != null) && times.BerthId.HasValue && (this.Shipcall?.Type != (int)Extensions.TypeEnum.Shifting))
|
||||||
{
|
{
|
||||||
Berth? berth = BreCalLists.Berths.Find((x) => x.Id == times.BerthId);
|
Berth? berth = BreCalLists.AllBerths.Find((x) => x.Id == times.BerthId);
|
||||||
berthText = berth?.Name;
|
berthText = berth?.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,12 +170,12 @@ namespace BreCalClient
|
|||||||
{
|
{
|
||||||
if (this.Shipcall?.Type == (int)Extensions.TypeEnum.Incoming)
|
if (this.Shipcall?.Type == (int)Extensions.TypeEnum.Incoming)
|
||||||
{
|
{
|
||||||
Berth? berth = BreCalLists.Berths?.Find((x) => x.Id == this.Shipcall?.ArrivalBerthId);
|
Berth? berth = BreCalLists.AllBerths?.Find((x) => x.Id == this.Shipcall?.ArrivalBerthId);
|
||||||
berthText = berth?.Name;
|
berthText = berth?.Name;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Berth? berth = BreCalLists.Berths?.Find((x) => x.Id == this.Shipcall?.DepartureBerthId);
|
Berth? berth = BreCalLists.AllBerths?.Find((x) => x.Id == this.Shipcall?.DepartureBerthId);
|
||||||
berthText = berth?.Name;
|
berthText = berth?.Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user