59 lines
1.4 KiB
C#
59 lines
1.4 KiB
C#
// Copyright (c) 2023 schick Informatik
|
|
// Description: Data model for search filters
|
|
//
|
|
|
|
using BreCalClient.misc.Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace BreCalClient
|
|
{
|
|
internal class SearchFilterModel
|
|
{
|
|
public SearchFilterModel() { }
|
|
|
|
#region Properties
|
|
|
|
public DateTime? EtaFrom { get; set; }
|
|
|
|
public DateTime? EtaTo { get; set; }
|
|
|
|
public List<ShipcallType> Categories { get; set; } = new();
|
|
|
|
public List<int> Agencies { get; set; } = new();
|
|
|
|
public List<int> Berths { get; set; } = new();
|
|
|
|
public List<int> Ports { get; set; } = new();
|
|
|
|
public string? SearchString { get; set; }
|
|
|
|
public double? ShipLengthFrom { get; set; }
|
|
|
|
public double? ShipLengthTo { get; set; }
|
|
|
|
public bool? MineOnly { get; set; }
|
|
|
|
public static Dictionary<int, SearchFilterModel>? filterMap = new();
|
|
|
|
#endregion
|
|
|
|
#region Serialisation
|
|
|
|
public static bool Deserialize(string json)
|
|
{
|
|
filterMap = (Dictionary<int, SearchFilterModel>?) JsonConvert.DeserializeObject(json, typeof(Dictionary<int, SearchFilterModel>));
|
|
return (filterMap != null);
|
|
}
|
|
|
|
public static string Serialize()
|
|
{
|
|
return JsonConvert.SerializeObject(filterMap, Formatting.Indented);
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|