GuestLog - StayEntry - Initial Implementation

- Added new entity "StayEntry" to log stays of guests.
- Added pages for StayEntry management (List and creation).
- New DataList for PaymentMethods.
- Other general changes and improvements.
This commit is contained in:
2026-08-15 19:33:32 +02:00
parent ec7efd867b
commit 6dc2d2426b
29 changed files with 1348 additions and 30 deletions
@@ -4,10 +4,17 @@ public class GuestDocFilterDTO
{
public string? DocumentType { get; set; }
public string? DocumentNumber { get; set; }
public string? Name { get; set; }
public string? Surname { get; set; }
public string? PhoneNumber { get; set; }
public bool IsEmpty => string.IsNullOrEmpty(DocumentType)
&& string.IsNullOrEmpty(DocumentNumber)
&& string.IsNullOrEmpty(Name)
&& string.IsNullOrEmpty(Surname)
&& string.IsNullOrEmpty(PhoneNumber);
}
@@ -31,4 +31,7 @@ public class GuestDocumentDTO
public DateTime? CreateTime { get; set; }
public DateTime? UpdateTime { get; set; }
public string FullKey => $"{DocumentType}-{DocumentNum}";
}
@@ -0,0 +1,20 @@
namespace Somnia.GuestLog.Models.DTOs;
public class StayEntryDTO
{
public long? Id { get; set; }
public DateTime? DateIn { get; set; }
public DateTime? DateOut { get; set; }
public int? RoomCount { get; set; }
public string? RoomNumber { get; set; }
public string? PaymentMethod { get; set; }
public List<GuestDocumentDTO> GuestDocuments { get; set; } = [];
public DateTime? CreateTime { get; set; }
public DateTime? UpdateTime { get; set; }
}
@@ -0,0 +1,24 @@
namespace Somnia.GuestLog.Models.Entities;
public class StayEntry : BaseEntity
{
public long Id { get; set; }
public required DateTime DateIn { get; set; }
public required DateTime DateOut { get; set; }
public required int RoomCount { get; set; }
public string? RoomNumber { get; set; }
public required string PaymentMethod { get; set; }
public virtual ICollection<GuestDocument> GuestDocuments { get; } = [];
//Generated Properties.
public required DateTime CreateTime { get; set; }
public required DateTime UpdateTime { get; set; }
public override string GetFullKey() => $"{Id}";
}
@@ -0,0 +1,52 @@
using Somnia.GuestLog.Models.DTOs;
using Somnia.GuestLog.Models.Entities;
namespace Somnia.GuestLog.Models;
internal static class EntityMapping
{
public static GuestDocumentDTO MapGuestDocumentEntityToDTO(GuestDocument entity)
{
return new()
{
DocumentType = entity.DocumentType,
DocumentNum = entity.DocumentNum,
IssueDate = entity.IssueDate.ToDateTime(TimeOnly.MinValue),
SupportNum = entity.SupportNum,
Nationality = entity.Nationality,
Name = entity.Name,
Surname = entity.Surname,
Surname2 = entity.Surname2,
BirthDate = entity.BirthDate.ToDateTime(TimeOnly.MinValue),
Gender = entity.Gender,
PhoneNumber = entity.PhoneNumber,
EmailAddress = entity.EmailAddress,
Address = entity.AddressDetails?.Address ?? "",
AddressCity = entity.AddressDetails?.AddressCity ?? "",
AddressProvince = entity.AddressDetails?.AddressProvince ?? "",
AddressState = entity.AddressDetails?.AddressState ?? "",
AddressCountry = entity.AddressDetails?.AddressCountry! ?? "",
ZipCode = entity.AddressDetails?.ZipCode ?? "",
CreateTime = entity.CreateTime,
UpdateTime = entity.UpdateTime,
};
}
public static StayEntryDTO MapStayEntryEntityToDTO(StayEntry entity)
{
return new()
{
Id = entity.Id,
DateIn = entity.DateIn,
DateOut = entity.DateOut,
RoomCount = entity.RoomCount,
RoomNumber = entity.RoomNumber,
PaymentMethod = entity.PaymentMethod,
CreateTime = entity.CreateTime,
UpdateTime = entity.UpdateTime,
GuestDocuments = [.. entity.GuestDocuments.Select(e => MapGuestDocumentEntityToDTO(e))],
};
}
}