add logs system
This commit is contained in:
parent
c91666726a
commit
996c08c9e8
29 changed files with 454 additions and 3035 deletions
25
Core/DateTimeFixConverter.cs
Normal file
25
Core/DateTimeFixConverter.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace BMA.EHR.Recruit.Service.Core
|
||||
{
|
||||
public class DateTimeFixConverter : JsonConverter<DateTime>
|
||||
{
|
||||
public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
if (reader.TokenType == JsonTokenType.String)
|
||||
{
|
||||
if (DateTime.TryParse(reader.GetString(), out var date))
|
||||
{
|
||||
return date;
|
||||
}
|
||||
}
|
||||
throw new JsonException("Invalid date format.");
|
||||
}
|
||||
|
||||
public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializerOptions options)
|
||||
{
|
||||
writer.WriteStringValue(value.ToString("yyyy-MM-dd"));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue