the absolute state of S T U F F

This commit is contained in:
femsci 2023-11-18 11:01:11 +01:00
parent 17ed4cdb6f
commit c22d5c6d82
Signed by: femsci
GPG key ID: 08F7911F0E650C67
28 changed files with 12110 additions and 95 deletions

View file

@ -1,11 +1,18 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Nyanlabs.Umogen.Core.Models;
public class LegalEntity(string Name, string? Nip = null, string? Headquarters = null, Person? Representative = null) : IEntity, INLSerializable
public class LegalEntity : IEntity, INLSerializable
{
public string Name { get; set; } = Name;
public string? Nip { get; set; } = Nip;
public string? Headquarters { get; set; } = Headquarters;
public Person? Representative { get; set; } = Representative;
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Key]
public long Id { get; set; }
public string Name { get; set; } = default!;
public string? Nip { get; set; } = default!;
public string? Headquarters { get; set; }
public Person? Representative { get; set; }
public long? PersonId { get; set; }
public string GetName()
{
@ -24,6 +31,6 @@ public class LegalEntity(string Name, string? Nip = null, string? Headquarters =
public string SerializeToDocument()
{
return $"{Name}, reprezentowaną przez {Representative.GetName()}";
return $"{Name}{(Representative != null ? $", reprezentowaną przez {Representative.GetName()}" : "")}";
}
}

View file

@ -1,13 +1,23 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace Nyanlabs.Umogen.Core.Models;
public record Person(string Name, string Surname, string? Id = null, string? Pesel = null, DateTime? DoB = null) : IEntity, INLSerializable
public record Person(string Name, string Surname, string IdC, string Pesel, DateTime? DoB = null) : IEntity, INLSerializable
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Key]
public long Id { get; set; }
public string Name { get; set; } = Name;
public string Surname { get; set; } = Surname;
public string? IDCode { get; set; } = Id;
public string? Pesel { get; set; } = Pesel;
public string IDCode { get; set; } = IdC;
public string Pesel { get; set; } = Pesel;
public DateTime? DoB { get; set; } = DoB;
[JsonIgnore]
public virtual ICollection<LegalEntity> Companies { get; set; }
public string GetName()
{
return $"{Name} {Surname}";

View file

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace Nyanlabs.Umogen.Core.Models;

View file

@ -27,6 +27,6 @@ public readonly struct ValidTime : INLSerializable, IDocSerializable
public string SerializeToDocument()
{
return this.Start != DateTime.MaxValue ? $"na czas od {Start:dd MMM yyyy} do {End:dd MMM yyyy}" : "na czas nieokreślony";
return this.Start != DateTime.MaxValue ? $"na czas od {Start:dd.MM.yyyy} do {End:dd.MM.yyyy}" : "na czas nieokreślony";
}
}

View file

@ -27,6 +27,7 @@ public class SseConsumer<TEvent> : IDisposable, IAsyncDisposable
yield return JsonSerializer.Deserialize<TEvent>(line, Umogen.JSON_OPTS) ?? throw new DataException("Invalid data...");
}
reader.Close();
}
public void Dispose()