SHA256
Compare commits
52
Commits
| Author | SHA256 | Date | |
|---|---|---|---|
|
|
f87d6303ea | ||
|
|
b515f18ca9 | ||
|
|
72cd11caf2 | ||
|
|
54387a6346 | ||
|
|
cf62a0e55e | ||
|
|
7b86b2224f | ||
|
|
2f0062b313 | ||
|
|
34b61e7fde | ||
|
|
e30fb16bcf | ||
|
|
29e51c016a | ||
|
|
0ab3957efa | ||
|
|
fbe1750510 | ||
|
|
23c8d490d8 | ||
|
|
c5d8487046 | ||
|
|
491ecc4cd1 | ||
|
|
a1a55aa396 | ||
|
|
dc85319da5 | ||
|
|
0abdfcd683 | ||
|
|
ae2ea51060 | ||
|
|
dcd5bb2aad | ||
|
|
fb2e00f06c | ||
|
|
9ec87d56da | ||
|
|
7b8020879b | ||
|
|
dc5293bdf7 | ||
|
|
4b72e3b3d3 | ||
|
|
6fe5a5e5a3 | ||
|
|
058352b7f3 | ||
|
|
313a714a99 | ||
|
|
cf31cbc414 | ||
|
|
b318f2415c | ||
|
|
c24faedee5 | ||
|
|
7052ec734c | ||
|
|
887c3d787a | ||
|
|
a01eed82e1 | ||
|
|
b08aaf2d7b | ||
|
|
4f22cd4541 | ||
|
|
b18bd7caa6 | ||
|
|
511bd023f2 | ||
|
|
0de4e1ba10 | ||
|
|
340bc583b7 | ||
|
|
67845e250f | ||
|
|
3e0ef34f66 | ||
|
|
6dc2d2426b | ||
|
|
ec7efd867b | ||
|
|
8232e7d7c9 | ||
|
|
5c7fed2677 | ||
|
|
3fe558c231 | ||
|
|
2335c223ea | ||
|
|
a5eea09eee | ||
|
|
5061f9362b | ||
|
|
e7e9fb1d12 | ||
|
|
d93ba3d9ee |
No files matched your search
Vendored
+9
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"files.associations": {
|
||||||
|
"appsettings*.json": "jsonc",
|
||||||
|
"*_config.json": "jsonc",
|
||||||
|
"*_config.json.sample": "jsonc"
|
||||||
|
},
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"editor.formatOnSaveMode": "modificationsIfAvailable",
|
||||||
|
}
|
||||||
Vendored
+36
@@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
|
// for the documentation about the tasks.json format
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"type": "dotnet",
|
||||||
|
"task": "build",
|
||||||
|
"group": "build",
|
||||||
|
"problemMatcher": [],
|
||||||
|
"label": "Build Somnia.GuestLog"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Publish Container Image",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "dotnet",
|
||||||
|
"args": [
|
||||||
|
"publish",
|
||||||
|
"-c",
|
||||||
|
"Release",
|
||||||
|
"--os",
|
||||||
|
"linux",
|
||||||
|
"--arch",
|
||||||
|
"x64",
|
||||||
|
"-p:PublishProfile=DefaultContainer"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"cwd": "${workspaceFolder}/src/Somnia.GuestLog"
|
||||||
|
},
|
||||||
|
"group": "build",
|
||||||
|
"presentation": {
|
||||||
|
"reveal": "always"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Somnia.GuestLog Deployment
|
||||||
|
|
||||||
|
## Deploy using docker-compose
|
||||||
|
|
||||||
|
Use [docker-compose file](docker-compose.yaml) as example. Configure required enviroment variables.
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
- By default, HTTP-only is deploy. Uncomment required sections to enable HTTPS (and mount required certs).
|
||||||
|
- Reverse-proxies should work?
|
||||||
|
|
||||||
|
[To-Be-Improved]
|
||||||
|
|
||||||
|
## Manually update registry
|
||||||
|
|
||||||
|
Container images are built by CI/CD pipelines and uploaded to the registry (**not yet!**).
|
||||||
|
|
||||||
|
If required, a image can be manually built and uploaded to the registry (for testing or development purposes):
|
||||||
|
```sh
|
||||||
|
podman push [IMAGE_ID] [REGISTRY]/somnia/somnia-guestlog:[TAG]
|
||||||
|
|
||||||
|
# Example:
|
||||||
|
podman push localhost/somnia-guestlog:latest gitea.uberelectronnetwork.cc/somnia/somnia-guestlog:devbuild
|
||||||
|
```
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
services:
|
||||||
|
database:
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: ${POSTGRES_DB:-SomniaGuestLog}
|
||||||
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-NotAStrongPassword}
|
||||||
|
POSTGRES_USER: ${POSTGRES_USER:-somnia}
|
||||||
|
healthcheck:
|
||||||
|
retries: 5
|
||||||
|
start_period: 60s
|
||||||
|
test:
|
||||||
|
- CMD
|
||||||
|
- pg_isready
|
||||||
|
timeout: 5s
|
||||||
|
image: postgres:18-alpine
|
||||||
|
volumes:
|
||||||
|
- somniaguestlog_database_data:/var/lib/postgresql:rw
|
||||||
|
somnia-guestlog:
|
||||||
|
depends_on:
|
||||||
|
- database
|
||||||
|
environment:
|
||||||
|
SOMNIA_ConnectionStrings__DbSomniaGuestLog: Host=database;Port=5432;Username=${POSTGRES_USER:-somnia};Password=${POSTGRES_PASSWORD:-NotAStrongPassword};Database=${POSTGRES_DB:-SomniaGuestLog}
|
||||||
|
# Configure path for data protection keys. This path must persists between container restarts (use a mount or a volume).
|
||||||
|
SOMNIA_DataProtectionDir: /SomniaGuestLog/dataprotection
|
||||||
|
ASPNETCORE_URLS: "http://+:8080"
|
||||||
|
# Somnia AddressQuery Service - START
|
||||||
|
SOMNIA_AddressQuery__Provider: "Nominatim"
|
||||||
|
# Override if required.
|
||||||
|
# SOMNIA_AddressQuery__ServiceURL: ""
|
||||||
|
# SOMNIA_AddressQuery__ApiKey: ""
|
||||||
|
SOMNIA_AddressQuery__UserAgent: Somnia-GuestLog-Dev-Container
|
||||||
|
SOMNIA_AddressQuery__ResultLang: es
|
||||||
|
# Somnia AddressQuery Service - END
|
||||||
|
SOMNIA_StayExport__ExportStorageConnectionString: disk://path=/SomniaGuestLog/StayExportFiles
|
||||||
|
# Somnia StayExport - SpainParteViajeros Provider - START
|
||||||
|
# Override vars if required
|
||||||
|
# SOMNIA_StayExportSpainParteViajeros__InternetAvailable: true
|
||||||
|
# SOMNIA_StayExportSpainParteViajeros__CodigoEstablecimiento: 123123123
|
||||||
|
# Somnia StayExport - SpainParteViajeros Provider - END
|
||||||
|
|
||||||
|
# Enable for HTTPS - START
|
||||||
|
# ASPNETCORE_URLS: "https://+:8090;http://+:8080"
|
||||||
|
# ASPNETCORE_HTTPS_PORTS: 8090
|
||||||
|
# ASPNETCORE_Kestrel__Certificates__Default__Password: ${CERTIFICATE_CREDENTIAL:-}
|
||||||
|
# ASPNETCORE_Kestrel__Certificates__Default__Path: /https/aspnetapp.pfx
|
||||||
|
# Enable for HTTPS - END
|
||||||
|
|
||||||
|
image: localhost/somnia-guestlog:latest
|
||||||
|
# image: gitea.uberelectronnetwork.cc/somnia/somnia-guestlog:devbuild
|
||||||
|
|
||||||
|
ports:
|
||||||
|
- protocol: tcp
|
||||||
|
published: 8080
|
||||||
|
target: 8080
|
||||||
|
# Enable for HTTPS
|
||||||
|
# - protocol: tcp
|
||||||
|
# published: 8090
|
||||||
|
# target: 8090
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- somniaguestlog_app_data:/SomniaGuestLog
|
||||||
|
# Enable for HTTPS and configure path to your certificate.
|
||||||
|
# - ${HOME}/.aspnet/https:/https/
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
somniaguestlog_database_data: Null
|
||||||
|
somniaguestlog_app_data: Null
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<!-- Required for intellisense -->
|
||||||
|
<CoreCompileDependsOn>CoreResGen;$(CoreCompileDependsOn)</CoreCompileDependsOn>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource
|
||||||
|
Update="@(EmbeddedResource -> WithMetadataValue('Generator', 'MSBuild:Compile'))"
|
||||||
|
Type="Resx">
|
||||||
|
<StronglyTypedFileName>$(IntermediateOutputPath)\$([MSBuild]::ValueOrDefault('%(RelativeDir)',
|
||||||
|
'').Replace('\', '.').Replace('/',
|
||||||
|
'.'))%(Filename).g$(DefaultLanguageSourceExtension)</StronglyTypedFileName>
|
||||||
|
<StronglyTypedLanguage>$(Language)</StronglyTypedLanguage>
|
||||||
|
<StronglyTypedNamespace Condition="'%(RelativeDir)' == ''">$(RootNamespace)</StronglyTypedNamespace>
|
||||||
|
<StronglyTypedNamespace Condition="'%(RelativeDir)' != ''">$(RootNamespace).$([MSBuild]::ValueOrDefault('%(RelativeDir)',
|
||||||
|
'').Replace('\', '.').Replace('/', '.').TrimEnd('.'))</StronglyTypedNamespace>
|
||||||
|
<StronglyTypedClassName>%(Filename)</StronglyTypedClassName>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
@@ -6,22 +6,34 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageVersion Include="Extensions.MudBlazor.StaticInput" Version="4.1.0" />
|
<PackageVersion Include="Extensions.MudBlazor.StaticInput" Version="4.1.0" />
|
||||||
|
<PackageVersion Include="FluentStorage" Version="8.0.22" />
|
||||||
|
<PackageVersion Include="FluentStorage.AWS" Version="8.0.21" />
|
||||||
<PackageVersion Include="FluentValidation" Version="12.1.1" />
|
<PackageVersion Include="FluentValidation" Version="12.1.1" />
|
||||||
<PackageVersion Include="Grpc.AspNetCore" Version="2.64.0" />
|
<PackageVersion Include="Grpc.AspNetCore" Version="2.64.0" />
|
||||||
<PackageVersion Include="MudBlazor" Version="9.4.0" />
|
<PackageVersion Include="Microsoft.Extensions.Localization" Version="10.0.9" />
|
||||||
|
<PackageVersion Include="MudBlazor" Version="9.10.0" />
|
||||||
|
<PackageVersion Include="MudBlazor.Translations" Version="3.6.0" />
|
||||||
|
<PackageVersion Include="Serilog" Version="4.4.0" />
|
||||||
|
<PackageVersion Include="Serilog.Enrichers.Process" Version="3.0.0" />
|
||||||
|
<PackageVersion Include="Serilog.Enrichers.Thread" Version="4.0.0" />
|
||||||
|
<PackageVersion Include="Serilog.Extensions.Hosting" Version="10.0.0" />
|
||||||
|
<PackageVersion Include="Serilog.Settings.Configuration" Version="10.0.1" />
|
||||||
|
<PackageVersion Include="Serilog.Sinks.Console" Version="6.1.1" />
|
||||||
|
<PackageVersion Include="Serilog.Sinks.File" Version="7.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageVersion Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="10.0.7" />
|
<PackageVersion Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="10.0.12" />
|
||||||
<PackageVersion Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="10.0.7" />
|
<PackageVersion Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="10.0.7" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="10.0.7" />
|
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="10.0.12" />
|
||||||
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.7">
|
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.12">
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageVersion>
|
</PackageVersion>
|
||||||
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.7" />
|
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.12" />
|
||||||
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="10.0.7" />
|
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="10.0.12" />
|
||||||
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.1" />
|
<PackageVersion Include="Microsoft.EntityFrameworkCore.Proxies" Version="10.0.12" />
|
||||||
|
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Somnia.GuestLog;
|
||||||
|
|
||||||
|
public static class AppSettings
|
||||||
|
{
|
||||||
|
public const string AppName = "Somnia-GuestLog-dev";
|
||||||
|
|
||||||
|
public const string AppVersion = "v0.0.0-dev"; //2026-09-08
|
||||||
|
}
|
||||||
@@ -1,4 +1,7 @@
|
|||||||
<!DOCTYPE html>
|
@using System.Globalization
|
||||||
|
@using Microsoft.AspNetCore.Localization
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
@@ -20,6 +23,22 @@
|
|||||||
<ReconnectModal />
|
<ReconnectModal />
|
||||||
<script src="@Assets["_framework/blazor.web.js"]"></script>
|
<script src="@Assets["_framework/blazor.web.js"]"></script>
|
||||||
<script src="@Assets["_content/MudBlazor/MudBlazor.min.js"]"></script>
|
<script src="@Assets["_content/MudBlazor/MudBlazor.min.js"]"></script>
|
||||||
|
<script src="js/App.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[CascadingParameter]
|
||||||
|
private HttpContext? HttpContext { get; set; }
|
||||||
|
|
||||||
|
protected override void OnInitialized()
|
||||||
|
{
|
||||||
|
HttpContext?.Response.Cookies.Append(
|
||||||
|
CookieRequestCultureProvider.DefaultCookieName,
|
||||||
|
CookieRequestCultureProvider.MakeCookieValue(
|
||||||
|
new RequestCulture(
|
||||||
|
CultureInfo.CurrentCulture,
|
||||||
|
CultureInfo.CurrentUICulture)));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,177 @@
|
|||||||
|
@using Somnia.GuestLog.Models.DTOs;
|
||||||
|
@using Somnia.GuestLog.Services
|
||||||
|
@using Somnia.GuestLog.Services.AddressQuery;
|
||||||
|
|
||||||
|
@inject ILogger<AddressQueryDialog> logger;
|
||||||
|
@inject IAddressQueryFactory addressQueryFactory;
|
||||||
|
@inject IUserMessageService userMessage
|
||||||
|
|
||||||
|
<MudDialog @ref="@DialogRef">
|
||||||
|
<TitleContent>
|
||||||
|
<MudText Typo="Typo.h6">
|
||||||
|
<MudIcon Icon="@Icons.Material.Filled.NotListedLocation" Class="mr-3 mb-n1" />
|
||||||
|
@LanguageLocale.control_AddressQueryDialog_dialogTitle
|
||||||
|
</MudText>
|
||||||
|
</TitleContent>
|
||||||
|
<DialogContent>
|
||||||
|
<MudStack row>
|
||||||
|
<MudTextField @bind-Value="SearchText" Label="@LanguageLocale.control_AddressQueryDialog_searchText"
|
||||||
|
Required />
|
||||||
|
<MudIconButton Icon="@Icons.Material.Filled.Search" OnClick="btnSearchAddress" Disabled="@_isDataLoading" />
|
||||||
|
</MudStack>
|
||||||
|
|
||||||
|
<MudPaper Class="mt-4 pa-2">
|
||||||
|
@if (addressResults.Count == 0 && !_isDataLoading)
|
||||||
|
{
|
||||||
|
<MudElement Style="width: 100%; height: 100px;" HtmlTag="div">
|
||||||
|
<MudText Typo="Typo.body1" Align="Align.Center">
|
||||||
|
@LanguageLocale.general_noResults
|
||||||
|
</MudText>
|
||||||
|
</MudElement>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (_isDataLoading)
|
||||||
|
{
|
||||||
|
<MudSkeleton Width="100%" Height="100px" />
|
||||||
|
}
|
||||||
|
|
||||||
|
<MudList T="AddressResultDTO" @bind-SelectedValue="SelectedAddressResult"
|
||||||
|
SelectionMode="SelectionMode.SingleSelection" Color="Color.Info">
|
||||||
|
@foreach (AddressResultDTO result in addressResults)
|
||||||
|
{
|
||||||
|
<MudListItem Value="result">
|
||||||
|
<ChildContent>
|
||||||
|
<MudTextField Value="@($"{result.AddressRoad}, {result.HouseNumber}")"
|
||||||
|
Label="@LanguageLocale.general_address_address" ReadOnly />
|
||||||
|
<MudStack row>
|
||||||
|
<MudTextField Value="@result.AddressCity" Label="@LanguageLocale.general_address_city"
|
||||||
|
ReadOnly />
|
||||||
|
<MudTextField Value="@result.AddressProvince"
|
||||||
|
Label="@LanguageLocale.general_address_province" ReadOnly />
|
||||||
|
<MudTextField Value="@result.AddressState" Label="@LanguageLocale.general_address_state"
|
||||||
|
ReadOnly />
|
||||||
|
</MudStack>
|
||||||
|
<MudStack row>
|
||||||
|
<MudTextField Value="@result.AddressCountry" Label="@LanguageLocale.general_address_country"
|
||||||
|
ReadOnly />
|
||||||
|
<MudTextField Value="@result.ZipCode" Label="@LanguageLocale.general_address_zipCode"
|
||||||
|
ReadOnly />
|
||||||
|
</MudStack>
|
||||||
|
</ChildContent>
|
||||||
|
</MudListItem>
|
||||||
|
}
|
||||||
|
</MudList>
|
||||||
|
</MudPaper>
|
||||||
|
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<MudButton OnClick="Cancel">
|
||||||
|
@LanguageLocale.general_btnCancel
|
||||||
|
</MudButton>
|
||||||
|
<MudButton Color="Color.Primary" OnClick="btnSelectAddress">
|
||||||
|
@LanguageLocale.control_AddressQueryDialog_btnSelectAddress
|
||||||
|
</MudButton>
|
||||||
|
</DialogActions>
|
||||||
|
</MudDialog>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
// Dialog Instance injected when open by the DialogService.
|
||||||
|
// This field is null when dialog is not open by the DialogService.
|
||||||
|
[CascadingParameter]
|
||||||
|
private IMudDialogInstance MudDialog { get; set; } = null!;
|
||||||
|
// Reference to the Dialog when open by the ShowAsync Method. (When dialog is used inline).
|
||||||
|
// This field is null when dialog is not open using the internal methods.
|
||||||
|
private IDialogReference? _reference;
|
||||||
|
|
||||||
|
//Reference to the MudDialog component. Used to manage the internal dialog when the component is inline.
|
||||||
|
private MudDialog DialogRef { get; set; } = null!;
|
||||||
|
|
||||||
|
private string SearchText { get; set; } = "";
|
||||||
|
private List<AddressResultDTO> addressResults = [];
|
||||||
|
private AddressResultDTO? SelectedAddressResult { get; set; }
|
||||||
|
|
||||||
|
private bool _isDataLoading = false;
|
||||||
|
private string _lastSearchText = "";
|
||||||
|
|
||||||
|
|
||||||
|
private void Cancel()
|
||||||
|
{
|
||||||
|
if (MudDialog is not null)
|
||||||
|
{
|
||||||
|
MudDialog.Cancel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (_reference is not null)
|
||||||
|
{
|
||||||
|
DialogRef.CloseAsync(DialogResult.Cancel());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw new InvalidOperationException("Unable to cancel (close) the dialog!");
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task btnSearchAddress()
|
||||||
|
{
|
||||||
|
if (SearchText.Length == 0 || SearchText == _lastSearchText)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_isDataLoading = true;
|
||||||
|
|
||||||
|
var queryService = addressQueryFactory.GetService();
|
||||||
|
addressResults = await queryService.SearchAddressAsync(SearchText);
|
||||||
|
_lastSearchText = SearchText;
|
||||||
|
|
||||||
|
_isDataLoading = false;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.LogError(ex, "SearchAddress returned an error!");
|
||||||
|
userMessage.ShowMessage($"Error searching address: {ex.Message}", MessageKind.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task btnSelectAddress()
|
||||||
|
{
|
||||||
|
if (SelectedAddressResult is null)
|
||||||
|
{
|
||||||
|
userMessage.ShowMessage("Select an address", MessageKind.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DialogResult dialogResult = DialogResult.Ok<AddressResultDTO?>(SelectedAddressResult);
|
||||||
|
|
||||||
|
//Close the dialog when opened by DialogService.
|
||||||
|
if (MudDialog != null)
|
||||||
|
{
|
||||||
|
logger.LogDebug("AddressQueryDialog - Closed MudDialogInstance!");
|
||||||
|
MudDialog.Close(dialogResult);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//Close the dialog when is a Inline dialog.
|
||||||
|
else if (_reference is not null)
|
||||||
|
{
|
||||||
|
logger.LogDebug("AddressQueryDialog - Closed inline dialog instance!");
|
||||||
|
await DialogRef.CloseAsync(dialogResult);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//Throw if the dialog can't be closed (as none of the above is true).
|
||||||
|
throw new InvalidOperationException("Dialog cannot be closed! No reference to close!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<IDialogReference> ShowAsync(DialogOptions? options = null)
|
||||||
|
{
|
||||||
|
_reference = await DialogRef.ShowAsync(options: options);
|
||||||
|
return _reference;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task CloseAsync()
|
||||||
|
{
|
||||||
|
await DialogRef.CloseAsync();
|
||||||
|
_reference = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<MudMessageBox @ref="_msgBox" Title="@LanguageLocale.general_confirmTitle"
|
||||||
|
CancelText="@LanguageLocale.general_btnCancel">
|
||||||
|
<MessageContent>
|
||||||
|
@LanguageLocale.general_confirmDeleteMsg
|
||||||
|
</MessageContent>
|
||||||
|
<YesButton>
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Error" StartIcon="@Icons.Material.Filled.DeleteForever">
|
||||||
|
@LanguageLocale.general_btnDelete
|
||||||
|
</MudButton>
|
||||||
|
</YesButton>
|
||||||
|
</MudMessageBox>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
public MudMessageBox MsgBox => _msgBox;
|
||||||
|
|
||||||
|
MudMessageBox _msgBox = null!;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
<DialogActions>
|
<DialogActions>
|
||||||
<MudButton Color="Color.Primary" Variant="Variant.Filled" EndIcon="@Icons.Material.Filled.Close"
|
<MudButton Color="Color.Primary" Variant="Variant.Filled" EndIcon="@Icons.Material.Filled.Close"
|
||||||
OnClick="Submit">
|
OnClick="Submit">
|
||||||
Close
|
@LanguageLocale.general_btnClose
|
||||||
</MudButton>
|
</MudButton>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</MudDialog>
|
</MudDialog>
|
||||||
|
|||||||
@@ -1,144 +0,0 @@
|
|||||||
@using Somnia.GuestLog.Models.DTOs;
|
|
||||||
@using Somnia.GuestLog.Validators;
|
|
||||||
|
|
||||||
<MudForm @ref="@_form" Model="@Model" Validation="@(guestDocValidator.ValidateValue)" ValidationDelay="0"
|
|
||||||
ReadOnly="@ReadOnly">
|
|
||||||
<MudGrid>
|
|
||||||
<MudItem xs="12" md="6">
|
|
||||||
<MudPaper Class="pa-4" Elevation="3" Height="100%">
|
|
||||||
<MudText Typo="Typo.subtitle1" Align="Align.Center">Document Details</MudText>
|
|
||||||
<MudDivider DividerType="DividerType.Middle" Class="mb-4" />
|
|
||||||
<MudStack Row>
|
|
||||||
<MudSelect @bind-Value="Model.DocumentType" For="@(() => Model.DocumentType)" Label="DocumentType"
|
|
||||||
Required>
|
|
||||||
@foreach (string docType in GuestConsts.DocumentTypeList)
|
|
||||||
{
|
|
||||||
<MudSelectItem Value="docType">@docType</MudSelectItem>
|
|
||||||
}
|
|
||||||
</MudSelect>
|
|
||||||
<MudTextField @bind-Value="Model.DocumentNum" For="@(() => Model.DocumentNum)" Label="Document Num"
|
|
||||||
Immediate="true" Required />
|
|
||||||
</MudStack>
|
|
||||||
|
|
||||||
<MudStack Row>
|
|
||||||
<MudDatePicker @bind-Date="Model.IssueDate" For="@(() => Model.IssueDate)" Label="Issue Date"
|
|
||||||
Clearable OpenTo="OpenTo.Year" Editable />
|
|
||||||
|
|
||||||
<MudTextField @bind-Value="Model.SupportNum" For="@(() => Model.SupportNum)" Label="Support Num"
|
|
||||||
Immediate="true" Required="@isSuportNumberRequired" />
|
|
||||||
</MudStack>
|
|
||||||
|
|
||||||
<MudSelect @bind-Value="Model.Nationality" For="@(() => Model.Nationality)" Label="Nationality">
|
|
||||||
@foreach (var countryPair in GuestConsts.CountryList)
|
|
||||||
{
|
|
||||||
<MudSelectItem Value="countryPair.Key">@countryPair.Value</MudSelectItem>
|
|
||||||
}
|
|
||||||
</MudSelect>
|
|
||||||
</MudPaper>
|
|
||||||
</MudItem>
|
|
||||||
<MudItem xs="12" md="6">
|
|
||||||
<MudPaper Class="pa-4" Elevation="3" Height="100%">
|
|
||||||
<MudText Typo="Typo.subtitle1" Align="Align.Center">Customer Details</MudText>
|
|
||||||
<MudDivider DividerType="DividerType.Middle" Class="mb-4" />
|
|
||||||
|
|
||||||
<MudTextField @bind-Value="Model.Name" For="@(() => Model.Name)" Immediate="true" Label="Name" />
|
|
||||||
<MudTextField @bind-Value="Model.Surname" For="@(() => Model.Surname)" Immediate="true"
|
|
||||||
Label="Surname" />
|
|
||||||
<MudTextField @bind-Value="Model.Surname2" For="@(() => Model.Surname2)" Immediate="true"
|
|
||||||
Label="Surname2" />
|
|
||||||
|
|
||||||
<MudStack Row>
|
|
||||||
<MudDatePicker @bind-Date="Model.BirthDate" For="@(() => Model.BirthDate)" Label="BirthDate"
|
|
||||||
Clearable OpenTo="OpenTo.Year" Editable />
|
|
||||||
|
|
||||||
<MudSelect @bind-Value="Model.Gender" For="@(() => Model.Gender)" Label="Gender">
|
|
||||||
@foreach (var genderPair in GuestConsts.GenderList)
|
|
||||||
{
|
|
||||||
<MudSelectItem Value="genderPair.Key">@genderPair.Value</MudSelectItem>
|
|
||||||
}
|
|
||||||
</MudSelect>
|
|
||||||
</MudStack>
|
|
||||||
</MudPaper>
|
|
||||||
</MudItem>
|
|
||||||
|
|
||||||
<MudItem xs="12" md="6">
|
|
||||||
<MudPaper Class="pa-4" Elevation="3" Height="100%">
|
|
||||||
<MudText Typo="Typo.subtitle1" Align="Align.Center">Contact Details</MudText>
|
|
||||||
<MudDivider DividerType="DividerType.Middle" Class="mb-4" />
|
|
||||||
|
|
||||||
<MudStack Row>
|
|
||||||
<MudTextField @bind-Value="Model.PhoneNumber" For="@(() => Model.PhoneNumber)" Immediate="true"
|
|
||||||
Label="Phone Number" />
|
|
||||||
<MudTextField @bind-Value="Model.EmailAddress" For="@(() => Model.EmailAddress)" Immediate="true"
|
|
||||||
Label="Email" />
|
|
||||||
</MudStack>
|
|
||||||
</MudPaper>
|
|
||||||
</MudItem>
|
|
||||||
|
|
||||||
<MudItem xs="12" md="6">
|
|
||||||
<MudPaper Class="pa-4" Elevation="3" Height="100%">
|
|
||||||
<MudText Typo="Typo.subtitle1" Align="Align.Center">Address</MudText>
|
|
||||||
<MudDivider DividerType="DividerType.Middle" Class="mb-4" />
|
|
||||||
|
|
||||||
<MudTextField @bind-Value="Model.Address" For="@(() => Model.Address)" Immediate="true" Label="Address" />
|
|
||||||
<MudStack Row>
|
|
||||||
<MudTextField @bind-Value="Model.AddressCity" For="@(() => Model.AddressCity)" Immediate="true"
|
|
||||||
Label="City" />
|
|
||||||
<MudTextField @bind-Value="Model.AddressProvince" For="@(() => Model.AddressProvince)" Immediate="true"
|
|
||||||
Label="Province" />
|
|
||||||
<MudTextField @bind-Value="Model.AddressState" For="@(() => Model.AddressState)" Immediate="true"
|
|
||||||
Label="State" />
|
|
||||||
</MudStack>
|
|
||||||
<MudStack Row>
|
|
||||||
<MudSelect @bind-Value="Model.AddressCountry" For="@(() => Model.AddressCountry)" Label="Country">
|
|
||||||
@foreach (var countryPair in GuestConsts.CountryList)
|
|
||||||
{
|
|
||||||
<MudSelectItem Value="countryPair.Key">@countryPair.Value</MudSelectItem>
|
|
||||||
}
|
|
||||||
</MudSelect>
|
|
||||||
<MudTextField @bind-Value="Model.ZipCode" For="@(() => Model.ZipCode)" Immediate="true"
|
|
||||||
Label="ZipCode" />
|
|
||||||
</MudStack>
|
|
||||||
</MudPaper>
|
|
||||||
</MudItem>
|
|
||||||
</MudGrid>
|
|
||||||
<MudText Class="mt-4">@CreateTimeString</MudText>
|
|
||||||
</MudForm>
|
|
||||||
|
|
||||||
@code {
|
|
||||||
|
|
||||||
[Parameter]
|
|
||||||
public GuestDocumentDTO Model { get; set; } = new();
|
|
||||||
|
|
||||||
[Parameter]
|
|
||||||
public bool ReadOnly { get; set; } = false;
|
|
||||||
|
|
||||||
|
|
||||||
private MudForm _form = null!;
|
|
||||||
private readonly GuestDocumentDTOValidator guestDocValidator = new();
|
|
||||||
|
|
||||||
private bool isSuportNumberRequired { get => Model?.Nationality == "ESP"; }
|
|
||||||
private string CreateTimeString
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
List<string> textList = [];
|
|
||||||
if (Model.CreateTime != null)
|
|
||||||
{
|
|
||||||
textList.Add($"Created at: {Model.CreateTime.Value.ToString()}");
|
|
||||||
}
|
|
||||||
if (Model.UpdateTime != null)
|
|
||||||
{
|
|
||||||
textList.Add($"Last Update Time: {Model.UpdateTime.Value.ToString()}");
|
|
||||||
}
|
|
||||||
return string.Join("; ", textList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<bool> ValidateForm()
|
|
||||||
{
|
|
||||||
await _form.ValidateAsync();
|
|
||||||
return _form.IsValid;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
@using Somnia.GuestLog.Models.DTOs;
|
||||||
|
@using Somnia.GuestLog.Services
|
||||||
|
@using Somnia.GuestLog.Services.Entity
|
||||||
|
|
||||||
|
@inject ILogger<AddressQueryDialog> logger;
|
||||||
|
@inject IUserMessageService userMessage
|
||||||
|
@inject IGuestDocumentEntityService guestDocumentService;
|
||||||
|
|
||||||
|
|
||||||
|
<MudDialog Style="max-height: 90%;">
|
||||||
|
<TitleContent>
|
||||||
|
<MudText Typo="Typo.h6">
|
||||||
|
<MudIcon Icon="@Icons.Material.Filled.PersonSearch" Class="mr-3 mb-n1" />
|
||||||
|
@LanguageLocale.control_GuestDocumentSearchDialog_dialogTitle
|
||||||
|
</MudText>
|
||||||
|
</TitleContent>
|
||||||
|
<DialogContent>
|
||||||
|
<GuestDocumentFilterForm @bind-Filter="@filter" />
|
||||||
|
<MudButton StartIcon="@Icons.Material.Filled.Search" OnClick="BtnSearchGuestDocuments" FullWidth
|
||||||
|
Variant="Variant.Filled" Disabled="@isLoading">
|
||||||
|
@LanguageLocale.general_btnSearch
|
||||||
|
</MudButton>
|
||||||
|
<MudDivider DividerType="DividerType.FullWidth" Class="my-4" />
|
||||||
|
|
||||||
|
<MudPaper Class="pa-2" MinHeight="120px">
|
||||||
|
@if (!isLoading && results.Count() == 0)
|
||||||
|
{
|
||||||
|
<MudText Typo="Typo.body1" Align="Align.Center">@LanguageLocale.general_noResults</MudText>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (isLoading)
|
||||||
|
{
|
||||||
|
<MudSkeleton SkeletonType="SkeletonType.Rectangle" Height="100px" />
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (!isLoading)
|
||||||
|
{
|
||||||
|
@* Only show on first load *@
|
||||||
|
@if (loadCount == 1)
|
||||||
|
{
|
||||||
|
<MudText Align="Align.Center" GutterBottom>
|
||||||
|
@LanguageLocale.control_GuestDocumentSearchDialog_txtSuggestedGuests
|
||||||
|
</MudText>
|
||||||
|
}
|
||||||
|
|
||||||
|
<MudList T="GuestDocumentDTO" @bind-SelectedValue="SelectedResult"
|
||||||
|
SelectionMode="SelectionMode.SingleSelection" Color="Color.Info">
|
||||||
|
@foreach (GuestDocumentDTO result in results)
|
||||||
|
{
|
||||||
|
<MudListItem Value="result">
|
||||||
|
<ChildContent>
|
||||||
|
<MudTextField Value="@($"{result.DocumentType} - {result.DocumentNum}")"
|
||||||
|
Label="@LanguageLocale.dto_GuestDocument_DocumentNum" ReadOnly />
|
||||||
|
<MudTextField Value="@($"{result.Name} {result.Surname} {result.Surname2}")"
|
||||||
|
Label="@LanguageLocale.dto_GuestDocument_Name" ReadOnly />
|
||||||
|
</ChildContent>
|
||||||
|
</MudListItem>
|
||||||
|
}
|
||||||
|
</MudList>
|
||||||
|
}
|
||||||
|
</MudPaper>
|
||||||
|
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<MudButton OnClick="Cancel">
|
||||||
|
@LanguageLocale.general_btnCancel
|
||||||
|
</MudButton>
|
||||||
|
<MudButton Color="Color.Primary" OnClick="btnSelectGuest">
|
||||||
|
@LanguageLocale.control_GuestDocumentSearchDialog_btnSelectDocument
|
||||||
|
</MudButton>
|
||||||
|
</DialogActions>
|
||||||
|
</MudDialog>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
// Dialog Instance injected when open by the DialogService.
|
||||||
|
// This field is null when dialog is not open by the DialogService.
|
||||||
|
[CascadingParameter]
|
||||||
|
private IMudDialogInstance MudDialog { get; set; } = null!;
|
||||||
|
|
||||||
|
|
||||||
|
private GuestDocFilterDTO filter { get; set; } = new()
|
||||||
|
{
|
||||||
|
OnlyLastVersion = true
|
||||||
|
};
|
||||||
|
private IEnumerable<GuestDocumentDTO> results = [];
|
||||||
|
private GuestDocumentDTO? SelectedResult { get; set; }
|
||||||
|
|
||||||
|
private bool isLoading = false;
|
||||||
|
private int loadCount = 0;
|
||||||
|
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
//Load last 5 guests.
|
||||||
|
await LoadGuests(limit: 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void Cancel() => MudDialog.Cancel();
|
||||||
|
|
||||||
|
|
||||||
|
private async Task LoadGuests(int limit = 25)
|
||||||
|
{
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
isLoading = true;
|
||||||
|
results = await guestDocumentService.GetDtoListByFilterAsync(filter);
|
||||||
|
isLoading = false;
|
||||||
|
loadCount++;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.LogError(ex, "GuestDocument Search returned an error!");
|
||||||
|
userMessage.ShowMessage($"Error searching: {ex.Message}", MessageKind.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#region Event Handlers
|
||||||
|
|
||||||
|
private async Task BtnSearchGuestDocuments()
|
||||||
|
{
|
||||||
|
if (filter.IsEmpty)
|
||||||
|
{
|
||||||
|
userMessage.ShowMessage("Search can't be empty!", MessageKind.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Load unlimited guests using current filter.
|
||||||
|
await LoadGuests();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task btnSelectGuest()
|
||||||
|
{
|
||||||
|
if (SelectedResult is null)
|
||||||
|
{
|
||||||
|
userMessage.ShowMessage("A guest document must be selected", MessageKind.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DialogResult dialogResult = DialogResult.Ok<GuestDocumentDTO?>(SelectedResult);
|
||||||
|
|
||||||
|
//Close the dialog when opened by DialogService.
|
||||||
|
logger.LogDebug("GuestDocumentSearchDialog - Closed MudDialogInstance!");
|
||||||
|
MudDialog.Close(dialogResult);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
@using System.Globalization
|
||||||
|
@using Microsoft.AspNetCore.Localization
|
||||||
|
|
||||||
|
@inject IJSRuntime JS
|
||||||
|
@inject NavigationManager Navigation
|
||||||
|
|
||||||
|
<MudItem>
|
||||||
|
<MudIconButton Icon="@Icons.Material.Outlined.Translate" Color="Color.Primary" DropShadow="false"
|
||||||
|
OnClick="@BtnToggleOpen" />
|
||||||
|
<MudPopover Open="_open" AnchorOrigin="Origin.BottomCenter" TransformOrigin="Origin.TopLeft" Paper="false">
|
||||||
|
<MudPaper Outlined="true" Class="px-4 py-8">
|
||||||
|
<MudSelect Value="currentCulture" T="CultureInfo" Label="@LanguageLocale.general_languageSelector" FullWidth="true"
|
||||||
|
ValueChanged="(culture) => CmbSelectedCultureChanged(culture)">
|
||||||
|
@foreach (CultureInfo culture in supportedCultures)
|
||||||
|
{
|
||||||
|
<MudSelectItem Value="culture">
|
||||||
|
@culture.DisplayName
|
||||||
|
</MudSelectItem>
|
||||||
|
}
|
||||||
|
</MudSelect>
|
||||||
|
</MudPaper>
|
||||||
|
</MudPopover>
|
||||||
|
</MudItem>
|
||||||
|
|
||||||
|
|
||||||
|
@code {
|
||||||
|
|
||||||
|
private bool _open;
|
||||||
|
|
||||||
|
private CultureInfo? currentCulture;
|
||||||
|
private List<CultureInfo> supportedCultures = [
|
||||||
|
new CultureInfo("en-US"),
|
||||||
|
new CultureInfo("es-ES"),
|
||||||
|
];
|
||||||
|
|
||||||
|
protected override void OnInitialized()
|
||||||
|
{
|
||||||
|
currentCulture = CultureInfo.CurrentCulture;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void BtnToggleOpen() => _open = !_open;
|
||||||
|
private async Task CmbSelectedCultureChanged(CultureInfo? newCulture)
|
||||||
|
{
|
||||||
|
if (newCulture is null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string cookieValue = CookieRequestCultureProvider.MakeCookieValue(
|
||||||
|
new RequestCulture(newCulture, newCulture));
|
||||||
|
|
||||||
|
await JS.InvokeVoidAsync("setBlazorCultureCookie", cookieValue);
|
||||||
|
Navigation.NavigateTo(Navigation.Uri, forceLoad: true);
|
||||||
|
|
||||||
|
//Close Popover.
|
||||||
|
_open = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<MudDialog>
|
<MudDialog>
|
||||||
<TitleContent>
|
<TitleContent>
|
||||||
<MudText Typo="Typo.subtitle1" Align="Align.Center">In progress...</MudText>
|
<MudText Typo="Typo.subtitle1" Align="Align.Center">@LanguageLocale.general_inProgressMsg</MudText>
|
||||||
</TitleContent>
|
</TitleContent>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<div class="d-flex flex-grow-1 flex-wrap justify-center align-center ma-8">
|
<div class="d-flex flex-grow-1 flex-wrap justify-center align-center ma-8">
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<MudText Typo="@TextTypo" Align="Align.Center">
|
||||||
|
@Title
|
||||||
|
</MudText>
|
||||||
|
<MudDivider DividerType="DividerType.Middle" Class="mb-4" />
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter, EditorRequired]
|
||||||
|
public string Title { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public Typo TextTypo { get; set; } = Typo.subtitle1;
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
@using Somnia.GuestLog.Enums.Models
|
||||||
|
@using Somnia.GuestLog.Models.DTOs
|
||||||
|
@using Somnia.GuestLog.Services
|
||||||
|
|
||||||
|
@inject ILocalizerService Localizer;
|
||||||
|
|
||||||
|
<MudDialog>
|
||||||
|
<TitleContent>
|
||||||
|
@LanguageLocale.control_UploadStatusSelectorDialog_dialogTitle
|
||||||
|
</TitleContent>
|
||||||
|
<DialogContent>
|
||||||
|
<MudTextField Value="@Localizer.GetEnumValue(CurrentStatus)"
|
||||||
|
Label="@LanguageLocale.control_UploadStatusSelectorDialog_lbCurrentStatus" FullWidth ReadOnly="true" />
|
||||||
|
<MudSelect @bind-Value="selectedStatus"
|
||||||
|
Label="@LanguageLocale.control_UploadStatusSelectorDialog_lbSelectStatus" FullWidth Clearable Required
|
||||||
|
Error="selectErrorText != null" ErrorText="@selectErrorText">
|
||||||
|
@foreach (UploadStatus option in Enum.GetValues<UploadStatus>())
|
||||||
|
{
|
||||||
|
<MudSelectItem Value="new Nullable<UploadStatus>(option)">
|
||||||
|
@Localizer.GetEnumValue(option)
|
||||||
|
</MudSelectItem>
|
||||||
|
}
|
||||||
|
</MudSelect>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<MudButton OnClick="Cancel">
|
||||||
|
@LanguageLocale.general_btnCancel
|
||||||
|
</MudButton>
|
||||||
|
<MudButton Color="Color.Primary" OnClick="Submit">
|
||||||
|
@LanguageLocale.general_btnSave
|
||||||
|
</MudButton>
|
||||||
|
</DialogActions>
|
||||||
|
</MudDialog>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[CascadingParameter]
|
||||||
|
private IMudDialogInstance MudDialog { get; set; } = null!;
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public UploadStatus CurrentStatus { get; set; } = new();
|
||||||
|
|
||||||
|
private UploadStatus? selectedStatus = null;
|
||||||
|
|
||||||
|
private string? selectErrorText = null;
|
||||||
|
|
||||||
|
private void Cancel() => MudDialog.Cancel();
|
||||||
|
|
||||||
|
private void Submit()
|
||||||
|
{
|
||||||
|
if (selectedStatus == null || selectedStatus == CurrentStatus)
|
||||||
|
{
|
||||||
|
selectErrorText = LanguageLocale.general_validation_invalidOption;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Clear errors.
|
||||||
|
selectErrorText = null;
|
||||||
|
|
||||||
|
DialogResult dialogResult = DialogResult.Ok<UploadStatus>(selectedStatus.Value);
|
||||||
|
MudDialog.Close(dialogResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,282 @@
|
|||||||
|
@using System.Linq;
|
||||||
|
@using FluentValidation;
|
||||||
|
@using Somnia.GuestLog.Models.DTOs;
|
||||||
|
@using Somnia.GuestLog.Services;
|
||||||
|
@using Somnia.GuestLog.Validators;
|
||||||
|
|
||||||
|
@inject IDataListService dataListService;
|
||||||
|
@inject IValidator<GuestDocumentDTO> guestDocValidator;
|
||||||
|
@inject IUserMessageService userMessage;
|
||||||
|
|
||||||
|
|
||||||
|
<MudForm @ref="@_form" Model="@Model" Validation="@((guestDocValidator as GuestDocumentDTOValidator)!.ValidateValue)"
|
||||||
|
ValidationDelay="0" ReadOnly="@ReadOnly">
|
||||||
|
<MudGrid>
|
||||||
|
<MudItem xs="12" md="6">
|
||||||
|
<MudPaper Class="pa-4" Elevation="3" Height="100%">
|
||||||
|
<MudText Typo="Typo.subtitle1" Align="Align.Center">
|
||||||
|
@LanguageLocale.control_GuestDocForm_sectionDocument
|
||||||
|
</MudText>
|
||||||
|
<MudDivider DividerType="DividerType.Middle" Class="mb-4" />
|
||||||
|
<MudStack Row style="@FieldMarginY">
|
||||||
|
<MudSelect @bind-Value="Model.DocumentType" For="@(() => Model.DocumentType)"
|
||||||
|
Label="@LanguageLocale.dto_GuestDocument_DocumentType" Required ReadOnly="@ReadOnlyDocId">
|
||||||
|
@foreach (string docType in
|
||||||
|
dataListService.GetDataListByName(GuestConsts.DataList_DocumentTypes))
|
||||||
|
{
|
||||||
|
<MudSelectItem Value="docType">
|
||||||
|
@dataListService.GetLocalizedValue(GuestConsts.DataList_DocumentTypes, docType)
|
||||||
|
</MudSelectItem>
|
||||||
|
}
|
||||||
|
</MudSelect>
|
||||||
|
<MudTextField @bind-Value="Model.DocumentNum" For="@(() => Model.DocumentNum)"
|
||||||
|
Label="@LanguageLocale.dto_GuestDocument_DocumentNum" Required ReadOnly="@ReadOnlyDocId" />
|
||||||
|
</MudStack>
|
||||||
|
|
||||||
|
<MudStack Row style="@FieldMarginY">
|
||||||
|
<MudDatePicker @bind-Date="Model.IssueDate" For="@(() => Model.IssueDate)"
|
||||||
|
Label="@LanguageLocale.dto_GuestDocument_IssueDate" Clearable OpenTo="OpenTo.Year" Editable />
|
||||||
|
|
||||||
|
<MudTextField @bind-Value="Model.SupportNum" For="@(() => Model.SupportNum)"
|
||||||
|
Label="@LanguageLocale.dto_GuestDocument_SupportNum" Required="@isSuportNumberRequired"
|
||||||
|
Mask="SuportNumberPatternMask"
|
||||||
|
OnBlur="@(() => Model.SupportNum = Model.SupportNum?.ToUpper())" />
|
||||||
|
</MudStack>
|
||||||
|
|
||||||
|
<MudAutocomplete T="string" @bind-Value="Model.Nationality" For="@(() => Model.Nationality)"
|
||||||
|
Label="@LanguageLocale.dto_GuestDocument_Nationality" SearchFunc="@SearchCountryCodes"
|
||||||
|
ToStringFunc="@(e=> string.IsNullOrEmpty(e) ? "" : @dataListService.GetLocalizedValue(GuestConsts.DataList_CountryCodes, e))"
|
||||||
|
SelectValueOnTab="true" AdornmentIcon="@Icons.Material.Filled.Search" style="@FieldMarginY"
|
||||||
|
Required />
|
||||||
|
</MudPaper>
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="12" md="6">
|
||||||
|
<MudPaper Class="pa-4" Elevation="3" Height="100%">
|
||||||
|
<MudText Typo="Typo.subtitle1" Align="Align.Center">
|
||||||
|
@LanguageLocale.control_GuestDocForm_sectionGuest
|
||||||
|
</MudText>
|
||||||
|
<MudDivider DividerType="DividerType.Middle" Class="mb-4" />
|
||||||
|
|
||||||
|
<MudTextField @bind-Value="Model.Name" For="@(() => Model.Name)" Required
|
||||||
|
Label="@LanguageLocale.dto_GuestDocument_Name"
|
||||||
|
OnBlur="@(() => Model.Name = Model.Name?.ToUpper())" />
|
||||||
|
<MudTextField @bind-Value="Model.Surname" For="@(() => Model.Surname)" Required
|
||||||
|
Label="@LanguageLocale.dto_GuestDocument_Surname"
|
||||||
|
OnBlur="@(() => Model.Surname = Model.Surname?.ToUpper())" />
|
||||||
|
<MudTextField @bind-Value="Model.Surname2" For="@(() => Model.Surname2)"
|
||||||
|
Label="@LanguageLocale.dto_GuestDocument_Surname2"
|
||||||
|
OnBlur="@(() => Model.Surname2 = Model.Surname2?.ToUpper())" />
|
||||||
|
|
||||||
|
<MudStack Row style="@FieldMarginY">
|
||||||
|
<MudDatePicker @bind-Date="Model.BirthDate" For="@(() => Model.BirthDate)"
|
||||||
|
Label="@LanguageLocale.dto_GuestDocument_BirthDate" OpenTo="OpenTo.Year" Clearable Required
|
||||||
|
Editable />
|
||||||
|
|
||||||
|
<MudSelect @bind-Value="Model.Gender" For="@(() => Model.Gender)"
|
||||||
|
Label="@LanguageLocale.dto_GuestDocument_Gender">
|
||||||
|
@foreach (string gender in
|
||||||
|
dataListService.GetDataListByName(GuestConsts.DataList_GenderOptions))
|
||||||
|
{
|
||||||
|
<MudSelectItem Value="gender">
|
||||||
|
@dataListService.GetLocalizedValue(GuestConsts.DataList_GenderOptions, gender)
|
||||||
|
</MudSelectItem>
|
||||||
|
}
|
||||||
|
</MudSelect>
|
||||||
|
</MudStack>
|
||||||
|
</MudPaper>
|
||||||
|
</MudItem>
|
||||||
|
|
||||||
|
<MudItem xs="12" md="6">
|
||||||
|
<MudPaper Class="pa-4" Elevation="3" Height="100%">
|
||||||
|
<MudText Typo="Typo.subtitle1" Align="Align.Center">
|
||||||
|
@LanguageLocale.control_GuestDocForm_sectionContact
|
||||||
|
</MudText>
|
||||||
|
<MudDivider DividerType="DividerType.Middle" Class="mb-4" />
|
||||||
|
|
||||||
|
<MudStack Row>
|
||||||
|
<MudTextField @bind-Value="Model.PhoneNumber" For="@(() => Model.PhoneNumber)"
|
||||||
|
Label="@LanguageLocale.dto_GuestDocument_PhoneNumber" InputType="InputType.Telephone" />
|
||||||
|
<MudTextField @bind-Value="Model.EmailAddress" For="@(() => Model.EmailAddress)"
|
||||||
|
Label="@LanguageLocale.dto_GuestDocument_EmailAddress" InputType="InputType.Email" />
|
||||||
|
</MudStack>
|
||||||
|
</MudPaper>
|
||||||
|
</MudItem>
|
||||||
|
|
||||||
|
<MudItem xs="12" md="6">
|
||||||
|
<MudPaper Class="pa-4" Elevation="3" Height="100%">
|
||||||
|
<MudText Typo="Typo.subtitle1" Align="Align.Center">
|
||||||
|
@LanguageLocale.control_GuestDocForm_sectionAddress
|
||||||
|
</MudText>
|
||||||
|
<MudDivider DividerType="DividerType.Middle" Class="mb-4" />
|
||||||
|
|
||||||
|
@if (!ReadOnly)
|
||||||
|
{
|
||||||
|
<MudStack Row>
|
||||||
|
<MudButton OnClick="BtnOpenAddressSearchDialog" Variant="Variant.Outlined" FullWidth="true"
|
||||||
|
Class="mb-2">
|
||||||
|
@LanguageLocale.control_GuestDocForm_btnSearchAddress
|
||||||
|
</MudButton>
|
||||||
|
<MudIconButton OnClick="BtnSkipAddressSearch" Variant="Variant.Outlined" Disabled="!ReadOnlyAddress"
|
||||||
|
Icon="@Icons.Material.Filled.SkipNext" Class="mb-2" />
|
||||||
|
</MudStack>
|
||||||
|
}
|
||||||
|
|
||||||
|
<MudTextField @bind-Value="Model.Address" For="@(() => Model.Address)"
|
||||||
|
Label="@LanguageLocale.general_address_address" ReadOnly="@ReadOnlyAddress" />
|
||||||
|
<MudStack Row style="@FieldMarginY">
|
||||||
|
<MudTextField @bind-Value="Model.AddressCity" For="@(() => Model.AddressCity)"
|
||||||
|
Label="@LanguageLocale.general_address_city" ReadOnly="@ReadOnlyAddress" />
|
||||||
|
<MudTextField @bind-Value="Model.AddressProvince" For="@(() => Model.AddressProvince)"
|
||||||
|
Label="@LanguageLocale.general_address_province" ReadOnly="@ReadOnlyAddress" />
|
||||||
|
<MudTextField @bind-Value="Model.AddressState" For="@(() => Model.AddressState)"
|
||||||
|
Label="@LanguageLocale.general_address_state" ReadOnly="@ReadOnlyAddress" />
|
||||||
|
</MudStack>
|
||||||
|
<MudStack Row style="@FieldMarginY">
|
||||||
|
<MudAutocomplete T="string" @bind-Value="Model.AddressCountry" For="@(() => Model.AddressCountry)"
|
||||||
|
Label="@LanguageLocale.general_address_country" ReadOnly="@ReadOnlyAddress"
|
||||||
|
SearchFunc="@SearchCountryCodes"
|
||||||
|
ToStringFunc="@(e=> string.IsNullOrEmpty(e) ? "" : @dataListService.GetLocalizedValue(GuestConsts.DataList_CountryCodes, e))"
|
||||||
|
SelectValueOnTab="true" AdornmentIcon="@Icons.Material.Filled.Search" />
|
||||||
|
|
||||||
|
<MudTextField @bind-Value="Model.ZipCode" For="@(() => Model.ZipCode)"
|
||||||
|
Label="@LanguageLocale.general_address_zipCode" ReadOnly="@ReadOnlyAddress" />
|
||||||
|
</MudStack>
|
||||||
|
</MudPaper>
|
||||||
|
</MudItem>
|
||||||
|
</MudGrid>
|
||||||
|
<MudText Class="mt-4">@CreateTimeString</MudText>
|
||||||
|
</MudForm>
|
||||||
|
|
||||||
|
<AddressQueryDialog @ref="@AddressQueryDialog" />
|
||||||
|
|
||||||
|
@code {
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public GuestDocumentDTO Model { get; set; } = new();
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public bool ReadOnly { get; set; } = false;
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public bool ReadOnlyDocId { get; set; } = true;
|
||||||
|
|
||||||
|
|
||||||
|
private MudForm _form = null!;
|
||||||
|
AddressQueryDialog AddressQueryDialog { get; set; } = null!;
|
||||||
|
DialogOptions AddressQueryDialogOptions = new()
|
||||||
|
{
|
||||||
|
MaxWidth = MaxWidth.Large,
|
||||||
|
FullWidth = true,
|
||||||
|
};
|
||||||
|
private bool ReadOnlyAddress { get; set; } = true;
|
||||||
|
|
||||||
|
private const string FieldMarginY = "margin-block: 0.5em";
|
||||||
|
|
||||||
|
private Dictionary<string, string>? countryDict = null;
|
||||||
|
|
||||||
|
private bool isSuportNumberRequired
|
||||||
|
{
|
||||||
|
get => Model?.DocumentType == GuestConsts.DocumentType_DNI
|
||||||
|
|| Model?.DocumentType == GuestConsts.DocumentType_NIE;
|
||||||
|
}
|
||||||
|
private PatternMask SuportNumberPatternMask
|
||||||
|
{
|
||||||
|
get => Model?.DocumentType switch
|
||||||
|
{
|
||||||
|
GuestConsts.DocumentType_DNI => new PatternMask("aaa000000"),
|
||||||
|
GuestConsts.DocumentType_NIE => new PatternMask("a00000000"),
|
||||||
|
_ => new PatternMask("")
|
||||||
|
};
|
||||||
|
}
|
||||||
|
private string CreateTimeString
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
List<string> textList = [];
|
||||||
|
if (Model.CreateTime != null)
|
||||||
|
{
|
||||||
|
textList.Add($"Created at: {Model.CreateTime.Value.ToString()}");
|
||||||
|
}
|
||||||
|
if (Model.UpdateTime != null)
|
||||||
|
{
|
||||||
|
textList.Add($"Last Update Time: {Model.UpdateTime.Value.ToString()}");
|
||||||
|
}
|
||||||
|
return string.Join("; ", textList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> ValidateForm()
|
||||||
|
{
|
||||||
|
await _form.ValidateAsync();
|
||||||
|
return _form.IsValid;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<IEnumerable<string>> SearchCountryCodes(string value, CancellationToken token)
|
||||||
|
{
|
||||||
|
// if text is null or empty, show complete list
|
||||||
|
if (string.IsNullOrEmpty(value))
|
||||||
|
{
|
||||||
|
return new string[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (countryDict is null || countryDict.Count == 0)
|
||||||
|
{
|
||||||
|
var countryCodeSet = dataListService.GetDataListByName(GuestConsts.DataList_CountryCodes);
|
||||||
|
countryDict = new(countryCodeSet.Count);
|
||||||
|
|
||||||
|
//Init dict.
|
||||||
|
foreach (string code in dataListService.GetDataListByName(GuestConsts.DataList_CountryCodes))
|
||||||
|
{
|
||||||
|
countryDict.Add(code, dataListService.GetLocalizedValue(GuestConsts.DataList_CountryCodes, code));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return countryDict
|
||||||
|
.Where(x => x.Value.Contains(value, StringComparison.InvariantCultureIgnoreCase))
|
||||||
|
.Select(x => x.Key);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Event Handlers
|
||||||
|
|
||||||
|
private async Task BtnOpenAddressSearchDialog()
|
||||||
|
{
|
||||||
|
var reference = await AddressQueryDialog.ShowAsync(options: AddressQueryDialogOptions);
|
||||||
|
|
||||||
|
DialogResult? result = await reference.Result;
|
||||||
|
|
||||||
|
if (result is null || result.Canceled)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
AddressResultDTO? resultData = await reference.GetReturnValueAsync<AddressResultDTO>();
|
||||||
|
if (resultData is null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Update Address info.
|
||||||
|
Model.Address = $"{resultData.AddressRoad}, {resultData.HouseNumber}";
|
||||||
|
Model.AddressCity = resultData.AddressCity;
|
||||||
|
Model.AddressProvince = resultData.AddressProvince;
|
||||||
|
Model.AddressState = resultData.AddressState;
|
||||||
|
Model.ZipCode = resultData.ZipCode;
|
||||||
|
|
||||||
|
//Set country by address code.
|
||||||
|
Model.AddressCountry = resultData.AddressCountryCode;
|
||||||
|
|
||||||
|
//Address is editable after searching (if the form is editable).
|
||||||
|
ReadOnlyAddress = ReadOnly;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task BtnSkipAddressSearch()
|
||||||
|
{
|
||||||
|
userMessage.ShowMessage("Address search skipped! Address is editable now", MessageKind.Info);
|
||||||
|
|
||||||
|
//Make Address editable (if the form is editable).
|
||||||
|
ReadOnlyAddress = ReadOnly;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
@using Somnia.GuestLog.Models.DTOs
|
||||||
|
@using Somnia.GuestLog.Services
|
||||||
|
|
||||||
|
@inject IDataListService dataListService;
|
||||||
|
|
||||||
|
<MudForm Model="@Filter" IsTouchedChanged="@(() => FilterChanged.InvokeAsync(Filter))">
|
||||||
|
<MudStack Row Breakpoint="Breakpoint.LgAndDown" StretchItems="StretchItems.All">
|
||||||
|
<MudStack Row style="margin-block: 0.2em;">
|
||||||
|
<MudSelect @bind-Value="Filter.DocumentType" For="@(() => Filter.DocumentType)"
|
||||||
|
Label="@LanguageLocale.dto_GuestDocument_DocumentType" FullWidth Clearable>
|
||||||
|
@foreach (string docType in dataListService.GetDataListByName(GuestConsts.DataList_DocumentTypes))
|
||||||
|
{
|
||||||
|
<MudSelectItem Value="docType">
|
||||||
|
@dataListService.GetLocalizedValue(GuestConsts.DataList_DocumentTypes, docType)
|
||||||
|
</MudSelectItem>
|
||||||
|
}
|
||||||
|
</MudSelect>
|
||||||
|
<MudTextField @bind-Value="Filter.DocumentNumber" For="@(() => Filter.DocumentNumber)"
|
||||||
|
Label="@LanguageLocale.dto_GuestDocument_DocumentNum" FullWidth Clearable />
|
||||||
|
</MudStack>
|
||||||
|
<MudStack Row style="margin-block: 0.2em;">
|
||||||
|
<MudTextField @bind-Value="Filter.Name" For="@(() => Filter.Name)"
|
||||||
|
Label="@LanguageLocale.dto_GuestDocument_Name" HelperText="@LanguageLocale.general_wildcardHelperText"
|
||||||
|
HelperTextOnFocus="true" FullWidth Clearable OnBlur="@(() => Filter.Name = Filter.Name?.ToUpper())" />
|
||||||
|
<MudTextField @bind-Value="Filter.Surname" For="@(() => Filter.Surname)"
|
||||||
|
Label="@LanguageLocale.dto_GuestDocument_Surname"
|
||||||
|
HelperText="@LanguageLocale.general_wildcardHelperText" HelperTextOnFocus="true" FullWidth Clearable
|
||||||
|
OnBlur="@(() => Filter.Surname = Filter.Surname?.ToUpper())" />
|
||||||
|
</MudStack>
|
||||||
|
</MudStack>
|
||||||
|
</MudForm>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public GuestDocFilterDTO Filter { get; set; } = new();
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public EventCallback<GuestDocFilterDTO> FilterChanged { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
@using System.ComponentModel
|
||||||
|
@using Somnia.GuestLog.Enums.Models
|
||||||
|
@using Somnia.GuestLog.Models.DTOs
|
||||||
|
@using Somnia.GuestLog.Services
|
||||||
|
|
||||||
|
@inject IDataListService dataListService;
|
||||||
|
@inject ILocalizerService Localizer;
|
||||||
|
|
||||||
|
<MudForm Model="@Filter" IsTouchedChanged="@(() => FilterChanged.InvokeAsync(Filter))">
|
||||||
|
<MudStack Row Breakpoint="Breakpoint.LgAndDown" StretchItems="StretchItems.All">
|
||||||
|
<MudStack Row style="margin-block: 0.2em;">
|
||||||
|
<MudDatePicker @bind-Date="Filter.DateInStart" For="@(() => Filter.DateInStart)"
|
||||||
|
Label="@LanguageLocale.general_dateStart" OpenTo="OpenTo.Date" Editable Required="@DateRequired" />
|
||||||
|
<MudDatePicker @bind-Date="Filter.DateInEnd" For="@(() => Filter.DateInEnd)"
|
||||||
|
Label="@LanguageLocale.general_dateEnd" OpenTo="OpenTo.Date" Editable Required="@DateRequired" />
|
||||||
|
</MudStack>
|
||||||
|
|
||||||
|
<MudStack Row style="margin-block: 0.2em;">
|
||||||
|
<MudTextField @bind-Value="Filter.RoomNumber" For="@(() => Filter.RoomNumber)"
|
||||||
|
Label="@LanguageLocale.dto_StayEntry_RoomNumber" FullWidth Clearable />
|
||||||
|
<MudSelect @bind-Value="Filter.PaymentMethod" For="@(() => Filter.PaymentMethod)"
|
||||||
|
Label="@LanguageLocale.dto_StayEntry_PaymentMethod" FullWidth Clearable>
|
||||||
|
@foreach (string paymentType in
|
||||||
|
dataListService.GetDataListByName(GuestConsts.DataList_PaymentMethods))
|
||||||
|
{
|
||||||
|
<MudSelectItem Value="paymentType">
|
||||||
|
@dataListService.GetLocalizedValue(GuestConsts.DataList_PaymentMethods, paymentType)
|
||||||
|
</MudSelectItem>
|
||||||
|
}
|
||||||
|
</MudSelect>
|
||||||
|
<MudSelect @bind-Value="Filter.StayUploadStatus" Label="@LanguageLocale.dto_StayEntry_StayUploadStatus"
|
||||||
|
FullWidth Clearable>
|
||||||
|
@foreach (UploadStatus option in Enum.GetValues<UploadStatus>())
|
||||||
|
{
|
||||||
|
<MudSelectItem Value="new Nullable<UploadStatus>(option)">
|
||||||
|
@Localizer.GetEnumValue(option)
|
||||||
|
</MudSelectItem>
|
||||||
|
}
|
||||||
|
</MudSelect>
|
||||||
|
</MudStack>
|
||||||
|
</MudStack>
|
||||||
|
</MudForm>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
|
||||||
|
[Parameter, Bindable(true)]
|
||||||
|
public StayEntryFilterDTO Filter { get; set; } = new();
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public EventCallback<StayEntryFilterDTO> FilterChanged { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public bool DateRequired { get; set; } = true;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,282 @@
|
|||||||
|
@using System.Diagnostics
|
||||||
|
@using FluentValidation;
|
||||||
|
@using Somnia.GuestLog.Models.DTOs;
|
||||||
|
@using Somnia.GuestLog.Services;
|
||||||
|
@using Somnia.GuestLog.Validators;
|
||||||
|
|
||||||
|
@inject IDataListService dataListService;
|
||||||
|
@inject IValidator<StayEntryDTO> stayValidator;
|
||||||
|
@inject IDialogService dialogService;
|
||||||
|
@inject IUserMessageService userMessage;
|
||||||
|
@inject ILocalizerService Localizer;
|
||||||
|
|
||||||
|
|
||||||
|
<MudForm @ref="@_form" Model="@Model" Validation="@((stayValidator as StayEntryDTOValidator)!.ValidateValue)"
|
||||||
|
ReadOnly="@ReadOnly">
|
||||||
|
<MudGrid>
|
||||||
|
<MudItem xs="12" sm="@stayDetailPanelSize">
|
||||||
|
<MudPaper Class="pa-4" Elevation="3" Height="100%">
|
||||||
|
<SectionTitle Title="@LanguageLocale.control_StayEntryForm_sectionDetails" />
|
||||||
|
|
||||||
|
<MudStack Row style="@FieldMarginY">
|
||||||
|
<MudDatePicker Date="Model.DateIn" For="@(() => Model.DateIn)"
|
||||||
|
DateChanged="@((newVal) => Model.DateIn = GetDateTimeFromDateAndTime(newVal, Model.DateIn?.TimeOfDay))"
|
||||||
|
Label="@LanguageLocale.dto_StayEntry_DateIn" Clearable OpenTo="OpenTo.Date" Editable
|
||||||
|
AutoClose="true" />
|
||||||
|
<MudTimePicker Time="Model.DateIn?.TimeOfDay" Label=" " Editable
|
||||||
|
TimeChanged="@((newVal) => Model.DateIn = GetDateTimeFromDateAndTime(Model.DateIn, newVal))" />
|
||||||
|
<MudDatePicker Date="Model.DateOut" For="@(() => Model.DateOut)"
|
||||||
|
DateChanged="@((newVal) => Model.DateOut = GetDateTimeFromDateAndTime(newVal, Model.DateOut?.TimeOfDay))"
|
||||||
|
Label="@LanguageLocale.dto_StayEntry_DateOut" Clearable OpenTo="OpenTo.Date" Editable
|
||||||
|
AutoClose="true" />
|
||||||
|
<MudTimePicker Time="Model.DateOut?.TimeOfDay" Label=" " Editable
|
||||||
|
TimeChanged="@((newVal) => Model.DateOut = GetDateTimeFromDateAndTime(Model.DateOut, newVal))" />
|
||||||
|
</MudStack>
|
||||||
|
<MudStack Row style="@FieldMarginY">
|
||||||
|
<MudTextField @bind-Value="Model.RoomCount" For="@(() => Model.RoomCount)"
|
||||||
|
Label="@LanguageLocale.dto_StayEntry_RoomCount" InputType="InputType.Number" FullWidth />
|
||||||
|
<MudTextField @bind-Value="Model.RoomNumber" For="@(() => Model.RoomNumber)"
|
||||||
|
Label="@LanguageLocale.dto_StayEntry_RoomNumber" FullWidth />
|
||||||
|
|
||||||
|
<MudSelect @bind-Value="Model.PaymentMethod" For="@(() => Model.PaymentMethod)"
|
||||||
|
Label="@LanguageLocale.dto_StayEntry_PaymentMethod" FullWidth>
|
||||||
|
@foreach (string payment in PaymentMethodSet)
|
||||||
|
{
|
||||||
|
<MudSelectItem Value="payment">
|
||||||
|
@dataListService.GetLocalizedValue(GuestConsts.DataList_PaymentMethods, payment)
|
||||||
|
</MudSelectItem>
|
||||||
|
}
|
||||||
|
</MudSelect>
|
||||||
|
</MudStack>
|
||||||
|
</MudPaper>
|
||||||
|
</MudItem>
|
||||||
|
@if (FormMode == FormMode.ReadOnly)
|
||||||
|
{
|
||||||
|
<MudItem xs="12" sm="3">
|
||||||
|
<MudPaper Class="pa-4" Elevation="3" Height="100%">
|
||||||
|
<SectionTitle Title="@LanguageLocale.control_StayEntryForm_sectionUploadStatus" />
|
||||||
|
|
||||||
|
<MudTextField Value="@Localizer.GetEnumValue(Model.StayUploadStatus)"
|
||||||
|
Label="@LanguageLocale.dto_StayEntry_StayUploadStatus" FullWidth ReadOnly />
|
||||||
|
@if (Model.StayUploadStatusTime != null)
|
||||||
|
{
|
||||||
|
<MudTextField @bind-Value="Model.StayUploadStatusTime" For="@(() => Model.StayUploadStatusTime)"
|
||||||
|
Label="@LanguageLocale.dto_StayEntry_StayUploadStatusTime" FullWidth ReadOnly />
|
||||||
|
}
|
||||||
|
</MudPaper>
|
||||||
|
</MudItem>
|
||||||
|
}
|
||||||
|
<MudItem xs="12" xl="12">
|
||||||
|
<MudPaper Class="pa-4" Elevation="3" Height="100%" Width="100%">
|
||||||
|
<SectionTitle Title="@LanguageLocale.control_StayEntryForm_sectionGuests" />
|
||||||
|
|
||||||
|
@if (!ReadOnly)
|
||||||
|
{
|
||||||
|
<MudStack Row style="@FieldMarginY">
|
||||||
|
<MudButton OnClick="BtnAddGuest" StartIcon="@Icons.Material.Filled.Add">
|
||||||
|
@LanguageLocale.control_StayEntryForm_btnAddGuest
|
||||||
|
</MudButton>
|
||||||
|
</MudStack>
|
||||||
|
}
|
||||||
|
|
||||||
|
<MudTable Items="@Model.GuestDocuments" Hover="true">
|
||||||
|
<HeaderContent>
|
||||||
|
<MudTh>@LanguageLocale.dto_GuestDocument_DocumentType</MudTh>
|
||||||
|
<MudTh>@LanguageLocale.dto_GuestDocument_DocumentNum</MudTh>
|
||||||
|
<MudTh>@LanguageLocale.dto_GuestDocument_Name</MudTh>
|
||||||
|
<MudTh>@LanguageLocale.dto_GuestDocument_Surname</MudTh>
|
||||||
|
<MudTh>@LanguageLocale.dto_GuestDocument_Surname2</MudTh>
|
||||||
|
<MudTh>@LanguageLocale.general_actions</MudTh>
|
||||||
|
</HeaderContent>
|
||||||
|
<RowTemplate>
|
||||||
|
<MudTd DataLabel="@LanguageLocale.dto_GuestDocument_DocumentType">
|
||||||
|
@context.DocumentType
|
||||||
|
</MudTd>
|
||||||
|
<MudTd DataLabel="@LanguageLocale.dto_GuestDocument_DocumentNum">
|
||||||
|
@context.DocumentNum
|
||||||
|
</MudTd>
|
||||||
|
<MudTd DataLabel="@LanguageLocale.dto_GuestDocument_Name">
|
||||||
|
@context.Name
|
||||||
|
</MudTd>
|
||||||
|
<MudTd DataLabel="@LanguageLocale.dto_GuestDocument_Surname" HideSmall="true">
|
||||||
|
@context.Surname
|
||||||
|
</MudTd>
|
||||||
|
<MudTd DataLabel="@LanguageLocale.dto_GuestDocument_Surname2" HideSmall="true">
|
||||||
|
@context.Surname2
|
||||||
|
</MudTd>
|
||||||
|
@if (!ReadOnly)
|
||||||
|
{
|
||||||
|
<MudTd DataLabel="@LanguageLocale.general_actions">
|
||||||
|
<MudIconButton Icon="@Icons.Material.Filled.Delete"
|
||||||
|
OnClick="@(() => BtnDeleteGuest(context.Id!.Value, context.Version!.Value))" />
|
||||||
|
</MudTd>
|
||||||
|
}
|
||||||
|
@if (ReadOnly)
|
||||||
|
{
|
||||||
|
<MudTd DataLabel="@LanguageLocale.general_actions">
|
||||||
|
<MudIconButton Icon="@Icons.Material.Filled.Info"
|
||||||
|
OnClick="@(() => BtnViewGuestDetails(context))" />
|
||||||
|
</MudTd>
|
||||||
|
}
|
||||||
|
</RowTemplate>
|
||||||
|
</MudTable>
|
||||||
|
|
||||||
|
</MudPaper>
|
||||||
|
</MudItem>
|
||||||
|
</MudGrid>
|
||||||
|
</MudForm>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter]
|
||||||
|
public StayEntryDTO Model { private get; set; } = new();
|
||||||
|
|
||||||
|
[Parameter, EditorRequired]
|
||||||
|
public FormMode FormMode { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
private bool ReadOnly => FormMode == FormMode.ReadOnly;
|
||||||
|
private int stayDetailPanelSize => FormMode == FormMode.ReadOnly ? 9 : 12;
|
||||||
|
|
||||||
|
|
||||||
|
private MudForm _form = null!;
|
||||||
|
|
||||||
|
private const string FieldMarginY = "margin-block: 0.5em";
|
||||||
|
private IEnumerable<string> PaymentMethodSet
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (field is null)
|
||||||
|
{
|
||||||
|
field = dataListService.GetDataListByName(GuestConsts.DataList_PaymentMethods);
|
||||||
|
}
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected override void OnInitialized()
|
||||||
|
{
|
||||||
|
//Initialize values when not ReadOnly.
|
||||||
|
if (FormMode == FormMode.Create)
|
||||||
|
{
|
||||||
|
Model.DateIn = DateTime.Now;
|
||||||
|
|
||||||
|
DateTime dateOut = DateTime.Today.AddDays(1);
|
||||||
|
Model.DateOut = new(
|
||||||
|
year: dateOut.Year, month: dateOut.Month, day: dateOut.Day,
|
||||||
|
hour: 12, minute: 0, second: 0
|
||||||
|
);
|
||||||
|
|
||||||
|
//Init Guest List
|
||||||
|
Model.GuestDocuments = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Public Methods
|
||||||
|
|
||||||
|
public async Task<bool> ValidateForm()
|
||||||
|
{
|
||||||
|
await _form.ValidateAsync();
|
||||||
|
|
||||||
|
if (Model.GuestDocuments is null || Model.GuestDocuments.Count == 0)
|
||||||
|
{
|
||||||
|
userMessage.ShowMessage("At least 1 guest is required!", MessageKind.Warning);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _form.IsValid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StayEntryDTO GetModel()
|
||||||
|
{
|
||||||
|
return Model;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
private static DateTime? GetDateTimeFromDateAndTime(DateTime? date, TimeSpan? time)
|
||||||
|
{
|
||||||
|
DateOnly? dateOnly = date is not null ? DateOnly.FromDateTime(date.Value) : null;
|
||||||
|
TimeOnly? timeOnly = time is not null ? TimeOnly.FromTimeSpan(time.Value) : null;
|
||||||
|
|
||||||
|
if (dateOnly is not null && timeOnly is not null)
|
||||||
|
{
|
||||||
|
return new DateTime(dateOnly.Value, timeOnly.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Event Handlers
|
||||||
|
|
||||||
|
private async Task BtnAddGuest()
|
||||||
|
{
|
||||||
|
Debug.Assert(Model.GuestDocuments != null);
|
||||||
|
|
||||||
|
DialogOptions dialogOptions = new()
|
||||||
|
{
|
||||||
|
MaxWidth = MaxWidth.Medium,
|
||||||
|
FullWidth = true,
|
||||||
|
BackdropClick = false,
|
||||||
|
CloseOnEscapeKey = true,
|
||||||
|
};
|
||||||
|
|
||||||
|
var dialog = await dialogService.ShowAsync<GuestDocumentSearchDialog>(title: "", options: dialogOptions);
|
||||||
|
DialogResult? result = await dialog.Result;
|
||||||
|
|
||||||
|
if (result is null || result.Canceled)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GuestDocumentDTO? resultData = await dialog.GetReturnValueAsync<GuestDocumentDTO>();
|
||||||
|
|
||||||
|
if (resultData is null)
|
||||||
|
{
|
||||||
|
userMessage.ShowMessage("Error! No Guest Document selected!", MessageKind.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Check if this guest is already added.
|
||||||
|
if (Model.GuestDocuments.Count > 0)
|
||||||
|
{
|
||||||
|
bool alreadyAdded = Model.GuestDocuments.Any(e => e.Id == resultData.Id);
|
||||||
|
if (alreadyAdded)
|
||||||
|
{
|
||||||
|
userMessage.ShowMessage("GuestDocument already added!", MessageKind.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Model.GuestDocuments.Add(resultData);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnDeleteGuest(long guestDocId, int version)
|
||||||
|
{
|
||||||
|
Debug.Assert(Model.GuestDocuments is not null);
|
||||||
|
|
||||||
|
//Filter out given GuestDocument from model.
|
||||||
|
Model.GuestDocuments = Model.GuestDocuments
|
||||||
|
.Where(e => !(e.Id == guestDocId && e.Version == version))
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private async Task BtnViewGuestDetails(GuestDocumentDTO item)
|
||||||
|
{
|
||||||
|
var parameters =
|
||||||
|
new DialogParameters<GuestDocDetailsDialog> { { x => x.DocumentDTO, item } };
|
||||||
|
var options = new DialogOptions()
|
||||||
|
{
|
||||||
|
FullScreen = true,
|
||||||
|
CloseButton = true,
|
||||||
|
CloseOnEscapeKey = true,
|
||||||
|
};
|
||||||
|
|
||||||
|
await dialogService.ShowAsync<GuestDocDetailsDialog>("GuestDoc Details", parameters, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
@@ -19,9 +19,14 @@
|
|||||||
<MudToggleIconButton Class="ml-auto" Icon="@Icons.Material.Outlined.LightMode"
|
<MudToggleIconButton Class="ml-auto" Icon="@Icons.Material.Outlined.LightMode"
|
||||||
ToggledIcon="@Icons.Material.Outlined.DarkMode" ToggledColor="Color.Primary" Color="Color.Primary"
|
ToggledIcon="@Icons.Material.Outlined.DarkMode" ToggledColor="Color.Primary" Color="Color.Primary"
|
||||||
Toggled="@_isDarkMode" ToggledChanged="@DarkModeToggle" />
|
Toggled="@_isDarkMode" ToggledChanged="@DarkModeToggle" />
|
||||||
|
<LanguageSelector />
|
||||||
</MudAppBar>
|
</MudAppBar>
|
||||||
<MudDrawer id="nav-drawer" @bind-Open="_drawerOpen" ClipMode="DrawerClipMode.Docked" Elevation="2">
|
<MudDrawer id="nav-drawer" @bind-Open="_drawerOpen" ClipMode="DrawerClipMode.Docked" Elevation="2">
|
||||||
<NavMenu />
|
<NavMenu />
|
||||||
|
<MudSpacer />
|
||||||
|
<MudText Typo="Typo.caption" Class="mx-2" GutterBottom>
|
||||||
|
@AppSettings.AppName - @AppSettings.AppVersion
|
||||||
|
</MudText>
|
||||||
</MudDrawer>
|
</MudDrawer>
|
||||||
<MudMainContent Class="pt-16 pa-4">
|
<MudMainContent Class="pt-16 pa-4">
|
||||||
@Body
|
@Body
|
||||||
|
|||||||
@@ -1,11 +1,19 @@
|
|||||||
|
<MudNavMenu>
|
||||||
<MudNavMenu>
|
|
||||||
<MudNavLink Href="" Match="NavLinkMatch.All" Icon="@Icons.Material.Filled.Home">Home</MudNavLink>
|
<MudNavLink Href="" Match="NavLinkMatch.All" Icon="@Icons.Material.Filled.Home">Home</MudNavLink>
|
||||||
|
|
||||||
|
@*
|
||||||
<MudNavLink Href="counter" Match="NavLinkMatch.Prefix" Icon="@Icons.Material.Filled.Add">Counter</MudNavLink>
|
<MudNavLink Href="counter" Match="NavLinkMatch.Prefix" Icon="@Icons.Material.Filled.Add">Counter</MudNavLink>
|
||||||
|
|
||||||
<MudNavLink Href="weather" Match="NavLinkMatch.Prefix" Icon="@Icons.Material.Filled.List">Weather</MudNavLink>
|
<MudNavLink Href="weather" Match="NavLinkMatch.Prefix" Icon="@Icons.Material.Filled.List">Weather</MudNavLink>
|
||||||
|
*@
|
||||||
|
|
||||||
<MudNavLink Href="@GuestConsts.Page_GuestDocs_List" Match="NavLinkMatch.Prefix" Icon="@Icons.Material.Filled.DocumentScanner">Guests</MudNavLink>
|
<MudNavLink Href="@GuestConsts.Page_GuestDocs_List" Match="NavLinkMatch.Prefix"
|
||||||
|
Icon="@Icons.Material.Filled.DocumentScanner">
|
||||||
|
@LanguageLocale.navMenu_GuestDocumentList
|
||||||
|
</MudNavLink>
|
||||||
|
<MudNavLink Href="@GuestConsts.Page_StayEntry_List" Match="NavLinkMatch.Prefix" Icon="@Icons.Material.Filled.Book">
|
||||||
|
@LanguageLocale.navMenu_StayEntryList
|
||||||
|
</MudNavLink>
|
||||||
|
<MudNavLink Href="@GuestConsts.Page_StayExport_List" Match="NavLinkMatch.Prefix" Icon="@Icons.Material.Filled.ImportExport">
|
||||||
|
@LanguageLocale.navMenu_StayExport
|
||||||
|
</MudNavLink>
|
||||||
</MudNavMenu>
|
</MudNavMenu>
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
@page "/debug/addrSearch"
|
||||||
|
|
||||||
|
@using Somnia.GuestLog.Models.DTOs;
|
||||||
|
@using Somnia.GuestLog.Services;
|
||||||
|
@using Somnia.GuestLog.Services.AddressQuery;
|
||||||
|
|
||||||
|
@inject ILogger<AddressQuery> logger;
|
||||||
|
@inject IAddressQueryFactory addressQueryFactory;
|
||||||
|
@inject IUserMessageService userMessage
|
||||||
|
@inject IDialogService DialogService
|
||||||
|
|
||||||
|
<PageTitle>DEBUG - Address Query</PageTitle>
|
||||||
|
|
||||||
|
<MudText Typo="Typo.h3" GutterBottom="true" Class="mt-2">Address Search</MudText>
|
||||||
|
|
||||||
|
<MudPaper Class="ma-2 pa-4">
|
||||||
|
<MudStack Row>
|
||||||
|
<MudTextField @ref="txtSearch" @bind-Value="SearchText" Label="Search address" Required />
|
||||||
|
<MudButton Color="Color.Primary" Variant="Variant.Filled" @onclick="btnSearchAddress" Class="mt-2">Search
|
||||||
|
</MudButton>
|
||||||
|
</MudStack>
|
||||||
|
|
||||||
|
<MudPaper class="mt-2 pa-4">
|
||||||
|
@if (addressResults.Count == 0)
|
||||||
|
{
|
||||||
|
<MudText Typo="Typo.body1">No results!</MudText>
|
||||||
|
}
|
||||||
|
@foreach (AddressResultDTO result in addressResults)
|
||||||
|
{
|
||||||
|
<MudItem>
|
||||||
|
<MudStack>
|
||||||
|
<MudText>Address: @result.AddressRoad , @result.HouseNumber</MudText>
|
||||||
|
<MudText>City: @result.AddressCity</MudText>
|
||||||
|
<MudText>Province: @result.AddressProvince</MudText>
|
||||||
|
<MudText>State: @result.AddressState</MudText>
|
||||||
|
<MudText>Country: @result.AddressCountry</MudText>
|
||||||
|
<MudText>ZipCode: @result.ZipCode</MudText>
|
||||||
|
</MudStack>
|
||||||
|
</MudItem>
|
||||||
|
}
|
||||||
|
</MudPaper>
|
||||||
|
</MudPaper>
|
||||||
|
|
||||||
|
<MudDivider DividerType="DividerType.FullWidth" />
|
||||||
|
|
||||||
|
<MudPaper Class="ma-2 pa-4">
|
||||||
|
<MudButton OnClick="btnOpenSearchDialog" Color="Color.Primary" Variant="Variant.Filled" FullWidth>
|
||||||
|
Open Search Dialog
|
||||||
|
</MudButton>
|
||||||
|
|
||||||
|
@if (dialogSelectedAddress is not null)
|
||||||
|
{
|
||||||
|
<MudPaper class="mt-2 pa-4">
|
||||||
|
<MudText>Selected Address: </MudText>
|
||||||
|
<MudStack>
|
||||||
|
<MudText>Address: @dialogSelectedAddress.AddressRoad , @dialogSelectedAddress.HouseNumber</MudText>
|
||||||
|
<MudText>City: @dialogSelectedAddress.AddressCity</MudText>
|
||||||
|
<MudText>Province: @dialogSelectedAddress.AddressProvince</MudText>
|
||||||
|
<MudText>State: @dialogSelectedAddress.AddressState</MudText>
|
||||||
|
<MudText>Country: @dialogSelectedAddress.AddressCountry</MudText>
|
||||||
|
<MudText>ZipCode: @dialogSelectedAddress.ZipCode</MudText>
|
||||||
|
</MudStack>
|
||||||
|
</MudPaper>
|
||||||
|
}
|
||||||
|
</MudPaper>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
|
||||||
|
public string SearchText { get; set; } = "";
|
||||||
|
private List<AddressResultDTO> addressResults = [];
|
||||||
|
|
||||||
|
private MudTextField<string> txtSearch = null!;
|
||||||
|
|
||||||
|
private AddressResultDTO? dialogSelectedAddress = null;
|
||||||
|
|
||||||
|
private async Task btnSearchAddress()
|
||||||
|
{
|
||||||
|
if (SearchText.Length == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var queryService = addressQueryFactory.GetService();
|
||||||
|
|
||||||
|
addressResults = await queryService.SearchAddressAsync(SearchText);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.LogError(ex, "SearchAddress returned an error!");
|
||||||
|
userMessage.ShowMessage($"Error searching address: {ex.Message}", MessageKind.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task btnOpenSearchDialog()
|
||||||
|
{
|
||||||
|
DialogOptions options = new()
|
||||||
|
{
|
||||||
|
MaxWidth = MaxWidth.Large,
|
||||||
|
FullWidth= true,
|
||||||
|
};
|
||||||
|
|
||||||
|
var dialog = await DialogService.ShowAsync<AddressQueryDialog>("Search Address", options);
|
||||||
|
DialogResult? result = await dialog.Result;
|
||||||
|
|
||||||
|
if (result is not null && !result.Canceled)
|
||||||
|
{
|
||||||
|
AddressResultDTO? resultData = await dialog.GetReturnValueAsync<AddressResultDTO>();
|
||||||
|
|
||||||
|
dialogSelectedAddress = resultData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
@page "/debug/empty"
|
||||||
|
|
||||||
|
@using Somnia.GuestLog.Services
|
||||||
|
|
||||||
|
|
||||||
|
@inject ILogger<Empty> logger;
|
||||||
|
@inject IUserMessageService userMessage
|
||||||
|
@inject IDialogService DialogService
|
||||||
|
|
||||||
|
<PageTitle>DEBUG - Empty</PageTitle>
|
||||||
|
|
||||||
|
<MudText Typo="Typo.h3" GutterBottom="true" Class="mt-2">Empty Page for Debug</MudText>
|
||||||
|
|
||||||
|
|
||||||
|
@code {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,232 @@
|
|||||||
|
@attribute [Route($"{GuestConsts.Page_GuestDocs_Detail}")]
|
||||||
|
|
||||||
|
@using Somnia.GuestLog.Models.DTOs;
|
||||||
|
@using Somnia.GuestLog.Services;
|
||||||
|
@using Microsoft.AspNetCore.WebUtilities;
|
||||||
|
|
||||||
|
@inject IUserMessageService userMessage
|
||||||
|
@inject IDialogService DialogService
|
||||||
|
@inject NavigationManager Navigation
|
||||||
|
@inject IGuestDocumentEntityService guestDocService
|
||||||
|
@inject IStayEntryEntityService stayService
|
||||||
|
@inject IDialogService DialogService
|
||||||
|
|
||||||
|
|
||||||
|
<PageTitle>Somnia - Guest Docs - Details</PageTitle>
|
||||||
|
|
||||||
|
<MudStack Row="true" Class="my-4">
|
||||||
|
<MudText Typo="Typo.h4" GutterBottom="true">Guest Document: @docId - @documentModel?.FullDocument</MudText>
|
||||||
|
<MudSpacer />
|
||||||
|
@if (_isEditMode)
|
||||||
|
{
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Error" Size="Size.Small" StartIcon="@Icons.Material.Filled.Cancel"
|
||||||
|
OnClick="() => BtnCancelEdit()" Disabled="!_isEditMode">
|
||||||
|
@LanguageLocale.general_btnCancel
|
||||||
|
</MudButton>
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Success" Size="Size.Small" StartIcon="@Icons.Material.Filled.Save"
|
||||||
|
OnClick="() => BtnSaveEdit()" Disabled="!_isEditMode">
|
||||||
|
@LanguageLocale.general_btnSave
|
||||||
|
</MudButton>
|
||||||
|
}
|
||||||
|
@if (!_isEditMode)
|
||||||
|
{
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Success" Size="Size.Small" StartIcon="@Icons.Material.Filled.Edit"
|
||||||
|
OnClick="() => BtnEnableEdit()" Disabled="_isEditMode">
|
||||||
|
@LanguageLocale.general_btnEdit
|
||||||
|
</MudButton>
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Default" Size="Size.Small"
|
||||||
|
StartIcon="@Icons.Material.Filled.ArrowBack" OnClick="() => BtnReturn()">
|
||||||
|
@LanguageLocale.general_btnReturn
|
||||||
|
</MudButton>
|
||||||
|
}
|
||||||
|
</MudStack>
|
||||||
|
|
||||||
|
@if (documentModel is not null)
|
||||||
|
{
|
||||||
|
<MudTabs Elevation="3" Rounded="true" ApplyEffectsToContainer="true" TabPanelsClass="pa-4" KeepPanelsAlive="true"
|
||||||
|
Centered>
|
||||||
|
|
||||||
|
<MudTabPanel Text="Details" Icon="@Icons.Material.Filled.Info">
|
||||||
|
<GuestDocForm @ref="_form" Model="documentModel" ReadOnly="!_isEditMode" />
|
||||||
|
</MudTabPanel>
|
||||||
|
|
||||||
|
<MudTabPanel Text="Stays" ToolTip="Guest stays" Icon="@Icons.Material.Filled.Bed" OnClick="LoadTabGuestStays"
|
||||||
|
Disabled="_isEditMode">
|
||||||
|
<MudText>Total Stays: @(guestStaysLoading ? "Loading..." : guestStayList.Count())</MudText>
|
||||||
|
<MudTable Items="@guestStayList" Hover="true" Loading="@guestStaysLoading" Class="mt-2" Elevation="2">
|
||||||
|
<HeaderContent>
|
||||||
|
<MudTh>@LanguageLocale.dto_StayEntry_DateIn</MudTh>
|
||||||
|
<MudTh>@LanguageLocale.dto_StayEntry_DateOut</MudTh>
|
||||||
|
<MudTh>@LanguageLocale.dto_StayEntry_RoomCount</MudTh>
|
||||||
|
<MudTh>@LanguageLocale.dto_StayEntry_RoomNumber</MudTh>
|
||||||
|
<MudTh>@LanguageLocale.general_actions</MudTh>
|
||||||
|
</HeaderContent>
|
||||||
|
<RowTemplate>
|
||||||
|
<MudTd DataLabel="@LanguageLocale.dto_StayEntry_DateIn">
|
||||||
|
@context.DateIn
|
||||||
|
</MudTd>
|
||||||
|
<MudTd DataLabel="@LanguageLocale.dto_StayEntry_DateOut">
|
||||||
|
@context.DateOut
|
||||||
|
</MudTd>
|
||||||
|
<MudTd DataLabel="@LanguageLocale.dto_StayEntry_RoomCount">
|
||||||
|
@context.RoomCount
|
||||||
|
</MudTd>
|
||||||
|
<MudTd DataLabel="@LanguageLocale.dto_StayEntry_RoomNumber">
|
||||||
|
@context.RoomNumber
|
||||||
|
</MudTd>
|
||||||
|
<MudTd DataLabel="@LanguageLocale.general_actions">
|
||||||
|
<MudIconButton Icon="@Icons.Material.Filled.Info" OnClick="@(() => BtnViewStayDetails(context))" />
|
||||||
|
</MudTd>
|
||||||
|
</RowTemplate>
|
||||||
|
<NoRecordsContent>
|
||||||
|
<MudText>@LanguageLocale.general_noResults</MudText>
|
||||||
|
</NoRecordsContent>
|
||||||
|
<LoadingContent>
|
||||||
|
<MudSkeleton Height="50px" Class="mx-4" />
|
||||||
|
</LoadingContent>
|
||||||
|
</MudTable>
|
||||||
|
</MudTabPanel>
|
||||||
|
|
||||||
|
</MudTabs>
|
||||||
|
}
|
||||||
|
|
||||||
|
@code {
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public long docId { get; set; }
|
||||||
|
|
||||||
|
GuestDocForm _form = null!;
|
||||||
|
|
||||||
|
GuestDocumentDTO? documentModel = null;
|
||||||
|
|
||||||
|
|
||||||
|
IEnumerable<StayEntryDTO> guestStayList = [];
|
||||||
|
bool guestStaysLoading = true;
|
||||||
|
|
||||||
|
private bool _isEditMode = false;
|
||||||
|
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
//Get model from db.
|
||||||
|
await LoadGuestDocumentAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task LoadGuestDocumentAsync()
|
||||||
|
{
|
||||||
|
//Get model from db.
|
||||||
|
documentModel = await guestDocService.GetLastVersionDtoByIdAsync(docId);
|
||||||
|
if (documentModel is null)
|
||||||
|
{
|
||||||
|
userMessage.ShowMessage($"GuestDocument not found with ID: '{docId}'", MessageKind.Error);
|
||||||
|
Navigation.NotFound();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task LoadTabGuestStays()
|
||||||
|
{
|
||||||
|
//Only load when there is no data.
|
||||||
|
if (guestStayList.Count() > 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (documentModel is null || documentModel.Id is null || documentModel.Version is null)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
guestStaysLoading = true;
|
||||||
|
guestStayList = await stayService.GetStaysWithGuest(documentModel.Id.Value);
|
||||||
|
guestStaysLoading = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#region Event Handlers
|
||||||
|
|
||||||
|
private void BtnEnableEdit()
|
||||||
|
{
|
||||||
|
Debug.Assert(_isEditMode == false);
|
||||||
|
|
||||||
|
userMessage.ShowMessage(LanguageLocale.general_msgEditEnabled, MessageKind.Normal);
|
||||||
|
_isEditMode = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task BtnCancelEdit()
|
||||||
|
{
|
||||||
|
Debug.Assert(_isEditMode == true);
|
||||||
|
|
||||||
|
var result = await DialogService.ShowMessageBoxAsync(
|
||||||
|
LanguageLocale.general_confirmTitle, LanguageLocale.general_msgConfirmCancelEdit,
|
||||||
|
yesText: "OK", cancelText: LanguageLocale.general_btnCancel);
|
||||||
|
|
||||||
|
if (result == null || result.Value == false)
|
||||||
|
{
|
||||||
|
// Cancel cancel -> Continue with edit.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Cancel edit -> Reload data from DB.
|
||||||
|
await LoadGuestDocumentAsync();
|
||||||
|
|
||||||
|
userMessage.ShowMessage(LanguageLocale.general_msgEditCanceled, MessageKind.Normal);
|
||||||
|
_isEditMode = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task BtnSaveEdit()
|
||||||
|
{
|
||||||
|
Debug.Assert(_isEditMode == true && documentModel is not null);
|
||||||
|
|
||||||
|
var confirmResult = await DialogService.ShowMessageBoxAsync(
|
||||||
|
LanguageLocale.general_confirmTitle, LanguageLocale.general_msgConfirmSaveEdit,
|
||||||
|
yesText: "OK", cancelText: LanguageLocale.general_btnCancel);
|
||||||
|
|
||||||
|
if (confirmResult == null || confirmResult.Value == false)
|
||||||
|
{
|
||||||
|
// Cancel save -> Continue with edit.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Show Loading dialog...
|
||||||
|
var loadingDialog = await DialogService.ShowAsync<LoadingDialog>();
|
||||||
|
|
||||||
|
//Save edit.
|
||||||
|
Result updateResult = await guestDocService.UpdateDocumentAsync(documentModel);
|
||||||
|
if (!updateResult.IsSuccess)
|
||||||
|
{
|
||||||
|
string errorMsg = string.Format(LanguageLocale.general_msgEditError, documentModel.FullDocument);
|
||||||
|
userMessage.ShowResultWithMessage(updateResult, errorMsg);
|
||||||
|
loadingDialog.Close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Reload data from DB.
|
||||||
|
await LoadGuestDocumentAsync();
|
||||||
|
loadingDialog.Close();
|
||||||
|
userMessage.ShowMessage(LanguageLocale.general_msgEditSaved, MessageKind.Success);
|
||||||
|
|
||||||
|
_isEditMode = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnReturn()
|
||||||
|
{
|
||||||
|
Navigation.NavigateTo(GuestConsts.Page_GuestDocs_List);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void BtnViewStayDetails(StayEntryDTO item)
|
||||||
|
{
|
||||||
|
string itemId = $"{item.Id ?? -1}";
|
||||||
|
string uri = GuestConsts.Page_StayEntry_Detail.Replace(GuestConsts.Page_StayEntry_Detail_Param_Id, itemId);
|
||||||
|
|
||||||
|
string relativeUri = Navigation.ToBaseRelativePath(Navigation.Uri);
|
||||||
|
uri = QueryHelpers.AddQueryString(uri, [
|
||||||
|
new KeyValuePair<string, string?>(GuestConsts.QueryParam_ReturnUrl, relativeUri)
|
||||||
|
]);
|
||||||
|
Navigation.NavigateTo(uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,81 +3,95 @@
|
|||||||
@using Somnia.GuestLog.Models.DTOs;
|
@using Somnia.GuestLog.Models.DTOs;
|
||||||
@using Somnia.GuestLog.Services;
|
@using Somnia.GuestLog.Services;
|
||||||
|
|
||||||
@inject IGuestDocumentService GuestDocService
|
@inject IGuestDocumentEntityService GuestDocService
|
||||||
@inject NavigationManager Navigation
|
@inject NavigationManager Navigation
|
||||||
@inject ISnackbar Snackbar
|
@inject IUserMessageService userMessage
|
||||||
@inject IDialogService DialogService
|
@inject IDialogService DialogService
|
||||||
|
@inject IDataListService dataListService;
|
||||||
|
|
||||||
|
|
||||||
<PageTitle>Somnia - Guest Docs</PageTitle>
|
<PageTitle>Somnia - Guest Docs</PageTitle>
|
||||||
|
|
||||||
<MudStack Row="true" Class="my-4">
|
<MudStack Row="true" Class="my-4">
|
||||||
<MudText Typo="Typo.h4" GutterBottom="true">Guest Documents</MudText>
|
<MudText Typo="Typo.h4" GutterBottom="true">@LanguageLocale.page_GuestDocList_pageTitle</MudText>
|
||||||
<MudSpacer />
|
<MudSpacer />
|
||||||
<MudButton Variant="Variant.Filled" Color="Color.Success" Size="Size.Small" StartIcon="@Icons.Material.Filled.Add"
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" Size="Size.Small"
|
||||||
|
StartIcon="@Icons.Material.Filled.Search" OnClick="() => BtnSearchDataAsync()">
|
||||||
|
@LanguageLocale.general_btnSearch
|
||||||
|
</MudButton>
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" Size="Size.Small" StartIcon="@Icons.Material.Filled.Add"
|
||||||
OnClick="() => BtnNewGuest()">
|
OnClick="() => BtnNewGuest()">
|
||||||
New Guest
|
@LanguageLocale.page_GuestDocList_btnNewGuest
|
||||||
</MudButton>
|
</MudButton>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
|
|
||||||
<MudSelect T="string" MultiSelection="true" FullWidth="true" Dense="true" Clearable="true" Margin="@Margin.Dense"
|
<MudPaper Class="pa-4 my-4" Elevation="2" Height="100%">
|
||||||
Class="filter-input category-filter" Label="Module" Placeholder="Select Modules"
|
<GuestDocumentFilterForm @bind-Filter="docFilter" />
|
||||||
SelectedValuesChanged="@FilterModuleValuesChanged">
|
</MudPaper>
|
||||||
@foreach (var module in _moduleList)
|
|
||||||
{
|
|
||||||
<MudSelectItem T="string" Value="@module">@module</MudSelectItem>
|
|
||||||
}
|
|
||||||
</MudSelect>
|
|
||||||
|
|
||||||
<MudDataGrid @ref="_dataGrid" T="GuestDocumentDTO" Items="@guestDocList" Loading="@_dataLoading" ReadOnly="true"
|
<MudDataGrid @ref="_dataGrid" T="GuestDocumentDTO" Items="@guestDocList" Loading="@_dataLoading" ReadOnly="true"
|
||||||
Hideable="true" ColumnsPanelReordering="true">
|
Hideable="true" ColumnsPanelReordering="true" Elevation="2">
|
||||||
<ToolBarContent>
|
<ToolBarContent>
|
||||||
<MudText Typo="Typo.subtitle1">Document List</MudText>
|
<MudText Typo="Typo.subtitle1">@LanguageLocale.page_GuestDocList_documentList</MudText>
|
||||||
<MudStack Class="ml-auto" Row="true" AlignItems="AlignItems.End">
|
<MudStack Class="ml-auto" Row="true" AlignItems="AlignItems.Center">
|
||||||
<MudButton StartIcon="@Icons.Material.Outlined.Refresh" Variant="Variant.Outlined" Size="Size.Small"
|
<MudCheckBox @bind-Value="_showAllData" Label="@LanguageLocale.general_showAllElements"
|
||||||
OnClick="() => LoadDataAsync()">
|
LabelPlacement="Placement.Start" />
|
||||||
Reload Data
|
|
||||||
</MudButton>
|
|
||||||
<MudButton StartIcon="@Icons.Material.Outlined.ViewColumn" Variant="Variant.Outlined" Size="Size.Small"
|
<MudButton StartIcon="@Icons.Material.Outlined.ViewColumn" Variant="Variant.Outlined" Size="Size.Small"
|
||||||
OnClick="(args) => BtnConfigureColumnsClick(args)">
|
OnClick="(args) => BtnConfigureColumnsClick(args)">
|
||||||
Configure Columns
|
@LanguageLocale.general_ConfigureColumns
|
||||||
</MudButton>
|
</MudButton>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
</ToolBarContent>
|
</ToolBarContent>
|
||||||
<Columns>
|
<Columns>
|
||||||
<PropertyColumn Property="x => x.DocumentType" Hideable="false" />
|
<PropertyColumn Property="x => x.Id" Title="@LanguageLocale.dto_GuestDocument_Id" Hideable="false" />
|
||||||
<PropertyColumn Property="x => x.DocumentNum" Hideable="false" />
|
<PropertyColumn Property="x => x.Version" Title="@LanguageLocale.dto_GuestDocument_Version" Hidden
|
||||||
<PropertyColumn Property="x => x.Name" />
|
Hideable="true" />
|
||||||
<PropertyColumn Property="x => x.Surname" />
|
<PropertyColumn Title="@LanguageLocale.dto_GuestDocument_DocumentType"
|
||||||
<PropertyColumn Property="x => x.Nationality" />
|
Property="x => dataListService.GetLocalizedValue(GuestConsts.DataList_DocumentTypes, x.DocumentType)"
|
||||||
<PropertyColumn Property="x => x.UpdateTime" />
|
Hideable="false" />
|
||||||
|
<PropertyColumn Property="x => x.DocumentNum" Hideable="false"
|
||||||
|
Title="@LanguageLocale.dto_GuestDocument_DocumentNum" />
|
||||||
|
<PropertyColumn Property="x => x.Name" Title="@LanguageLocale.dto_GuestDocument_Name" />
|
||||||
|
<PropertyColumn Property="x => x.Surname" Title="@LanguageLocale.dto_GuestDocument_Surname" />
|
||||||
|
<PropertyColumn Property="x => x.Surname2" Title="@LanguageLocale.dto_GuestDocument_Surname2" />
|
||||||
|
<PropertyColumn Title="@LanguageLocale.dto_GuestDocument_Nationality"
|
||||||
|
Property="x => dataListService.GetLocalizedValue(GuestConsts.DataList_CountryCodes, x.Nationality)" />
|
||||||
|
<PropertyColumn Property="x => x.UpdateTime" Title="@LanguageLocale.dto_GuestDocument_UpdateTime" />
|
||||||
|
|
||||||
<TemplateColumn CellClass="d-flex justify-between" Title="Options" StickyRight Hideable="false"
|
<TemplateColumn CellClass="d-flex justify-between" Title="Options" StickyRight Hideable="false"
|
||||||
ShowColumnOptions="false">
|
ShowColumnOptions="false">
|
||||||
<CellTemplate>
|
<CellTemplate>
|
||||||
<MudIconButton Size="@Size.Small" Icon="@Icons.Material.Outlined.Info"
|
<MudIconButton Size="@Size.Small" Icon="@Icons.Material.Outlined.Info"
|
||||||
OnClick="() => BtnViewDetails(context.Item)" />
|
OnClick="() => BtnViewDetails(context.Item)" />
|
||||||
|
<MudIconButton Size="@Size.Small" Icon="@Icons.Material.Outlined.Delete"
|
||||||
|
OnClick="() => BtnDeleteItem(context.Item)" />
|
||||||
</CellTemplate>
|
</CellTemplate>
|
||||||
</TemplateColumn>
|
</TemplateColumn>
|
||||||
</Columns>
|
</Columns>
|
||||||
|
<PagerContent>
|
||||||
|
<MudDataGridPager T="GuestDocumentDTO" />
|
||||||
|
</PagerContent>
|
||||||
</MudDataGrid>
|
</MudDataGrid>
|
||||||
|
|
||||||
|
<ConfirmDeleteMsgBox @ref="_msgBoxConfirmDelete" />
|
||||||
|
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private IEnumerable<GuestDocumentDTO> guestDocList = [];
|
private IEnumerable<GuestDocumentDTO> guestDocList = [];
|
||||||
|
|
||||||
private bool _dataLoading = true;
|
private bool _dataLoading = true;
|
||||||
private HashSet<string> _moduleList = [];
|
private bool _showAllData = false;
|
||||||
private HashSet<string> _selectedModuleList = [];
|
private const int resultLimit = 200;
|
||||||
|
|
||||||
private MudDataGrid<GuestDocumentDTO>? _dataGrid;
|
private GuestDocFilterDTO docFilter = new GuestDocFilterDTO();
|
||||||
|
|
||||||
|
private MudDataGrid<GuestDocumentDTO> _dataGrid = null!;
|
||||||
|
private ConfirmDeleteMsgBox _msgBoxConfirmDelete = null!;
|
||||||
|
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
await LoadDataAsync(showMsg: false);
|
await LoadDataAsync(showMsg: false);
|
||||||
|
|
||||||
@* _moduleList = guestDocList.Select(e => e.Module).ToHashSet(); *@
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Data Loading
|
#region Data Loading
|
||||||
@@ -86,11 +100,12 @@
|
|||||||
{
|
{
|
||||||
_dataLoading = true;
|
_dataLoading = true;
|
||||||
|
|
||||||
guestDocList = await GuestDocService.GetDtoListAsync();
|
int dataLimit = _showAllData ? 0 : resultLimit;
|
||||||
|
guestDocList = await GuestDocService.GetDtoListByFilterAsync(filter: docFilter, limit: dataLimit);
|
||||||
|
|
||||||
if (showMsg)
|
if (showMsg)
|
||||||
{
|
{
|
||||||
Snackbar.Add("Data loaded from DB", Severity.Info, o => o.VisibleStateDuration = 1000);
|
userMessage.ShowMessage("Data loaded from DB", MessageKind.Info);
|
||||||
}
|
}
|
||||||
_dataLoading = false;
|
_dataLoading = false;
|
||||||
}
|
}
|
||||||
@@ -99,35 +114,47 @@
|
|||||||
|
|
||||||
#region Event Handlers
|
#region Event Handlers
|
||||||
|
|
||||||
private async Task FilterModuleValuesChanged(IReadOnlyCollection<string> newValues)
|
private async Task BtnSearchDataAsync()
|
||||||
{
|
{
|
||||||
_selectedModuleList = [.. newValues];
|
docFilter.Name = docFilter.Name?.ToUpper();
|
||||||
|
docFilter.Surname = docFilter.Surname?.ToUpper();
|
||||||
|
|
||||||
await LoadDataAsync();
|
await LoadDataAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task BtnConfigureColumnsClick(MouseEventArgs args)
|
private async Task BtnConfigureColumnsClick(MouseEventArgs args)
|
||||||
{
|
{
|
||||||
if (_dataGrid is null)
|
|
||||||
{
|
|
||||||
Snackbar.Add("No ref to grid");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_dataGrid.ShowColumnsPanel(args);
|
_dataGrid.ShowColumnsPanel(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private async Task BtnViewDetails(GuestDocumentDTO item)
|
private async Task BtnViewDetails(GuestDocumentDTO item)
|
||||||
{
|
{
|
||||||
var parameters =
|
string strId = item.Id?.ToString() ?? throw new InvalidOperationException();
|
||||||
new DialogParameters<GuestDocDetailsDialog> { { x => x.DocumentDTO, item } };
|
|
||||||
var options = new DialogOptions()
|
|
||||||
{
|
|
||||||
FullScreen = true,
|
|
||||||
CloseButton = true,
|
|
||||||
CloseOnEscapeKey = true,
|
|
||||||
};
|
|
||||||
|
|
||||||
await DialogService.ShowAsync<GuestDocDetailsDialog>("GuestDoc Details", parameters, options);
|
string uri = GuestConsts.Page_GuestDocs_Detail.Replace(GuestConsts.Page_GuestDocs_Detail_Param_DocId, strId);
|
||||||
|
Navigation.NavigateTo(uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task BtnDeleteItem(GuestDocumentDTO item)
|
||||||
|
{
|
||||||
|
bool? confirmDelete = await _msgBoxConfirmDelete.MsgBox.ShowAsync();
|
||||||
|
|
||||||
|
if (confirmDelete is null || confirmDelete.Value == false)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result deleteResult = await GuestDocService.DeleteDocumentAsync(item);
|
||||||
|
if (!deleteResult.IsSuccess)
|
||||||
|
{
|
||||||
|
string errorMsg = $"Error deleting document {item.DocumentType}-{item.DocumentNum}";
|
||||||
|
userMessage.ShowResultWithMessage(deleteResult, errorMsg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
userMessage.ShowMessage($"Document {item.DocumentType}-{item.DocumentNum} deleted!", MessageKind.Success);
|
||||||
|
await LoadDataAsync(showMsg: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BtnNewGuest()
|
private void BtnNewGuest()
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
@attribute [Route($"{GuestConsts.Page_GuestDocs_New}")]
|
@attribute [Route($"{GuestConsts.Page_GuestDocs_New}")]
|
||||||
|
|
||||||
@using Microsoft.EntityFrameworkCore;
|
|
||||||
@using Somnia.GuestLog.Models.DTOs;
|
@using Somnia.GuestLog.Models.DTOs;
|
||||||
@using Somnia.GuestLog.Infrastructure;
|
|
||||||
@using Somnia.GuestLog.Services;
|
@using Somnia.GuestLog.Services;
|
||||||
|
@using Somnia.GuestLog.Validators;
|
||||||
|
|
||||||
@inject IDbContextFactory<GuestLogContext> contextFactory
|
@inject IUserMessageService userMessage
|
||||||
@inject ISnackbar Snackbar
|
|
||||||
@inject IDialogService DialogService
|
@inject IDialogService DialogService
|
||||||
@inject NavigationManager Navigation
|
@inject NavigationManager Navigation
|
||||||
@inject IGuestDocumentService guestDocService
|
@inject IGuestDocumentEntityService guestDocService
|
||||||
|
@inject IDataListService dataListService;
|
||||||
|
|
||||||
|
@inject FluentValidation.IValidator<GuestDocIdDTO> docIdValidator;
|
||||||
|
|
||||||
|
|
||||||
<PageTitle>Somnia - Guest Docs - New</PageTitle>
|
<PageTitle>Somnia - Guest Docs - New</PageTitle>
|
||||||
@@ -17,25 +18,113 @@
|
|||||||
<MudStack Row="true" Class="my-4">
|
<MudStack Row="true" Class="my-4">
|
||||||
<MudText Typo="Typo.h4" GutterBottom="true">New Guest Document</MudText>
|
<MudText Typo="Typo.h4" GutterBottom="true">New Guest Document</MudText>
|
||||||
<MudSpacer />
|
<MudSpacer />
|
||||||
<MudButton Variant="Variant.Filled" Color="Color.Success" Size="Size.Small" StartIcon="@Icons.Material.Filled.Add"
|
@if (currentPageMode == ePageMode.createNew)
|
||||||
OnClick="() => BtnSaveNewGuest()">
|
{
|
||||||
Create
|
<MudButton Variant="Variant.Filled" Color="Color.Success" Size="Size.Small" StartIcon="@Icons.Material.Filled.Add"
|
||||||
</MudButton>
|
OnClick="() => BtnSaveNewGuest()">
|
||||||
|
@LanguageLocale.general_btnCreate
|
||||||
|
</MudButton>
|
||||||
|
}
|
||||||
<MudButton Variant="Variant.Filled" Color="Color.Default" Size="Size.Small"
|
<MudButton Variant="Variant.Filled" Color="Color.Default" Size="Size.Small"
|
||||||
StartIcon="@Icons.Material.Filled.ArrowBack" OnClick="() => BtnReturn()">
|
StartIcon="@Icons.Material.Filled.ArrowBack" OnClick="() => BtnReturn()">
|
||||||
Return
|
@LanguageLocale.general_btnReturn
|
||||||
</MudButton>
|
</MudButton>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
<GuestDocForm @ref="_form" />
|
|
||||||
|
@if (currentPageMode == ePageMode.selectDocId || currentPageMode == ePageMode.alreadyExistDoc)
|
||||||
|
{
|
||||||
|
<MudPaper Class="pa-4" Elevation="3" Height="100%" Style="">
|
||||||
|
<MudForm @ref="_docIdForm" Model="@currentDocId"
|
||||||
|
Validation="@((docIdValidator as GuestDocIdDTOValidator)!.ValidateValue)">
|
||||||
|
<MudStack Breakpoint="Breakpoint.Sm">
|
||||||
|
<MudSelect @bind-Value="currentDocId.DocumentType" For="@(() => currentDocId.DocumentType)"
|
||||||
|
Label="@LanguageLocale.dto_GuestDocument_DocumentType" Immediate="true" Required>
|
||||||
|
|
||||||
|
@foreach (string docType in dataListService.GetDataListByName(GuestConsts.DataList_DocumentTypes))
|
||||||
|
{
|
||||||
|
<MudSelectItem Value="docType">
|
||||||
|
@dataListService.GetLocalizedValue(GuestConsts.DataList_DocumentTypes, docType)
|
||||||
|
</MudSelectItem>
|
||||||
|
}
|
||||||
|
|
||||||
|
</MudSelect>
|
||||||
|
<MudTextField @bind-Value="currentDocId.DocumentNum" For="@(() => currentDocId.DocumentNum)"
|
||||||
|
Label="@LanguageLocale.dto_GuestDocument_DocumentNum" Required
|
||||||
|
OnBlur="@(() => currentDocId.DocumentNum = currentDocId.DocumentNum.ToUpper())" />
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" Size="Size.Small"
|
||||||
|
StartIcon="@Icons.Material.Filled.Search" OnClick="() => BtnCheckDocId()" Disabled="@loadingDocId">
|
||||||
|
@LanguageLocale.general_btnSearch
|
||||||
|
</MudButton>
|
||||||
|
</MudStack>
|
||||||
|
</MudForm>
|
||||||
|
|
||||||
|
@if (currentPageMode == ePageMode.alreadyExistDoc)
|
||||||
|
{
|
||||||
|
<MudStack>
|
||||||
|
<MudDivider Class="my-4" />
|
||||||
|
<MudText Typo="Typo.body1" Style="text-align: center;">@LanguageLocale.page_GuestDocNew_msgAlreadyExists
|
||||||
|
</MudText>
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" Size="Size.Small"
|
||||||
|
StartIcon="@Icons.Material.Filled.Search" OnClick="() => BtnGoToDocument()">
|
||||||
|
@LanguageLocale.page_GuestDocNew_btnGoExistingDoc
|
||||||
|
</MudButton>
|
||||||
|
</MudStack>
|
||||||
|
}
|
||||||
|
</MudPaper>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (currentPageMode == ePageMode.createNew)
|
||||||
|
{
|
||||||
|
<GuestDocForm @ref="_form" Model="newDocumentModel" />
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
|
||||||
GuestDocForm _form = null!;
|
GuestDocForm _form = null!;
|
||||||
|
MudForm _docIdForm = null!;
|
||||||
|
|
||||||
|
ePageMode currentPageMode = ePageMode.selectDocId;
|
||||||
|
GuestDocIdDTO currentDocId = new() { DocumentNum = "", DocumentType = "" };
|
||||||
|
long? alreadyExistDocId = null;
|
||||||
|
GuestDocumentDTO newDocumentModel = new();
|
||||||
|
|
||||||
|
bool loadingDocId = false;
|
||||||
|
|
||||||
#region Event Handlers
|
#region Event Handlers
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check if given Document already exists or can be created.
|
||||||
|
/// </summary>
|
||||||
|
private async Task BtnCheckDocId()
|
||||||
|
{
|
||||||
|
await _docIdForm.ValidateAsync();
|
||||||
|
if (!_docIdForm.IsValid)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
loadingDocId = true;
|
||||||
|
GuestDocumentDTO? dto =
|
||||||
|
await guestDocService.GetLastVersionDtoByDocumentAsync(currentDocId.DocumentType, currentDocId.DocumentNum);
|
||||||
|
loadingDocId = false;
|
||||||
|
|
||||||
|
if (dto is null)
|
||||||
|
{
|
||||||
|
//Document don't exist -> Create it.
|
||||||
|
currentPageMode = ePageMode.createNew;
|
||||||
|
|
||||||
|
//Update model with current DocId
|
||||||
|
newDocumentModel.DocumentType = currentDocId.DocumentType;
|
||||||
|
newDocumentModel.DocumentNum = currentDocId.DocumentNum;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//GuestDoc already exists!
|
||||||
|
currentPageMode = ePageMode.alreadyExistDoc;
|
||||||
|
alreadyExistDocId = dto.Id;
|
||||||
|
}
|
||||||
|
|
||||||
private void BtnReturn()
|
private void BtnReturn()
|
||||||
{
|
{
|
||||||
Navigation.NavigateTo(GuestConsts.Page_GuestDocs_List);
|
Navigation.NavigateTo(GuestConsts.Page_GuestDocs_List);
|
||||||
@@ -43,32 +132,55 @@
|
|||||||
|
|
||||||
private async Task BtnSaveNewGuest()
|
private async Task BtnSaveNewGuest()
|
||||||
{
|
{
|
||||||
|
Debug.Assert(currentPageMode == ePageMode.createNew && _form != null);
|
||||||
|
|
||||||
bool isFormValid = await _form.ValidateForm();
|
bool isFormValid = await _form.ValidateForm();
|
||||||
if (!isFormValid)
|
if (!isFormValid)
|
||||||
{
|
{
|
||||||
Snackbar.Add("Invalid Form!", Severity.Error);
|
userMessage.ShowMessage("Invalid Form!", MessageKind.Warning);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GuestDocumentDTO model = _form.Model;
|
GuestDocumentDTO model = _form.Model;
|
||||||
|
|
||||||
Snackbar.Add($"Document '{model.DocumentNum}' creating...", Severity.Info);
|
|
||||||
|
|
||||||
//Show Loading dialog...
|
//Show Loading dialog...
|
||||||
var loadingDialog = await DialogService.ShowAsync<LoadingDialog>();
|
var loadingDialog = await DialogService.ShowAsync<LoadingDialog>();
|
||||||
|
|
||||||
bool isCreated = await guestDocService.CreateDocumentAsync(model);
|
Result createResult = await guestDocService.CreateDocumentAsync(model);
|
||||||
if (!isCreated)
|
if (!createResult.IsSuccess)
|
||||||
{
|
{
|
||||||
Snackbar.Add($"Error creating Document '{model.DocumentNum}'", Severity.Error);
|
string errorMsg = $"Error creating Document '{model.FullDocument}'";
|
||||||
|
userMessage.ShowResultWithMessage(createResult, errorMsg);
|
||||||
loadingDialog.Close();
|
loadingDialog.Close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Snackbar.Add($"Document '{model.DocumentNum}' Created!", Severity.Success);
|
userMessage.ShowMessage($"Document '{model.FullDocument}' Created!", MessageKind.Success);
|
||||||
Navigation.NavigateTo(GuestConsts.Page_GuestDocs_List);
|
Navigation.NavigateTo(GuestConsts.Page_GuestDocs_List);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void BtnGoToDocument()
|
||||||
|
{
|
||||||
|
if (currentPageMode != ePageMode.alreadyExistDoc || alreadyExistDocId is null)
|
||||||
|
{
|
||||||
|
userMessage.ShowMessage("Invalid operation!", MessageKind.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
string strId = alreadyExistDocId.Value.ToString();
|
||||||
|
string uri = GuestConsts.Page_GuestDocs_Detail.Replace(GuestConsts.Page_GuestDocs_Detail_Param_DocId, strId);
|
||||||
|
Navigation.NavigateTo(uri);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Models
|
||||||
|
|
||||||
|
enum ePageMode
|
||||||
|
{
|
||||||
|
selectDocId, alreadyExistDoc, createNew
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,259 @@
|
|||||||
|
@attribute [Route($"{GuestConsts.Page_StayEntry_Detail}")]
|
||||||
|
|
||||||
|
@using Somnia.GuestLog.Enums.Models
|
||||||
|
@using Somnia.GuestLog.Models.DTOs;
|
||||||
|
@using Somnia.GuestLog.Services;
|
||||||
|
|
||||||
|
@inject IUserMessageService userMessage
|
||||||
|
@inject IDialogService DialogService
|
||||||
|
@inject NavigationManager Navigation
|
||||||
|
@inject IGuestDocumentEntityService guestDocService
|
||||||
|
@inject IStayEntryEntityService stayService
|
||||||
|
@inject ILocalizerService Localizer;
|
||||||
|
|
||||||
|
|
||||||
|
<PageTitle>Somnia - Stays - Details</PageTitle>
|
||||||
|
|
||||||
|
<MudStack Row="true" Class="my-4">
|
||||||
|
<MudText Typo="Typo.h4" GutterBottom="true">
|
||||||
|
@LanguageLocale.page_StayEntryDetail_pageTitle - "@StayId"
|
||||||
|
</MudText>
|
||||||
|
<MudSpacer />
|
||||||
|
@if (_isEditMode)
|
||||||
|
{
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Error" Size="Size.Small" StartIcon="@Icons.Material.Filled.Cancel"
|
||||||
|
OnClick="() => BtnCancelEdit()" Disabled="!_isEditMode">
|
||||||
|
@LanguageLocale.general_btnCancel
|
||||||
|
</MudButton>
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Success" Size="Size.Small" StartIcon="@Icons.Material.Filled.Save"
|
||||||
|
OnClick="() => BtnSaveEdit()" Disabled="!_isEditMode">
|
||||||
|
@LanguageLocale.general_btnSave
|
||||||
|
</MudButton>
|
||||||
|
}
|
||||||
|
@if (!_isEditMode)
|
||||||
|
{
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Success" Size="Size.Small" StartIcon="@Icons.Material.Filled.Edit"
|
||||||
|
OnClick="() => BtnEnableEdit()" Disabled="_isEditMode">
|
||||||
|
@LanguageLocale.general_btnEdit
|
||||||
|
</MudButton>
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Default" Size="Size.Small"
|
||||||
|
StartIcon="@Icons.Material.Filled.ArrowBack" OnClick="() => BtnReturn()">
|
||||||
|
@LanguageLocale.general_btnReturn
|
||||||
|
</MudButton>
|
||||||
|
}
|
||||||
|
</MudStack>
|
||||||
|
|
||||||
|
@if (stayModel is not null)
|
||||||
|
{
|
||||||
|
<StayEntryForm Model="stayModel" FormMode="@_formFormMode" />
|
||||||
|
|
||||||
|
@if (!_isEditMode)
|
||||||
|
{
|
||||||
|
<MudGrid Class="mt-6">
|
||||||
|
<MudItem xs="6" md="3">
|
||||||
|
<MudPaper Class="pa-4" Elevation="3" Height="100%">
|
||||||
|
<MudStack Style="margin-block: 0.5em;">
|
||||||
|
<MudTextField @bind-Value="stayModel.CreateTime" Label="@LanguageLocale.dto_StayEntry_CreateTime"
|
||||||
|
FullWidth ReadOnly />
|
||||||
|
<MudTextField @bind-Value="stayModel.UpdateTime" Label="@LanguageLocale.dto_StayEntry_UpdateTime"
|
||||||
|
FullWidth ReadOnly />
|
||||||
|
</MudStack>
|
||||||
|
</MudPaper>
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="6" md="3">
|
||||||
|
<MudPaper Class="pa-4" Elevation="3" Height="100%">
|
||||||
|
<SectionTitle Title="Actions" />
|
||||||
|
<MudButton FullWidth OnClick="BtnUpdateUploadStatus">
|
||||||
|
@LanguageLocale.page_StayEntryList_btnUpdateUploadStatus
|
||||||
|
</MudButton>
|
||||||
|
</MudPaper>
|
||||||
|
</MudItem>
|
||||||
|
</MudGrid>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@code {
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public long StayId { get; set; }
|
||||||
|
|
||||||
|
[SupplyParameterFromQuery(Name = GuestConsts.QueryParam_ReturnUrl)]
|
||||||
|
public string? ReturnUrl { get; set; }
|
||||||
|
|
||||||
|
StayEntryDTO? stayModel = null;
|
||||||
|
|
||||||
|
|
||||||
|
private bool _isEditMode = false;
|
||||||
|
private FormMode _formFormMode => _isEditMode ? FormMode.Edit : FormMode.ReadOnly;
|
||||||
|
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
@* if (StayId is default)
|
||||||
|
{
|
||||||
|
Snackbar.Add("No Id provided!!", Severity.Error);
|
||||||
|
Navigation.NotFound();
|
||||||
|
return;
|
||||||
|
} *@
|
||||||
|
|
||||||
|
await LoadModelAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task LoadModelAsync()
|
||||||
|
{
|
||||||
|
//Get model from db.
|
||||||
|
stayModel = await stayService.GetDtoByIdAsync(StayId, queryConfig: new(IncludeGuests: true));
|
||||||
|
if (stayModel is null)
|
||||||
|
{
|
||||||
|
userMessage.ShowMessage($"Stay not found with ID: '{StayId}'", MessageKind.Error);
|
||||||
|
Navigation.NotFound();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#region Event Handlers
|
||||||
|
|
||||||
|
private void BtnEnableEdit()
|
||||||
|
{
|
||||||
|
Debug.Assert(_isEditMode == false && stayModel != null);
|
||||||
|
|
||||||
|
if (stayModel.StayUploadStatus == UploadStatus.Uploaded)
|
||||||
|
{
|
||||||
|
userMessage.ShowMessage(LanguageLocale.page_StayEntryDetail_cantEditFinalData, MessageKind.Info);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
userMessage.ShowMessage(LanguageLocale.general_msgEditEnabled, MessageKind.Normal);
|
||||||
|
_isEditMode = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task BtnCancelEdit()
|
||||||
|
{
|
||||||
|
Debug.Assert(_isEditMode == true);
|
||||||
|
|
||||||
|
var result = await DialogService.ShowMessageBoxAsync(
|
||||||
|
LanguageLocale.general_confirmTitle, LanguageLocale.general_msgConfirmCancelEdit,
|
||||||
|
yesText: "OK", cancelText: LanguageLocale.general_btnCancel);
|
||||||
|
|
||||||
|
if (result == null || result.Value == false)
|
||||||
|
{
|
||||||
|
// Cancel cancel -> Continue with edit.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Cancel edit -> Reload data from DB.
|
||||||
|
await LoadModelAsync();
|
||||||
|
|
||||||
|
userMessage.ShowMessage(LanguageLocale.general_msgEditCanceled, MessageKind.Normal);
|
||||||
|
_isEditMode = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task BtnSaveEdit()
|
||||||
|
{
|
||||||
|
Debug.Assert(_isEditMode == true && stayModel is not null);
|
||||||
|
|
||||||
|
var confirmResult = await DialogService.ShowMessageBoxAsync(
|
||||||
|
LanguageLocale.general_confirmTitle, LanguageLocale.general_msgConfirmSaveEdit,
|
||||||
|
yesText: "OK", cancelText: LanguageLocale.general_btnCancel);
|
||||||
|
|
||||||
|
if (confirmResult == null || confirmResult.Value == false)
|
||||||
|
{
|
||||||
|
// Cancel save -> Continue with edit.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Show Loading dialog...
|
||||||
|
var loadingDialog = await DialogService.ShowAsync<LoadingDialog>();
|
||||||
|
|
||||||
|
//Save edit.
|
||||||
|
Result updateResult = await stayService.UpdateEntryAsync(stayModel);
|
||||||
|
if (!updateResult.IsSuccess)
|
||||||
|
{
|
||||||
|
string errorMsg = string.Format(LanguageLocale.general_msgEditError, stayModel.Id);
|
||||||
|
userMessage.ShowResultWithMessage(updateResult, errorMsg);
|
||||||
|
loadingDialog.Close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Reload data from DB.
|
||||||
|
await LoadModelAsync();
|
||||||
|
loadingDialog.Close();
|
||||||
|
userMessage.ShowMessage(LanguageLocale.general_msgEditSaved, MessageKind.Success);
|
||||||
|
|
||||||
|
_isEditMode = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void BtnReturn()
|
||||||
|
{
|
||||||
|
string uri = ReturnUrl ?? GuestConsts.Page_StayEntry_List;
|
||||||
|
Navigation.NavigateTo(uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task BtnUpdateUploadStatus()
|
||||||
|
{
|
||||||
|
Debug.Assert(stayModel != null && stayModel.Id != null);
|
||||||
|
|
||||||
|
DialogOptions dialogOptions = new()
|
||||||
|
{
|
||||||
|
MaxWidth = MaxWidth.Medium,
|
||||||
|
FullWidth = true,
|
||||||
|
BackdropClick = true,
|
||||||
|
CloseOnEscapeKey = true,
|
||||||
|
};
|
||||||
|
|
||||||
|
bool? confirmed = await DialogService.ShowMessageBoxAsync(
|
||||||
|
title: LanguageLocale.general_confirmTitle,
|
||||||
|
message: LanguageLocale.general_confirmAdvanceOperationMsg,
|
||||||
|
yesText: LanguageLocale.general_btnContinue,
|
||||||
|
noText: LanguageLocale.general_btnCancel,
|
||||||
|
options: dialogOptions);
|
||||||
|
|
||||||
|
if (confirmed == null || confirmed.Value == false)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var parameters =
|
||||||
|
new DialogParameters<UploadStatusSelectorDialog> { { x => x.CurrentStatus, stayModel.StayUploadStatus } };
|
||||||
|
var dialog = await DialogService.ShowAsync<UploadStatusSelectorDialog>(parameters: parameters, options: dialogOptions);
|
||||||
|
DialogResult? dialogRs = await dialog.Result;
|
||||||
|
|
||||||
|
if (dialogRs is null || dialogRs.Canceled)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UploadStatus? newUploadStatus = await dialog.GetReturnValueAsync<UploadStatus>();
|
||||||
|
|
||||||
|
if (newUploadStatus is null)
|
||||||
|
{
|
||||||
|
userMessage.ShowMessage("Error! No upload status selected!", MessageKind.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var loadingDialog = await DialogService.ShowAsync<LoadingDialog>();
|
||||||
|
|
||||||
|
//Update StayEntry
|
||||||
|
Result rs = await stayService.UpdateEntryUploadStatusAsync(stayModel.Id.Value, newUploadStatus.Value);
|
||||||
|
if (!rs.IsSuccess)
|
||||||
|
{
|
||||||
|
userMessage.ShowResultWithMessage(rs, "Error updating UploadStatus");
|
||||||
|
loadingDialog.Close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Reload model.
|
||||||
|
await LoadModelAsync();
|
||||||
|
loadingDialog.Close();
|
||||||
|
|
||||||
|
string txtNewStatus = Localizer.GetEnumValue(newUploadStatus);
|
||||||
|
string successMsg = string.Format(LanguageLocale.page_StayEntryDetail_uploadStatusSuccessMsg, txtNewStatus);
|
||||||
|
userMessage.ShowMessage(successMsg, MessageKind.Success);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,158 @@
|
|||||||
|
@attribute [Route($"{GuestConsts.Page_StayEntry_List}")]
|
||||||
|
|
||||||
|
@using Somnia.GuestLog.Models.DTOs;
|
||||||
|
@using Somnia.GuestLog.Services;
|
||||||
|
|
||||||
|
@inject IStayEntryEntityService StayEntryService
|
||||||
|
@inject NavigationManager Navigation
|
||||||
|
@inject IUserMessageService userMessage
|
||||||
|
@inject IDialogService DialogService
|
||||||
|
@inject IDataListService dataListService;
|
||||||
|
@inject ILocalizerService Localizer;
|
||||||
|
|
||||||
|
|
||||||
|
<PageTitle>Somnia - Stay Entries</PageTitle>
|
||||||
|
|
||||||
|
<MudStack Row="true" Class="my-4">
|
||||||
|
<MudText Typo="Typo.h4" GutterBottom="true">@LanguageLocale.page_StayEntryList_pageTitle</MudText>
|
||||||
|
<MudSpacer />
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" Size="Size.Small"
|
||||||
|
StartIcon="@Icons.Material.Filled.Search" OnClick="() => BtnSearchDataAsync()">
|
||||||
|
@LanguageLocale.general_btnSearch
|
||||||
|
</MudButton>
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" Size="Size.Small" StartIcon="@Icons.Material.Filled.Add"
|
||||||
|
OnClick="() => BtnNewStay()">
|
||||||
|
@LanguageLocale.page_StayEntryList_btnNewStay
|
||||||
|
</MudButton>
|
||||||
|
</MudStack>
|
||||||
|
|
||||||
|
<MudPaper Class="pa-4 my-4" Elevation="2" Height="100%">
|
||||||
|
<StayEntryFilterForm @bind-Filter="stayFilter" />
|
||||||
|
</MudPaper>
|
||||||
|
|
||||||
|
<MudDataGrid @ref="_dataGrid" T="StayEntryDTO" Items="@stayEntryList" Loading="@_dataLoading" ReadOnly="true"
|
||||||
|
Elevation="2">
|
||||||
|
<ToolBarContent>
|
||||||
|
<MudText Typo="Typo.subtitle1">@LanguageLocale.page_StayEntryList_entryList</MudText>
|
||||||
|
<MudStack Class="ml-auto" Row="true" AlignItems="AlignItems.Center">
|
||||||
|
<MudCheckBox @bind-Value="_showAllData" Label="@LanguageLocale.general_showAllElements"
|
||||||
|
LabelPlacement="Placement.Start" />
|
||||||
|
</MudStack>
|
||||||
|
</ToolBarContent>
|
||||||
|
<Columns>
|
||||||
|
<PropertyColumn Property="x => x.Id" Hideable="false" Title="@LanguageLocale.dto_StayEntry_Id" />
|
||||||
|
<PropertyColumn Property="x => x.DateIn" Title="@LanguageLocale.dto_StayEntry_DateIn" />
|
||||||
|
<PropertyColumn Property="x => x.DateOut" Title="@LanguageLocale.dto_StayEntry_DateOut" />
|
||||||
|
<PropertyColumn Property="x => x.RoomNumber" Title="@LanguageLocale.dto_StayEntry_RoomNumber" />
|
||||||
|
<PropertyColumn Title="@LanguageLocale.dto_StayEntry_PaymentMethod"
|
||||||
|
Property="x => dataListService.GetLocalizedValue(GuestConsts.DataList_PaymentMethods, x.PaymentMethod)" />
|
||||||
|
|
||||||
|
<PropertyColumn Property="x => x.UpdateTime" Title="@LanguageLocale.dto_GuestDocument_UpdateTime" />
|
||||||
|
<PropertyColumn Property="x => Localizer.GetEnumValue(x.StayUploadStatus)"
|
||||||
|
Title="@LanguageLocale.dto_StayEntry_StayUploadStatus" />
|
||||||
|
|
||||||
|
<TemplateColumn CellClass="d-flex justify-between" Title="Options" StickyRight Hideable="false"
|
||||||
|
ShowColumnOptions="false">
|
||||||
|
<CellTemplate>
|
||||||
|
<MudIconButton Size="@Size.Small" Icon="@Icons.Material.Outlined.Info"
|
||||||
|
OnClick="() => BtnViewDetails(context.Item)" />
|
||||||
|
<MudIconButton Size="@Size.Small" Icon="@Icons.Material.Outlined.Delete"
|
||||||
|
OnClick="() => BtnDeleteItem(context.Item)" />
|
||||||
|
</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
</Columns>
|
||||||
|
<PagerContent>
|
||||||
|
<MudDataGridPager T="StayEntryDTO" />
|
||||||
|
</PagerContent>
|
||||||
|
</MudDataGrid>
|
||||||
|
|
||||||
|
<ConfirmDeleteMsgBox @ref="_confirmDeleteMsgBox" />
|
||||||
|
|
||||||
|
@code {
|
||||||
|
|
||||||
|
private bool _dataLoading = true;
|
||||||
|
private bool _showAllData = false;
|
||||||
|
private const int resultLimit = 200;
|
||||||
|
|
||||||
|
private StayEntryFilterDTO stayFilter = new StayEntryFilterDTO()
|
||||||
|
{
|
||||||
|
DateInStart = DateTime.Today.AddDays(-14),
|
||||||
|
DateInEnd = DateTime.Today.AddDays(1),
|
||||||
|
};
|
||||||
|
|
||||||
|
private IEnumerable<StayEntryDTO> stayEntryList = [];
|
||||||
|
|
||||||
|
private MudDataGrid<StayEntryDTO> _dataGrid = null!;
|
||||||
|
private ConfirmDeleteMsgBox _confirmDeleteMsgBox = null!;
|
||||||
|
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
await LoadDataAsync(showMsg: false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task LoadDataAsync(bool showMsg = true)
|
||||||
|
{
|
||||||
|
_dataLoading = true;
|
||||||
|
|
||||||
|
int dataLimit = _showAllData ? 0 : resultLimit;
|
||||||
|
stayEntryList = await StayEntryService.GetDtoListByFilterAsync(filter: stayFilter, limit: dataLimit);
|
||||||
|
|
||||||
|
if (showMsg)
|
||||||
|
{
|
||||||
|
userMessage.ShowMessage("Data loaded from DB", MessageKind.Info);
|
||||||
|
}
|
||||||
|
_dataLoading = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#region Event Handlers
|
||||||
|
|
||||||
|
private async Task BtnSearchDataAsync()
|
||||||
|
{
|
||||||
|
await LoadDataAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnNewStay()
|
||||||
|
{
|
||||||
|
Navigation.NavigateTo(GuestConsts.Page_StayEntry_New);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private async Task BtnViewDetails(StayEntryDTO item)
|
||||||
|
{
|
||||||
|
string itemId = item.Id?.ToString() ?? throw new InvalidOperationException();
|
||||||
|
string uri = GuestConsts.Page_StayEntry_Detail.Replace(GuestConsts.Page_StayEntry_Detail_Param_Id, itemId);
|
||||||
|
Navigation.NavigateTo(uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task BtnDeleteItem(StayEntryDTO item)
|
||||||
|
{
|
||||||
|
if (item.StayUploadStatus == Enums.Models.UploadStatus.Uploaded)
|
||||||
|
{
|
||||||
|
userMessage.ShowMessage(LanguageLocale.page_StayEntryList_msgDeleteUploadedStay, MessageKind.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool? confirmDelete = await _confirmDeleteMsgBox.MsgBox.ShowAsync();
|
||||||
|
|
||||||
|
if (confirmDelete is null || confirmDelete.Value == false)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result deleteResult = await StayEntryService.DeleteEntryAsync(item);
|
||||||
|
if (!deleteResult.IsSuccess)
|
||||||
|
{
|
||||||
|
string errorMsg = $"Error deleting Stay {item.Id}";
|
||||||
|
userMessage.ShowResultWithMessage(deleteResult, errorMsg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
userMessage.ShowMessage($"Stay {item.Id} deleted!", MessageKind.Success);
|
||||||
|
await LoadDataAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
@attribute [Route($"{GuestConsts.Page_StayEntry_New}")]
|
||||||
|
|
||||||
|
@using Somnia.GuestLog.Models.DTOs;
|
||||||
|
@using Somnia.GuestLog.Services;
|
||||||
|
|
||||||
|
|
||||||
|
@inject IUserMessageService userMessage
|
||||||
|
@inject IDialogService DialogService
|
||||||
|
@inject NavigationManager Navigation
|
||||||
|
@inject IStayEntryEntityService stayService
|
||||||
|
@inject IDataListService dataListService;
|
||||||
|
|
||||||
|
<PageTitle>Somnia - Stay Entries - New</PageTitle>
|
||||||
|
|
||||||
|
<MudStack Row="true" Class="my-4">
|
||||||
|
<MudText Typo="Typo.h4" GutterBottom="true">
|
||||||
|
@LanguageLocale.page_StayEntryNew_pageTitle
|
||||||
|
</MudText>
|
||||||
|
<MudSpacer />
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Success" Size="Size.Small" StartIcon="@Icons.Material.Filled.Add"
|
||||||
|
OnClick="() => BtnSaveStay()">
|
||||||
|
@LanguageLocale.general_btnCreate
|
||||||
|
</MudButton>
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Default" Size="Size.Small"
|
||||||
|
StartIcon="@Icons.Material.Filled.ArrowBack" OnClick="() => BtnReturn()">
|
||||||
|
@LanguageLocale.general_btnReturn
|
||||||
|
</MudButton>
|
||||||
|
</MudStack>
|
||||||
|
|
||||||
|
<StayEntryForm @ref="_form" Model="@newStayModel" FormMode="FormMode.Create" />
|
||||||
|
|
||||||
|
@code {
|
||||||
|
StayEntryForm _form = null!;
|
||||||
|
|
||||||
|
StayEntryDTO newStayModel = new();
|
||||||
|
|
||||||
|
|
||||||
|
private void BtnReturn()
|
||||||
|
{
|
||||||
|
Navigation.NavigateTo(GuestConsts.Page_StayEntry_List);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task BtnSaveStay()
|
||||||
|
{
|
||||||
|
bool isFormValid = await _form.ValidateForm();
|
||||||
|
if (!isFormValid)
|
||||||
|
{
|
||||||
|
userMessage.ShowMessage("Invalid Form!", MessageKind.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var loadingDialog = await DialogService.ShowAsync<LoadingDialog>();
|
||||||
|
|
||||||
|
StayEntryDTO model = _form.GetModel();
|
||||||
|
Result createResult = await stayService.CreateEntryAsync(model);
|
||||||
|
if (!createResult.IsSuccess)
|
||||||
|
{
|
||||||
|
userMessage.ShowResultWithMessage(createResult, $"Error creating StayEntry");
|
||||||
|
loadingDialog.Close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
userMessage.ShowMessage("StayEntry Created: (Id: {0})", MessageKind.Success, createResult.Context ?? ["???"]);
|
||||||
|
Navigation.NavigateTo(GuestConsts.Page_StayEntry_List);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,288 @@
|
|||||||
|
@attribute [Route($"{GuestConsts.Page_StayExport_List}")]
|
||||||
|
|
||||||
|
@using System.Text.Json;
|
||||||
|
@using Somnia.GuestLog.Enums.Models
|
||||||
|
@using Somnia.GuestLog.Models.DTOs;
|
||||||
|
@using Somnia.GuestLog.Services;
|
||||||
|
@using Somnia.GuestLog.Services.StayExport;
|
||||||
|
|
||||||
|
@inject IStayExportFileEntityService stayExportEntityService
|
||||||
|
@inject NavigationManager Navigation
|
||||||
|
@inject IUserMessageService userMessage
|
||||||
|
@inject IDialogService DialogService
|
||||||
|
@inject IDataListService dataListService;
|
||||||
|
@inject ILocalizerService Localizer;
|
||||||
|
|
||||||
|
@inject IStayExportService ExportService;
|
||||||
|
@inject IJSRuntime JS
|
||||||
|
|
||||||
|
|
||||||
|
<PageTitle>Somnia - Stay Export Files</PageTitle>
|
||||||
|
|
||||||
|
<MudStack Row="true" Class="my-4">
|
||||||
|
<MudText Typo="Typo.h4" GutterBottom="true">@LanguageLocale.page_StayExportList_pageTitle</MudText>
|
||||||
|
<MudSpacer />
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" Size="Size.Small"
|
||||||
|
StartIcon="@Icons.Material.Filled.Search" OnClick="() => BtnSearchDataAsync()">
|
||||||
|
@LanguageLocale.general_btnSearch
|
||||||
|
</MudButton>
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" Size="Size.Small" StartIcon="@Icons.Material.Filled.Add"
|
||||||
|
OnClick="() => BtnNewExport()">
|
||||||
|
@LanguageLocale.page_StayExportList_btnNewExport
|
||||||
|
</MudButton>
|
||||||
|
</MudStack>
|
||||||
|
|
||||||
|
@* <MudPaper Class="pa-4 my-4" Elevation="2" Height="100%">
|
||||||
|
FILTER
|
||||||
|
</MudPaper> *@
|
||||||
|
|
||||||
|
<MudDataGrid @ref="_dataGrid" T="StayExportFileDTO" Items="@stayExportList" Loading="@_dataLoading" ReadOnly="true"
|
||||||
|
Elevation="2">
|
||||||
|
<ToolBarContent>
|
||||||
|
<MudText Typo="Typo.subtitle1">@LanguageLocale.page_StayExportList_exportList</MudText>
|
||||||
|
</ToolBarContent>
|
||||||
|
<Columns>
|
||||||
|
<PropertyColumn Property="x => x.Id" Hideable="false" Title="@LanguageLocale.dto_StayExportFile_Id" />
|
||||||
|
<PropertyColumn Property="x => Localizer.GetEnumValue(x.ExportFormat)"
|
||||||
|
Title="@LanguageLocale.dto_StayExportFile_ExportFormat" />
|
||||||
|
<TemplateColumn Title="@LanguageLocale.dto_StayExportFile_ExportParams">
|
||||||
|
<CellTemplate>
|
||||||
|
<MudIconButton Size="@Size.Small" Icon="@Icons.Material.Outlined.Info"
|
||||||
|
OnClick="() => ShowExportParams(context.Item)" />
|
||||||
|
</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
<PropertyColumn Property="x => Localizer.GetEnumValue(x.ExportResult)"
|
||||||
|
Title="@LanguageLocale.dto_StayExportFile_ExportResult" />
|
||||||
|
<PropertyColumn Property="x => x.ExportTime" Title="@LanguageLocale.dto_StayExportFile_ExportTime" />
|
||||||
|
<TemplateColumn Title="@LanguageLocale.dto_StayExportFile_ExportDetails">
|
||||||
|
<CellTemplate>
|
||||||
|
<MudIconButton Size="@Size.Small" Icon="@Icons.Material.Outlined.Info"
|
||||||
|
OnClick="() => ShowExportDetails(context.Item)" />
|
||||||
|
</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
<PropertyColumn Property="x => Localizer.GetEnumValue(x.FileUploadStatus)"
|
||||||
|
Title="@LanguageLocale.dto_StayExportFile_FileUploadStatus" />
|
||||||
|
<PropertyColumn Property="x => x.FileUploadStatusTime"
|
||||||
|
Title="@LanguageLocale.dto_StayExportFile_FileUploadStatusTime" />
|
||||||
|
|
||||||
|
<TemplateColumn CellClass="d-flex justify-between" Title="Options" StickyRight Hideable="false"
|
||||||
|
ShowColumnOptions="false">
|
||||||
|
<CellTemplate>
|
||||||
|
<MudIconButton Size="@Size.Small" Icon="@Icons.Material.Outlined.Download"
|
||||||
|
OnClick="() => BtnDownloadFile(context.Item)" />
|
||||||
|
<MudIconButton Size="@Size.Small" Icon="@Icons.Material.Outlined.FileUpload"
|
||||||
|
OnClick="() => BtnUpdateUploadStatus(context.Item)" />
|
||||||
|
<MudIconButton Size="@Size.Small" Icon="@Icons.Material.Outlined.Delete"
|
||||||
|
OnClick="() => BtnDeleteItem(context.Item)" />
|
||||||
|
</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
</Columns>
|
||||||
|
<PagerContent>
|
||||||
|
<MudDataGridPager T="StayExportFileDTO" />
|
||||||
|
</PagerContent>
|
||||||
|
</MudDataGrid>
|
||||||
|
|
||||||
|
<ConfirmDeleteMsgBox @ref="_confirmDeleteMsgBox" />
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private bool _dataLoading = true;
|
||||||
|
private const int resultLimit = 200;
|
||||||
|
|
||||||
|
private IEnumerable<StayExportFileDTO> stayExportList = [];
|
||||||
|
|
||||||
|
private MudDataGrid<StayExportFileDTO> _dataGrid = null!;
|
||||||
|
private ConfirmDeleteMsgBox _confirmDeleteMsgBox = null!;
|
||||||
|
|
||||||
|
private DialogOptions uploadStatusSelectorDialogOptions = new()
|
||||||
|
{
|
||||||
|
MaxWidth = MaxWidth.Medium,
|
||||||
|
FullWidth = true,
|
||||||
|
BackdropClick = true,
|
||||||
|
CloseOnEscapeKey = true,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
await LoadDataAsync(showMsg: false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task LoadDataAsync(bool showMsg = true)
|
||||||
|
{
|
||||||
|
_dataLoading = true;
|
||||||
|
|
||||||
|
stayExportList = await stayExportEntityService.GetDtoListAsync(limit: resultLimit);
|
||||||
|
|
||||||
|
if (showMsg)
|
||||||
|
{
|
||||||
|
userMessage.ShowMessage("Data loaded from DB", MessageKind.Info);
|
||||||
|
}
|
||||||
|
_dataLoading = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#region Event Handlers
|
||||||
|
|
||||||
|
private async Task BtnSearchDataAsync()
|
||||||
|
{
|
||||||
|
await LoadDataAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnNewExport()
|
||||||
|
{
|
||||||
|
Navigation.NavigateTo(GuestConsts.Page_StayExport_New);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private async Task ShowExportParams(StayExportFileDTO dto)
|
||||||
|
{
|
||||||
|
string jsonParams = JsonSerializer.Serialize(dto.ExportParams, options: new() { WriteIndented = true });
|
||||||
|
|
||||||
|
await DialogService.ShowMessageBoxAsync("Details", (MarkupString)$"<pre>{jsonParams}</pre>");
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task ShowExportDetails(StayExportFileDTO dto)
|
||||||
|
{
|
||||||
|
if (dto.ExportDetails == null)
|
||||||
|
{
|
||||||
|
userMessage.ShowMessage("This ExportFile doesn't have any export details", MessageKind.Info);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string jsonDetails = JsonSerializer.Serialize(
|
||||||
|
value: dto.ExportDetails,
|
||||||
|
options: new JsonSerializerOptions { WriteIndented = true }
|
||||||
|
);
|
||||||
|
|
||||||
|
await DialogService.ShowMessageBoxAsync("Details", (MarkupString)$"<pre>{jsonDetails}</pre>");
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task BtnDownloadFile(StayExportFileDTO item)
|
||||||
|
{
|
||||||
|
if (item.ExportResult == Enums.Models.StayExportFileResult.NoData)
|
||||||
|
{
|
||||||
|
userMessage.ShowMessage("A Export without data can't be downloaded!", MessageKind.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(item.ExportedPath))
|
||||||
|
{
|
||||||
|
userMessage.ShowMessage("File can't be downloaded: no path found!", MessageKind.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
using Stream objectStream = new MemoryStream();
|
||||||
|
Result loadResult = await ExportService.GetExportedFileAsync(item, objectStream);
|
||||||
|
if (!loadResult.IsSuccess)
|
||||||
|
{
|
||||||
|
userMessage.ShowResultWithMessage(loadResult, "Exported File can't be downloaded");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
objectStream.Seek(0, SeekOrigin.Begin);
|
||||||
|
|
||||||
|
using var streamRef = new DotNetStreamReference(stream: objectStream);
|
||||||
|
|
||||||
|
var fileName = Path.GetFileName(item.ExportedPath);
|
||||||
|
await JS.InvokeVoidAsync("downloadFileFromStream", fileName, streamRef);
|
||||||
|
userMessage.ShowMessage("Exported File downloaded!", MessageKind.Success);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task BtnDeleteItem(StayExportFileDTO item)
|
||||||
|
{
|
||||||
|
if (item.FileUploadStatus == Enums.Models.UploadStatus.Uploaded)
|
||||||
|
{
|
||||||
|
userMessage.ShowMessage(LanguageLocale.page_StayExportList_msgDeleteUploadedFile, MessageKind.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool? confirmDelete = await _confirmDeleteMsgBox.MsgBox.ShowAsync();
|
||||||
|
|
||||||
|
if (confirmDelete is null || confirmDelete.Value == false)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result deleteResult = await ExportService.DeleteExportedFileAsync(item);
|
||||||
|
if (!deleteResult.IsSuccess)
|
||||||
|
{
|
||||||
|
string errorMsg = $"Error deleting Export file {item.Id}";
|
||||||
|
userMessage.ShowResultWithMessage(deleteResult, errorMsg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
userMessage.ShowMessage($"Export file {item.Id} deleted!", MessageKind.Success);
|
||||||
|
await LoadDataAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task BtnUpdateUploadStatus(StayExportFileDTO item)
|
||||||
|
{
|
||||||
|
Debug.Assert(item != null && item.Id != null);
|
||||||
|
|
||||||
|
//Check current status.
|
||||||
|
if (item.FileUploadStatus != UploadStatus.Pending)
|
||||||
|
{
|
||||||
|
userMessage.ShowMessage(LanguageLocale.page_StayExportList_editUploadStatus_msgNotPending, MessageKind.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Show UploadStatus selector dialog.
|
||||||
|
var parameters =
|
||||||
|
new DialogParameters<UploadStatusSelectorDialog> { { x => x.CurrentStatus, item.FileUploadStatus } };
|
||||||
|
var dialog = await DialogService.ShowAsync<UploadStatusSelectorDialog>(
|
||||||
|
parameters: parameters,
|
||||||
|
options: uploadStatusSelectorDialogOptions);
|
||||||
|
|
||||||
|
DialogResult? dialogRs = await dialog.Result;
|
||||||
|
if (dialogRs is null || dialogRs.Canceled)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UploadStatus? newUploadStatus = await dialog.GetReturnValueAsync<UploadStatus>();
|
||||||
|
|
||||||
|
if (newUploadStatus is null)
|
||||||
|
{
|
||||||
|
userMessage.ShowMessage("Error! No upload status selected!", MessageKind.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string txtNewStatus = Localizer.GetEnumValue(newUploadStatus);
|
||||||
|
string confirmMsg = string.Format(LanguageLocale.page_StayExportList_editUploadStatus_msgConfirm,
|
||||||
|
item.Id.Value, txtNewStatus);
|
||||||
|
bool? confirmed = await DialogService.ShowMessageBoxAsync(
|
||||||
|
title: LanguageLocale.general_confirmTitle,
|
||||||
|
message: confirmMsg,
|
||||||
|
yesText: LanguageLocale.general_btnContinue,
|
||||||
|
noText: LanguageLocale.general_btnCancel,
|
||||||
|
options: uploadStatusSelectorDialogOptions);
|
||||||
|
|
||||||
|
if (confirmed == null || confirmed.Value == false)
|
||||||
|
{
|
||||||
|
userMessage.ShowMessage(LanguageLocale.general_msgOperationCanceled, MessageKind.Info);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var loadingDialog = await DialogService.ShowAsync<LoadingDialog>();
|
||||||
|
|
||||||
|
//Update StayEntry
|
||||||
|
Result rs = await stayExportEntityService.UpdateStayExportUploadStatusAsync(item.Id.Value, newUploadStatus.Value);
|
||||||
|
if (!rs.IsSuccess)
|
||||||
|
{
|
||||||
|
userMessage.ShowResultWithMessage(rs, "Error updating UploadStatus");
|
||||||
|
loadingDialog.Close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Reload model.
|
||||||
|
await LoadDataAsync();
|
||||||
|
loadingDialog.Close();
|
||||||
|
|
||||||
|
string successMsg = string.Format(LanguageLocale.page_StayExportList_editUploadStatus_msgEditSuccess,
|
||||||
|
item.Id.Value, txtNewStatus);
|
||||||
|
userMessage.ShowMessage(successMsg, MessageKind.Success);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,190 @@
|
|||||||
|
@attribute [Route($"{GuestConsts.Page_StayExport_New}")]
|
||||||
|
|
||||||
|
@using FluentValidation;
|
||||||
|
@using Somnia.GuestLog.Models.DTOs;
|
||||||
|
@using Somnia.GuestLog.Enums.Models;
|
||||||
|
@using Somnia.GuestLog.Services;
|
||||||
|
@using Somnia.GuestLog.Validators;
|
||||||
|
@using Somnia.GuestLog.Services.StayExport;
|
||||||
|
|
||||||
|
|
||||||
|
@inject IUserMessageService userMessage
|
||||||
|
@inject IDialogService DialogService
|
||||||
|
@inject NavigationManager Navigation
|
||||||
|
@inject IValidator<StayExportParamsDTO> ExportParamsValidator;
|
||||||
|
@inject ILocalizerService Localizer;
|
||||||
|
@inject IStayExportService ExportService;
|
||||||
|
|
||||||
|
@inject IJSRuntime JS
|
||||||
|
|
||||||
|
|
||||||
|
<PageTitle>Somnia - Stay Export - New</PageTitle>
|
||||||
|
|
||||||
|
<MudStack Row="true" Class="my-4">
|
||||||
|
<MudText Typo="Typo.h4" GutterBottom="true">
|
||||||
|
@LanguageLocale.page_StayExportNew_pageTitle
|
||||||
|
</MudText>
|
||||||
|
<MudSpacer />
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Success" Size="Size.Small" StartIcon="@Icons.Material.Filled.Add"
|
||||||
|
OnClick="() => BtnCreateExport()" Disabled="@_isExported">
|
||||||
|
@LanguageLocale.general_btnCreate
|
||||||
|
</MudButton>
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Default" Size="Size.Small"
|
||||||
|
StartIcon="@Icons.Material.Filled.ArrowBack" OnClick="() => BtnReturn()">
|
||||||
|
@LanguageLocale.general_btnReturn
|
||||||
|
</MudButton>
|
||||||
|
</MudStack>
|
||||||
|
|
||||||
|
<MudForm @ref="@_form" Model="@exportParams"
|
||||||
|
Validation="@((ExportParamsValidator as StayExportParamsDTOValidator)!.ValidateValue)" ReadOnly="@_isExported">
|
||||||
|
<MudPaper Class="pa-4 my-4" Elevation="3" Height="100%">
|
||||||
|
<MudStack Row style="margin-block: 0.2em;">
|
||||||
|
<MudSelect @bind-Value="exportFormat" Label="@LanguageLocale.dto_StayExportFile_ExportFormat" FullWidth
|
||||||
|
Clearable>
|
||||||
|
@foreach (StayExportFormat option in Enum.GetValues<StayExportFormat>())
|
||||||
|
{
|
||||||
|
<MudSelectItem Value="new Nullable<StayExportFormat>(option)">
|
||||||
|
@Localizer.GetEnumValue(option)
|
||||||
|
</MudSelectItem>
|
||||||
|
}
|
||||||
|
</MudSelect>
|
||||||
|
<MudSelect @bind-Value="exportParams.ExportType" For="@(() => exportParams.ExportType)"
|
||||||
|
Label="@LanguageLocale.dto_StayExportParams_ExportType" FullWidth Clearable>
|
||||||
|
@foreach (StayExportParamType option in Enum.GetValues<StayExportParamType>())
|
||||||
|
{
|
||||||
|
<MudSelectItem Value="new Nullable<StayExportParamType>(option)">
|
||||||
|
@Localizer.GetEnumValue(option)
|
||||||
|
</MudSelectItem>
|
||||||
|
}
|
||||||
|
</MudSelect>
|
||||||
|
</MudStack>
|
||||||
|
</MudPaper>
|
||||||
|
@if (periodFieldsMode != PeriodFieldsMode.NotAllowed)
|
||||||
|
{
|
||||||
|
<MudPaper Class="pa-4" Elevation="3" Height="100%">
|
||||||
|
@if (periodFieldsMode == PeriodFieldsMode.Optional)
|
||||||
|
{
|
||||||
|
<MudCheckBox @bind-Value="_showOptionalPeriodFields"
|
||||||
|
Label="@LanguageLocale.page_StayExportNew_chkShowPeriodFields" />
|
||||||
|
}
|
||||||
|
@if (periodFieldsMode == PeriodFieldsMode.Required || _showOptionalPeriodFields)
|
||||||
|
{
|
||||||
|
<MudStack Row>
|
||||||
|
<MudDatePicker @bind-Date="exportParams.ExportPeriodStart" For="@(() => exportParams.ExportPeriodStart)"
|
||||||
|
Label="@LanguageLocale.dto_StayExportParams_ExportPeriodStart" Clearable OpenTo="OpenTo.Date" Editable
|
||||||
|
AutoClose="true" Required="periodFieldsMode == PeriodFieldsMode.Required" />
|
||||||
|
<MudDatePicker @bind-Date="exportParams.ExportPeriodEnd" For="@(() => exportParams.ExportPeriodEnd)"
|
||||||
|
Label="@LanguageLocale.dto_StayExportParams_ExportPeriodEnd" Clearable OpenTo="OpenTo.Date" Editable
|
||||||
|
AutoClose="true" Required="periodFieldsMode == PeriodFieldsMode.Required" />
|
||||||
|
</MudStack>
|
||||||
|
}
|
||||||
|
</MudPaper>
|
||||||
|
}
|
||||||
|
|
||||||
|
</MudForm>
|
||||||
|
|
||||||
|
@if (_isExported && exportedFile != null)
|
||||||
|
{
|
||||||
|
<MudPaper Class="pa-4 my-6" Elevation="3" Height="100%">
|
||||||
|
<MudStack>
|
||||||
|
<MudText Typo="Typo.h4">File Exported!</MudText>
|
||||||
|
<MudTextField Value="@Localizer.GetEnumValue(exportedFile.ExportResult)"
|
||||||
|
Label="@LanguageLocale.dto_StayExportFile_ExportResult" FullWidth ReadOnly="true" />
|
||||||
|
<MudTextField Value="@Localizer.GetEnumValue(exportedFile.ExportFormat)"
|
||||||
|
Label="@LanguageLocale.dto_StayExportFile_ExportFormat" FullWidth ReadOnly="true" />
|
||||||
|
<MudButton OnClick="BtnDownloadExportedFile">Download Exported File</MudButton>
|
||||||
|
</MudStack>
|
||||||
|
</MudPaper>
|
||||||
|
}
|
||||||
|
|
||||||
|
@code {
|
||||||
|
MudForm _form = null!;
|
||||||
|
|
||||||
|
StayExportFormat? exportFormat = null;
|
||||||
|
StayExportParamsDTO exportParams = new();
|
||||||
|
StayExportFileDTO? exportedFile = null;
|
||||||
|
|
||||||
|
PeriodFieldsMode periodFieldsMode => exportParams.ExportType switch
|
||||||
|
{
|
||||||
|
StayExportParamType.PeriodDateIn => PeriodFieldsMode.Required,
|
||||||
|
StayExportParamType.UploadPending => PeriodFieldsMode.Optional,
|
||||||
|
_ => PeriodFieldsMode.NotAllowed
|
||||||
|
};
|
||||||
|
bool _showOptionalPeriodFields = false;
|
||||||
|
|
||||||
|
bool _isExported => exportedFile != null;
|
||||||
|
|
||||||
|
|
||||||
|
#region Event Handlers
|
||||||
|
|
||||||
|
private void BtnReturn()
|
||||||
|
{
|
||||||
|
Navigation.NavigateTo(GuestConsts.Page_StayExport_List);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task BtnCreateExport()
|
||||||
|
{
|
||||||
|
await _form.ValidateAsync();
|
||||||
|
if (!_form.IsValid || exportFormat == null)
|
||||||
|
{
|
||||||
|
userMessage.ShowMessage(LanguageLocale.general_validation_invalidForm, MessageKind.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var loadingDialog = await DialogService.ShowAsync<LoadingDialog>();
|
||||||
|
|
||||||
|
var exportResult = await ExportService.ExportStaysByParamsAsync(exportFormat.Value, exportParams);
|
||||||
|
exportedFile = exportResult.Value;
|
||||||
|
loadingDialog.Close();
|
||||||
|
|
||||||
|
if (!exportResult.IsSuccess)
|
||||||
|
{
|
||||||
|
userMessage.ShowResultWithMessage(exportResult, LanguageLocale.general_msgUnknownError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string strExportResult = Localizer.GetEnumValue(exportedFile?.ExportResult);
|
||||||
|
string strMsg = string.Format(LanguageLocale.page_StayExportNew_msgExportOk, strExportResult);
|
||||||
|
userMessage.ShowMessage(strMsg, MessageKind.Success);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task BtnDownloadExportedFile()
|
||||||
|
{
|
||||||
|
Debug.Assert(exportedFile != null);
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(exportedFile.ExportedPath))
|
||||||
|
{
|
||||||
|
userMessage.ShowMessage(LanguageLocale.page_StayExportNew_msgDownloadErrorNoFile, MessageKind.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
using Stream dataStream = new MemoryStream();
|
||||||
|
|
||||||
|
Result loadResult = await ExportService.GetExportedFileAsync(exportedFile, dataStream);
|
||||||
|
if (!loadResult.IsSuccess)
|
||||||
|
{
|
||||||
|
userMessage.ShowResultWithMessage(loadResult, LanguageLocale.page_StayExportNew_msgDownloadError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dataStream.Seek(0, SeekOrigin.Begin);
|
||||||
|
using var streamRef = new DotNetStreamReference(stream: dataStream);
|
||||||
|
|
||||||
|
var fileName = Path.GetFileName(exportedFile.ExportedPath);
|
||||||
|
await JS.InvokeVoidAsync("downloadFileFromStream", fileName, streamRef);
|
||||||
|
|
||||||
|
userMessage.ShowMessage(LanguageLocale.page_StayExportNew_msgDownloadOk, MessageKind.Success);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Internal Models
|
||||||
|
|
||||||
|
private enum PeriodFieldsMode
|
||||||
|
{
|
||||||
|
NotAllowed, Optional, Required
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1 +1,3 @@
|
|||||||
@using Somnia.GuestLog.Components.Controls
|
@using Somnia.GuestLog.Components.Controls
|
||||||
|
@using Somnia.GuestLog.Services.Entity;
|
||||||
|
@using System.Diagnostics;
|
||||||
@@ -1,13 +1,19 @@
|
|||||||
@using System.Net.Http
|
@using System.Net.Http
|
||||||
@using System.Net.Http.Json
|
@using System.Net.Http.Json
|
||||||
|
@using System.Linq;
|
||||||
@using Microsoft.AspNetCore.Components.Forms
|
@using Microsoft.AspNetCore.Components.Forms
|
||||||
@using Microsoft.AspNetCore.Components.Routing
|
@using Microsoft.AspNetCore.Components.Routing
|
||||||
@using Microsoft.AspNetCore.Components.Web
|
@using Microsoft.AspNetCore.Components.Web
|
||||||
@using static Microsoft.AspNetCore.Components.Web.RenderMode
|
@using static Microsoft.AspNetCore.Components.Web.RenderMode
|
||||||
@using Microsoft.AspNetCore.Components.Web.Virtualization
|
@using Microsoft.AspNetCore.Components.Web.Virtualization
|
||||||
@using Microsoft.JSInterop
|
@using Microsoft.JSInterop
|
||||||
|
@using Microsoft.Extensions.Localization
|
||||||
@using MudBlazor
|
@using MudBlazor
|
||||||
@using MudBlazor.Services
|
@using MudBlazor.Services
|
||||||
@using Somnia.GuestLog
|
@using Somnia.GuestLog
|
||||||
@using Somnia.GuestLog.Components
|
@using Somnia.GuestLog.Components
|
||||||
@using Somnia.GuestLog.Components.Layout
|
@using Somnia.GuestLog.Components.Layout
|
||||||
|
@using Somnia.GuestLog.Components.Forms
|
||||||
|
@using Somnia.GuestLog.Components.Controls
|
||||||
|
@using Somnia.GuestLog.Resources
|
||||||
|
@using Somnia.GuestLog.Enums.UI
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Serilog": {
|
||||||
|
"Using": [
|
||||||
|
"Serilog.Sinks.Console",
|
||||||
|
"Serilog.Sinks.File"
|
||||||
|
],
|
||||||
|
"MinimumLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Override": {
|
||||||
|
"Microsoft": "Warning",
|
||||||
|
"Microsoft.EntityFrameworkCore.Database.Command": "Warning"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Enrich": [
|
||||||
|
"FromLogContext",
|
||||||
|
"WithThreadId",
|
||||||
|
"WithProcessId"
|
||||||
|
],
|
||||||
|
"Properties": {
|
||||||
|
"ApplicationName": "Somnia-GuestLog"
|
||||||
|
},
|
||||||
|
"WriteTo": [
|
||||||
|
{
|
||||||
|
"Name": "Console",
|
||||||
|
"Args": {
|
||||||
|
"restrictedToMinimumLevel": "Information"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "File",
|
||||||
|
"Args": {
|
||||||
|
// Logs data path
|
||||||
|
"path": "/SomniaGuestLog/logs/log_.log",
|
||||||
|
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{ProcessId}-{ThreadId}] [{Level}] {JobKey}{Message}{NewLine}{Exception}",
|
||||||
|
"rollingInterval": "Day",
|
||||||
|
"rollOnFileSizeLimit": true,
|
||||||
|
"fileSizeLimitBytes": 1073741824,
|
||||||
|
"retainedFileCountLimit": 30,
|
||||||
|
"restrictedToMinimumLevel": "Information"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Somnia.GuestLog.Enums.Models;
|
||||||
|
|
||||||
|
public enum StayExportDetailsStayEntryResult
|
||||||
|
{
|
||||||
|
OK = 0,
|
||||||
|
Error = 1
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
namespace Somnia.GuestLog.Enums.Models;
|
||||||
|
|
||||||
|
public enum StayExportFileResult
|
||||||
|
{
|
||||||
|
OK = 0,
|
||||||
|
NoData = 1,
|
||||||
|
ExportError = 2,
|
||||||
|
UploadError = 3,
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Somnia.GuestLog.Enums.Models;
|
||||||
|
|
||||||
|
public enum StayExportFormat
|
||||||
|
{
|
||||||
|
GuestLogJson = 0,
|
||||||
|
SpainParteViajeros = 1,
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Somnia.GuestLog.Enums.Models;
|
||||||
|
|
||||||
|
public enum StayExportParamType
|
||||||
|
{
|
||||||
|
PeriodDateIn = 0,
|
||||||
|
UploadPending = 1,
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Somnia.GuestLog.Enums.Models;
|
||||||
|
|
||||||
|
public enum UploadStatus
|
||||||
|
{
|
||||||
|
Pending = 0,
|
||||||
|
Uploaded = 1,
|
||||||
|
Skipped = 2,
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Somnia.GuestLog.Enums.Services;
|
||||||
|
|
||||||
|
public enum AddressQueryProvider
|
||||||
|
{
|
||||||
|
Nominatim,
|
||||||
|
GoogleApiV4
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
namespace Somnia.GuestLog.Enums.Services;
|
||||||
|
|
||||||
|
public enum ResultCode
|
||||||
|
{
|
||||||
|
//Common Codes
|
||||||
|
Ok,
|
||||||
|
UnknownError,
|
||||||
|
FailedValidation,
|
||||||
|
NotFound,
|
||||||
|
FileStorageError,
|
||||||
|
NoPendingChanges,
|
||||||
|
DataIsFinal,
|
||||||
|
|
||||||
|
//Specific Codes
|
||||||
|
GuestInStay,
|
||||||
|
GuestCurrentlyInStay,
|
||||||
|
UploadStatusIsFinal,
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Somnia.GuestLog.Enums.UI;
|
||||||
|
|
||||||
|
public enum FormMode
|
||||||
|
{
|
||||||
|
Create, ReadOnly, Edit
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Somnia.GuestLog.Enums.UI;
|
||||||
|
|
||||||
|
public enum MessageKind
|
||||||
|
{
|
||||||
|
Info, Warning, Error, Success, Normal
|
||||||
|
}
|
||||||
@@ -5,29 +5,39 @@ public static class GuestConsts
|
|||||||
|
|
||||||
public const string Page_GuestDocs_List = "/guest-documents";
|
public const string Page_GuestDocs_List = "/guest-documents";
|
||||||
public const string Page_GuestDocs_New = "/guest-documents/new";
|
public const string Page_GuestDocs_New = "/guest-documents/new";
|
||||||
|
public const string Page_GuestDocs_Detail = $"/guest-documents/d/{Page_GuestDocs_Detail_Param_DocId}";
|
||||||
|
public const string Page_GuestDocs_Detail_Param_DocId = "{docId:long}";
|
||||||
|
|
||||||
|
public const string Page_StayEntry_List = "/stayEntries";
|
||||||
|
public const string Page_StayEntry_New = "/stayEntries/new";
|
||||||
|
public const string Page_StayEntry_Detail = $"/stayEntries/d/{Page_StayEntry_Detail_Param_Id}";
|
||||||
|
public const string Page_StayEntry_Detail_Param_Id = "{StayId:long}";
|
||||||
|
|
||||||
|
public const string Page_StayExport_List = "/stayExport";
|
||||||
|
public const string Page_StayExport_New = "/stayExport/new";
|
||||||
|
|
||||||
|
|
||||||
public static HashSet<string> DocumentTypeList { get; private set; } = [
|
public const string QueryParam_ReturnUrl = "returnUrl";
|
||||||
"DNI",
|
|
||||||
"NIE",
|
|
||||||
"Passport",
|
|
||||||
"ID Card",
|
|
||||||
"Other",
|
|
||||||
];
|
|
||||||
|
|
||||||
public static Dictionary<string, string> CountryList { get; private set; } = new([
|
|
||||||
new KeyValuePair<string, string>("ESP", "Spain"),
|
|
||||||
new KeyValuePair<string, string>("ITA", "Italy"),
|
|
||||||
new KeyValuePair<string, string>("USA", "United States")
|
|
||||||
]);
|
|
||||||
|
|
||||||
public static Dictionary<string, string> GenderList { get; private set; } = new([
|
|
||||||
new KeyValuePair<string, string>("M", "Male"),
|
|
||||||
new KeyValuePair<string, string>("F", "Female"),
|
|
||||||
new KeyValuePair<string, string>("O", "Other")
|
|
||||||
]);
|
|
||||||
|
|
||||||
|
|
||||||
public const string regexPattern_phoneNum = @"\+?\d{1,4}?[-.\s]?\(?\d{1,3}?\)?[-.\s]?\d{1,4}[-.\s]?\d{1,4}[-.\s]?\d{1,9}";
|
public const string DataList_DocumentTypes = "DocumentType";
|
||||||
|
public const string DataList_GenderOptions = "GenderOption";
|
||||||
|
public const string DataList_CountryCodes = "CountryCode";
|
||||||
|
public const string DataList_PaymentMethods = "PaymentMethod";
|
||||||
|
|
||||||
|
|
||||||
|
public const string CountryCode_ESP = "ESP";
|
||||||
|
|
||||||
|
public const string DocumentType_DNI = "DNI";
|
||||||
|
public const string DocumentType_NIE = "NIE";
|
||||||
|
public const string DocumentType_PASSPORT = "PASSPORT";
|
||||||
|
|
||||||
|
public const string GenderOptions_MALE = "M";
|
||||||
|
public const string GenderOptions_FEMALE = "F";
|
||||||
|
public const string GenderOptions_OTHER = "O";
|
||||||
|
|
||||||
|
public const int GuestDocument_FirstVersion = 1;
|
||||||
|
|
||||||
|
|
||||||
|
public const string EmptyField = "-";
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
namespace Somnia.GuestLog.Infrastructure;
|
||||||
|
|
||||||
|
public static class DbConsts
|
||||||
|
{
|
||||||
|
public const string DbType_Timestamptz = "timestamp with time zone";
|
||||||
|
public const string DbType_Timestamptz_0 = "timestamp(0) with time zone";
|
||||||
|
public const string DbType_Timestamptz_3 = "timestamp(3) with time zone";
|
||||||
|
|
||||||
|
public const string DbType_jsonb = "jsonb";
|
||||||
|
|
||||||
|
public const string PK_NotApply = "N/A";
|
||||||
|
}
|
||||||
@@ -11,7 +11,13 @@ public class GuestDocumentEntityConfig : IEntityTypeConfiguration<GuestDocument>
|
|||||||
builder.ToTable("GuestDocument");
|
builder.ToTable("GuestDocument");
|
||||||
|
|
||||||
//PK
|
//PK
|
||||||
builder.HasKey(e => new { e.DocumentType, e.DocumentNum });
|
builder.HasKey(e => new { e.Id, e.Version });
|
||||||
|
|
||||||
|
builder.Property(e => e.Id)
|
||||||
|
.UseIdentityByDefaultColumn();
|
||||||
|
|
||||||
|
builder.Property(e => e.Version)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
builder.Property(e => e.DocumentType)
|
builder.Property(e => e.DocumentType)
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
@@ -48,6 +54,15 @@ public class GuestDocumentEntityConfig : IEntityTypeConfiguration<GuestDocument>
|
|||||||
builder.Property(e => e.EmailAddress)
|
builder.Property(e => e.EmailAddress)
|
||||||
.HasMaxLength(256);
|
.HasMaxLength(256);
|
||||||
|
|
||||||
|
builder.Property(e => e.CreateTime)
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType(DbConsts.DbType_Timestamptz_3);
|
||||||
|
builder.Property(e => e.UpdateTime)
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType(DbConsts.DbType_Timestamptz_3);
|
||||||
|
builder.Property(e => e.IsLastVersion)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
|
||||||
var addressBuilder = builder.ComplexProperty(e => e.AddressDetails);
|
var addressBuilder = builder.ComplexProperty(e => e.AddressDetails);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using Somnia.GuestLog.Models.Entities;
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Infrastructure.EntityConfigs;
|
||||||
|
|
||||||
|
public class StayEntryEntityConfig : IEntityTypeConfiguration<StayEntry>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<StayEntry> builder)
|
||||||
|
{
|
||||||
|
builder.ToTable("StayEntry");
|
||||||
|
|
||||||
|
//PK
|
||||||
|
builder.HasKey(e => e.Id);
|
||||||
|
|
||||||
|
builder.Property(e => e.Id)
|
||||||
|
.IsRequired()
|
||||||
|
.UseIdentityByDefaultColumn();
|
||||||
|
|
||||||
|
builder.Property(e => e.DateIn)
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType(DbConsts.DbType_Timestamptz_0);
|
||||||
|
builder.Property(e => e.DateOut)
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType(DbConsts.DbType_Timestamptz_0);
|
||||||
|
|
||||||
|
builder.Property(e => e.RoomNumber)
|
||||||
|
.HasMaxLength(32);
|
||||||
|
builder.Property(e => e.PaymentMethod)
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(5);
|
||||||
|
|
||||||
|
builder.Property(e => e.StayUploadStatus)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(e => e.StayUploadStatusTime)
|
||||||
|
.HasColumnType(DbConsts.DbType_Timestamptz);
|
||||||
|
|
||||||
|
builder.Property(e => e.CreateTime)
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType(DbConsts.DbType_Timestamptz);
|
||||||
|
builder.Property(e => e.UpdateTime)
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType(DbConsts.DbType_Timestamptz);
|
||||||
|
|
||||||
|
|
||||||
|
builder.HasMany(e => e.GuestDocuments)
|
||||||
|
.WithMany();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
using Somnia.GuestLog.Models.Entities;
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Infrastructure.EntityConfigs;
|
||||||
|
|
||||||
|
public class StayExportFileEntityConfig : IEntityTypeConfiguration<StayExportFile>
|
||||||
|
{
|
||||||
|
public void Configure(EntityTypeBuilder<StayExportFile> builder)
|
||||||
|
{
|
||||||
|
builder.ToTable("StayExportFile");
|
||||||
|
|
||||||
|
//PK
|
||||||
|
builder.HasKey(e => e.Id);
|
||||||
|
|
||||||
|
builder.Property(e => e.Id)
|
||||||
|
.IsRequired()
|
||||||
|
.UseIdentityByDefaultColumn();
|
||||||
|
|
||||||
|
builder.ComplexProperty(e => e.ExportParams, e =>
|
||||||
|
{
|
||||||
|
e.ToJson();
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.Property(e => e.ExportedPath)
|
||||||
|
.HasMaxLength(256);
|
||||||
|
|
||||||
|
builder.ComplexProperty(e => e.ExportDetails, e =>
|
||||||
|
{
|
||||||
|
e.ToJson();
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.Property(e => e.ExportTime)
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType(DbConsts.DbType_Timestamptz);
|
||||||
|
|
||||||
|
builder.Property(e => e.FileUploadStatus)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(e => e.FileUploadStatusTime)
|
||||||
|
.HasColumnType(DbConsts.DbType_Timestamptz);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,11 +11,16 @@ public partial class GuestLogContext : DbContext
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
public DbSet<GuestDocument> GuestDocuments { get; set; }
|
public DbSet<GuestDocument> GuestDocuments { get; set; }
|
||||||
|
public DbSet<StayEntry> StayEntries { get; set; }
|
||||||
|
|
||||||
|
public DbSet<StayExportFile> StayExportFiles { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
modelBuilder.ApplyConfiguration<GuestDocument>(new GuestDocumentEntityConfig());
|
modelBuilder.ApplyConfiguration<GuestDocument>(new GuestDocumentEntityConfig());
|
||||||
|
modelBuilder.ApplyConfiguration<StayEntry>(new StayEntryEntityConfig());
|
||||||
|
modelBuilder.ApplyConfiguration<StayExportFile>(new StayExportFileEntityConfig());
|
||||||
|
|
||||||
OnModelCreatingPartial(modelBuilder);
|
OnModelCreatingPartial(modelBuilder);
|
||||||
base.OnModelCreating(modelBuilder);
|
base.OnModelCreating(modelBuilder);
|
||||||
|
|||||||
Generated
+191
@@ -0,0 +1,191 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
using Somnia.GuestLog.Infrastructure;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(GuestLogContext))]
|
||||||
|
[Migration("20260813085339_AddTable_StayEntry")]
|
||||||
|
partial class AddTable_StayEntry
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "10.0.7")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("GuestDocumentStayEntry", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("StayEntryId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<string>("GuestDocumentsDocumentType")
|
||||||
|
.HasColumnType("character varying(8)");
|
||||||
|
|
||||||
|
b.Property<string>("GuestDocumentsDocumentNum")
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.HasKey("StayEntryId", "GuestDocumentsDocumentType", "GuestDocumentsDocumentNum");
|
||||||
|
|
||||||
|
b.HasIndex("GuestDocumentsDocumentType", "GuestDocumentsDocumentNum");
|
||||||
|
|
||||||
|
b.ToTable("GuestDocumentStayEntry");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Somnia.GuestLog.Models.Entities.GuestDocument", b =>
|
||||||
|
{
|
||||||
|
b.Property<string>("DocumentType")
|
||||||
|
.HasMaxLength(8)
|
||||||
|
.HasColumnType("character varying(8)");
|
||||||
|
|
||||||
|
b.Property<string>("DocumentNum")
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<DateOnly>("BirthDate")
|
||||||
|
.HasColumnType("date");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("EmailAddress")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("character varying(256)");
|
||||||
|
|
||||||
|
b.Property<string>("Gender")
|
||||||
|
.HasMaxLength(1)
|
||||||
|
.HasColumnType("character varying(1)");
|
||||||
|
|
||||||
|
b.Property<DateOnly>("IssueDate")
|
||||||
|
.HasColumnType("date");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("Nationality")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(3)
|
||||||
|
.HasColumnType("character varying(3)");
|
||||||
|
|
||||||
|
b.Property<string>("PhoneNumber")
|
||||||
|
.HasMaxLength(32)
|
||||||
|
.HasColumnType("character varying(32)");
|
||||||
|
|
||||||
|
b.Property<string>("SupportNum")
|
||||||
|
.HasMaxLength(10)
|
||||||
|
.HasColumnType("character varying(10)");
|
||||||
|
|
||||||
|
b.Property<string>("Surname")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("Surname2")
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.ComplexProperty(typeof(Dictionary<string, object>), "AddressDetails", "Somnia.GuestLog.Models.Entities.GuestDocument.AddressDetails#GuestAddress", b1 =>
|
||||||
|
{
|
||||||
|
b1.Property<string>("Address")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressCity")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressCountry")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(3)
|
||||||
|
.HasColumnType("character varying(3)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressProvince")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressState")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("ZipCode")
|
||||||
|
.HasMaxLength(12)
|
||||||
|
.HasColumnType("character varying(12)");
|
||||||
|
});
|
||||||
|
|
||||||
|
b.HasKey("DocumentType", "DocumentNum");
|
||||||
|
|
||||||
|
b.ToTable("GuestDocument", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Somnia.GuestLog.Models.Entities.StayEntry", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateIn")
|
||||||
|
.HasColumnType("timestamp(0) with time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateOut")
|
||||||
|
.HasColumnType("timestamp(0) with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("PaymentMethod")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(5)
|
||||||
|
.HasColumnType("character varying(5)");
|
||||||
|
|
||||||
|
b.Property<int>("RoomCount")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("RoomNumber")
|
||||||
|
.HasMaxLength(32)
|
||||||
|
.HasColumnType("character varying(32)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("StayEntry", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("GuestDocumentStayEntry", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Somnia.GuestLog.Models.Entities.StayEntry", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("StayEntryId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Somnia.GuestLog.Models.Entities.GuestDocument", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("GuestDocumentsDocumentType", "GuestDocumentsDocumentNum")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddTable_StayEntry : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "StayEntry",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
DateIn = table.Column<DateTime>(type: "timestamp(0) with time zone", nullable: false),
|
||||||
|
DateOut = table.Column<DateTime>(type: "timestamp(0) with time zone", nullable: false),
|
||||||
|
RoomCount = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
RoomNumber = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: true),
|
||||||
|
PaymentMethod = table.Column<string>(type: "character varying(5)", maxLength: 5, nullable: false),
|
||||||
|
CreateTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||||
|
UpdateTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_StayEntry", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "GuestDocumentStayEntry",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
StayEntryId = table.Column<long>(type: "bigint", nullable: false),
|
||||||
|
GuestDocumentsDocumentType = table.Column<string>(type: "character varying(8)", nullable: false),
|
||||||
|
GuestDocumentsDocumentNum = table.Column<string>(type: "character varying(64)", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_GuestDocumentStayEntry", x => new { x.StayEntryId, x.GuestDocumentsDocumentType, x.GuestDocumentsDocumentNum });
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_GuestDocumentStayEntry_GuestDocument_GuestDocumentsDocument~",
|
||||||
|
columns: x => new { x.GuestDocumentsDocumentType, x.GuestDocumentsDocumentNum },
|
||||||
|
principalTable: "GuestDocument",
|
||||||
|
principalColumns: new[] { "DocumentType", "DocumentNum" },
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_GuestDocumentStayEntry_StayEntry_StayEntryId",
|
||||||
|
column: x => x.StayEntryId,
|
||||||
|
principalTable: "StayEntry",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_GuestDocumentStayEntry_GuestDocumentsDocumentType_GuestDocu~",
|
||||||
|
table: "GuestDocumentStayEntry",
|
||||||
|
columns: new[] { "GuestDocumentsDocumentType", "GuestDocumentsDocumentNum" });
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "GuestDocumentStayEntry");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "StayEntry");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+205
@@ -0,0 +1,205 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
using Somnia.GuestLog.Infrastructure;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(GuestLogContext))]
|
||||||
|
[Migration("20260830201743_GuestDocument_ChangePKToIdAndVersion")]
|
||||||
|
partial class GuestDocument_ChangePKToIdAndVersion
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "10.0.7")
|
||||||
|
.HasAnnotation("Proxies:ChangeTracking", false)
|
||||||
|
.HasAnnotation("Proxies:CheckEquality", false)
|
||||||
|
.HasAnnotation("Proxies:LazyLoading", true)
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("GuestDocumentStayEntry", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("StayEntryId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<long>("GuestDocumentsId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<int>("GuestDocumentsVersion")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("StayEntryId", "GuestDocumentsId", "GuestDocumentsVersion");
|
||||||
|
|
||||||
|
b.HasIndex("GuestDocumentsId", "GuestDocumentsVersion");
|
||||||
|
|
||||||
|
b.ToTable("GuestDocumentStayEntry");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Somnia.GuestLog.Models.Entities.GuestDocument", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("Version")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateOnly>("BirthDate")
|
||||||
|
.HasColumnType("date");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("DocumentNum")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("DocumentType")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(8)
|
||||||
|
.HasColumnType("character varying(8)");
|
||||||
|
|
||||||
|
b.Property<string>("EmailAddress")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("character varying(256)");
|
||||||
|
|
||||||
|
b.Property<string>("Gender")
|
||||||
|
.HasMaxLength(1)
|
||||||
|
.HasColumnType("character varying(1)");
|
||||||
|
|
||||||
|
b.Property<DateOnly>("IssueDate")
|
||||||
|
.HasColumnType("date");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("Nationality")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(3)
|
||||||
|
.HasColumnType("character varying(3)");
|
||||||
|
|
||||||
|
b.Property<string>("PhoneNumber")
|
||||||
|
.HasMaxLength(32)
|
||||||
|
.HasColumnType("character varying(32)");
|
||||||
|
|
||||||
|
b.Property<string>("SupportNum")
|
||||||
|
.HasMaxLength(10)
|
||||||
|
.HasColumnType("character varying(10)");
|
||||||
|
|
||||||
|
b.Property<string>("Surname")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("Surname2")
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.ComplexProperty(typeof(Dictionary<string, object>), "AddressDetails", "Somnia.GuestLog.Models.Entities.GuestDocument.AddressDetails#GuestAddress", b1 =>
|
||||||
|
{
|
||||||
|
b1.Property<string>("Address")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressCity")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressCountry")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(3)
|
||||||
|
.HasColumnType("character varying(3)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressProvince")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressState")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("ZipCode")
|
||||||
|
.HasMaxLength(12)
|
||||||
|
.HasColumnType("character varying(12)");
|
||||||
|
});
|
||||||
|
|
||||||
|
b.HasKey("Id", "Version");
|
||||||
|
|
||||||
|
b.ToTable("GuestDocument", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Somnia.GuestLog.Models.Entities.StayEntry", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateIn")
|
||||||
|
.HasColumnType("timestamp(0) with time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateOut")
|
||||||
|
.HasColumnType("timestamp(0) with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("PaymentMethod")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(5)
|
||||||
|
.HasColumnType("character varying(5)");
|
||||||
|
|
||||||
|
b.Property<int>("RoomCount")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("RoomNumber")
|
||||||
|
.HasMaxLength(32)
|
||||||
|
.HasColumnType("character varying(32)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("StayEntry", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("GuestDocumentStayEntry", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Somnia.GuestLog.Models.Entities.StayEntry", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("StayEntryId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Somnia.GuestLog.Models.Entities.GuestDocument", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("GuestDocumentsId", "GuestDocumentsVersion")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+101
@@ -0,0 +1,101 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class GuestDocument_ChangePKToIdAndVersion : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
//Data don't really matter right now. Just get it working good.
|
||||||
|
//This migration will destry all data, but it's fine.
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "GuestDocumentStayEntry"
|
||||||
|
);
|
||||||
|
|
||||||
|
migrationBuilder.Sql("""DELETE FROM "StayEntry";""");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "GuestDocument"
|
||||||
|
);
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "GuestDocument",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
Version = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
DocumentType = table.Column<string>(type: "character varying(8)", maxLength: 8, nullable: false),
|
||||||
|
DocumentNum = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
||||||
|
IssueDate = table.Column<DateOnly>(type: "date", nullable: false),
|
||||||
|
SupportNum = table.Column<string>(type: "character varying(10)", maxLength: 10, nullable: true),
|
||||||
|
Nationality = table.Column<string>(type: "character varying(3)", maxLength: 3, nullable: false),
|
||||||
|
Name = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
||||||
|
Surname = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
||||||
|
Surname2 = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
|
||||||
|
BirthDate = table.Column<DateOnly>(type: "date", nullable: false),
|
||||||
|
Gender = table.Column<string>(type: "character varying(1)", maxLength: 1, nullable: true),
|
||||||
|
PhoneNumber = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: true),
|
||||||
|
EmailAddress = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||||
|
CreateTime = table.Column<DateTime>(type: "timestamp(3) with time zone", nullable: false),
|
||||||
|
UpdateTime = table.Column<DateTime>(type: "timestamp(3) with time zone", nullable: false),
|
||||||
|
IsLastVersion = table.Column<bool>(type: "boolean", nullable: false),
|
||||||
|
AddressDetails_Address = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true),
|
||||||
|
AddressDetails_AddressCity = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true),
|
||||||
|
AddressDetails_AddressCountry = table.Column<string>(type: "character varying(3)", maxLength: 3, nullable: true),
|
||||||
|
AddressDetails_AddressProvince = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true),
|
||||||
|
AddressDetails_AddressState = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true),
|
||||||
|
AddressDetails_ZipCode = table.Column<string>(type: "character varying(12)", maxLength: 12, nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_GuestDocument", x => new { x.Id, x.Version });
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//Existing index for "DocType" and "DocNum" can be useful, so let's keep it.
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "GuestDocumentStayEntry",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
StayEntryId = table.Column<long>(type: "bigint", nullable: false),
|
||||||
|
GuestDocumentsId = table.Column<long>(type: "bigint", nullable: false),
|
||||||
|
GuestDocumentsVersion = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_GuestDocumentStayEntry", x => new { x.StayEntryId, x.GuestDocumentsId, x.GuestDocumentsVersion });
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_GuestDocumentStayEntry_GuestDocument_GuestDocumentsId_Guest~",
|
||||||
|
columns: x => new { x.GuestDocumentsId, x.GuestDocumentsVersion },
|
||||||
|
principalTable: "GuestDocument",
|
||||||
|
principalColumns: new[] { "Id", "Version" },
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_GuestDocumentStayEntry_StayEntry_StayEntryId",
|
||||||
|
column: x => x.StayEntryId,
|
||||||
|
principalTable: "StayEntry",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_GuestDocumentStayEntry_GuestDocumentsId_GuestDocumentsVersi~",
|
||||||
|
table: "GuestDocumentStayEntry",
|
||||||
|
columns: new[] { "GuestDocumentsId", "GuestDocumentsVersion" });
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException("Rollback is not supported for this migration!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Generated
+249
@@ -0,0 +1,249 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
using Somnia.GuestLog.Infrastructure;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(GuestLogContext))]
|
||||||
|
[Migration("20260901161146_AddTable_StayExportFile")]
|
||||||
|
partial class AddTable_StayExportFile
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "10.0.7")
|
||||||
|
.HasAnnotation("Proxies:ChangeTracking", false)
|
||||||
|
.HasAnnotation("Proxies:CheckEquality", false)
|
||||||
|
.HasAnnotation("Proxies:LazyLoading", true)
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("GuestDocumentStayEntry", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("StayEntryId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<long>("GuestDocumentsId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<int>("GuestDocumentsVersion")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("StayEntryId", "GuestDocumentsId", "GuestDocumentsVersion");
|
||||||
|
|
||||||
|
b.HasIndex("GuestDocumentsId", "GuestDocumentsVersion");
|
||||||
|
|
||||||
|
b.ToTable("GuestDocumentStayEntry");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Somnia.GuestLog.Models.Entities.GuestDocument", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("Version")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateOnly>("BirthDate")
|
||||||
|
.HasColumnType("date");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("timestamp(3) with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("DocumentNum")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("DocumentType")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(8)
|
||||||
|
.HasColumnType("character varying(8)");
|
||||||
|
|
||||||
|
b.Property<string>("EmailAddress")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("character varying(256)");
|
||||||
|
|
||||||
|
b.Property<string>("Gender")
|
||||||
|
.HasMaxLength(1)
|
||||||
|
.HasColumnType("character varying(1)");
|
||||||
|
|
||||||
|
b.Property<bool>("IsLastVersion")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<DateOnly>("IssueDate")
|
||||||
|
.HasColumnType("date");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("Nationality")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(3)
|
||||||
|
.HasColumnType("character varying(3)");
|
||||||
|
|
||||||
|
b.Property<string>("PhoneNumber")
|
||||||
|
.HasMaxLength(32)
|
||||||
|
.HasColumnType("character varying(32)");
|
||||||
|
|
||||||
|
b.Property<string>("SupportNum")
|
||||||
|
.HasMaxLength(10)
|
||||||
|
.HasColumnType("character varying(10)");
|
||||||
|
|
||||||
|
b.Property<string>("Surname")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("Surname2")
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("timestamp(3) with time zone");
|
||||||
|
|
||||||
|
b.ComplexProperty(typeof(Dictionary<string, object>), "AddressDetails", "Somnia.GuestLog.Models.Entities.GuestDocument.AddressDetails#GuestAddress", b1 =>
|
||||||
|
{
|
||||||
|
b1.Property<string>("Address")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressCity")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressCountry")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(3)
|
||||||
|
.HasColumnType("character varying(3)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressProvince")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressState")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("ZipCode")
|
||||||
|
.HasMaxLength(12)
|
||||||
|
.HasColumnType("character varying(12)");
|
||||||
|
});
|
||||||
|
|
||||||
|
b.HasKey("Id", "Version");
|
||||||
|
|
||||||
|
b.ToTable("GuestDocument", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Somnia.GuestLog.Models.Entities.StayEntry", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateIn")
|
||||||
|
.HasColumnType("timestamp(0) with time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateOut")
|
||||||
|
.HasColumnType("timestamp(0) with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("PaymentMethod")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(5)
|
||||||
|
.HasColumnType("character varying(5)");
|
||||||
|
|
||||||
|
b.Property<int>("RoomCount")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("RoomNumber")
|
||||||
|
.HasMaxLength(32)
|
||||||
|
.HasColumnType("character varying(32)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("StayEntry", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Somnia.GuestLog.Models.Entities.StayExportFile", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ExportFormat")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("ExportResult")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateTime>("ExportTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("ExportedPath")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("character varying(256)");
|
||||||
|
|
||||||
|
b.ComplexProperty(typeof(Dictionary<string, object>), "ExportParams", "Somnia.GuestLog.Models.Entities.StayExportFile.ExportParams#StayExportParams", b1 =>
|
||||||
|
{
|
||||||
|
b1.IsRequired();
|
||||||
|
|
||||||
|
b1.Property<DateTime?>("ExportPeriodEnd");
|
||||||
|
|
||||||
|
b1.Property<DateTime?>("ExportPeriodStart");
|
||||||
|
|
||||||
|
b1.Property<int>("ExportType");
|
||||||
|
|
||||||
|
b1
|
||||||
|
.ToJson("ExportParams")
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
});
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("StayExportFile", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("GuestDocumentStayEntry", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Somnia.GuestLog.Models.Entities.StayEntry", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("StayEntryId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Somnia.GuestLog.Models.Entities.GuestDocument", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("GuestDocumentsId", "GuestDocumentsVersion")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+40
@@ -0,0 +1,40 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddTable_StayExportFile : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "StayExportFile",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
ExportFormat = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
ExportResult = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
ExportedPath = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||||
|
ExportTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||||
|
ExportParams = table.Column<string>(type: "jsonb", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_StayExportFile", x => x.Id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "StayExportFile");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+252
@@ -0,0 +1,252 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
using Somnia.GuestLog.Infrastructure;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(GuestLogContext))]
|
||||||
|
[Migration("20260908172441_StayExportFile_AddColumn_ExportDetails")]
|
||||||
|
partial class StayExportFile_AddColumn_ExportDetails
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "10.0.7")
|
||||||
|
.HasAnnotation("Proxies:ChangeTracking", false)
|
||||||
|
.HasAnnotation("Proxies:CheckEquality", false)
|
||||||
|
.HasAnnotation("Proxies:LazyLoading", true)
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("GuestDocumentStayEntry", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("StayEntryId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<long>("GuestDocumentsId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<int>("GuestDocumentsVersion")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("StayEntryId", "GuestDocumentsId", "GuestDocumentsVersion");
|
||||||
|
|
||||||
|
b.HasIndex("GuestDocumentsId", "GuestDocumentsVersion");
|
||||||
|
|
||||||
|
b.ToTable("GuestDocumentStayEntry");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Somnia.GuestLog.Models.Entities.GuestDocument", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("Version")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateOnly>("BirthDate")
|
||||||
|
.HasColumnType("date");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("timestamp(3) with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("DocumentNum")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("DocumentType")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(8)
|
||||||
|
.HasColumnType("character varying(8)");
|
||||||
|
|
||||||
|
b.Property<string>("EmailAddress")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("character varying(256)");
|
||||||
|
|
||||||
|
b.Property<string>("Gender")
|
||||||
|
.HasMaxLength(1)
|
||||||
|
.HasColumnType("character varying(1)");
|
||||||
|
|
||||||
|
b.Property<bool>("IsLastVersion")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<DateOnly>("IssueDate")
|
||||||
|
.HasColumnType("date");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("Nationality")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(3)
|
||||||
|
.HasColumnType("character varying(3)");
|
||||||
|
|
||||||
|
b.Property<string>("PhoneNumber")
|
||||||
|
.HasMaxLength(32)
|
||||||
|
.HasColumnType("character varying(32)");
|
||||||
|
|
||||||
|
b.Property<string>("SupportNum")
|
||||||
|
.HasMaxLength(10)
|
||||||
|
.HasColumnType("character varying(10)");
|
||||||
|
|
||||||
|
b.Property<string>("Surname")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("Surname2")
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("timestamp(3) with time zone");
|
||||||
|
|
||||||
|
b.ComplexProperty(typeof(Dictionary<string, object>), "AddressDetails", "Somnia.GuestLog.Models.Entities.GuestDocument.AddressDetails#GuestAddress", b1 =>
|
||||||
|
{
|
||||||
|
b1.Property<string>("Address")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressCity")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressCountry")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(3)
|
||||||
|
.HasColumnType("character varying(3)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressProvince")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressState")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("ZipCode")
|
||||||
|
.HasMaxLength(12)
|
||||||
|
.HasColumnType("character varying(12)");
|
||||||
|
});
|
||||||
|
|
||||||
|
b.HasKey("Id", "Version");
|
||||||
|
|
||||||
|
b.ToTable("GuestDocument", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Somnia.GuestLog.Models.Entities.StayEntry", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateIn")
|
||||||
|
.HasColumnType("timestamp(0) with time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateOut")
|
||||||
|
.HasColumnType("timestamp(0) with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("PaymentMethod")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(5)
|
||||||
|
.HasColumnType("character varying(5)");
|
||||||
|
|
||||||
|
b.Property<int>("RoomCount")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("RoomNumber")
|
||||||
|
.HasMaxLength(32)
|
||||||
|
.HasColumnType("character varying(32)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("StayEntry", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Somnia.GuestLog.Models.Entities.StayExportFile", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ExportDetails")
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.Property<int>("ExportFormat")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("ExportResult")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateTime>("ExportTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("ExportedPath")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("character varying(256)");
|
||||||
|
|
||||||
|
b.ComplexProperty(typeof(Dictionary<string, object>), "ExportParams", "Somnia.GuestLog.Models.Entities.StayExportFile.ExportParams#StayExportParams", b1 =>
|
||||||
|
{
|
||||||
|
b1.IsRequired();
|
||||||
|
|
||||||
|
b1.Property<DateTime?>("ExportPeriodEnd");
|
||||||
|
|
||||||
|
b1.Property<DateTime?>("ExportPeriodStart");
|
||||||
|
|
||||||
|
b1.Property<int>("ExportType");
|
||||||
|
|
||||||
|
b1
|
||||||
|
.ToJson("ExportParams")
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
});
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("StayExportFile", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("GuestDocumentStayEntry", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Somnia.GuestLog.Models.Entities.StayEntry", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("StayEntryId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Somnia.GuestLog.Models.Entities.GuestDocument", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("GuestDocumentsId", "GuestDocumentsVersion")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class StayExportFile_AddColumn_ExportDetails : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "ExportDetails",
|
||||||
|
table: "StayExportFile",
|
||||||
|
type: "jsonb",
|
||||||
|
nullable: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "ExportDetails",
|
||||||
|
table: "StayExportFile");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+252
@@ -0,0 +1,252 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
using Somnia.GuestLog.Infrastructure;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(GuestLogContext))]
|
||||||
|
[Migration("20260910093310_GuestDocument_IssueDate_MakeNullable")]
|
||||||
|
partial class GuestDocument_IssueDate_MakeNullable
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "10.0.7")
|
||||||
|
.HasAnnotation("Proxies:ChangeTracking", false)
|
||||||
|
.HasAnnotation("Proxies:CheckEquality", false)
|
||||||
|
.HasAnnotation("Proxies:LazyLoading", true)
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("GuestDocumentStayEntry", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("StayEntryId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<long>("GuestDocumentsId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<int>("GuestDocumentsVersion")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("StayEntryId", "GuestDocumentsId", "GuestDocumentsVersion");
|
||||||
|
|
||||||
|
b.HasIndex("GuestDocumentsId", "GuestDocumentsVersion");
|
||||||
|
|
||||||
|
b.ToTable("GuestDocumentStayEntry");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Somnia.GuestLog.Models.Entities.GuestDocument", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("Version")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateOnly>("BirthDate")
|
||||||
|
.HasColumnType("date");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("timestamp(3) with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("DocumentNum")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("DocumentType")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(8)
|
||||||
|
.HasColumnType("character varying(8)");
|
||||||
|
|
||||||
|
b.Property<string>("EmailAddress")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("character varying(256)");
|
||||||
|
|
||||||
|
b.Property<string>("Gender")
|
||||||
|
.HasMaxLength(1)
|
||||||
|
.HasColumnType("character varying(1)");
|
||||||
|
|
||||||
|
b.Property<bool>("IsLastVersion")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<DateOnly?>("IssueDate")
|
||||||
|
.HasColumnType("date");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("Nationality")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(3)
|
||||||
|
.HasColumnType("character varying(3)");
|
||||||
|
|
||||||
|
b.Property<string>("PhoneNumber")
|
||||||
|
.HasMaxLength(32)
|
||||||
|
.HasColumnType("character varying(32)");
|
||||||
|
|
||||||
|
b.Property<string>("SupportNum")
|
||||||
|
.HasMaxLength(10)
|
||||||
|
.HasColumnType("character varying(10)");
|
||||||
|
|
||||||
|
b.Property<string>("Surname")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("Surname2")
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("timestamp(3) with time zone");
|
||||||
|
|
||||||
|
b.ComplexProperty(typeof(Dictionary<string, object>), "AddressDetails", "Somnia.GuestLog.Models.Entities.GuestDocument.AddressDetails#GuestAddress", b1 =>
|
||||||
|
{
|
||||||
|
b1.Property<string>("Address")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressCity")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressCountry")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(3)
|
||||||
|
.HasColumnType("character varying(3)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressProvince")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressState")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("ZipCode")
|
||||||
|
.HasMaxLength(12)
|
||||||
|
.HasColumnType("character varying(12)");
|
||||||
|
});
|
||||||
|
|
||||||
|
b.HasKey("Id", "Version");
|
||||||
|
|
||||||
|
b.ToTable("GuestDocument", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Somnia.GuestLog.Models.Entities.StayEntry", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateIn")
|
||||||
|
.HasColumnType("timestamp(0) with time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateOut")
|
||||||
|
.HasColumnType("timestamp(0) with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("PaymentMethod")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(5)
|
||||||
|
.HasColumnType("character varying(5)");
|
||||||
|
|
||||||
|
b.Property<int>("RoomCount")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("RoomNumber")
|
||||||
|
.HasMaxLength(32)
|
||||||
|
.HasColumnType("character varying(32)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("StayEntry", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Somnia.GuestLog.Models.Entities.StayExportFile", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ExportDetails")
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.Property<int>("ExportFormat")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("ExportResult")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateTime>("ExportTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("ExportedPath")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("character varying(256)");
|
||||||
|
|
||||||
|
b.ComplexProperty(typeof(Dictionary<string, object>), "ExportParams", "Somnia.GuestLog.Models.Entities.StayExportFile.ExportParams#StayExportParams", b1 =>
|
||||||
|
{
|
||||||
|
b1.IsRequired();
|
||||||
|
|
||||||
|
b1.Property<DateTime?>("ExportPeriodEnd");
|
||||||
|
|
||||||
|
b1.Property<DateTime?>("ExportPeriodStart");
|
||||||
|
|
||||||
|
b1.Property<int>("ExportType");
|
||||||
|
|
||||||
|
b1
|
||||||
|
.ToJson("ExportParams")
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
});
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("StayExportFile", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("GuestDocumentStayEntry", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Somnia.GuestLog.Models.Entities.StayEntry", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("StayEntryId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Somnia.GuestLog.Models.Entities.GuestDocument", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("GuestDocumentsId", "GuestDocumentsVersion")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+42
@@ -0,0 +1,42 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class GuestDocument_IssueDate_MakeNullable : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<DateOnly>(
|
||||||
|
name: "IssueDate",
|
||||||
|
table: "GuestDocument",
|
||||||
|
type: "date",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(DateOnly),
|
||||||
|
oldType: "date");
|
||||||
|
|
||||||
|
//Make null any IssueDate column with "default" value:
|
||||||
|
migrationBuilder.Sql("""UPDATE "GuestDocument" SET "IssueDate" = NULL WHERE "IssueDate" = '1970-01-01';""");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
//Set value to all IssueDate null columns.
|
||||||
|
migrationBuilder.Sql("""UPDATE "GuestDocument" SET "IssueDate" = '1970-01-01' WHERE "IssueDate" IS NULL;""");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<DateOnly>(
|
||||||
|
name: "IssueDate",
|
||||||
|
table: "GuestDocument",
|
||||||
|
type: "date",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(DateOnly),
|
||||||
|
oldType: "date",
|
||||||
|
oldNullable: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+264
@@ -0,0 +1,264 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
using Somnia.GuestLog.Infrastructure;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(GuestLogContext))]
|
||||||
|
[Migration("20261006112835_StayEntry_StayExport_AddUploadStatusFields")]
|
||||||
|
partial class StayEntry_StayExport_AddUploadStatusFields
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "10.0.12")
|
||||||
|
.HasAnnotation("Proxies:ChangeTracking", false)
|
||||||
|
.HasAnnotation("Proxies:CheckEquality", false)
|
||||||
|
.HasAnnotation("Proxies:LazyLoading", true)
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("GuestDocumentStayEntry", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("StayEntryId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<long>("GuestDocumentsId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<int>("GuestDocumentsVersion")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("StayEntryId", "GuestDocumentsId", "GuestDocumentsVersion");
|
||||||
|
|
||||||
|
b.HasIndex("GuestDocumentsId", "GuestDocumentsVersion");
|
||||||
|
|
||||||
|
b.ToTable("GuestDocumentStayEntry");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Somnia.GuestLog.Models.Entities.GuestDocument", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("Version")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateOnly>("BirthDate")
|
||||||
|
.HasColumnType("date");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("timestamp(3) with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("DocumentNum")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("DocumentType")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(8)
|
||||||
|
.HasColumnType("character varying(8)");
|
||||||
|
|
||||||
|
b.Property<string>("EmailAddress")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("character varying(256)");
|
||||||
|
|
||||||
|
b.Property<string>("Gender")
|
||||||
|
.HasMaxLength(1)
|
||||||
|
.HasColumnType("character varying(1)");
|
||||||
|
|
||||||
|
b.Property<bool>("IsLastVersion")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<DateOnly?>("IssueDate")
|
||||||
|
.HasColumnType("date");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("Nationality")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(3)
|
||||||
|
.HasColumnType("character varying(3)");
|
||||||
|
|
||||||
|
b.Property<string>("PhoneNumber")
|
||||||
|
.HasMaxLength(32)
|
||||||
|
.HasColumnType("character varying(32)");
|
||||||
|
|
||||||
|
b.Property<string>("SupportNum")
|
||||||
|
.HasMaxLength(10)
|
||||||
|
.HasColumnType("character varying(10)");
|
||||||
|
|
||||||
|
b.Property<string>("Surname")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("Surname2")
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("timestamp(3) with time zone");
|
||||||
|
|
||||||
|
b.ComplexProperty(typeof(Dictionary<string, object>), "AddressDetails", "Somnia.GuestLog.Models.Entities.GuestDocument.AddressDetails#GuestAddress", b1 =>
|
||||||
|
{
|
||||||
|
b1.Property<string>("Address")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressCity")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressCountry")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(3)
|
||||||
|
.HasColumnType("character varying(3)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressProvince")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressState")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("ZipCode")
|
||||||
|
.HasMaxLength(12)
|
||||||
|
.HasColumnType("character varying(12)");
|
||||||
|
});
|
||||||
|
|
||||||
|
b.HasKey("Id", "Version");
|
||||||
|
|
||||||
|
b.ToTable("GuestDocument", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Somnia.GuestLog.Models.Entities.StayEntry", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateIn")
|
||||||
|
.HasColumnType("timestamp(0) with time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateOut")
|
||||||
|
.HasColumnType("timestamp(0) with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("PaymentMethod")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(5)
|
||||||
|
.HasColumnType("character varying(5)");
|
||||||
|
|
||||||
|
b.Property<int>("RoomCount")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("RoomNumber")
|
||||||
|
.HasMaxLength(32)
|
||||||
|
.HasColumnType("character varying(32)");
|
||||||
|
|
||||||
|
b.Property<int>("StayUploadStatus")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("StayUploadStatusTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("StayEntry", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Somnia.GuestLog.Models.Entities.StayExportFile", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ExportDetails")
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.Property<int>("ExportFormat")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("ExportResult")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateTime>("ExportTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("ExportedPath")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("character varying(256)");
|
||||||
|
|
||||||
|
b.Property<int>("FileUploadStatus")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("FileUploadStatusTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.ComplexProperty(typeof(Dictionary<string, object>), "ExportParams", "Somnia.GuestLog.Models.Entities.StayExportFile.ExportParams#StayExportParams", b1 =>
|
||||||
|
{
|
||||||
|
b1.IsRequired();
|
||||||
|
|
||||||
|
b1.Property<DateTime?>("ExportPeriodEnd");
|
||||||
|
|
||||||
|
b1.Property<DateTime?>("ExportPeriodStart");
|
||||||
|
|
||||||
|
b1.Property<int>("ExportType");
|
||||||
|
|
||||||
|
b1
|
||||||
|
.ToJson("ExportParams")
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
});
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("StayExportFile", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("GuestDocumentStayEntry", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Somnia.GuestLog.Models.Entities.StayEntry", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("StayEntryId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Somnia.GuestLog.Models.Entities.GuestDocument", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("GuestDocumentsId", "GuestDocumentsVersion")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+86
@@ -0,0 +1,86 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class StayEntry_StayExport_AddUploadStatusFields : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
// TABLE - StayExportFile
|
||||||
|
|
||||||
|
//Create column as nullable
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "FileUploadStatus",
|
||||||
|
table: "StayExportFile",
|
||||||
|
type: "integer",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
//Update all to Pending.
|
||||||
|
migrationBuilder.Sql("""UPDATE "StayExportFile" SET "FileUploadStatus" = 0;""");
|
||||||
|
|
||||||
|
//Alter column to not nullable
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "FileUploadStatus",
|
||||||
|
table: "StayExportFile",
|
||||||
|
nullable: false,
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<DateTime>(
|
||||||
|
name: "FileUploadStatusTime",
|
||||||
|
table: "StayExportFile",
|
||||||
|
type: "timestamp with time zone",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
|
||||||
|
// TABLE - StayEntry
|
||||||
|
|
||||||
|
//Create column as nullable
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "StayUploadStatus",
|
||||||
|
table: "StayEntry",
|
||||||
|
type: "integer",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
//Update all to Pending.
|
||||||
|
migrationBuilder.Sql("""UPDATE "StayEntry" SET "StayUploadStatus" = 0;""");
|
||||||
|
|
||||||
|
//Alter column to not nullable
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "StayUploadStatus",
|
||||||
|
table: "StayEntry",
|
||||||
|
nullable: false,
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<DateTime>(
|
||||||
|
name: "StayUploadStatusTime",
|
||||||
|
table: "StayEntry",
|
||||||
|
type: "timestamp with time zone",
|
||||||
|
nullable: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "FileUploadStatus",
|
||||||
|
table: "StayExportFile");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "FileUploadStatusTime",
|
||||||
|
table: "StayExportFile");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "StayUploadStatus",
|
||||||
|
table: "StayEntry");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "StayUploadStatusTime",
|
||||||
|
table: "StayEntry");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+283
@@ -0,0 +1,283 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
using Somnia.GuestLog.Infrastructure;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(GuestLogContext))]
|
||||||
|
[Migration("20261009104234_StayExportFile_ExportDetails_UpdatedFormat")]
|
||||||
|
partial class StayExportFile_ExportDetails_UpdatedFormat
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "10.0.12")
|
||||||
|
.HasAnnotation("Proxies:ChangeTracking", false)
|
||||||
|
.HasAnnotation("Proxies:CheckEquality", false)
|
||||||
|
.HasAnnotation("Proxies:LazyLoading", true)
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("GuestDocumentStayEntry", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("StayEntryId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<long>("GuestDocumentsId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<int>("GuestDocumentsVersion")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("StayEntryId", "GuestDocumentsId", "GuestDocumentsVersion");
|
||||||
|
|
||||||
|
b.HasIndex("GuestDocumentsId", "GuestDocumentsVersion");
|
||||||
|
|
||||||
|
b.ToTable("GuestDocumentStayEntry");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Somnia.GuestLog.Models.Entities.GuestDocument", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("Version")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateOnly>("BirthDate")
|
||||||
|
.HasColumnType("date");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("timestamp(3) with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("DocumentNum")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("DocumentType")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(8)
|
||||||
|
.HasColumnType("character varying(8)");
|
||||||
|
|
||||||
|
b.Property<string>("EmailAddress")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("character varying(256)");
|
||||||
|
|
||||||
|
b.Property<string>("Gender")
|
||||||
|
.HasMaxLength(1)
|
||||||
|
.HasColumnType("character varying(1)");
|
||||||
|
|
||||||
|
b.Property<bool>("IsLastVersion")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<DateOnly?>("IssueDate")
|
||||||
|
.HasColumnType("date");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("Nationality")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(3)
|
||||||
|
.HasColumnType("character varying(3)");
|
||||||
|
|
||||||
|
b.Property<string>("PhoneNumber")
|
||||||
|
.HasMaxLength(32)
|
||||||
|
.HasColumnType("character varying(32)");
|
||||||
|
|
||||||
|
b.Property<string>("SupportNum")
|
||||||
|
.HasMaxLength(10)
|
||||||
|
.HasColumnType("character varying(10)");
|
||||||
|
|
||||||
|
b.Property<string>("Surname")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("Surname2")
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("timestamp(3) with time zone");
|
||||||
|
|
||||||
|
b.ComplexProperty(typeof(Dictionary<string, object>), "AddressDetails", "Somnia.GuestLog.Models.Entities.GuestDocument.AddressDetails#GuestAddress", b1 =>
|
||||||
|
{
|
||||||
|
b1.Property<string>("Address")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressCity")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressCountry")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(3)
|
||||||
|
.HasColumnType("character varying(3)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressProvince")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("AddressState")
|
||||||
|
.HasMaxLength(128)
|
||||||
|
.HasColumnType("character varying(128)");
|
||||||
|
|
||||||
|
b1.Property<string>("ZipCode")
|
||||||
|
.HasMaxLength(12)
|
||||||
|
.HasColumnType("character varying(12)");
|
||||||
|
});
|
||||||
|
|
||||||
|
b.HasKey("Id", "Version");
|
||||||
|
|
||||||
|
b.ToTable("GuestDocument", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Somnia.GuestLog.Models.Entities.StayEntry", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateIn")
|
||||||
|
.HasColumnType("timestamp(0) with time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateOut")
|
||||||
|
.HasColumnType("timestamp(0) with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("PaymentMethod")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(5)
|
||||||
|
.HasColumnType("character varying(5)");
|
||||||
|
|
||||||
|
b.Property<int>("RoomCount")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("RoomNumber")
|
||||||
|
.HasMaxLength(32)
|
||||||
|
.HasColumnType("character varying(32)");
|
||||||
|
|
||||||
|
b.Property<int>("StayUploadStatus")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("StayUploadStatusTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("StayEntry", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Somnia.GuestLog.Models.Entities.StayExportFile", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ExportFormat")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("ExportResult")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateTime>("ExportTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("ExportedPath")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("character varying(256)");
|
||||||
|
|
||||||
|
b.Property<int>("FileUploadStatus")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("FileUploadStatusTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.ComplexProperty(typeof(Dictionary<string, object>), "ExportDetails", "Somnia.GuestLog.Models.Entities.StayExportFile.ExportDetails#StayExportDetails", b1 =>
|
||||||
|
{
|
||||||
|
b1.Property<int?>("ExportedStayCount");
|
||||||
|
|
||||||
|
b1.Property<int?>("StayErrorCount");
|
||||||
|
|
||||||
|
b1.ComplexCollection(typeof(List<Dictionary<string, object>>), "StayEntries", "Somnia.GuestLog.Models.Entities.StayExportFile.ExportDetails#StayExportDetails.StayEntries#StayExportDetailsStayEntry", b2 =>
|
||||||
|
{
|
||||||
|
b2.IsRequired();
|
||||||
|
|
||||||
|
b2.Property<string>("Details");
|
||||||
|
|
||||||
|
b2.Property<int>("ExportResult");
|
||||||
|
|
||||||
|
b2.Property<long>("StayEntryId");
|
||||||
|
});
|
||||||
|
|
||||||
|
b1
|
||||||
|
.ToJson("ExportDetails")
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
});
|
||||||
|
|
||||||
|
b.ComplexProperty(typeof(Dictionary<string, object>), "ExportParams", "Somnia.GuestLog.Models.Entities.StayExportFile.ExportParams#StayExportParams", b1 =>
|
||||||
|
{
|
||||||
|
b1.IsRequired();
|
||||||
|
|
||||||
|
b1.Property<DateTime?>("ExportPeriodEnd");
|
||||||
|
|
||||||
|
b1.Property<DateTime?>("ExportPeriodStart");
|
||||||
|
|
||||||
|
b1.Property<int>("ExportType");
|
||||||
|
|
||||||
|
b1
|
||||||
|
.ToJson("ExportParams")
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
});
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("StayExportFile", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("GuestDocumentStayEntry", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Somnia.GuestLog.Models.Entities.StayEntry", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("StayEntryId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Somnia.GuestLog.Models.Entities.GuestDocument", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("GuestDocumentsId", "GuestDocumentsVersion")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class StayExportFile_ExportDetails_UpdatedFormat : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
//Update all StayExportFiles ExportDetails to NULL to prevent format errors when parsing the new types.
|
||||||
|
migrationBuilder.Sql("""UPDATE "StayExportFile" SET "ExportDetails" = NULL;""");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
//Nothing to do. Data can't be recovered!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,26 +18,58 @@ namespace Somnia.GuestLog.Infrastructure.Migrations
|
|||||||
{
|
{
|
||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("ProductVersion", "10.0.7")
|
.HasAnnotation("ProductVersion", "10.0.12")
|
||||||
|
.HasAnnotation("Proxies:ChangeTracking", false)
|
||||||
|
.HasAnnotation("Proxies:CheckEquality", false)
|
||||||
|
.HasAnnotation("Proxies:LazyLoading", true)
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("GuestDocumentStayEntry", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("StayEntryId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<long>("GuestDocumentsId")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<int>("GuestDocumentsVersion")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("StayEntryId", "GuestDocumentsId", "GuestDocumentsVersion");
|
||||||
|
|
||||||
|
b.HasIndex("GuestDocumentsId", "GuestDocumentsVersion");
|
||||||
|
|
||||||
|
b.ToTable("GuestDocumentStayEntry");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Somnia.GuestLog.Models.Entities.GuestDocument", b =>
|
modelBuilder.Entity("Somnia.GuestLog.Models.Entities.GuestDocument", b =>
|
||||||
{
|
{
|
||||||
b.Property<string>("DocumentType")
|
b.Property<long>("Id")
|
||||||
.HasMaxLength(8)
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("character varying(8)");
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
b.Property<string>("DocumentNum")
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||||
.HasMaxLength(64)
|
|
||||||
.HasColumnType("character varying(64)");
|
b.Property<int>("Version")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<DateOnly>("BirthDate")
|
b.Property<DateOnly>("BirthDate")
|
||||||
.HasColumnType("date");
|
.HasColumnType("date");
|
||||||
|
|
||||||
b.Property<DateTime>("CreateTime")
|
b.Property<DateTime>("CreateTime")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("timestamp(3) with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("DocumentNum")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
|
b.Property<string>("DocumentType")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(8)
|
||||||
|
.HasColumnType("character varying(8)");
|
||||||
|
|
||||||
b.Property<string>("EmailAddress")
|
b.Property<string>("EmailAddress")
|
||||||
.HasMaxLength(256)
|
.HasMaxLength(256)
|
||||||
@@ -47,7 +79,10 @@ namespace Somnia.GuestLog.Infrastructure.Migrations
|
|||||||
.HasMaxLength(1)
|
.HasMaxLength(1)
|
||||||
.HasColumnType("character varying(1)");
|
.HasColumnType("character varying(1)");
|
||||||
|
|
||||||
b.Property<DateOnly>("IssueDate")
|
b.Property<bool>("IsLastVersion")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<DateOnly?>("IssueDate")
|
||||||
.HasColumnType("date");
|
.HasColumnType("date");
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
@@ -78,7 +113,7 @@ namespace Somnia.GuestLog.Infrastructure.Migrations
|
|||||||
.HasColumnType("character varying(64)");
|
.HasColumnType("character varying(64)");
|
||||||
|
|
||||||
b.Property<DateTime>("UpdateTime")
|
b.Property<DateTime>("UpdateTime")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("timestamp(3) with time zone");
|
||||||
|
|
||||||
b.ComplexProperty(typeof(Dictionary<string, object>), "AddressDetails", "Somnia.GuestLog.Models.Entities.GuestDocument.AddressDetails#GuestAddress", b1 =>
|
b.ComplexProperty(typeof(Dictionary<string, object>), "AddressDetails", "Somnia.GuestLog.Models.Entities.GuestDocument.AddressDetails#GuestAddress", b1 =>
|
||||||
{
|
{
|
||||||
@@ -108,10 +143,137 @@ namespace Somnia.GuestLog.Infrastructure.Migrations
|
|||||||
.HasColumnType("character varying(12)");
|
.HasColumnType("character varying(12)");
|
||||||
});
|
});
|
||||||
|
|
||||||
b.HasKey("DocumentType", "DocumentNum");
|
b.HasKey("Id", "Version");
|
||||||
|
|
||||||
b.ToTable("GuestDocument", (string)null);
|
b.ToTable("GuestDocument", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Somnia.GuestLog.Models.Entities.StayEntry", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateIn")
|
||||||
|
.HasColumnType("timestamp(0) with time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateOut")
|
||||||
|
.HasColumnType("timestamp(0) with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("PaymentMethod")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(5)
|
||||||
|
.HasColumnType("character varying(5)");
|
||||||
|
|
||||||
|
b.Property<int>("RoomCount")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("RoomNumber")
|
||||||
|
.HasMaxLength(32)
|
||||||
|
.HasColumnType("character varying(32)");
|
||||||
|
|
||||||
|
b.Property<int>("StayUploadStatus")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("StayUploadStatusTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdateTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("StayEntry", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Somnia.GuestLog.Models.Entities.StayExportFile", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ExportFormat")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("ExportResult")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateTime>("ExportTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.Property<string>("ExportedPath")
|
||||||
|
.HasMaxLength(256)
|
||||||
|
.HasColumnType("character varying(256)");
|
||||||
|
|
||||||
|
b.Property<int>("FileUploadStatus")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("FileUploadStatusTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.ComplexProperty(typeof(Dictionary<string, object>), "ExportDetails", "Somnia.GuestLog.Models.Entities.StayExportFile.ExportDetails#StayExportDetails", b1 =>
|
||||||
|
{
|
||||||
|
b1.Property<int?>("ExportedStayCount");
|
||||||
|
|
||||||
|
b1.Property<int?>("StayErrorCount");
|
||||||
|
|
||||||
|
b1.ComplexCollection(typeof(List<Dictionary<string, object>>), "StayEntries", "Somnia.GuestLog.Models.Entities.StayExportFile.ExportDetails#StayExportDetails.StayEntries#StayExportDetailsStayEntry", b2 =>
|
||||||
|
{
|
||||||
|
b2.IsRequired();
|
||||||
|
|
||||||
|
b2.Property<string>("Details");
|
||||||
|
|
||||||
|
b2.Property<int>("ExportResult");
|
||||||
|
|
||||||
|
b2.Property<long>("StayEntryId");
|
||||||
|
});
|
||||||
|
|
||||||
|
b1
|
||||||
|
.ToJson("ExportDetails")
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
});
|
||||||
|
|
||||||
|
b.ComplexProperty(typeof(Dictionary<string, object>), "ExportParams", "Somnia.GuestLog.Models.Entities.StayExportFile.ExportParams#StayExportParams", b1 =>
|
||||||
|
{
|
||||||
|
b1.IsRequired();
|
||||||
|
|
||||||
|
b1.Property<DateTime?>("ExportPeriodEnd");
|
||||||
|
|
||||||
|
b1.Property<DateTime?>("ExportPeriodStart");
|
||||||
|
|
||||||
|
b1.Property<int>("ExportType");
|
||||||
|
|
||||||
|
b1
|
||||||
|
.ToJson("ExportParams")
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
});
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("StayExportFile", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("GuestDocumentStayEntry", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Somnia.GuestLog.Models.Entities.StayEntry", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("StayEntryId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("Somnia.GuestLog.Models.Entities.GuestDocument", null)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("GuestDocumentsId", "GuestDocumentsVersion")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using Somnia.GuestLog.Enums.Services;
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Models.Configuration;
|
||||||
|
|
||||||
|
public class AddressQueryConfig
|
||||||
|
{
|
||||||
|
public const string SectionName = "AddressQuery";
|
||||||
|
|
||||||
|
public bool EnableAddressQuery { get; set; }
|
||||||
|
public AddressQueryProvider? Provider { get; set; }
|
||||||
|
public string? ServiceURL { get; set; }
|
||||||
|
public string? ApiKey { get; set; }
|
||||||
|
public string? UserAgent { get; set; }
|
||||||
|
public string? ResultLang { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace Somnia.GuestLog.Models.Configuration;
|
||||||
|
|
||||||
|
public class StayExportConfig
|
||||||
|
{
|
||||||
|
public const string SectionName = "StayExport";
|
||||||
|
|
||||||
|
public bool EnableStayExport { get; set; } = false;
|
||||||
|
public string? ExportStorageConnectionString { get; set; }
|
||||||
|
public bool UseSubdirectoryByFormat { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
namespace Somnia.GuestLog.Models.Configuration;
|
||||||
|
|
||||||
|
public class StayExportSpainParteViajerosConfig
|
||||||
|
{
|
||||||
|
public const string SectionName = "StayExportSpainParteViajeros";
|
||||||
|
|
||||||
|
public bool InternetAvailable { get; set; } = false;
|
||||||
|
public string? CodigoEstablecimiento { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
namespace Somnia.GuestLog.Models.DTOs;
|
||||||
|
|
||||||
|
public class AddressResultDTO
|
||||||
|
{
|
||||||
|
public string? HouseNumber { get; set; }
|
||||||
|
public string? AddressRoad { get; set; }
|
||||||
|
public string? AddressCity { get; set; }
|
||||||
|
public string? AddressProvince { get; set; }
|
||||||
|
public string? AddressState { get; set; }
|
||||||
|
public string? AddressCountry { get; set; }
|
||||||
|
public string? ZipCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// CountryCode in ISO3166-1:alpha3
|
||||||
|
/// </summary>
|
||||||
|
public string? AddressCountryCode { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
namespace Somnia.GuestLog.Models.DTOs;
|
||||||
|
|
||||||
|
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 OnlyLastVersion { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public bool IsEmpty => string.IsNullOrEmpty(DocumentType)
|
||||||
|
&& string.IsNullOrEmpty(DocumentNumber)
|
||||||
|
&& string.IsNullOrEmpty(Name)
|
||||||
|
&& string.IsNullOrEmpty(Surname)
|
||||||
|
&& string.IsNullOrEmpty(PhoneNumber);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
namespace Somnia.GuestLog.Models.DTOs;
|
||||||
|
|
||||||
|
public class GuestDocIdDTO
|
||||||
|
{
|
||||||
|
public required string DocumentType { get; set; }
|
||||||
|
public required string DocumentNum { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public static string EncodeAsString(GuestDocIdDTO docId)
|
||||||
|
{
|
||||||
|
return $"{docId.DocumentType}-{docId.DocumentNum}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GuestDocIdDTO? DecodeFromString(string str)
|
||||||
|
{
|
||||||
|
var parts = str.Split("-");
|
||||||
|
if (parts.Length < 2)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new()
|
||||||
|
{
|
||||||
|
DocumentType = parts[0],
|
||||||
|
DocumentNum = parts[1]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GuestDocIdDTO? BuildFromDto(GuestDocumentDTO? dto)
|
||||||
|
{
|
||||||
|
if (dto is null || dto.DocumentType is null || dto.DocumentNum is null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new()
|
||||||
|
{
|
||||||
|
DocumentType = dto.DocumentType,
|
||||||
|
DocumentNum = dto.DocumentNum
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,9 @@ namespace Somnia.GuestLog.Models.DTOs;
|
|||||||
|
|
||||||
public class GuestDocumentDTO
|
public class GuestDocumentDTO
|
||||||
{
|
{
|
||||||
|
public long? Id { get; set; }
|
||||||
|
public int? Version { get; set; }
|
||||||
|
|
||||||
public string? DocumentType { get; set; }
|
public string? DocumentType { get; set; }
|
||||||
public string? DocumentNum { get; set; }
|
public string? DocumentNum { get; set; }
|
||||||
|
|
||||||
@@ -31,4 +34,8 @@ public class GuestDocumentDTO
|
|||||||
|
|
||||||
public DateTime? CreateTime { get; set; }
|
public DateTime? CreateTime { get; set; }
|
||||||
public DateTime? UpdateTime { get; set; }
|
public DateTime? UpdateTime { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public string FullKey => $"{Id}-{Version}";
|
||||||
|
public string FullDocument => $"{DocumentType ?? "???"}-{DocumentNum ?? "???"}";
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
using Somnia.GuestLog.Enums.Services;
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Models.DTOs;
|
||||||
|
|
||||||
|
public interface IResult
|
||||||
|
{
|
||||||
|
bool IsSuccess { get; }
|
||||||
|
ResultCode ResultCode { get; }
|
||||||
|
object[]? Context { get; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed record Result(
|
||||||
|
bool IsSuccess,
|
||||||
|
ResultCode ResultCode,
|
||||||
|
params object[]? Context
|
||||||
|
) : IResult
|
||||||
|
{
|
||||||
|
public static Result Ok() => new(IsSuccess: true, ResultCode: ResultCode.Ok, Context: null);
|
||||||
|
public static Result OkWithContext(params object[] context)
|
||||||
|
=> new(IsSuccess: true, ResultCode: ResultCode.Ok, Context: context);
|
||||||
|
|
||||||
|
public static Result Fail(ResultCode resultCode) => new(IsSuccess: false, resultCode, Context: null);
|
||||||
|
public static Result FailWithContext(ResultCode resultCode, params object[] context)
|
||||||
|
=> new(IsSuccess: false, resultCode, context);
|
||||||
|
public static Result FailUnknownError()
|
||||||
|
=> new(IsSuccess: false, ResultCode: ResultCode.UnknownError, Context: null);
|
||||||
|
|
||||||
|
public bool IsUnknownError => !IsSuccess && ResultCode == ResultCode.UnknownError;
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed record Result<T>(
|
||||||
|
bool IsSuccess,
|
||||||
|
T? Value,
|
||||||
|
ResultCode ResultCode,
|
||||||
|
params object[]? Context
|
||||||
|
) : IResult
|
||||||
|
{
|
||||||
|
public static Result<T> Ok(T value) => new(IsSuccess: true, value, ResultCode: ResultCode.Ok, Context: null);
|
||||||
|
public static Result<T> Fail(ResultCode resultCode) => new(IsSuccess: false, Value: default, resultCode, Context: null);
|
||||||
|
public static Result<T> FailWithContext(ResultCode resultCode, params object[] context)
|
||||||
|
=> new(IsSuccess: false, Value: default, resultCode, context);
|
||||||
|
|
||||||
|
public bool IsUnknownError => !IsSuccess && ResultCode == ResultCode.UnknownError;
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
using Somnia.GuestLog.Enums.Models;
|
||||||
|
|
||||||
|
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 UploadStatus StayUploadStatus { get; set; }
|
||||||
|
public DateTime? StayUploadStatusTime { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public List<GuestDocumentDTO>? GuestDocuments { get; set; } = null;
|
||||||
|
|
||||||
|
|
||||||
|
public DateTime? CreateTime { get; set; }
|
||||||
|
public DateTime? UpdateTime { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Somnia.GuestLog.Enums.Models;
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Models.DTOs;
|
||||||
|
|
||||||
|
public class StayEntryFilterDTO
|
||||||
|
{
|
||||||
|
public DateTime? DateInStart { get; set; }
|
||||||
|
public DateTime? DateInEnd { get; set; }
|
||||||
|
|
||||||
|
public string? RoomNumber { get; set; }
|
||||||
|
public string? PaymentMethod { get; set; }
|
||||||
|
|
||||||
|
public UploadStatus? StayUploadStatus { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
using Somnia.GuestLog.Enums.Models;
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Models.DTOs;
|
||||||
|
|
||||||
|
public class StayExportFileDTO
|
||||||
|
{
|
||||||
|
public long? Id { get; set; }
|
||||||
|
|
||||||
|
public StayExportFormat? ExportFormat { get; set; }
|
||||||
|
|
||||||
|
public StayExportParamsDTO? ExportParams { get; set; }
|
||||||
|
|
||||||
|
public StayExportFileResult? ExportResult { get; set; }
|
||||||
|
|
||||||
|
public string? ExportedPath { get; set; }
|
||||||
|
|
||||||
|
public StayExportDetailsDTO? ExportDetails { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public DateTime? ExportTime { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public UploadStatus FileUploadStatus { get; set; }
|
||||||
|
public DateTime? FileUploadStatusTime { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class StayExportParamsDTO
|
||||||
|
{
|
||||||
|
public StayExportParamType? ExportType { get; set; }
|
||||||
|
|
||||||
|
public DateTime? ExportPeriodStart { get; set; }
|
||||||
|
public DateTime? ExportPeriodEnd { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class StayExportDetailsDTO
|
||||||
|
{
|
||||||
|
public int? ExportedStayCount { get; set; }
|
||||||
|
public int? StayErrorCount { get; set; }
|
||||||
|
|
||||||
|
public List<StayExportDetailsStayEntryDTO> StayEntries { get; set; } = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public class StayExportDetailsStayEntryDTO
|
||||||
|
{
|
||||||
|
public required long StayEntryId { get; set; }
|
||||||
|
public required StayExportDetailsStayEntryResult ExportResult { get; set; }
|
||||||
|
public string? Details { get; set; }
|
||||||
|
}
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
using Somnia.GuestLog.Infrastructure;
|
||||||
|
|
||||||
namespace Somnia.GuestLog.Models.Entities;
|
namespace Somnia.GuestLog.Models.Entities;
|
||||||
|
|
||||||
public class GuestAddress : BaseEntity
|
public class GuestAddress : BaseEntity
|
||||||
@@ -9,5 +11,5 @@ public class GuestAddress : BaseEntity
|
|||||||
public required string AddressCountry { get; set; }
|
public required string AddressCountry { get; set; }
|
||||||
public string? ZipCode { get; set; }
|
public string? ZipCode { get; set; }
|
||||||
|
|
||||||
public override string GetFullKey() => "N/A";
|
public override string GetFullKey() => DbConsts.PK_NotApply;
|
||||||
}
|
}
|
||||||
@@ -2,10 +2,13 @@ namespace Somnia.GuestLog.Models.Entities;
|
|||||||
|
|
||||||
public class GuestDocument : BaseEntity
|
public class GuestDocument : BaseEntity
|
||||||
{
|
{
|
||||||
|
public long Id { get; set; }
|
||||||
|
public int Version { get; set; }
|
||||||
|
|
||||||
public required string DocumentType { get; set; }
|
public required string DocumentType { get; set; }
|
||||||
public required string DocumentNum { get; set; }
|
public required string DocumentNum { get; set; }
|
||||||
|
|
||||||
public required DateOnly IssueDate { get; set; }
|
public required DateOnly? IssueDate { get; set; }
|
||||||
public string? SupportNum { get; set; }
|
public string? SupportNum { get; set; }
|
||||||
|
|
||||||
public required string Nationality { get; set; }
|
public required string Nationality { get; set; }
|
||||||
@@ -26,6 +29,9 @@ public class GuestDocument : BaseEntity
|
|||||||
public required DateTime CreateTime { get; set; }
|
public required DateTime CreateTime { get; set; }
|
||||||
public required DateTime UpdateTime { get; set; }
|
public required DateTime UpdateTime { get; set; }
|
||||||
|
|
||||||
|
public required bool IsLastVersion { get; set; }
|
||||||
|
|
||||||
public override string GetFullKey() => $"{DocumentType}-{DocumentNum}";
|
|
||||||
|
public override string GetFullKey() => $"{Id}-{Version}";
|
||||||
|
public string FullDocument => $"{DocumentType}-{DocumentNum}";
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using Somnia.GuestLog.Enums.Models;
|
||||||
|
|
||||||
|
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; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// StayEntry upload status to upstream system.
|
||||||
|
/// </summary>
|
||||||
|
public required UploadStatus StayUploadStatus { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Date/Time of last StayUploadStatus update
|
||||||
|
/// Will be null when status hadn't been updated
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? StayUploadStatusTime { 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,27 @@
|
|||||||
|
using Somnia.GuestLog.Enums.Models;
|
||||||
|
using Somnia.GuestLog.Infrastructure;
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Models.Entities;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This class store details and extra information about the exported data of a StayExportFile.
|
||||||
|
/// </summary>
|
||||||
|
public class StayExportDetails : BaseEntity
|
||||||
|
{
|
||||||
|
public int? ExportedStayCount { get; set; }
|
||||||
|
public int? StayErrorCount { get; set; }
|
||||||
|
|
||||||
|
public List<StayExportDetailsStayEntry> StayEntries { get; set; } = [];
|
||||||
|
|
||||||
|
public override string GetFullKey() => DbConsts.PK_NotApply;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Export details for each exported stayEntry in a StayExportFile.
|
||||||
|
/// </summary>
|
||||||
|
public class StayExportDetailsStayEntry
|
||||||
|
{
|
||||||
|
public required long StayEntryId { get; set; }
|
||||||
|
public required StayExportDetailsStayEntryResult ExportResult { get; set; }
|
||||||
|
public string? Details { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
using Somnia.GuestLog.Enums.Models;
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Models.Entities;
|
||||||
|
|
||||||
|
public class StayExportFile : BaseEntity
|
||||||
|
{
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
public required StayExportFormat ExportFormat { get; set; }
|
||||||
|
public required StayExportParams ExportParams { get; set; }
|
||||||
|
|
||||||
|
public required StayExportFileResult ExportResult { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Path to exported data.
|
||||||
|
/// Should be relative to configured Storage.
|
||||||
|
/// </summary>
|
||||||
|
public string? ExportedPath { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A JSON column to store details about the exported file.
|
||||||
|
/// This details can contain information about errors, which stays where included, etc.
|
||||||
|
/// </summary>
|
||||||
|
public StayExportDetails? ExportDetails { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Date/Time when export file was generated.
|
||||||
|
/// </summary>
|
||||||
|
public required DateTime ExportTime { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ExportFile upload status to upstream system.
|
||||||
|
/// </summary>
|
||||||
|
public required UploadStatus FileUploadStatus { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Date/Time of last FileUploadStatus update
|
||||||
|
/// Will be null when status hadn't been updated
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? FileUploadStatusTime { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public override string GetFullKey() => $"{Id}";
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using Somnia.GuestLog.Enums.Models;
|
||||||
|
using Somnia.GuestLog.Infrastructure;
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Models.Entities;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This class store params used on StayExport.
|
||||||
|
/// Different params apply for different export types.
|
||||||
|
/// </summary>
|
||||||
|
public class StayExportParams : BaseEntity
|
||||||
|
{
|
||||||
|
public required StayExportParamType ExportType { get; set; }
|
||||||
|
|
||||||
|
public DateTime? ExportPeriodStart { get; set; }
|
||||||
|
public DateTime? ExportPeriodEnd { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public override string GetFullKey() => DbConsts.PK_NotApply;
|
||||||
|
}
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
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()
|
||||||
|
{
|
||||||
|
Id = entity.Id,
|
||||||
|
Version = entity.Version,
|
||||||
|
DocumentType = entity.DocumentType,
|
||||||
|
DocumentNum = entity.DocumentNum,
|
||||||
|
IssueDate = entity.IssueDate?.ToDateTime(TimeOnly.MinValue) ?? null,
|
||||||
|
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.ToLocalTime(),
|
||||||
|
UpdateTime = entity.UpdateTime.ToLocalTime(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static StayEntryDTO MapStayEntryEntityToDTO(StayEntry entity, bool includeGuests)
|
||||||
|
{
|
||||||
|
return new()
|
||||||
|
{
|
||||||
|
Id = entity.Id,
|
||||||
|
DateIn = entity.DateIn.ToLocalTime(),
|
||||||
|
DateOut = entity.DateOut.ToLocalTime(),
|
||||||
|
RoomCount = entity.RoomCount,
|
||||||
|
RoomNumber = entity.RoomNumber,
|
||||||
|
PaymentMethod = entity.PaymentMethod,
|
||||||
|
StayUploadStatus = entity.StayUploadStatus,
|
||||||
|
StayUploadStatusTime = entity.StayUploadStatusTime?.ToLocalTime(),
|
||||||
|
CreateTime = entity.CreateTime.ToLocalTime(),
|
||||||
|
UpdateTime = entity.UpdateTime.ToLocalTime(),
|
||||||
|
GuestDocuments = includeGuests ? [.. entity.GuestDocuments.Select(e => MapGuestDocumentEntityToDTO(e))] : null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static StayExportFileDTO MapStayExportFileEntityToDTO(StayExportFile entity)
|
||||||
|
{
|
||||||
|
StayExportParamsDTO exportParamsDto = new()
|
||||||
|
{
|
||||||
|
ExportType = entity.ExportParams.ExportType,
|
||||||
|
ExportPeriodStart = entity.ExportParams.ExportPeriodStart,
|
||||||
|
ExportPeriodEnd = entity.ExportParams.ExportPeriodEnd,
|
||||||
|
};
|
||||||
|
|
||||||
|
StayExportDetailsDTO? detailsDTO = null;
|
||||||
|
|
||||||
|
if (entity.ExportDetails != null)
|
||||||
|
{
|
||||||
|
List<StayExportDetailsStayEntryDTO> entriesDto = [];
|
||||||
|
foreach (var entry in entity.ExportDetails.StayEntries)
|
||||||
|
{
|
||||||
|
entriesDto.Add(new()
|
||||||
|
{
|
||||||
|
StayEntryId = entry.StayEntryId,
|
||||||
|
ExportResult = entry.ExportResult,
|
||||||
|
Details = entry.Details,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
detailsDTO = new()
|
||||||
|
{
|
||||||
|
ExportedStayCount = entity.ExportDetails.ExportedStayCount,
|
||||||
|
StayErrorCount = entity.ExportDetails.StayErrorCount,
|
||||||
|
StayEntries = entriesDto,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return new()
|
||||||
|
{
|
||||||
|
Id = entity.Id,
|
||||||
|
ExportFormat = entity.ExportFormat,
|
||||||
|
ExportParams = exportParamsDto,
|
||||||
|
ExportResult = entity.ExportResult,
|
||||||
|
ExportedPath = entity.ExportedPath,
|
||||||
|
ExportDetails = detailsDTO,
|
||||||
|
ExportTime = entity.ExportTime.ToLocalTime(),
|
||||||
|
FileUploadStatus = entity.FileUploadStatus,
|
||||||
|
FileUploadStatusTime = entity.FileUploadStatusTime?.ToLocalTime(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Somnia.GuestLog.Models.Entities;
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Models.QueryConfigs;
|
||||||
|
|
||||||
|
public record StayEntryQueryConfig(bool IncludeGuests = false, bool UseSplitQueries = true, bool DisableTracking = false)
|
||||||
|
{
|
||||||
|
public readonly static StayEntryQueryConfig DefaultQueryConfig = new();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static class StayEntryQueryExtensions
|
||||||
|
{
|
||||||
|
public static IQueryable<StayEntry> AddQueryConfig(this IQueryable<StayEntry> query, StayEntryQueryConfig? config)
|
||||||
|
{
|
||||||
|
config ??= StayEntryQueryConfig.DefaultQueryConfig;
|
||||||
|
|
||||||
|
if (config.IncludeGuests)
|
||||||
|
{
|
||||||
|
query = query.Include(e => e.GuestDocuments);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.UseSplitQueries)
|
||||||
|
{
|
||||||
|
query = query.AsSplitQuery();
|
||||||
|
}
|
||||||
|
if (config.DisableTracking)
|
||||||
|
{
|
||||||
|
query = query.AsNoTracking();
|
||||||
|
}
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,38 +1,127 @@
|
|||||||
|
using FluentStorage;
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
|
using Microsoft.AspNetCore.DataProtection;
|
||||||
|
using Microsoft.AspNetCore.HttpOverrides;
|
||||||
|
using Microsoft.AspNetCore.Localization;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Diagnostics;
|
||||||
using MudBlazor.Services;
|
using MudBlazor.Services;
|
||||||
|
using MudBlazor.Translations;
|
||||||
|
using Serilog;
|
||||||
|
using Serilog.Extensions.Logging;
|
||||||
|
using Somnia.GuestLog;
|
||||||
using Somnia.GuestLog.Components;
|
using Somnia.GuestLog.Components;
|
||||||
using Somnia.GuestLog.Infrastructure;
|
using Somnia.GuestLog.Infrastructure;
|
||||||
|
using Somnia.GuestLog.Models.Configuration;
|
||||||
using Somnia.GuestLog.Models.DTOs;
|
using Somnia.GuestLog.Models.DTOs;
|
||||||
using Somnia.GuestLog.Services;
|
using Somnia.GuestLog.Services;
|
||||||
|
using Somnia.GuestLog.Services.AddressQuery;
|
||||||
|
using Somnia.GuestLog.Services.Entity;
|
||||||
|
using Somnia.GuestLog.Services.SpainCodigoMunicipio;
|
||||||
|
using Somnia.GuestLog.Services.StayExport;
|
||||||
|
using Somnia.GuestLog.Utils;
|
||||||
using Somnia.GuestLog.Validators;
|
using Somnia.GuestLog.Validators;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
//Load config files.
|
||||||
|
builder.Configuration.AddJsonFile("Config/log_Config.json", optional: false, reloadOnChange: false);
|
||||||
|
builder.Configuration.AddEnvironmentVariables("SOMNIA_");
|
||||||
|
|
||||||
|
//Create and configure Logger (Serilog)
|
||||||
|
var serilog = new LoggerConfiguration()
|
||||||
|
.ReadFrom.Configuration(builder.Configuration)
|
||||||
|
.CreateLogger();
|
||||||
|
builder.Services.AddSerilog(serilog);
|
||||||
|
|
||||||
|
var logger = new SerilogLoggerFactory(serilog).CreateLogger<Program>();
|
||||||
|
|
||||||
|
logger.LogInformation("\n\n\n -------------- Starting {appName} {appVersion} --------------", AppSettings.AppName, AppSettings.AppVersion);
|
||||||
|
|
||||||
|
if (!builder.Environment.IsDevelopment())
|
||||||
|
{
|
||||||
|
string dataProtectionPath = builder.Configuration.GetValue<string>("DataProtectionDir", defaultValue: "/SomniaGuestLog/dataprotection");
|
||||||
|
builder.Services.AddDataProtection()
|
||||||
|
.PersistKeysToFileSystem(new DirectoryInfo(dataProtectionPath))
|
||||||
|
.SetApplicationName("SomniaGuestLog");
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.Services.Configure<ForwardedHeadersOptions>(options =>
|
||||||
|
{
|
||||||
|
options.ForwardedHeaders =
|
||||||
|
ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto | ForwardedHeaders.XForwardedHost;
|
||||||
|
});
|
||||||
|
|
||||||
var connectionStringGuestLog = builder.Configuration.GetConnectionString("DbSomniaGuestLog")
|
var connectionStringGuestLog = builder.Configuration.GetConnectionString("DbSomniaGuestLog")
|
||||||
?? throw new InvalidOperationException("Connection string 'DbSomniaGuestLog' not found.");
|
?? throw new InvalidOperationException("Connection string 'DbSomniaGuestLog' not found.");
|
||||||
builder.Services.AddDbContextFactory<GuestLogContext>(options =>
|
builder.Services.AddDbContextFactory<GuestLogContext>(options =>
|
||||||
{
|
{
|
||||||
options.UseNpgsql(connectionStringGuestLog);
|
options.UseNpgsql(connectionStringGuestLog)
|
||||||
|
.UseLazyLoadingProxies()
|
||||||
|
.ConfigureWarnings(w => w.Log((CoreEventId.NavigationLazyLoading, LogLevel.Warning)));
|
||||||
|
|
||||||
|
// The following options help with debugging, but should
|
||||||
|
// be changed or removed for production.
|
||||||
|
if (builder.Environment.IsDevelopment())
|
||||||
|
{
|
||||||
|
options.EnableSensitiveDataLogging()
|
||||||
|
.EnableDetailedErrors();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
builder.Services.AddDatabaseDeveloperPageExceptionFilter();
|
builder.Services.AddDatabaseDeveloperPageExceptionFilter();
|
||||||
|
|
||||||
// Add MudBlazor services
|
// Add MudBlazor services
|
||||||
builder.Services.AddMudServices();
|
builder.Services.AddMudServices(c =>
|
||||||
|
{
|
||||||
|
c.SnackbarConfiguration.PositionClass = MudBlazor.Defaults.Classes.Position.TopCenter;
|
||||||
|
c.SnackbarConfiguration.ShowTransitionDuration = 300;
|
||||||
|
c.SnackbarConfiguration.HideTransitionDuration = 500;
|
||||||
|
c.SnackbarConfiguration.VisibleStateDuration = 10000;
|
||||||
|
});
|
||||||
|
|
||||||
// Add services to the container.
|
// Add components services to the container.
|
||||||
builder.Services.AddRazorComponents()
|
builder.Services.AddRazorComponents()
|
||||||
.AddInteractiveServerComponents();
|
.AddInteractiveServerComponents();
|
||||||
|
|
||||||
|
builder.Services.AddLocalization();
|
||||||
|
builder.Services.AddMudTranslations();
|
||||||
|
builder.Services.AddHttpClient();
|
||||||
|
|
||||||
// Add Validation Services
|
// Add Validation Services
|
||||||
builder.Services.AddSingleton<IValidator<GuestDocumentDTO>, GuestDocumentDTOValidator>();
|
builder.Services.AddSingleton<IValidator<GuestDocumentDTO>, GuestDocumentDTOValidator>();
|
||||||
|
builder.Services.AddSingleton<IValidator<GuestDocIdDTO>, GuestDocIdDTOValidator>();
|
||||||
|
builder.Services.AddSingleton<IValidator<StayEntryDTO>, StayEntryDTOValidator>();
|
||||||
|
builder.Services.AddSingleton<IValidator<StayExportParamsDTO>, StayExportParamsDTOValidator>();
|
||||||
|
|
||||||
|
// Add Entity Services
|
||||||
|
builder.Services.AddSingleton<IGuestDocumentEntityService, GuestDocumentEntityService>();
|
||||||
|
builder.Services.AddSingleton<IStayEntryEntityService, StayEntryEntityService>();
|
||||||
|
builder.Services.AddSingleton<IStayExportFileEntityService, StayExportFileEntityService>();
|
||||||
|
|
||||||
// Add Services
|
// Add Services
|
||||||
builder.Services.AddSingleton<IGuestDocumentService, GuestDocumentService>();
|
builder.Services.AddSingleton<IDataListService, StaticDataListService>();
|
||||||
|
builder.Services.AddScoped<IUserMessageService, UserMessageService>();
|
||||||
|
builder.Services.AddSingleton<ILocalizerService, LocalizerService>();
|
||||||
|
builder.Services.AddSingleton<IStayExportService, StayExportService>();
|
||||||
|
builder.Services.AddSingleton<ISpainCodigoMunicipioService, SpainCodigoMunicipioCatastroService>();
|
||||||
|
|
||||||
|
// Add Factories (and it's services)
|
||||||
|
builder.Services.AddFactoryDI<IAddressQueryFactory, ConfigFileAddressQueryFactory>();
|
||||||
|
builder.Services.AddFactoryDI<IStayExportFormatProviderFactory, StayExportFormatProviderFactory>();
|
||||||
|
|
||||||
|
// Add Options config
|
||||||
|
builder.Services.AddOptions<AddressQueryConfig>()
|
||||||
|
.Bind(builder.Configuration.GetSection(AddressQueryConfig.SectionName));
|
||||||
|
builder.Services.AddOptions<StayExportConfig>()
|
||||||
|
.Bind(builder.Configuration.GetSection(StayExportConfig.SectionName));
|
||||||
|
builder.Services.AddOptions<StayExportSpainParteViajerosConfig>()
|
||||||
|
.Bind(builder.Configuration.GetSection(StayExportSpainParteViajerosConfig.SectionName));
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
|
app.UseForwardedHeaders();
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
if (app.Environment.IsDevelopment())
|
if (app.Environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
@@ -49,8 +138,33 @@ app.UseHttpsRedirection();
|
|||||||
|
|
||||||
app.UseAntiforgery();
|
app.UseAntiforgery();
|
||||||
|
|
||||||
|
string[] supportedCultures = ["en-US", "es-ES"];
|
||||||
|
var localizationOptions = new RequestLocalizationOptions()
|
||||||
|
.SetDefaultCulture(supportedCultures[0])
|
||||||
|
.AddSupportedCultures(supportedCultures)
|
||||||
|
.AddSupportedUICultures(supportedCultures);
|
||||||
|
localizationOptions.RequestCultureProviders = [
|
||||||
|
new QueryStringRequestCultureProvider(),
|
||||||
|
new CookieRequestCultureProvider()
|
||||||
|
];
|
||||||
|
|
||||||
|
app.UseRequestLocalization(localizationOptions);
|
||||||
app.MapStaticAssets();
|
app.MapStaticAssets();
|
||||||
app.MapRazorComponents<App>()
|
app.MapRazorComponents<App>()
|
||||||
.AddInteractiveServerRenderMode();
|
.AddInteractiveServerRenderMode();
|
||||||
|
|
||||||
|
//Activate S3 storage.
|
||||||
|
AwsS3Storage.Use();
|
||||||
|
|
||||||
|
//Run database migrations
|
||||||
|
bool runMigrationsOnStartup = builder.Configuration.GetValue<bool>("RunDatabaseMigrationOnStartup", defaultValue: true);
|
||||||
|
if (runMigrationsOnStartup)
|
||||||
|
{
|
||||||
|
logger.LogInformation("Running database migrations...");
|
||||||
|
using var scope = app.Services.CreateScope();
|
||||||
|
var db = scope.ServiceProvider.GetRequiredService<GuestLogContext>();
|
||||||
|
await db.Database.MigrateAsync();
|
||||||
|
logger.LogInformation("Database migrations OK");
|
||||||
|
}
|
||||||
|
|
||||||
app.Run();
|
app.Run();
|
||||||
@@ -0,0 +1,397 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing"
|
||||||
|
mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework
|
||||||
|
object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||||
|
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0"
|
||||||
|
msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0"
|
||||||
|
msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required"
|
||||||
|
msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0"
|
||||||
|
msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0,
|
||||||
|
Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0,
|
||||||
|
Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
|
||||||
|
|
||||||
|
<data name="dataList.CountryCode.ABW" xml:space="preserve"><value>Aruba</value></data>
|
||||||
|
<data name="dataList.CountryCode.AFG" xml:space="preserve"><value>Afganistán</value></data>
|
||||||
|
<data name="dataList.CountryCode.AGO" xml:space="preserve"><value>Angola</value></data>
|
||||||
|
<data name="dataList.CountryCode.AIA" xml:space="preserve"><value>Anguila</value></data>
|
||||||
|
<data name="dataList.CountryCode.ALA" xml:space="preserve"><value>Åland, (las) Islas</value></data>
|
||||||
|
<data name="dataList.CountryCode.ALB" xml:space="preserve"><value>Albania</value></data>
|
||||||
|
<data name="dataList.CountryCode.AND" xml:space="preserve"><value>Andorra</value></data>
|
||||||
|
<data name="dataList.CountryCode.ARE" xml:space="preserve"><value>Emiratos Árabes Unidos (los)</value></data>
|
||||||
|
<data name="dataList.CountryCode.ARG" xml:space="preserve"><value>Argentina</value></data>
|
||||||
|
<data name="dataList.CountryCode.ARM" xml:space="preserve"><value>Armenia</value></data>
|
||||||
|
<data name="dataList.CountryCode.ASM" xml:space="preserve"><value>Samoa Americana</value></data>
|
||||||
|
<data name="dataList.CountryCode.ATA" xml:space="preserve"><value>Antártida</value></data>
|
||||||
|
<data name="dataList.CountryCode.ATF" xml:space="preserve"><value>Tierras Australes Francesas (las)</value></data>
|
||||||
|
<data name="dataList.CountryCode.ATG" xml:space="preserve"><value>Antigua y Barbuda</value></data>
|
||||||
|
<data name="dataList.CountryCode.AUS" xml:space="preserve"><value>Australia</value></data>
|
||||||
|
<data name="dataList.CountryCode.AUT" xml:space="preserve"><value>Austria</value></data>
|
||||||
|
<data name="dataList.CountryCode.AZE" xml:space="preserve"><value>Azerbaiyán</value></data>
|
||||||
|
<data name="dataList.CountryCode.BDI" xml:space="preserve"><value>Burundi</value></data>
|
||||||
|
<data name="dataList.CountryCode.BEL" xml:space="preserve"><value>Bélgica</value></data>
|
||||||
|
<data name="dataList.CountryCode.BEN" xml:space="preserve"><value>Benín</value></data>
|
||||||
|
<data name="dataList.CountryCode.BES" xml:space="preserve"><value>Bonaire, San Eustaquio y Saba</value></data>
|
||||||
|
<data name="dataList.CountryCode.BFA" xml:space="preserve"><value>Burkina Faso</value></data>
|
||||||
|
<data name="dataList.CountryCode.BGD" xml:space="preserve"><value>Bangladés</value></data>
|
||||||
|
<data name="dataList.CountryCode.BGR" xml:space="preserve"><value>Bulgaria</value></data>
|
||||||
|
<data name="dataList.CountryCode.BHR" xml:space="preserve"><value>Baréin</value></data>
|
||||||
|
<data name="dataList.CountryCode.BHS" xml:space="preserve"><value>Bahamas (las)</value></data>
|
||||||
|
<data name="dataList.CountryCode.BIH" xml:space="preserve"><value>Bosnia y Herzegovina</value></data>
|
||||||
|
<data name="dataList.CountryCode.BLM" xml:space="preserve"><value>San Barthélemy</value></data>
|
||||||
|
<data name="dataList.CountryCode.BLR" xml:space="preserve"><value>Belarús</value></data>
|
||||||
|
<data name="dataList.CountryCode.BLZ" xml:space="preserve"><value>Belice</value></data>
|
||||||
|
<data name="dataList.CountryCode.BMU" xml:space="preserve"><value>Bermuda</value></data>
|
||||||
|
<data name="dataList.CountryCode.BOL" xml:space="preserve"><value>Bolivia (Estado Plurinacional de)</value></data>
|
||||||
|
<data name="dataList.CountryCode.BRA" xml:space="preserve"><value>Brasil</value></data>
|
||||||
|
<data name="dataList.CountryCode.BRB" xml:space="preserve"><value>Barbados</value></data>
|
||||||
|
<data name="dataList.CountryCode.BRN" xml:space="preserve"><value>Brunei Darussalam</value></data>
|
||||||
|
<data name="dataList.CountryCode.BTN" xml:space="preserve"><value>Bhután</value></data>
|
||||||
|
<data name="dataList.CountryCode.BVT" xml:space="preserve"><value>Bouvet, Isla</value></data>
|
||||||
|
<data name="dataList.CountryCode.BWA" xml:space="preserve"><value>Botsuana</value></data>
|
||||||
|
<data name="dataList.CountryCode.CAF" xml:space="preserve"><value>República Centroafricana (la)</value></data>
|
||||||
|
<data name="dataList.CountryCode.CAN" xml:space="preserve"><value>Canadá</value></data>
|
||||||
|
<data name="dataList.CountryCode.CCK" xml:space="preserve"><value>Cocos / Keeling, (las) Islas</value></data>
|
||||||
|
<data name="dataList.CountryCode.CHE" xml:space="preserve"><value>Suiza</value></data>
|
||||||
|
<data name="dataList.CountryCode.CHL" xml:space="preserve"><value>Chile</value></data>
|
||||||
|
<data name="dataList.CountryCode.CHN" xml:space="preserve"><value>China</value></data>
|
||||||
|
<data name="dataList.CountryCode.CIV" xml:space="preserve"><value>Côte d'Ivoire</value></data>
|
||||||
|
<data name="dataList.CountryCode.CMR" xml:space="preserve"><value>Camerún</value></data>
|
||||||
|
<data name="dataList.CountryCode.COD" xml:space="preserve"><value>Congo (la República Democrática del)</value></data>
|
||||||
|
<data name="dataList.CountryCode.COG" xml:space="preserve"><value>Congo (el)</value></data>
|
||||||
|
<data name="dataList.CountryCode.COK" xml:space="preserve"><value>Cook, (las) Islas</value></data>
|
||||||
|
<data name="dataList.CountryCode.COL" xml:space="preserve"><value>Colombia</value></data>
|
||||||
|
<data name="dataList.CountryCode.COM" xml:space="preserve"><value>Comoras (las)</value></data>
|
||||||
|
<data name="dataList.CountryCode.CPV" xml:space="preserve"><value>Cabo Verde</value></data>
|
||||||
|
<data name="dataList.CountryCode.CRI" xml:space="preserve"><value>Costa Rica</value></data>
|
||||||
|
<data name="dataList.CountryCode.CUB" xml:space="preserve"><value>Cuba</value></data>
|
||||||
|
<data name="dataList.CountryCode.CUW" xml:space="preserve"><value>Curazao</value></data>
|
||||||
|
<data name="dataList.CountryCode.CXR" xml:space="preserve"><value>Christmas, Isla</value></data>
|
||||||
|
<data name="dataList.CountryCode.CYM" xml:space="preserve"><value>Caimán, (las) Islas</value></data>
|
||||||
|
<data name="dataList.CountryCode.CYP" xml:space="preserve"><value>Chipre</value></data>
|
||||||
|
<data name="dataList.CountryCode.CZE" xml:space="preserve"><value>Chequia</value></data>
|
||||||
|
<data name="dataList.CountryCode.DEU" xml:space="preserve"><value>Alemania</value></data>
|
||||||
|
<data name="dataList.CountryCode.DJI" xml:space="preserve"><value>Yibuti</value></data>
|
||||||
|
<data name="dataList.CountryCode.DMA" xml:space="preserve"><value>Dominica</value></data>
|
||||||
|
<data name="dataList.CountryCode.DNK" xml:space="preserve"><value>Dinamarca</value></data>
|
||||||
|
<data name="dataList.CountryCode.DOM" xml:space="preserve"><value>Dominicana, (la) República</value></data>
|
||||||
|
<data name="dataList.CountryCode.DZA" xml:space="preserve"><value>Argelia</value></data>
|
||||||
|
<data name="dataList.CountryCode.ECU" xml:space="preserve"><value>Ecuador</value></data>
|
||||||
|
<data name="dataList.CountryCode.EGY" xml:space="preserve"><value>Egipto</value></data>
|
||||||
|
<data name="dataList.CountryCode.ERI" xml:space="preserve"><value>Eritrea</value></data>
|
||||||
|
<data name="dataList.CountryCode.ESH" xml:space="preserve"><value>Sáhara Occidental</value></data>
|
||||||
|
<data name="dataList.CountryCode.ESP" xml:space="preserve"><value>España</value></data>
|
||||||
|
<data name="dataList.CountryCode.EST" xml:space="preserve"><value>Estonia</value></data>
|
||||||
|
<data name="dataList.CountryCode.ETH" xml:space="preserve"><value>Etiopía</value></data>
|
||||||
|
<data name="dataList.CountryCode.FIN" xml:space="preserve"><value>Finlandia</value></data>
|
||||||
|
<data name="dataList.CountryCode.FJI" xml:space="preserve"><value>Fiyi</value></data>
|
||||||
|
<data name="dataList.CountryCode.FLK" xml:space="preserve"><value>Malvinas [Falkland], (las) Islas</value></data>
|
||||||
|
<data name="dataList.CountryCode.FRA" xml:space="preserve"><value>Francia</value></data>
|
||||||
|
<data name="dataList.CountryCode.FRO" xml:space="preserve"><value>Feroe, (las) Islas</value></data>
|
||||||
|
<data name="dataList.CountryCode.FSM" xml:space="preserve"><value>Micronesia (Estados Federados de)</value></data>
|
||||||
|
<data name="dataList.CountryCode.GAB" xml:space="preserve"><value>Gabón</value></data>
|
||||||
|
<data name="dataList.CountryCode.GBR" xml:space="preserve"><value>Reino Unido de Gran Bretaña e Irlanda del Norte</value></data>
|
||||||
|
<data name="dataList.CountryCode.GEO" xml:space="preserve"><value>Georgia</value></data>
|
||||||
|
<data name="dataList.CountryCode.GGY" xml:space="preserve"><value>Guernsey</value></data>
|
||||||
|
<data name="dataList.CountryCode.GHA" xml:space="preserve"><value>Ghana</value></data>
|
||||||
|
<data name="dataList.CountryCode.GIB" xml:space="preserve"><value>Gibraltar</value></data>
|
||||||
|
<data name="dataList.CountryCode.GIN" xml:space="preserve"><value>Guinea</value></data>
|
||||||
|
<data name="dataList.CountryCode.GLP" xml:space="preserve"><value>Guadalupe</value></data>
|
||||||
|
<data name="dataList.CountryCode.GMB" xml:space="preserve"><value>Gambia (la)</value></data>
|
||||||
|
<data name="dataList.CountryCode.GNB" xml:space="preserve"><value>Guinea-Bissau</value></data>
|
||||||
|
<data name="dataList.CountryCode.GNQ" xml:space="preserve"><value>Guinea Ecuatorial</value></data>
|
||||||
|
<data name="dataList.CountryCode.GRC" xml:space="preserve"><value>Grecia</value></data>
|
||||||
|
<data name="dataList.CountryCode.GRD" xml:space="preserve"><value>Granada</value></data>
|
||||||
|
<data name="dataList.CountryCode.GRL" xml:space="preserve"><value>Groenlandia</value></data>
|
||||||
|
<data name="dataList.CountryCode.GTM" xml:space="preserve"><value>Guatemala</value></data>
|
||||||
|
<data name="dataList.CountryCode.GUF" xml:space="preserve"><value>Guayana Francesa</value></data>
|
||||||
|
<data name="dataList.CountryCode.GUM" xml:space="preserve"><value>Guam</value></data>
|
||||||
|
<data name="dataList.CountryCode.GUY" xml:space="preserve"><value>Guyana</value></data>
|
||||||
|
<data name="dataList.CountryCode.HKG" xml:space="preserve"><value>Hong Kong</value></data>
|
||||||
|
<data name="dataList.CountryCode.HMD" xml:space="preserve"><value>Heard (Isla) e Islas McDonald</value></data>
|
||||||
|
<data name="dataList.CountryCode.HND" xml:space="preserve"><value>Honduras</value></data>
|
||||||
|
<data name="dataList.CountryCode.HRV" xml:space="preserve"><value>Croacia</value></data>
|
||||||
|
<data name="dataList.CountryCode.HTI" xml:space="preserve"><value>Haití</value></data>
|
||||||
|
<data name="dataList.CountryCode.HUN" xml:space="preserve"><value>Hungría</value></data>
|
||||||
|
<data name="dataList.CountryCode.IDN" xml:space="preserve"><value>Indonesia</value></data>
|
||||||
|
<data name="dataList.CountryCode.IMN" xml:space="preserve"><value>Isla de Man</value></data>
|
||||||
|
<data name="dataList.CountryCode.IND" xml:space="preserve"><value>India</value></data>
|
||||||
|
<data name="dataList.CountryCode.IOT" xml:space="preserve"><value>Territorio Británico del Océano Índico (el)</value></data>
|
||||||
|
<data name="dataList.CountryCode.IRL" xml:space="preserve"><value>Irlanda</value></data>
|
||||||
|
<data name="dataList.CountryCode.IRN" xml:space="preserve"><value>Irán (República Islámica de)</value></data>
|
||||||
|
<data name="dataList.CountryCode.IRQ" xml:space="preserve"><value>Irak</value></data>
|
||||||
|
<data name="dataList.CountryCode.ISL" xml:space="preserve"><value>Islandia</value></data>
|
||||||
|
<data name="dataList.CountryCode.ISR" xml:space="preserve"><value>Israel</value></data>
|
||||||
|
<data name="dataList.CountryCode.ITA" xml:space="preserve"><value>Italia</value></data>
|
||||||
|
<data name="dataList.CountryCode.JAM" xml:space="preserve"><value>Jamaica</value></data>
|
||||||
|
<data name="dataList.CountryCode.JEY" xml:space="preserve"><value>Jersey</value></data>
|
||||||
|
<data name="dataList.CountryCode.JOR" xml:space="preserve"><value>Jordania</value></data>
|
||||||
|
<data name="dataList.CountryCode.JPN" xml:space="preserve"><value>Japón</value></data>
|
||||||
|
<data name="dataList.CountryCode.KAZ" xml:space="preserve"><value>Kazajistán</value></data>
|
||||||
|
<data name="dataList.CountryCode.KEN" xml:space="preserve"><value>Kenia</value></data>
|
||||||
|
<data name="dataList.CountryCode.KGZ" xml:space="preserve"><value>Kirguistán</value></data>
|
||||||
|
<data name="dataList.CountryCode.KHM" xml:space="preserve"><value>Camboya</value></data>
|
||||||
|
<data name="dataList.CountryCode.KIR" xml:space="preserve"><value>Kiribati</value></data>
|
||||||
|
<data name="dataList.CountryCode.KNA" xml:space="preserve"><value>Saint Kitts y Nevis</value></data>
|
||||||
|
<data name="dataList.CountryCode.KOR" xml:space="preserve"><value>Corea (la República de)</value></data>
|
||||||
|
<data name="dataList.CountryCode.KWT" xml:space="preserve"><value>Kuwait</value></data>
|
||||||
|
<data name="dataList.CountryCode.LAO" xml:space="preserve"><value>Lao, (la) República Democrática Popular</value></data>
|
||||||
|
<data name="dataList.CountryCode.LBN" xml:space="preserve"><value>Líbano</value></data>
|
||||||
|
<data name="dataList.CountryCode.LBR" xml:space="preserve"><value>Liberia</value></data>
|
||||||
|
<data name="dataList.CountryCode.LBY" xml:space="preserve"><value>Libia</value></data>
|
||||||
|
<data name="dataList.CountryCode.LCA" xml:space="preserve"><value>Santa Lucía</value></data>
|
||||||
|
<data name="dataList.CountryCode.LIE" xml:space="preserve"><value>Liechtenstein</value></data>
|
||||||
|
<data name="dataList.CountryCode.LKA" xml:space="preserve"><value>Sri Lanka</value></data>
|
||||||
|
<data name="dataList.CountryCode.LSO" xml:space="preserve"><value>Lesoto</value></data>
|
||||||
|
<data name="dataList.CountryCode.LTU" xml:space="preserve"><value>Lituania</value></data>
|
||||||
|
<data name="dataList.CountryCode.LUX" xml:space="preserve"><value>Luxemburgo</value></data>
|
||||||
|
<data name="dataList.CountryCode.LVA" xml:space="preserve"><value>Letonia</value></data>
|
||||||
|
<data name="dataList.CountryCode.MAC" xml:space="preserve"><value>Macao</value></data>
|
||||||
|
<data name="dataList.CountryCode.MAF" xml:space="preserve"><value>San Martín (parte francesa)</value></data>
|
||||||
|
<data name="dataList.CountryCode.MAR" xml:space="preserve"><value>Marruecos</value></data>
|
||||||
|
<data name="dataList.CountryCode.MCO" xml:space="preserve"><value>Mónaco</value></data>
|
||||||
|
<data name="dataList.CountryCode.MDA" xml:space="preserve"><value>Moldova (la República de)</value></data>
|
||||||
|
<data name="dataList.CountryCode.MDG" xml:space="preserve"><value>Madagascar</value></data>
|
||||||
|
<data name="dataList.CountryCode.MDV" xml:space="preserve"><value>Maldivas</value></data>
|
||||||
|
<data name="dataList.CountryCode.MEX" xml:space="preserve"><value>México</value></data>
|
||||||
|
<data name="dataList.CountryCode.MHL" xml:space="preserve"><value>Marshall, (las) Islas</value></data>
|
||||||
|
<data name="dataList.CountryCode.MKD" xml:space="preserve"><value>Macedonia del Norte</value></data>
|
||||||
|
<data name="dataList.CountryCode.MLI" xml:space="preserve"><value>Malí</value></data>
|
||||||
|
<data name="dataList.CountryCode.MLT" xml:space="preserve"><value>Malta</value></data>
|
||||||
|
<data name="dataList.CountryCode.MMR" xml:space="preserve"><value>Myanmar</value></data>
|
||||||
|
<data name="dataList.CountryCode.MNE" xml:space="preserve"><value>Montenegro</value></data>
|
||||||
|
<data name="dataList.CountryCode.MNG" xml:space="preserve"><value>Mongolia</value></data>
|
||||||
|
<data name="dataList.CountryCode.MNP" xml:space="preserve"><value>Marianas Septentrionales, (las) Islas</value></data>
|
||||||
|
<data name="dataList.CountryCode.MOZ" xml:space="preserve"><value>Mozambique</value></data>
|
||||||
|
<data name="dataList.CountryCode.MRT" xml:space="preserve"><value>Mauritania</value></data>
|
||||||
|
<data name="dataList.CountryCode.MSR" xml:space="preserve"><value>Montserrat</value></data>
|
||||||
|
<data name="dataList.CountryCode.MTQ" xml:space="preserve"><value>Martinica</value></data>
|
||||||
|
<data name="dataList.CountryCode.MUS" xml:space="preserve"><value>Mauricio</value></data>
|
||||||
|
<data name="dataList.CountryCode.MWI" xml:space="preserve"><value>Malaui</value></data>
|
||||||
|
<data name="dataList.CountryCode.MYS" xml:space="preserve"><value>Malasia</value></data>
|
||||||
|
<data name="dataList.CountryCode.MYT" xml:space="preserve"><value>Mayotte</value></data>
|
||||||
|
<data name="dataList.CountryCode.NAM" xml:space="preserve"><value>Namibia</value></data>
|
||||||
|
<data name="dataList.CountryCode.NCL" xml:space="preserve"><value>Nueva Caledonia</value></data>
|
||||||
|
<data name="dataList.CountryCode.NER" xml:space="preserve"><value>Níger (el)</value></data>
|
||||||
|
<data name="dataList.CountryCode.NFK" xml:space="preserve"><value>Norfolk, Isla</value></data>
|
||||||
|
<data name="dataList.CountryCode.NGA" xml:space="preserve"><value>Nigeria</value></data>
|
||||||
|
<data name="dataList.CountryCode.NIC" xml:space="preserve"><value>Nicaragua</value></data>
|
||||||
|
<data name="dataList.CountryCode.NIU" xml:space="preserve"><value>Niue</value></data>
|
||||||
|
<data name="dataList.CountryCode.NLD" xml:space="preserve"><value>Países Bajos (los)</value></data>
|
||||||
|
<data name="dataList.CountryCode.NOR" xml:space="preserve"><value>Noruega</value></data>
|
||||||
|
<data name="dataList.CountryCode.NPL" xml:space="preserve"><value>Nepal</value></data>
|
||||||
|
<data name="dataList.CountryCode.NRU" xml:space="preserve"><value>Nauru</value></data>
|
||||||
|
<data name="dataList.CountryCode.NZL" xml:space="preserve"><value>Nueva Zelandia</value></data>
|
||||||
|
<data name="dataList.CountryCode.OMN" xml:space="preserve"><value>Omán</value></data>
|
||||||
|
<data name="dataList.CountryCode.PAK" xml:space="preserve"><value>Pakistán</value></data>
|
||||||
|
<data name="dataList.CountryCode.PAN" xml:space="preserve"><value>Panamá</value></data>
|
||||||
|
<data name="dataList.CountryCode.PCN" xml:space="preserve"><value>Pitcairn, (las) Islas</value></data>
|
||||||
|
<data name="dataList.CountryCode.PER" xml:space="preserve"><value>Perú</value></data>
|
||||||
|
<data name="dataList.CountryCode.PHL" xml:space="preserve"><value>Filipinas (las)</value></data>
|
||||||
|
<data name="dataList.CountryCode.PLW" xml:space="preserve"><value>Palau</value></data>
|
||||||
|
<data name="dataList.CountryCode.PNG" xml:space="preserve"><value>Papúa Nueva Guinea</value></data>
|
||||||
|
<data name="dataList.CountryCode.POL" xml:space="preserve"><value>Polonia</value></data>
|
||||||
|
<data name="dataList.CountryCode.PRI" xml:space="preserve"><value>Puerto Rico</value></data>
|
||||||
|
<data name="dataList.CountryCode.PRK" xml:space="preserve"><value>Corea (la República Popular Democrática de)</value></data>
|
||||||
|
<data name="dataList.CountryCode.PRT" xml:space="preserve"><value>Portugal</value></data>
|
||||||
|
<data name="dataList.CountryCode.PRY" xml:space="preserve"><value>Paraguay</value></data>
|
||||||
|
<data name="dataList.CountryCode.PSE" xml:space="preserve"><value>Palestina, Estado de</value></data>
|
||||||
|
<data name="dataList.CountryCode.PYF" xml:space="preserve"><value>Polinesia Francesa</value></data>
|
||||||
|
<data name="dataList.CountryCode.QAT" xml:space="preserve"><value>Catar</value></data>
|
||||||
|
<data name="dataList.CountryCode.REU" xml:space="preserve"><value>Reunión</value></data>
|
||||||
|
<data name="dataList.CountryCode.ROU" xml:space="preserve"><value>Rumania</value></data>
|
||||||
|
<data name="dataList.CountryCode.RUS" xml:space="preserve"><value>Rusia, (la) Federación de</value></data>
|
||||||
|
<data name="dataList.CountryCode.RWA" xml:space="preserve"><value>Ruanda</value></data>
|
||||||
|
<data name="dataList.CountryCode.SAU" xml:space="preserve"><value>Arabia Saudita</value></data>
|
||||||
|
<data name="dataList.CountryCode.SDN" xml:space="preserve"><value>Sudán</value></data>
|
||||||
|
<data name="dataList.CountryCode.SEN" xml:space="preserve"><value>Senegal</value></data>
|
||||||
|
<data name="dataList.CountryCode.SGP" xml:space="preserve"><value>Singapur</value></data>
|
||||||
|
<data name="dataList.CountryCode.SGS" xml:space="preserve"><value>Georgia del Sur (la) y las Islas Sandwich del Sur</value></data>
|
||||||
|
<data name="dataList.CountryCode.SHN" xml:space="preserve"><value>Santa Elena, Ascensión y Tristán de Acuña</value></data>
|
||||||
|
<data name="dataList.CountryCode.SJM" xml:space="preserve"><value>Svalbard y Jan Mayen</value></data>
|
||||||
|
<data name="dataList.CountryCode.SLB" xml:space="preserve"><value>Salomón, (las) Islas</value></data>
|
||||||
|
<data name="dataList.CountryCode.SLE" xml:space="preserve"><value>Sierra Leona</value></data>
|
||||||
|
<data name="dataList.CountryCode.SLV" xml:space="preserve"><value>El Salvador</value></data>
|
||||||
|
<data name="dataList.CountryCode.SMR" xml:space="preserve"><value>San Marino</value></data>
|
||||||
|
<data name="dataList.CountryCode.SOM" xml:space="preserve"><value>Somalia</value></data>
|
||||||
|
<data name="dataList.CountryCode.SPM" xml:space="preserve"><value>San Pedro y Miquelón</value></data>
|
||||||
|
<data name="dataList.CountryCode.SRB" xml:space="preserve"><value>Serbia</value></data>
|
||||||
|
<data name="dataList.CountryCode.SSD" xml:space="preserve"><value>Sudán del Sur</value></data>
|
||||||
|
<data name="dataList.CountryCode.STP" xml:space="preserve"><value>Santo Tomé y Príncipe</value></data>
|
||||||
|
<data name="dataList.CountryCode.SUR" xml:space="preserve"><value>Suriname</value></data>
|
||||||
|
<data name="dataList.CountryCode.SVK" xml:space="preserve"><value>Eslovaquia</value></data>
|
||||||
|
<data name="dataList.CountryCode.SVN" xml:space="preserve"><value>Eslovenia</value></data>
|
||||||
|
<data name="dataList.CountryCode.SWE" xml:space="preserve"><value>Suecia</value></data>
|
||||||
|
<data name="dataList.CountryCode.SWZ" xml:space="preserve"><value>Eswatini</value></data>
|
||||||
|
<data name="dataList.CountryCode.SXM" xml:space="preserve"><value>San Martín (parte neerlandesa)</value></data>
|
||||||
|
<data name="dataList.CountryCode.SYC" xml:space="preserve"><value>Seychelles</value></data>
|
||||||
|
<data name="dataList.CountryCode.SYR" xml:space="preserve"><value>República Árabe Siria</value></data>
|
||||||
|
<data name="dataList.CountryCode.TCA" xml:space="preserve"><value>Turcas y Caicos, (las) Islas</value></data>
|
||||||
|
<data name="dataList.CountryCode.TCD" xml:space="preserve"><value>Chad</value></data>
|
||||||
|
<data name="dataList.CountryCode.TGO" xml:space="preserve"><value>Togo</value></data>
|
||||||
|
<data name="dataList.CountryCode.THA" xml:space="preserve"><value>Tailandia</value></data>
|
||||||
|
<data name="dataList.CountryCode.TJK" xml:space="preserve"><value>Tayikistán</value></data>
|
||||||
|
<data name="dataList.CountryCode.TKL" xml:space="preserve"><value>Tokelau</value></data>
|
||||||
|
<data name="dataList.CountryCode.TKM" xml:space="preserve"><value>Turkmenistán</value></data>
|
||||||
|
<data name="dataList.CountryCode.TLS" xml:space="preserve"><value>Timor-Leste</value></data>
|
||||||
|
<data name="dataList.CountryCode.TON" xml:space="preserve"><value>Tonga</value></data>
|
||||||
|
<data name="dataList.CountryCode.TTO" xml:space="preserve"><value>Trinidad y Tabago</value></data>
|
||||||
|
<data name="dataList.CountryCode.TUN" xml:space="preserve"><value>Túnez</value></data>
|
||||||
|
<data name="dataList.CountryCode.TUR" xml:space="preserve"><value>Turquía</value></data>
|
||||||
|
<data name="dataList.CountryCode.TUV" xml:space="preserve"><value>Tuvalu</value></data>
|
||||||
|
<data name="dataList.CountryCode.TWN" xml:space="preserve"><value>Taiwán (Provincia de China)</value></data>
|
||||||
|
<data name="dataList.CountryCode.TZA" xml:space="preserve"><value>Tanzania, República Unida de</value></data>
|
||||||
|
<data name="dataList.CountryCode.UGA" xml:space="preserve"><value>Uganda</value></data>
|
||||||
|
<data name="dataList.CountryCode.UKR" xml:space="preserve"><value>Ucrania</value></data>
|
||||||
|
<data name="dataList.CountryCode.UMI" xml:space="preserve"><value>Islas menores alejadas de Estados Unidos (las)</value></data>
|
||||||
|
<data name="dataList.CountryCode.URY" xml:space="preserve"><value>Uruguay</value></data>
|
||||||
|
<data name="dataList.CountryCode.USA" xml:space="preserve"><value>Estados Unidos de América (los)</value></data>
|
||||||
|
<data name="dataList.CountryCode.UZB" xml:space="preserve"><value>Uzbekistán</value></data>
|
||||||
|
<data name="dataList.CountryCode.VAT" xml:space="preserve"><value>Santa Sede (la)</value></data>
|
||||||
|
<data name="dataList.CountryCode.VCT" xml:space="preserve"><value>San Vincente y las Granadinas</value></data>
|
||||||
|
<data name="dataList.CountryCode.VEN" xml:space="preserve"><value>Venezuela (República Bolivariana de)</value></data>
|
||||||
|
<data name="dataList.CountryCode.VGB" xml:space="preserve"><value>Vírgenes Británicas, (las) Islas</value></data>
|
||||||
|
<data name="dataList.CountryCode.VIR" xml:space="preserve"><value>Vírgenes de los Estados Unidos, (las) Islas</value></data>
|
||||||
|
<data name="dataList.CountryCode.VNM" xml:space="preserve"><value>Viet Nam</value></data>
|
||||||
|
<data name="dataList.CountryCode.VUT" xml:space="preserve"><value>Vanuatu</value></data>
|
||||||
|
<data name="dataList.CountryCode.WLF" xml:space="preserve"><value>Wallis y Futuna</value></data>
|
||||||
|
<data name="dataList.CountryCode.WSM" xml:space="preserve"><value>Samoa</value></data>
|
||||||
|
<data name="dataList.CountryCode.YEM" xml:space="preserve"><value>Yemen</value></data>
|
||||||
|
<data name="dataList.CountryCode.ZAF" xml:space="preserve"><value>Sudáfrica</value></data>
|
||||||
|
<data name="dataList.CountryCode.ZMB" xml:space="preserve"><value>Zambia</value></data>
|
||||||
|
<data name="dataList.CountryCode.ZWE" xml:space="preserve"><value>Zimbabue</value></data>
|
||||||
|
|
||||||
|
<data name="dataList.DocumentType.DNI" xml:space="preserve"><value>DNI</value></data>
|
||||||
|
<data name="dataList.DocumentType.NIE" xml:space="preserve"><value>NIE</value></data>
|
||||||
|
<data name="dataList.DocumentType.PASSPORT" xml:space="preserve"><value>Pasaporte</value></data>
|
||||||
|
<data name="dataList.DocumentType.ID" xml:space="preserve"><value>ID Card</value></data>
|
||||||
|
<data name="dataList.DocumentType.OTHER" xml:space="preserve"><value>Otro</value></data>
|
||||||
|
|
||||||
|
<data name="dataList.GenderOption.M" xml:space="preserve"><value>Hombre</value></data>
|
||||||
|
<data name="dataList.GenderOption.F" xml:space="preserve"><value>Mujer</value></data>
|
||||||
|
<data name="dataList.GenderOption.O" xml:space="preserve"><value>Otro</value></data>
|
||||||
|
|
||||||
|
<data name="dataList.PaymentMethod.EFECT" xml:space="preserve"><value>Efectivo</value></data>
|
||||||
|
<data name="dataList.PaymentMethod.TARJT" xml:space="preserve"><value>Tarjeta</value></data>
|
||||||
|
<data name="dataList.PaymentMethod.TRANS" xml:space="preserve"><value>Transferencia</value></data>
|
||||||
|
<data name="dataList.PaymentMethod.MOVIL" xml:space="preserve"><value>Pago por Móvil</value></data>
|
||||||
|
<data name="dataList.PaymentMethod.OTRO" xml:space="preserve"><value>Otro</value></data>
|
||||||
|
|
||||||
|
</root>
|
||||||
@@ -0,0 +1,397 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing"
|
||||||
|
mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework
|
||||||
|
object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||||
|
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0"
|
||||||
|
msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0"
|
||||||
|
msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required"
|
||||||
|
msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0"
|
||||||
|
msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0,
|
||||||
|
Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0,
|
||||||
|
Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
|
||||||
|
|
||||||
|
<data name="dataList.CountryCode.ABW" xml:space="preserve"><value>Aruba</value></data>
|
||||||
|
<data name="dataList.CountryCode.AFG" xml:space="preserve"><value>Afghanistan</value></data>
|
||||||
|
<data name="dataList.CountryCode.AGO" xml:space="preserve"><value>Angola</value></data>
|
||||||
|
<data name="dataList.CountryCode.AIA" xml:space="preserve"><value>Anguilla</value></data>
|
||||||
|
<data name="dataList.CountryCode.ALA" xml:space="preserve"><value>Åland Islands</value></data>
|
||||||
|
<data name="dataList.CountryCode.ALB" xml:space="preserve"><value>Albania</value></data>
|
||||||
|
<data name="dataList.CountryCode.AND" xml:space="preserve"><value>Andorra</value></data>
|
||||||
|
<data name="dataList.CountryCode.ARE" xml:space="preserve"><value>United Arab Emirates</value></data>
|
||||||
|
<data name="dataList.CountryCode.ARG" xml:space="preserve"><value>Argentina</value></data>
|
||||||
|
<data name="dataList.CountryCode.ARM" xml:space="preserve"><value>Armenia</value></data>
|
||||||
|
<data name="dataList.CountryCode.ASM" xml:space="preserve"><value>American Samoa</value></data>
|
||||||
|
<data name="dataList.CountryCode.ATA" xml:space="preserve"><value>Antarctica</value></data>
|
||||||
|
<data name="dataList.CountryCode.ATF" xml:space="preserve"><value>French Southern Territories</value></data>
|
||||||
|
<data name="dataList.CountryCode.ATG" xml:space="preserve"><value>Antigua and Barbuda</value></data>
|
||||||
|
<data name="dataList.CountryCode.AUS" xml:space="preserve"><value>Australia</value></data>
|
||||||
|
<data name="dataList.CountryCode.AUT" xml:space="preserve"><value>Austria</value></data>
|
||||||
|
<data name="dataList.CountryCode.AZE" xml:space="preserve"><value>Azerbaijan</value></data>
|
||||||
|
<data name="dataList.CountryCode.BDI" xml:space="preserve"><value>Burundi</value></data>
|
||||||
|
<data name="dataList.CountryCode.BEL" xml:space="preserve"><value>Belgium</value></data>
|
||||||
|
<data name="dataList.CountryCode.BEN" xml:space="preserve"><value>Benin</value></data>
|
||||||
|
<data name="dataList.CountryCode.BES" xml:space="preserve"><value>Bonaire, Sint Eustatius and Saba</value></data>
|
||||||
|
<data name="dataList.CountryCode.BFA" xml:space="preserve"><value>Burkina Faso</value></data>
|
||||||
|
<data name="dataList.CountryCode.BGD" xml:space="preserve"><value>Bangladesh</value></data>
|
||||||
|
<data name="dataList.CountryCode.BGR" xml:space="preserve"><value>Bulgaria</value></data>
|
||||||
|
<data name="dataList.CountryCode.BHR" xml:space="preserve"><value>Bahrain</value></data>
|
||||||
|
<data name="dataList.CountryCode.BHS" xml:space="preserve"><value>Bahamas</value></data>
|
||||||
|
<data name="dataList.CountryCode.BIH" xml:space="preserve"><value>Bosnia and Herzegovina</value></data>
|
||||||
|
<data name="dataList.CountryCode.BLM" xml:space="preserve"><value>Saint Barthélemy</value></data>
|
||||||
|
<data name="dataList.CountryCode.BLR" xml:space="preserve"><value>Belarus</value></data>
|
||||||
|
<data name="dataList.CountryCode.BLZ" xml:space="preserve"><value>Belize</value></data>
|
||||||
|
<data name="dataList.CountryCode.BMU" xml:space="preserve"><value>Bermuda</value></data>
|
||||||
|
<data name="dataList.CountryCode.BOL" xml:space="preserve"><value>Bolivia, Plurinational State of</value></data>
|
||||||
|
<data name="dataList.CountryCode.BRA" xml:space="preserve"><value>Brazil</value></data>
|
||||||
|
<data name="dataList.CountryCode.BRB" xml:space="preserve"><value>Barbados</value></data>
|
||||||
|
<data name="dataList.CountryCode.BRN" xml:space="preserve"><value>Brunei Darussalam</value></data>
|
||||||
|
<data name="dataList.CountryCode.BTN" xml:space="preserve"><value>Bhutan</value></data>
|
||||||
|
<data name="dataList.CountryCode.BVT" xml:space="preserve"><value>Bouvet Island</value></data>
|
||||||
|
<data name="dataList.CountryCode.BWA" xml:space="preserve"><value>Botswana</value></data>
|
||||||
|
<data name="dataList.CountryCode.CAF" xml:space="preserve"><value>Central African Republic</value></data>
|
||||||
|
<data name="dataList.CountryCode.CAN" xml:space="preserve"><value>Canada</value></data>
|
||||||
|
<data name="dataList.CountryCode.CCK" xml:space="preserve"><value>Cocos (Keeling) Islands</value></data>
|
||||||
|
<data name="dataList.CountryCode.CHE" xml:space="preserve"><value>Switzerland</value></data>
|
||||||
|
<data name="dataList.CountryCode.CHL" xml:space="preserve"><value>Chile</value></data>
|
||||||
|
<data name="dataList.CountryCode.CHN" xml:space="preserve"><value>China</value></data>
|
||||||
|
<data name="dataList.CountryCode.CIV" xml:space="preserve"><value>Côte d'Ivoire</value></data>
|
||||||
|
<data name="dataList.CountryCode.CMR" xml:space="preserve"><value>Cameroon</value></data>
|
||||||
|
<data name="dataList.CountryCode.COD" xml:space="preserve"><value>Congo, Democratic Republic of the</value></data>
|
||||||
|
<data name="dataList.CountryCode.COG" xml:space="preserve"><value>Congo</value></data>
|
||||||
|
<data name="dataList.CountryCode.COK" xml:space="preserve"><value>Cook Islands</value></data>
|
||||||
|
<data name="dataList.CountryCode.COL" xml:space="preserve"><value>Colombia</value></data>
|
||||||
|
<data name="dataList.CountryCode.COM" xml:space="preserve"><value>Comoros</value></data>
|
||||||
|
<data name="dataList.CountryCode.CPV" xml:space="preserve"><value>Cabo Verde</value></data>
|
||||||
|
<data name="dataList.CountryCode.CRI" xml:space="preserve"><value>Costa Rica</value></data>
|
||||||
|
<data name="dataList.CountryCode.CUB" xml:space="preserve"><value>Cuba</value></data>
|
||||||
|
<data name="dataList.CountryCode.CUW" xml:space="preserve"><value>Curaçao</value></data>
|
||||||
|
<data name="dataList.CountryCode.CXR" xml:space="preserve"><value>Christmas Island</value></data>
|
||||||
|
<data name="dataList.CountryCode.CYM" xml:space="preserve"><value>Cayman Islands</value></data>
|
||||||
|
<data name="dataList.CountryCode.CYP" xml:space="preserve"><value>Cyprus</value></data>
|
||||||
|
<data name="dataList.CountryCode.CZE" xml:space="preserve"><value>Czechia</value></data>
|
||||||
|
<data name="dataList.CountryCode.DEU" xml:space="preserve"><value>Germany</value></data>
|
||||||
|
<data name="dataList.CountryCode.DJI" xml:space="preserve"><value>Djibouti</value></data>
|
||||||
|
<data name="dataList.CountryCode.DMA" xml:space="preserve"><value>Dominica</value></data>
|
||||||
|
<data name="dataList.CountryCode.DNK" xml:space="preserve"><value>Denmark</value></data>
|
||||||
|
<data name="dataList.CountryCode.DOM" xml:space="preserve"><value>Dominican Republic</value></data>
|
||||||
|
<data name="dataList.CountryCode.DZA" xml:space="preserve"><value>Algeria</value></data>
|
||||||
|
<data name="dataList.CountryCode.ECU" xml:space="preserve"><value>Ecuador</value></data>
|
||||||
|
<data name="dataList.CountryCode.EGY" xml:space="preserve"><value>Egypt</value></data>
|
||||||
|
<data name="dataList.CountryCode.ERI" xml:space="preserve"><value>Eritrea</value></data>
|
||||||
|
<data name="dataList.CountryCode.ESH" xml:space="preserve"><value>Western Sahara</value></data>
|
||||||
|
<data name="dataList.CountryCode.ESP" xml:space="preserve"><value>Spain</value></data>
|
||||||
|
<data name="dataList.CountryCode.EST" xml:space="preserve"><value>Estonia</value></data>
|
||||||
|
<data name="dataList.CountryCode.ETH" xml:space="preserve"><value>Ethiopia</value></data>
|
||||||
|
<data name="dataList.CountryCode.FIN" xml:space="preserve"><value>Finland</value></data>
|
||||||
|
<data name="dataList.CountryCode.FJI" xml:space="preserve"><value>Fiji</value></data>
|
||||||
|
<data name="dataList.CountryCode.FLK" xml:space="preserve"><value>Falkland Islands (Malvinas)</value></data>
|
||||||
|
<data name="dataList.CountryCode.FRA" xml:space="preserve"><value>France</value></data>
|
||||||
|
<data name="dataList.CountryCode.FRO" xml:space="preserve"><value>Faroe Islands</value></data>
|
||||||
|
<data name="dataList.CountryCode.FSM" xml:space="preserve"><value>Micronesia, Federated States of</value></data>
|
||||||
|
<data name="dataList.CountryCode.GAB" xml:space="preserve"><value>Gabon</value></data>
|
||||||
|
<data name="dataList.CountryCode.GBR" xml:space="preserve"><value>United Kingdom of Great Britain and Northern Ireland</value></data>
|
||||||
|
<data name="dataList.CountryCode.GEO" xml:space="preserve"><value>Georgia</value></data>
|
||||||
|
<data name="dataList.CountryCode.GGY" xml:space="preserve"><value>Guernsey</value></data>
|
||||||
|
<data name="dataList.CountryCode.GHA" xml:space="preserve"><value>Ghana</value></data>
|
||||||
|
<data name="dataList.CountryCode.GIB" xml:space="preserve"><value>Gibraltar</value></data>
|
||||||
|
<data name="dataList.CountryCode.GIN" xml:space="preserve"><value>Guinea</value></data>
|
||||||
|
<data name="dataList.CountryCode.GLP" xml:space="preserve"><value>Guadeloupe</value></data>
|
||||||
|
<data name="dataList.CountryCode.GMB" xml:space="preserve"><value>Gambia</value></data>
|
||||||
|
<data name="dataList.CountryCode.GNB" xml:space="preserve"><value>Guinea-Bissau</value></data>
|
||||||
|
<data name="dataList.CountryCode.GNQ" xml:space="preserve"><value>Equatorial Guinea</value></data>
|
||||||
|
<data name="dataList.CountryCode.GRC" xml:space="preserve"><value>Greece</value></data>
|
||||||
|
<data name="dataList.CountryCode.GRD" xml:space="preserve"><value>Grenada</value></data>
|
||||||
|
<data name="dataList.CountryCode.GRL" xml:space="preserve"><value>Greenland</value></data>
|
||||||
|
<data name="dataList.CountryCode.GTM" xml:space="preserve"><value>Guatemala</value></data>
|
||||||
|
<data name="dataList.CountryCode.GUF" xml:space="preserve"><value>French Guiana</value></data>
|
||||||
|
<data name="dataList.CountryCode.GUM" xml:space="preserve"><value>Guam</value></data>
|
||||||
|
<data name="dataList.CountryCode.GUY" xml:space="preserve"><value>Guyana</value></data>
|
||||||
|
<data name="dataList.CountryCode.HKG" xml:space="preserve"><value>Hong Kong</value></data>
|
||||||
|
<data name="dataList.CountryCode.HMD" xml:space="preserve"><value>Heard Island and McDonald Islands</value></data>
|
||||||
|
<data name="dataList.CountryCode.HND" xml:space="preserve"><value>Honduras</value></data>
|
||||||
|
<data name="dataList.CountryCode.HRV" xml:space="preserve"><value>Croatia</value></data>
|
||||||
|
<data name="dataList.CountryCode.HTI" xml:space="preserve"><value>Haiti</value></data>
|
||||||
|
<data name="dataList.CountryCode.HUN" xml:space="preserve"><value>Hungary</value></data>
|
||||||
|
<data name="dataList.CountryCode.IDN" xml:space="preserve"><value>Indonesia</value></data>
|
||||||
|
<data name="dataList.CountryCode.IMN" xml:space="preserve"><value>Isle of Man</value></data>
|
||||||
|
<data name="dataList.CountryCode.IND" xml:space="preserve"><value>India</value></data>
|
||||||
|
<data name="dataList.CountryCode.IOT" xml:space="preserve"><value>British Indian Ocean Territory</value></data>
|
||||||
|
<data name="dataList.CountryCode.IRL" xml:space="preserve"><value>Ireland</value></data>
|
||||||
|
<data name="dataList.CountryCode.IRN" xml:space="preserve"><value>Iran, Islamic Republic of</value></data>
|
||||||
|
<data name="dataList.CountryCode.IRQ" xml:space="preserve"><value>Iraq</value></data>
|
||||||
|
<data name="dataList.CountryCode.ISL" xml:space="preserve"><value>Iceland</value></data>
|
||||||
|
<data name="dataList.CountryCode.ISR" xml:space="preserve"><value>Israel</value></data>
|
||||||
|
<data name="dataList.CountryCode.ITA" xml:space="preserve"><value>Italy</value></data>
|
||||||
|
<data name="dataList.CountryCode.JAM" xml:space="preserve"><value>Jamaica</value></data>
|
||||||
|
<data name="dataList.CountryCode.JEY" xml:space="preserve"><value>Jersey</value></data>
|
||||||
|
<data name="dataList.CountryCode.JOR" xml:space="preserve"><value>Jordan</value></data>
|
||||||
|
<data name="dataList.CountryCode.JPN" xml:space="preserve"><value>Japan</value></data>
|
||||||
|
<data name="dataList.CountryCode.KAZ" xml:space="preserve"><value>Kazakhstan</value></data>
|
||||||
|
<data name="dataList.CountryCode.KEN" xml:space="preserve"><value>Kenya</value></data>
|
||||||
|
<data name="dataList.CountryCode.KGZ" xml:space="preserve"><value>Kyrgyzstan</value></data>
|
||||||
|
<data name="dataList.CountryCode.KHM" xml:space="preserve"><value>Cambodia</value></data>
|
||||||
|
<data name="dataList.CountryCode.KIR" xml:space="preserve"><value>Kiribati</value></data>
|
||||||
|
<data name="dataList.CountryCode.KNA" xml:space="preserve"><value>Saint Kitts and Nevis</value></data>
|
||||||
|
<data name="dataList.CountryCode.KOR" xml:space="preserve"><value>Korea, Republic of</value></data>
|
||||||
|
<data name="dataList.CountryCode.KWT" xml:space="preserve"><value>Kuwait</value></data>
|
||||||
|
<data name="dataList.CountryCode.LAO" xml:space="preserve"><value>Lao People's Democratic Republic</value></data>
|
||||||
|
<data name="dataList.CountryCode.LBN" xml:space="preserve"><value>Lebanon</value></data>
|
||||||
|
<data name="dataList.CountryCode.LBR" xml:space="preserve"><value>Liberia</value></data>
|
||||||
|
<data name="dataList.CountryCode.LBY" xml:space="preserve"><value>Libya</value></data>
|
||||||
|
<data name="dataList.CountryCode.LCA" xml:space="preserve"><value>Saint Lucia</value></data>
|
||||||
|
<data name="dataList.CountryCode.LIE" xml:space="preserve"><value>Liechtenstein</value></data>
|
||||||
|
<data name="dataList.CountryCode.LKA" xml:space="preserve"><value>Sri Lanka</value></data>
|
||||||
|
<data name="dataList.CountryCode.LSO" xml:space="preserve"><value>Lesotho</value></data>
|
||||||
|
<data name="dataList.CountryCode.LTU" xml:space="preserve"><value>Lithuania</value></data>
|
||||||
|
<data name="dataList.CountryCode.LUX" xml:space="preserve"><value>Luxembourg</value></data>
|
||||||
|
<data name="dataList.CountryCode.LVA" xml:space="preserve"><value>Latvia</value></data>
|
||||||
|
<data name="dataList.CountryCode.MAC" xml:space="preserve"><value>Macao</value></data>
|
||||||
|
<data name="dataList.CountryCode.MAF" xml:space="preserve"><value>Saint Martin (French part)</value></data>
|
||||||
|
<data name="dataList.CountryCode.MAR" xml:space="preserve"><value>Morocco</value></data>
|
||||||
|
<data name="dataList.CountryCode.MCO" xml:space="preserve"><value>Monaco</value></data>
|
||||||
|
<data name="dataList.CountryCode.MDA" xml:space="preserve"><value>Moldova, Republic of</value></data>
|
||||||
|
<data name="dataList.CountryCode.MDG" xml:space="preserve"><value>Madagascar</value></data>
|
||||||
|
<data name="dataList.CountryCode.MDV" xml:space="preserve"><value>Maldives</value></data>
|
||||||
|
<data name="dataList.CountryCode.MEX" xml:space="preserve"><value>Mexico</value></data>
|
||||||
|
<data name="dataList.CountryCode.MHL" xml:space="preserve"><value>Marshall Islands</value></data>
|
||||||
|
<data name="dataList.CountryCode.MKD" xml:space="preserve"><value>North Macedonia</value></data>
|
||||||
|
<data name="dataList.CountryCode.MLI" xml:space="preserve"><value>Mali</value></data>
|
||||||
|
<data name="dataList.CountryCode.MLT" xml:space="preserve"><value>Malta</value></data>
|
||||||
|
<data name="dataList.CountryCode.MMR" xml:space="preserve"><value>Myanmar</value></data>
|
||||||
|
<data name="dataList.CountryCode.MNE" xml:space="preserve"><value>Montenegro</value></data>
|
||||||
|
<data name="dataList.CountryCode.MNG" xml:space="preserve"><value>Mongolia</value></data>
|
||||||
|
<data name="dataList.CountryCode.MNP" xml:space="preserve"><value>Northern Mariana Islands</value></data>
|
||||||
|
<data name="dataList.CountryCode.MOZ" xml:space="preserve"><value>Mozambique</value></data>
|
||||||
|
<data name="dataList.CountryCode.MRT" xml:space="preserve"><value>Mauritania</value></data>
|
||||||
|
<data name="dataList.CountryCode.MSR" xml:space="preserve"><value>Montserrat</value></data>
|
||||||
|
<data name="dataList.CountryCode.MTQ" xml:space="preserve"><value>Martinique</value></data>
|
||||||
|
<data name="dataList.CountryCode.MUS" xml:space="preserve"><value>Mauritius</value></data>
|
||||||
|
<data name="dataList.CountryCode.MWI" xml:space="preserve"><value>Malawi</value></data>
|
||||||
|
<data name="dataList.CountryCode.MYS" xml:space="preserve"><value>Malaysia</value></data>
|
||||||
|
<data name="dataList.CountryCode.MYT" xml:space="preserve"><value>Mayotte</value></data>
|
||||||
|
<data name="dataList.CountryCode.NAM" xml:space="preserve"><value>Namibia</value></data>
|
||||||
|
<data name="dataList.CountryCode.NCL" xml:space="preserve"><value>New Caledonia</value></data>
|
||||||
|
<data name="dataList.CountryCode.NER" xml:space="preserve"><value>Niger</value></data>
|
||||||
|
<data name="dataList.CountryCode.NFK" xml:space="preserve"><value>Norfolk Island</value></data>
|
||||||
|
<data name="dataList.CountryCode.NGA" xml:space="preserve"><value>Nigeria</value></data>
|
||||||
|
<data name="dataList.CountryCode.NIC" xml:space="preserve"><value>Nicaragua</value></data>
|
||||||
|
<data name="dataList.CountryCode.NIU" xml:space="preserve"><value>Niue</value></data>
|
||||||
|
<data name="dataList.CountryCode.NLD" xml:space="preserve"><value>Netherlands, Kingdom of the</value></data>
|
||||||
|
<data name="dataList.CountryCode.NOR" xml:space="preserve"><value>Norway</value></data>
|
||||||
|
<data name="dataList.CountryCode.NPL" xml:space="preserve"><value>Nepal</value></data>
|
||||||
|
<data name="dataList.CountryCode.NRU" xml:space="preserve"><value>Nauru</value></data>
|
||||||
|
<data name="dataList.CountryCode.NZL" xml:space="preserve"><value>New Zealand</value></data>
|
||||||
|
<data name="dataList.CountryCode.OMN" xml:space="preserve"><value>Oman</value></data>
|
||||||
|
<data name="dataList.CountryCode.PAK" xml:space="preserve"><value>Pakistan</value></data>
|
||||||
|
<data name="dataList.CountryCode.PAN" xml:space="preserve"><value>Panama</value></data>
|
||||||
|
<data name="dataList.CountryCode.PCN" xml:space="preserve"><value>Pitcairn</value></data>
|
||||||
|
<data name="dataList.CountryCode.PER" xml:space="preserve"><value>Peru</value></data>
|
||||||
|
<data name="dataList.CountryCode.PHL" xml:space="preserve"><value>Philippines</value></data>
|
||||||
|
<data name="dataList.CountryCode.PLW" xml:space="preserve"><value>Palau</value></data>
|
||||||
|
<data name="dataList.CountryCode.PNG" xml:space="preserve"><value>Papua New Guinea</value></data>
|
||||||
|
<data name="dataList.CountryCode.POL" xml:space="preserve"><value>Poland</value></data>
|
||||||
|
<data name="dataList.CountryCode.PRI" xml:space="preserve"><value>Puerto Rico</value></data>
|
||||||
|
<data name="dataList.CountryCode.PRK" xml:space="preserve"><value>Korea, Democratic People's Republic of</value></data>
|
||||||
|
<data name="dataList.CountryCode.PRT" xml:space="preserve"><value>Portugal</value></data>
|
||||||
|
<data name="dataList.CountryCode.PRY" xml:space="preserve"><value>Paraguay</value></data>
|
||||||
|
<data name="dataList.CountryCode.PSE" xml:space="preserve"><value>Palestine, State of</value></data>
|
||||||
|
<data name="dataList.CountryCode.PYF" xml:space="preserve"><value>French Polynesia</value></data>
|
||||||
|
<data name="dataList.CountryCode.QAT" xml:space="preserve"><value>Qatar</value></data>
|
||||||
|
<data name="dataList.CountryCode.REU" xml:space="preserve"><value>Réunion</value></data>
|
||||||
|
<data name="dataList.CountryCode.ROU" xml:space="preserve"><value>Romania</value></data>
|
||||||
|
<data name="dataList.CountryCode.RUS" xml:space="preserve"><value>Russian Federation</value></data>
|
||||||
|
<data name="dataList.CountryCode.RWA" xml:space="preserve"><value>Rwanda</value></data>
|
||||||
|
<data name="dataList.CountryCode.SAU" xml:space="preserve"><value>Saudi Arabia</value></data>
|
||||||
|
<data name="dataList.CountryCode.SDN" xml:space="preserve"><value>Sudan</value></data>
|
||||||
|
<data name="dataList.CountryCode.SEN" xml:space="preserve"><value>Senegal</value></data>
|
||||||
|
<data name="dataList.CountryCode.SGP" xml:space="preserve"><value>Singapore</value></data>
|
||||||
|
<data name="dataList.CountryCode.SGS" xml:space="preserve"><value>South Georgia and the South Sandwich Islands</value></data>
|
||||||
|
<data name="dataList.CountryCode.SHN" xml:space="preserve"><value>Saint Helena, Ascension and Tristan da Cunha</value></data>
|
||||||
|
<data name="dataList.CountryCode.SJM" xml:space="preserve"><value>Svalbard and Jan Mayen</value></data>
|
||||||
|
<data name="dataList.CountryCode.SLB" xml:space="preserve"><value>Solomon Islands</value></data>
|
||||||
|
<data name="dataList.CountryCode.SLE" xml:space="preserve"><value>Sierra Leone</value></data>
|
||||||
|
<data name="dataList.CountryCode.SLV" xml:space="preserve"><value>El Salvador</value></data>
|
||||||
|
<data name="dataList.CountryCode.SMR" xml:space="preserve"><value>San Marino</value></data>
|
||||||
|
<data name="dataList.CountryCode.SOM" xml:space="preserve"><value>Somalia</value></data>
|
||||||
|
<data name="dataList.CountryCode.SPM" xml:space="preserve"><value>Saint Pierre and Miquelon</value></data>
|
||||||
|
<data name="dataList.CountryCode.SRB" xml:space="preserve"><value>Serbia</value></data>
|
||||||
|
<data name="dataList.CountryCode.SSD" xml:space="preserve"><value>South Sudan</value></data>
|
||||||
|
<data name="dataList.CountryCode.STP" xml:space="preserve"><value>Sao Tome and Principe</value></data>
|
||||||
|
<data name="dataList.CountryCode.SUR" xml:space="preserve"><value>Suriname</value></data>
|
||||||
|
<data name="dataList.CountryCode.SVK" xml:space="preserve"><value>Slovakia</value></data>
|
||||||
|
<data name="dataList.CountryCode.SVN" xml:space="preserve"><value>Slovenia</value></data>
|
||||||
|
<data name="dataList.CountryCode.SWE" xml:space="preserve"><value>Sweden</value></data>
|
||||||
|
<data name="dataList.CountryCode.SWZ" xml:space="preserve"><value>Eswatini</value></data>
|
||||||
|
<data name="dataList.CountryCode.SXM" xml:space="preserve"><value>Sint Maarten (Dutch part)</value></data>
|
||||||
|
<data name="dataList.CountryCode.SYC" xml:space="preserve"><value>Seychelles</value></data>
|
||||||
|
<data name="dataList.CountryCode.SYR" xml:space="preserve"><value>Syrian Arab Republic</value></data>
|
||||||
|
<data name="dataList.CountryCode.TCA" xml:space="preserve"><value>Turks and Caicos Islands</value></data>
|
||||||
|
<data name="dataList.CountryCode.TCD" xml:space="preserve"><value>Chad</value></data>
|
||||||
|
<data name="dataList.CountryCode.TGO" xml:space="preserve"><value>Togo</value></data>
|
||||||
|
<data name="dataList.CountryCode.THA" xml:space="preserve"><value>Thailand</value></data>
|
||||||
|
<data name="dataList.CountryCode.TJK" xml:space="preserve"><value>Tajikistan</value></data>
|
||||||
|
<data name="dataList.CountryCode.TKL" xml:space="preserve"><value>Tokelau</value></data>
|
||||||
|
<data name="dataList.CountryCode.TKM" xml:space="preserve"><value>Turkmenistan</value></data>
|
||||||
|
<data name="dataList.CountryCode.TLS" xml:space="preserve"><value>Timor-Leste</value></data>
|
||||||
|
<data name="dataList.CountryCode.TON" xml:space="preserve"><value>Tonga</value></data>
|
||||||
|
<data name="dataList.CountryCode.TTO" xml:space="preserve"><value>Trinidad and Tobago</value></data>
|
||||||
|
<data name="dataList.CountryCode.TUN" xml:space="preserve"><value>Tunisia</value></data>
|
||||||
|
<data name="dataList.CountryCode.TUR" xml:space="preserve"><value>Türkiye</value></data>
|
||||||
|
<data name="dataList.CountryCode.TUV" xml:space="preserve"><value>Tuvalu</value></data>
|
||||||
|
<data name="dataList.CountryCode.TWN" xml:space="preserve"><value>Taiwan, Province of China</value></data>
|
||||||
|
<data name="dataList.CountryCode.TZA" xml:space="preserve"><value>Tanzania, United Republic of</value></data>
|
||||||
|
<data name="dataList.CountryCode.UGA" xml:space="preserve"><value>Uganda</value></data>
|
||||||
|
<data name="dataList.CountryCode.UKR" xml:space="preserve"><value>Ukraine</value></data>
|
||||||
|
<data name="dataList.CountryCode.UMI" xml:space="preserve"><value>United States Minor Outlying Islands</value></data>
|
||||||
|
<data name="dataList.CountryCode.URY" xml:space="preserve"><value>Uruguay</value></data>
|
||||||
|
<data name="dataList.CountryCode.USA" xml:space="preserve"><value>United States of America</value></data>
|
||||||
|
<data name="dataList.CountryCode.UZB" xml:space="preserve"><value>Uzbekistan</value></data>
|
||||||
|
<data name="dataList.CountryCode.VAT" xml:space="preserve"><value>Holy See</value></data>
|
||||||
|
<data name="dataList.CountryCode.VCT" xml:space="preserve"><value>Saint Vincent and the Grenadines</value></data>
|
||||||
|
<data name="dataList.CountryCode.VEN" xml:space="preserve"><value>Venezuela, Bolivarian Republic of</value></data>
|
||||||
|
<data name="dataList.CountryCode.VGB" xml:space="preserve"><value>Virgin Islands (British)</value></data>
|
||||||
|
<data name="dataList.CountryCode.VIR" xml:space="preserve"><value>Virgin Islands (U.S.)</value></data>
|
||||||
|
<data name="dataList.CountryCode.VNM" xml:space="preserve"><value>Viet Nam</value></data>
|
||||||
|
<data name="dataList.CountryCode.VUT" xml:space="preserve"><value>Vanuatu</value></data>
|
||||||
|
<data name="dataList.CountryCode.WLF" xml:space="preserve"><value>Wallis and Futuna</value></data>
|
||||||
|
<data name="dataList.CountryCode.WSM" xml:space="preserve"><value>Samoa</value></data>
|
||||||
|
<data name="dataList.CountryCode.YEM" xml:space="preserve"><value>Yemen</value></data>
|
||||||
|
<data name="dataList.CountryCode.ZAF" xml:space="preserve"><value>South Africa</value></data>
|
||||||
|
<data name="dataList.CountryCode.ZMB" xml:space="preserve"><value>Zambia</value></data>
|
||||||
|
<data name="dataList.CountryCode.ZWE" xml:space="preserve"><value>Zimbabwe</value></data>
|
||||||
|
|
||||||
|
<data name="dataList.DocumentType.DNI" xml:space="preserve"><value>DNI</value></data>
|
||||||
|
<data name="dataList.DocumentType.NIE" xml:space="preserve"><value>NIE</value></data>
|
||||||
|
<data name="dataList.DocumentType.PASSPORT" xml:space="preserve"><value>Passport</value></data>
|
||||||
|
<data name="dataList.DocumentType.ID" xml:space="preserve"><value>ID Card</value></data>
|
||||||
|
<data name="dataList.DocumentType.OTHER" xml:space="preserve"><value>Other</value></data>
|
||||||
|
|
||||||
|
<data name="dataList.GenderOption.M" xml:space="preserve"><value>Male</value></data>
|
||||||
|
<data name="dataList.GenderOption.F" xml:space="preserve"><value>Female</value></data>
|
||||||
|
<data name="dataList.GenderOption.O" xml:space="preserve"><value>Other</value></data>
|
||||||
|
|
||||||
|
<data name="dataList.PaymentMethod.EFECT" xml:space="preserve"><value>Cash</value></data>
|
||||||
|
<data name="dataList.PaymentMethod.TARJT" xml:space="preserve"><value>Card</value></data>
|
||||||
|
<data name="dataList.PaymentMethod.TRANS" xml:space="preserve"><value>Wire Transfer</value></data>
|
||||||
|
<data name="dataList.PaymentMethod.MOVIL" xml:space="preserve"><value>Phone</value></data>
|
||||||
|
<data name="dataList.PaymentMethod.OTRO" xml:space="preserve"><value>Other</value></data>
|
||||||
|
|
||||||
|
</root>
|
||||||
@@ -0,0 +1,311 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing"
|
||||||
|
mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework
|
||||||
|
object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||||
|
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0,
|
||||||
|
Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0,
|
||||||
|
Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
|
||||||
|
<data name="dto.GuestDocument.Id" xml:space="preserve"><value>ID</value></data>
|
||||||
|
<data name="dto.GuestDocument.Version" xml:space="preserve"><value>Versión</value></data>
|
||||||
|
<data name="dto.GuestDocument.DocumentType" xml:space="preserve"><value>Tipo Documento</value></data>
|
||||||
|
<data name="dto.GuestDocument.DocumentNum" xml:space="preserve"><value>Número Documento</value></data>
|
||||||
|
<data name="dto.GuestDocument.IssueDate" xml:space="preserve"><value>Fecha Emisión</value></data>
|
||||||
|
<data name="dto.GuestDocument.SupportNum" xml:space="preserve"><value>Número Soporte</value></data>
|
||||||
|
<data name="dto.GuestDocument.Nationality" xml:space="preserve"><value>Nacionalidad</value></data>
|
||||||
|
<data name="dto.GuestDocument.Name" xml:space="preserve"><value>Nombre</value></data>
|
||||||
|
<data name="dto.GuestDocument.Surname" xml:space="preserve"><value>Apellido</value></data>
|
||||||
|
<data name="dto.GuestDocument.Surname2" xml:space="preserve"><value>Apellido 2</value></data>
|
||||||
|
<data name="dto.GuestDocument.BirthDate" xml:space="preserve"><value>Fecha Nacimiento</value></data>
|
||||||
|
<data name="dto.GuestDocument.Gender" xml:space="preserve"><value>Sexo</value></data>
|
||||||
|
<data name="dto.GuestDocument.PhoneNumber" xml:space="preserve"><value>Número Teléfono</value></data>
|
||||||
|
<data name="dto.GuestDocument.EmailAddress" xml:space="preserve"><value>Correo Electrónico</value></data>
|
||||||
|
<data name="dto.GuestDocument.CreateTime" xml:space="preserve"><value>Fecha Creación</value></data>
|
||||||
|
<data name="dto.GuestDocument.UpdateTime" xml:space="preserve"><value>Fecha Modificación</value></data>
|
||||||
|
<data name="dto.GuestDocument.validation.Address" xml:space="preserve"><value>Se require al menos uno de los siguientes campos: Ciudad, Pronvincia o Región</value></data>
|
||||||
|
<data name="dto.GuestDocument.validation.Contact" xml:space="preserve"><value>Se require al menos un medio de contacto (teléfono o email)</value></data>
|
||||||
|
<data name="dto.GuestDocument.validation.FormatSupportNumDNI" xml:space="preserve"><value>Formato Inválido para DNI. Formato: 'AAA000000'</value></data>
|
||||||
|
<data name="dto.GuestDocument.validation.FormatSupportNumNIE" xml:space="preserve"><value>Formato Inválido para NIE. Formato: 'E00000000'</value></data>
|
||||||
|
|
||||||
|
<data name="dto.StayEntry.Id" xml:space="preserve"><value>Id</value></data>
|
||||||
|
<data name="dto.StayEntry.DateIn" xml:space="preserve"><value>Fecha Entrada</value></data>
|
||||||
|
<data name="dto.StayEntry.DateOut" xml:space="preserve"><value>Fecha Salida</value></data>
|
||||||
|
<data name="dto.StayEntry.RoomCount" xml:space="preserve"><value>Cantidad Habitaciones</value></data>
|
||||||
|
<data name="dto.StayEntry.RoomNumber" xml:space="preserve"><value>Número Habitaciones</value></data>
|
||||||
|
<data name="dto.StayEntry.PaymentMethod" xml:space="preserve"><value>Forma de Pago</value></data>
|
||||||
|
<data name="dto.StayEntry.GuestDocuments" xml:space="preserve"><value>Huéspedes</value></data>
|
||||||
|
<data name="dto.StayEntry.CreateTime" xml:space="preserve"><value>Fecha Creación</value></data>
|
||||||
|
<data name="dto.StayEntry.UpdateTime" xml:space="preserve"><value>Fecha Modificación</value></data>
|
||||||
|
<data name="dto.StayEntry.StayUploadStatus" xml:space="preserve"><value>Estado Envío</value></data>
|
||||||
|
<data name="dto.StayEntry.StayUploadStatusTime" xml:space="preserve"><value>Fecha Envío</value></data>
|
||||||
|
|
||||||
|
<data name="dto.StayExportFile.Id" xml:space="preserve"><value>Id</value></data>
|
||||||
|
<data name="dto.StayExportFile.ExportFormat" xml:space="preserve"><value>Formato Exportación</value></data>
|
||||||
|
<data name="dto.StayExportFile.ExportParams" xml:space="preserve"><value>Parámetros Exportación</value></data>
|
||||||
|
<data name="dto.StayExportFile.ExportResult" xml:space="preserve"><value>Resultado Exportación</value></data>
|
||||||
|
<data name="dto.StayExportFile.ExportedPath" xml:space="preserve"><value>Ruta Exportación</value></data>
|
||||||
|
<data name="dto.StayExportFile.ExportDetails" xml:space="preserve"><value>Detalles Exportación</value></data>
|
||||||
|
<data name="dto.StayExportFile.ExportTime" xml:space="preserve"><value>Fecha Exportación</value></data>
|
||||||
|
<data name="dto.StayExportFile.FileUploadStatus" xml:space="preserve"><value>Estado Envío</value></data>
|
||||||
|
<data name="dto.StayExportFile.FileUploadStatusTime" xml:space="preserve"><value>Fecha Envío</value></data>
|
||||||
|
|
||||||
|
<data name="dto.StayExportParams.ExportType" xml:space="preserve"><value>Tipo Exportación</value></data>
|
||||||
|
<data name="dto.StayExportParams.ExportPeriodStart" xml:space="preserve"><value>Fecha Desde</value></data>
|
||||||
|
<data name="dto.StayExportParams.ExportPeriodEnd" xml:space="preserve"><value>Fecha Hasta</value></data>
|
||||||
|
|
||||||
|
<data name="tmp" xml:space="preserve"><value>TMP</value></data>
|
||||||
|
|
||||||
|
<data name="general.actions" xml:space="preserve"><value>Acciones</value></data>
|
||||||
|
<data name="general.reloadData" xml:space="preserve"><value>Recargar Datos</value></data>
|
||||||
|
<data name="general.inProgressMsg" xml:space="preserve"><value>En Progreso...</value></data>
|
||||||
|
<data name="general.ConfigureColumns" xml:space="preserve"><value>Configurar Columnas</value></data>
|
||||||
|
<data name="general.confirmDeleteMsg" xml:space="preserve"><value>¡Eliminar no se puede deshacer!</value></data>
|
||||||
|
<data name="general.confirmAdvanceOperationMsg" xml:space="preserve"><value>Operación Avanzada. Sólo continuar si sabes lo que estás haciendo</value></data>
|
||||||
|
<data name="general.confirmTitle" xml:space="preserve"><value>¿Confirmar?</value></data>
|
||||||
|
<data name="general.btnDelete" xml:space="preserve"><value>Eliminar</value></data>
|
||||||
|
<data name="general.btnCreate" xml:space="preserve"><value>Crear</value></data>
|
||||||
|
<data name="general.btnEdit" xml:space="preserve"><value>Editar</value></data>
|
||||||
|
<data name="general.btnReturn" xml:space="preserve"><value>Volver</value></data>
|
||||||
|
<data name="general.btnClose" xml:space="preserve"><value>Cerrar</value></data>
|
||||||
|
<data name="general.btnSearch" xml:space="preserve"><value>Buscar</value></data>
|
||||||
|
<data name="general.btnSave" xml:space="preserve"><value>Guardar</value></data>
|
||||||
|
<data name="general.btnCancel" xml:space="preserve"><value>Cancelar</value></data>
|
||||||
|
<data name="general.btnContinue" xml:space="preserve"><value>Continuar</value></data>
|
||||||
|
<data name="general.noResults" xml:space="preserve"><value>No hay resultados</value></data>
|
||||||
|
<data name="general.showAllElements" xml:space="preserve"><value>Mostrar todos los elementos</value></data>
|
||||||
|
<data name="general.wildcardHelperText" xml:space="preserve"><value>Usa '%' como comodín</value></data>
|
||||||
|
<data name="general.dateStart" xml:space="preserve"><value>Fecha Inicio</value></data>
|
||||||
|
<data name="general.dateEnd" xml:space="preserve"><value>Fecha Fin</value></data>
|
||||||
|
<data name="general.loading" xml:space="preserve"><value>Cargando...</value></data>
|
||||||
|
<data name="general.msgEditSaved" xml:space="preserve"><value>Cambios Guardados...</value></data>
|
||||||
|
<data name="general.msgEditCanceled" xml:space="preserve"><value>¡Edición cancelada!</value></data>
|
||||||
|
<data name="general.msgOperationCanceled" xml:space="preserve"><value>¡Operación Cancelada!</value></data>
|
||||||
|
<data name="general.msgEditEnabled" xml:space="preserve"><value>Se ha entrado en modo edición</value></data>
|
||||||
|
<data name="general.msgConfirmSaveEdit" xml:space="preserve"><value>¿Guardar los cambios?</value></data>
|
||||||
|
<data name="general.msgConfirmCancelEdit" xml:space="preserve"><value>¿Desea cancelar y salir sin guardar?. ¡Se perderán los cambios!</value></data>
|
||||||
|
<data name="general.msgEditError" xml:space="preserve"><value>Error al guardar los cambios para la entidad '{0}'</value></data>
|
||||||
|
<data name="general.msgUnknownError" xml:space="preserve"><value>Se ha producido un error inesperado</value></data>
|
||||||
|
<data name="general.languageSelector" xml:space="preserve"><value>Idioma</value></data>
|
||||||
|
|
||||||
|
<data name="general.address.address" xml:space="preserve"><value>Dirección</value></data>
|
||||||
|
<data name="general.address.city" xml:space="preserve"><value>Ciudad</value></data>
|
||||||
|
<data name="general.address.province" xml:space="preserve"><value>Provincia</value></data>
|
||||||
|
<data name="general.address.state" xml:space="preserve"><value>Región</value></data>
|
||||||
|
<data name="general.address.country" xml:space="preserve"><value>País</value></data>
|
||||||
|
<data name="general.address.zipCode" xml:space="preserve"><value>Código Postal</value></data>
|
||||||
|
|
||||||
|
<data name="general.validation.invalidFormat" xml:space="preserve"><value>Formato invalido</value></data>
|
||||||
|
<data name="general.validation.invalidForm" xml:space="preserve"><value>El formulario tiene errores</value></data>
|
||||||
|
<data name="general.validation.invalidOption" xml:space="preserve"><value>Opción inválida</value></data>
|
||||||
|
|
||||||
|
<!-- Common codes -->
|
||||||
|
<data name="enum.ResultCode.Ok" xml:space="preserve"><value>OK</value></data>
|
||||||
|
<data name="enum.ResultCode.UnknownError" xml:space="preserve"><value>Error desconocido</value></data>
|
||||||
|
<data name="enum.ResultCode.FailedValidation" xml:space="preserve"><value>Fallo de validación de datos</value></data>
|
||||||
|
<data name="enum.ResultCode.NotFound" xml:space="preserve"><value>¡No encontrado!</value></data>
|
||||||
|
<data name="enum.ResultCode.FileStorageError" xml:space="preserve"><value>Error de almacenamiento de ficheros</value></data>
|
||||||
|
<data name="enum.ResultCode.NoPendingChanges" xml:space="preserve"><value>Sin cambios pendientes</value></data>
|
||||||
|
<data name="enum.ResultCode.DataIsFinal" xml:space="preserve"><value>Datos finales. No se pueden editar o eliminar</value></data>
|
||||||
|
<!-- Specific codes -->
|
||||||
|
<data name="enum.ResultCode.GuestInStay" xml:space="preserve"><value>Huésped (ID: '{0}') está en una Estancia.</value></data>
|
||||||
|
<data name="enum.ResultCode.GuestCurrentlyInStay" xml:space="preserve"><value>Huésped (ID: '{0}') ya está en una estancia en el periodo: {1}</value></data>
|
||||||
|
<data name="enum.ResultCode.UploadStatusIsFinal" xml:space="preserve"><value>El estado de envío actual ('{0}') es final y no se puede cambiar</value></data>
|
||||||
|
|
||||||
|
<data name="enum.StayExportFileResult.OK" xml:space="preserve"><value>OK</value></data>
|
||||||
|
<data name="enum.StayExportFileResult.NoData" xml:space="preserve"><value>Sin datos</value></data>
|
||||||
|
<data name="enum.StayExportFileResult.ExportError" xml:space="preserve"><value>Error de Exportación</value></data>
|
||||||
|
<data name="enum.StayExportFileResult.UploadError" xml:space="preserve"><value>Error de ficheros</value></data>
|
||||||
|
|
||||||
|
<data name="enum.StayExportFormat.GuestLogJson" xml:space="preserve"><value>GuestLog JSON</value></data>
|
||||||
|
<data name="enum.StayExportFormat.SpainParteViajeros" xml:space="preserve"><value>Spain Parte Viajeros</value></data>
|
||||||
|
|
||||||
|
<data name="enum.StayExportParamType.PeriodDateIn" xml:space="preserve"><value>'Fecha Entrada' Estancia</value></data>
|
||||||
|
<data name="enum.StayExportParamType.UploadPending" xml:space="preserve"><value>Estancias pendientes de envío</value></data>
|
||||||
|
|
||||||
|
<data name="enum.UploadStatus.Pending" xml:space="preserve"><value>Pendiente</value></data>
|
||||||
|
<data name="enum.UploadStatus.Uploaded" xml:space="preserve"><value>Enviado</value></data>
|
||||||
|
<data name="enum.UploadStatus.Skipped" xml:space="preserve"><value>Omitido</value></data>
|
||||||
|
|
||||||
|
|
||||||
|
<data name="navMenu.GuestDocumentList" xml:space="preserve"><value>Huéspedes</value></data>
|
||||||
|
<data name="navMenu.StayEntryList" xml:space="preserve"><value>Estancias</value></data>
|
||||||
|
<data name="navMenu.StayExport" xml:space="preserve"><value>Exportación de Estancias</value></data>
|
||||||
|
|
||||||
|
|
||||||
|
<data name="page.GuestDocList.pageTitle" xml:space="preserve"><value>Documentos Huéspedes</value></data>
|
||||||
|
<data name="page.GuestDocList.documentList" xml:space="preserve"><value>Lista de Documentos</value></data>
|
||||||
|
<data name="page.GuestDocList.btnNewGuest" xml:space="preserve"><value>Nuevo Huésped</value></data>
|
||||||
|
|
||||||
|
<data name="page.GuestDocNew.msgAlreadyExists" xml:space="preserve"><value>¡Ya existe un huésped con este documento!</value></data>
|
||||||
|
<data name="page.GuestDocNew.btnGoExistingDoc" xml:space="preserve"><value>Ver huésped existente</value></data>
|
||||||
|
|
||||||
|
<data name="page.StayEntryList.pageTitle" xml:space="preserve"><value>Lista Estancias</value></data>
|
||||||
|
<data name="page.StayEntryList.entryList" xml:space="preserve"><value>Lista Estancias</value></data>
|
||||||
|
<data name="page.StayEntryList.btnNewStay" xml:space="preserve"><value>Nueva Estancia</value></data>
|
||||||
|
<data name="page.StayEntryList.msgDeleteUploadedStay" xml:space="preserve"><value>No se puede eliminar una estancia que ha sido enviada</value></data>
|
||||||
|
<data name="page.StayEntryList.btnUpdateUploadStatus" xml:space="preserve"><value>Modificar Estado de envío</value></data>
|
||||||
|
|
||||||
|
<data name="page.StayEntryDetail.pageTitle" xml:space="preserve"><value>Estancia</value></data>
|
||||||
|
<data name="page.StayEntryDetail.cantEditFinalData" xml:space="preserve"><value>Esta estancia no se puede editar: Ya ha sido enviada</value></data>
|
||||||
|
<data name="page.StayEntryDetail.uploadStatusSuccessMsg" xml:space="preserve"><value>Estado de envío modificado. Nuevo estado: '{0}'</value></data>
|
||||||
|
|
||||||
|
<data name="page.StayEntryNew.pageTitle" xml:space="preserve"><value>Nueva Estancia</value></data>
|
||||||
|
|
||||||
|
<data name="page.StayExportList.pageTitle" xml:space="preserve"><value>Exportación de Estancias</value></data>
|
||||||
|
<data name="page.StayExportList.exportList" xml:space="preserve"><value>Listado de Exportaciones</value></data>
|
||||||
|
<data name="page.StayExportList.btnNewExport" xml:space="preserve"><value>Nueva Exportación</value></data>
|
||||||
|
<data name="page.StayExportList.msgDeleteUploadedFile" xml:space="preserve"><value>No se puede eliminar una exporación que ha sido enviada</value></data>
|
||||||
|
<data name="page.StayExportList.editUploadStatus.msgNotPending" xml:space="preserve"><value>El estado de envío sólo se puede modificar en ficheros con estado "Pendiente"</value></data>
|
||||||
|
<data name="page.StayExportList.editUploadStatus.msgConfirm" xml:space="preserve"><value>Seguro que desea actualizar el estado de envío del fichero de exportación ID: '{0}' a estado '{1}'. ¡Esta operación es definitiva y NO se puede deshacer! ¡El estado de envío de las estancias exportadas también será actualidado!</value></data>
|
||||||
|
<data name="page.StayExportList.editUploadStatus.msgEditSuccess" xml:space="preserve"><value>Fichero Exportación (ID: '{0}'): Estado de envío actualizado al estado: '{1}'</value></data>
|
||||||
|
|
||||||
|
<data name="page.StayExportNew.pageTitle" xml:space="preserve"><value>Nueva Exportación de Estancias</value></data>
|
||||||
|
<data name="page.StayExportNew.chkShowPeriodFields" xml:space="preserve"><value>Establecer rango de fechas</value></data>
|
||||||
|
<data name="page.StayExportNew.msgExportOk" xml:space="preserve"><value>Exportación completada con resultado: {0}</value></data>
|
||||||
|
<data name="page.StayExportNew.msgDownloadError" xml:space="preserve"><value>Error al descargar el fichero</value></data>
|
||||||
|
<data name="page.StayExportNew.msgDownloadErrorNoFile" xml:space="preserve"><value>No se puede descargar el fichero: Esta exportación no tiene un fichero asociado</value></data>
|
||||||
|
<data name="page.StayExportNew.msgDownloadOk" xml:space="preserve"><value>Fichero descargado</value></data>
|
||||||
|
|
||||||
|
|
||||||
|
<data name="control.GuestDocForm.sectionDocument" xml:space="preserve"><value>Datos Documento</value></data>
|
||||||
|
<data name="control.GuestDocForm.sectionGuest" xml:space="preserve"><value>Datos Huésped</value></data>
|
||||||
|
<data name="control.GuestDocForm.sectionContact" xml:space="preserve"><value>Datos de contacto</value></data>
|
||||||
|
<data name="control.GuestDocForm.sectionAddress" xml:space="preserve"><value>Datos Dirección</value></data>
|
||||||
|
<data name="control.GuestDocForm.btnSearchAddress" xml:space="preserve"><value>Buscar Dirección</value></data>
|
||||||
|
|
||||||
|
<data name="control.StayEntryForm.sectionDetails" xml:space="preserve"><value>Detalles estancia</value></data>
|
||||||
|
<data name="control.StayEntryForm.sectionGuests" xml:space="preserve"><value>Lista de Huéspedes</value></data>
|
||||||
|
<data name="control.StayEntryForm.sectionUploadStatus" xml:space="preserve"><value>Estado de envío</value></data>
|
||||||
|
<data name="control.StayEntryForm.btnAddGuest" xml:space="preserve"><value>Añadir Huésped</value></data>
|
||||||
|
|
||||||
|
<data name="control.AddressQueryDialog.dialogTitle" xml:space="preserve"><value>Buscar dirección</value></data>
|
||||||
|
<data name="control.AddressQueryDialog.searchText" xml:space="preserve"><value>Buscar dirección</value></data>
|
||||||
|
<data name="control.AddressQueryDialog.btnSearch" xml:space="preserve"><value>Buscar dirección</value></data>
|
||||||
|
<data name="control.AddressQueryDialog.btnSelectAddress" xml:space="preserve"><value>Usar dirección</value></data>
|
||||||
|
|
||||||
|
<data name="control.GuestDocumentSearchDialog.dialogTitle" xml:space="preserve"><value>Buscar Huésped</value></data>
|
||||||
|
<data name="control.GuestDocumentSearchDialog.btnSelectDocument" xml:space="preserve"><value>Usar Huésped</value></data>
|
||||||
|
<data name="control.GuestDocumentSearchDialog.txtSuggestedGuests" xml:space="preserve"><value>Huéspedes sugeridos</value></data>
|
||||||
|
|
||||||
|
<data name="control.UploadStatusSelectorDialog.dialogTitle" xml:space="preserve"><value>Modificar estado de envío</value></data>
|
||||||
|
<data name="control.UploadStatusSelectorDialog.lbCurrentStatus" xml:space="preserve"><value>Estado de envío actual</value></data>
|
||||||
|
<data name="control.UploadStatusSelectorDialog.lbSelectStatus" xml:space="preserve"><value>Nuevo estado de envío</value></data>
|
||||||
|
|
||||||
|
</root>
|
||||||
@@ -0,0 +1,311 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing"
|
||||||
|
mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework
|
||||||
|
object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||||
|
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0,
|
||||||
|
Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0,
|
||||||
|
Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
|
||||||
|
<data name="dto.GuestDocument.Id" xml:space="preserve"><value>ID</value></data>
|
||||||
|
<data name="dto.GuestDocument.Version" xml:space="preserve"><value>Version</value></data>
|
||||||
|
<data name="dto.GuestDocument.DocumentType" xml:space="preserve"><value>Document Type</value></data>
|
||||||
|
<data name="dto.GuestDocument.DocumentNum" xml:space="preserve"><value>Document Number</value></data>
|
||||||
|
<data name="dto.GuestDocument.IssueDate" xml:space="preserve"><value>Issue Date</value></data>
|
||||||
|
<data name="dto.GuestDocument.SupportNum" xml:space="preserve"><value>Support Number</value></data>
|
||||||
|
<data name="dto.GuestDocument.Nationality" xml:space="preserve"><value>Nationality</value></data>
|
||||||
|
<data name="dto.GuestDocument.Name" xml:space="preserve"><value>Name</value></data>
|
||||||
|
<data name="dto.GuestDocument.Surname" xml:space="preserve"><value>Surname</value></data>
|
||||||
|
<data name="dto.GuestDocument.Surname2" xml:space="preserve"><value>Surname 2</value></data>
|
||||||
|
<data name="dto.GuestDocument.BirthDate" xml:space="preserve"><value>Birth Date</value></data>
|
||||||
|
<data name="dto.GuestDocument.Gender" xml:space="preserve"><value>Gender</value></data>
|
||||||
|
<data name="dto.GuestDocument.PhoneNumber" xml:space="preserve"><value>Phone Number</value></data>
|
||||||
|
<data name="dto.GuestDocument.EmailAddress" xml:space="preserve"><value>Email Address</value></data>
|
||||||
|
<data name="dto.GuestDocument.CreateTime" xml:space="preserve"><value>Creation Time</value></data>
|
||||||
|
<data name="dto.GuestDocument.UpdateTime" xml:space="preserve"><value>Update Time</value></data>
|
||||||
|
<data name="dto.GuestDocument.validation.Address" xml:space="preserve"><value>Is required at least one of the following fields: City, County or State</value></data>
|
||||||
|
<data name="dto.GuestDocument.validation.Contact" xml:space="preserve"><value>At least 1 contact field (phone or email) is required!</value></data>
|
||||||
|
<data name="dto.GuestDocument.validation.FormatSupportNumDNI" xml:space="preserve"><value>Invalid Format for DNI. Expected 'AAA000000'</value></data>
|
||||||
|
<data name="dto.GuestDocument.validation.FormatSupportNumNIE" xml:space="preserve"><value>Invalid Format for NIE. Expected 'E00000000'</value></data>
|
||||||
|
|
||||||
|
<data name="dto.StayEntry.Id" xml:space="preserve"><value>Id</value></data>
|
||||||
|
<data name="dto.StayEntry.DateIn" xml:space="preserve"><value>Date In</value></data>
|
||||||
|
<data name="dto.StayEntry.DateOut" xml:space="preserve"><value>Date Out</value></data>
|
||||||
|
<data name="dto.StayEntry.RoomCount" xml:space="preserve"><value>Room Count</value></data>
|
||||||
|
<data name="dto.StayEntry.RoomNumber" xml:space="preserve"><value>Room Number</value></data>
|
||||||
|
<data name="dto.StayEntry.PaymentMethod" xml:space="preserve"><value>Payment Method</value></data>
|
||||||
|
<data name="dto.StayEntry.GuestDocuments" xml:space="preserve"><value>Guests</value></data>
|
||||||
|
<data name="dto.StayEntry.CreateTime" xml:space="preserve"><value>Creation Time</value></data>
|
||||||
|
<data name="dto.StayEntry.UpdateTime" xml:space="preserve"><value>Update Time</value></data>
|
||||||
|
<data name="dto.StayEntry.StayUploadStatus" xml:space="preserve"><value>Upload Status</value></data>
|
||||||
|
<data name="dto.StayEntry.StayUploadStatusTime" xml:space="preserve"><value>Upload Status Time</value></data>
|
||||||
|
|
||||||
|
<data name="dto.StayExportFile.Id" xml:space="preserve"><value>Id</value></data>
|
||||||
|
<data name="dto.StayExportFile.ExportFormat" xml:space="preserve"><value>Export Format</value></data>
|
||||||
|
<data name="dto.StayExportFile.ExportParams" xml:space="preserve"><value>Export Params</value></data>
|
||||||
|
<data name="dto.StayExportFile.ExportResult" xml:space="preserve"><value>Export Result</value></data>
|
||||||
|
<data name="dto.StayExportFile.ExportedPath" xml:space="preserve"><value>Export Path</value></data>
|
||||||
|
<data name="dto.StayExportFile.ExportDetails" xml:space="preserve"><value>Export Details</value></data>
|
||||||
|
<data name="dto.StayExportFile.ExportTime" xml:space="preserve"><value>Export Time</value></data>
|
||||||
|
<data name="dto.StayExportFile.FileUploadStatus" xml:space="preserve"><value>Upload Status</value></data>
|
||||||
|
<data name="dto.StayExportFile.FileUploadStatusTime" xml:space="preserve"><value>Upload Status Time</value></data>
|
||||||
|
|
||||||
|
<data name="dto.StayExportParams.ExportType" xml:space="preserve"><value>Export Type</value></data>
|
||||||
|
<data name="dto.StayExportParams.ExportPeriodStart" xml:space="preserve"><value>Date From</value></data>
|
||||||
|
<data name="dto.StayExportParams.ExportPeriodEnd" xml:space="preserve"><value>Date To</value></data>
|
||||||
|
|
||||||
|
<data name="tmp" xml:space="preserve"><value>TMP</value></data>
|
||||||
|
|
||||||
|
<data name="general.actions" xml:space="preserve"><value>Actions</value></data>
|
||||||
|
<data name="general.reloadData" xml:space="preserve"><value>Reload Data</value></data>
|
||||||
|
<data name="general.inProgressMsg" xml:space="preserve"><value>In Progress...</value></data>
|
||||||
|
<data name="general.ConfigureColumns" xml:space="preserve"><value>Configure Columns</value></data>
|
||||||
|
<data name="general.confirmDeleteMsg" xml:space="preserve"><value>Deleting can not be undone!</value></data>
|
||||||
|
<data name="general.confirmAdvanceOperationMsg" xml:space="preserve"><value>Advanced operation. Only proceed if you know what you are doing</value></data>
|
||||||
|
<data name="general.confirmTitle" xml:space="preserve"><value>Confirm?</value></data>
|
||||||
|
<data name="general.btnDelete" xml:space="preserve"><value>Delete</value></data>
|
||||||
|
<data name="general.btnCreate" xml:space="preserve"><value>Create</value></data>
|
||||||
|
<data name="general.btnEdit" xml:space="preserve"><value>Edit</value></data>
|
||||||
|
<data name="general.btnReturn" xml:space="preserve"><value>Return</value></data>
|
||||||
|
<data name="general.btnClose" xml:space="preserve"><value>Close</value></data>
|
||||||
|
<data name="general.btnSearch" xml:space="preserve"><value>Search</value></data>
|
||||||
|
<data name="general.btnSave" xml:space="preserve"><value>Save</value></data>
|
||||||
|
<data name="general.btnCancel" xml:space="preserve"><value>Cancel</value></data>
|
||||||
|
<data name="general.btnContinue" xml:space="preserve"><value>Continue</value></data>
|
||||||
|
<data name="general.noResults" xml:space="preserve"><value>No Results!</value></data>
|
||||||
|
<data name="general.showAllElements" xml:space="preserve"><value>Show all elements</value></data>
|
||||||
|
<data name="general.wildcardHelperText" xml:space="preserve"><value>Use '%' as wildcard</value></data>
|
||||||
|
<data name="general.dateStart" xml:space="preserve"><value>Date Start</value></data>
|
||||||
|
<data name="general.dateEnd" xml:space="preserve"><value>Date End</value></data>
|
||||||
|
<data name="general.loading" xml:space="preserve"><value>Loading...</value></data>
|
||||||
|
<data name="general.msgEditSaved" xml:space="preserve"><value>Changes saved...</value></data>
|
||||||
|
<data name="general.msgEditCanceled" xml:space="preserve"><value>Edit Canceled!</value></data>
|
||||||
|
<data name="general.msgOperationCanceled" xml:space="preserve"><value>Operation Canceled!</value></data>
|
||||||
|
<data name="general.msgEditEnabled" xml:space="preserve"><value>Entered Edit mode</value></data>
|
||||||
|
<data name="general.msgConfirmSaveEdit" xml:space="preserve"><value>Save changes</value></data>
|
||||||
|
<data name="general.msgConfirmCancelEdit" xml:space="preserve"><value>Cancel edit. Changes will be lost!</value></data>
|
||||||
|
<data name="general.msgEditError" xml:space="preserve"><value>Error saving changes to db for entity '{0}'</value></data>
|
||||||
|
<data name="general.msgUnknownError" xml:space="preserve"><value>Unknown error!</value></data>
|
||||||
|
<data name="general.languageSelector" xml:space="preserve"><value>Language</value></data>
|
||||||
|
|
||||||
|
<data name="general.address.address" xml:space="preserve"><value>Address</value></data>
|
||||||
|
<data name="general.address.city" xml:space="preserve"><value>City</value></data>
|
||||||
|
<data name="general.address.province" xml:space="preserve"><value>County</value></data>
|
||||||
|
<data name="general.address.state" xml:space="preserve"><value>State</value></data>
|
||||||
|
<data name="general.address.country" xml:space="preserve"><value>Country</value></data>
|
||||||
|
<data name="general.address.zipCode" xml:space="preserve"><value>Zip Code</value></data>
|
||||||
|
|
||||||
|
<data name="general.validation.invalidFormat" xml:space="preserve"><value>Invalid Format</value></data>
|
||||||
|
<data name="general.validation.invalidForm" xml:space="preserve"><value>Invalid Form</value></data>
|
||||||
|
<data name="general.validation.invalidOption" xml:space="preserve"><value>Invalid Option</value></data>
|
||||||
|
|
||||||
|
<!-- Common codes -->
|
||||||
|
<data name="enum.ResultCode.Ok" xml:space="preserve"><value>OK</value></data>
|
||||||
|
<data name="enum.ResultCode.UnknownError" xml:space="preserve"><value>Unknown Error</value></data>
|
||||||
|
<data name="enum.ResultCode.FailedValidation" xml:space="preserve"><value>Failed entity validation</value></data>
|
||||||
|
<data name="enum.ResultCode.NotFound" xml:space="preserve"><value>Not found</value></data>
|
||||||
|
<data name="enum.ResultCode.FileStorageError" xml:space="preserve"><value>File Storage Error</value></data>
|
||||||
|
<data name="enum.ResultCode.NoPendingChanges" xml:space="preserve"><value>No pending changes to apply</value></data>
|
||||||
|
<data name="enum.ResultCode.DataIsFinal" xml:space="preserve"><value>Data is final. Can't be modified or deleted</value></data>
|
||||||
|
<!-- Specific codes -->
|
||||||
|
<data name="enum.ResultCode.GuestInStay" xml:space="preserve"><value>Guest (ID: '{0}') is in a stay.</value></data>
|
||||||
|
<data name="enum.ResultCode.GuestCurrentlyInStay" xml:space="preserve"><value>Guest (ID: '{0}') is already in one stay during the period: {1}</value></data>
|
||||||
|
<data name="enum.ResultCode.UploadStatusIsFinal" xml:space="preserve"><value>Current upload status ('{0}') is final and can't be changed</value></data>
|
||||||
|
|
||||||
|
<data name="enum.StayExportFileResult.OK" xml:space="preserve"><value>OK</value></data>
|
||||||
|
<data name="enum.StayExportFileResult.NoData" xml:space="preserve"><value>No Data</value></data>
|
||||||
|
<data name="enum.StayExportFileResult.ExportError" xml:space="preserve"><value>Export Error</value></data>
|
||||||
|
<data name="enum.StayExportFileResult.UploadError" xml:space="preserve"><value>File Error</value></data>
|
||||||
|
|
||||||
|
<data name="enum.StayExportFormat.GuestLogJson" xml:space="preserve"><value>GuestLog JSON</value></data>
|
||||||
|
<data name="enum.StayExportFormat.SpainParteViajeros" xml:space="preserve"><value>Spain Parte Viajeros</value></data>
|
||||||
|
|
||||||
|
<data name="enum.StayExportParamType.PeriodDateIn" xml:space="preserve"><value>Stay 'Date In' Period</value></data>
|
||||||
|
<data name="enum.StayExportParamType.UploadPending" xml:space="preserve"><value>Upload Pending Stays</value></data>
|
||||||
|
|
||||||
|
<data name="enum.UploadStatus.Pending" xml:space="preserve"><value>Pending</value></data>
|
||||||
|
<data name="enum.UploadStatus.Uploaded" xml:space="preserve"><value>Uploaded</value></data>
|
||||||
|
<data name="enum.UploadStatus.Skipped" xml:space="preserve"><value>Skipped</value></data>
|
||||||
|
|
||||||
|
|
||||||
|
<data name="navMenu.GuestDocumentList" xml:space="preserve"><value>Guests</value></data>
|
||||||
|
<data name="navMenu.StayEntryList" xml:space="preserve"><value>Stays</value></data>
|
||||||
|
<data name="navMenu.StayExport" xml:space="preserve"><value>Stay Export</value></data>
|
||||||
|
|
||||||
|
|
||||||
|
<data name="page.GuestDocList.pageTitle" xml:space="preserve"><value>Guest Documents</value></data>
|
||||||
|
<data name="page.GuestDocList.documentList" xml:space="preserve"><value>Document List</value></data>
|
||||||
|
<data name="page.GuestDocList.btnNewGuest" xml:space="preserve"><value>New Guest</value></data>
|
||||||
|
|
||||||
|
<data name="page.GuestDocNew.msgAlreadyExists" xml:space="preserve"><value>This Guest Document Already exists!!</value></data>
|
||||||
|
<data name="page.GuestDocNew.btnGoExistingDoc" xml:space="preserve"><value>Go to existing document</value></data>
|
||||||
|
|
||||||
|
<data name="page.StayEntryList.pageTitle" xml:space="preserve"><value>Stay Entries</value></data>
|
||||||
|
<data name="page.StayEntryList.entryList" xml:space="preserve"><value>Entry List</value></data>
|
||||||
|
<data name="page.StayEntryList.btnNewStay" xml:space="preserve"><value>New Stay</value></data>
|
||||||
|
<data name="page.StayEntryList.msgDeleteUploadedStay" xml:space="preserve"><value>A StayEntry can't be deleted after it has been uploaded!</value></data>
|
||||||
|
<data name="page.StayEntryList.btnUpdateUploadStatus" xml:space="preserve"><value>Update Upload Status</value></data>
|
||||||
|
|
||||||
|
<data name="page.StayEntryDetail.pageTitle" xml:space="preserve"><value>Stay Entry</value></data>
|
||||||
|
<data name="page.StayEntryDetail.cantEditFinalData" xml:space="preserve"><value>Stay can't be edited: it's already uploaded!</value></data>
|
||||||
|
<data name="page.StayEntryDetail.uploadStatusSuccessMsg" xml:space="preserve"><value>Upload status updated. New Status: '{0}'</value></data>
|
||||||
|
|
||||||
|
<data name="page.StayEntryNew.pageTitle" xml:space="preserve"><value>New Stay</value></data>
|
||||||
|
|
||||||
|
<data name="page.StayExportList.pageTitle" xml:space="preserve"><value>Stay Export Files</value></data>
|
||||||
|
<data name="page.StayExportList.exportList" xml:space="preserve"><value>Export List</value></data>
|
||||||
|
<data name="page.StayExportList.btnNewExport" xml:space="preserve"><value>New Export</value></data>
|
||||||
|
<data name="page.StayExportList.msgDeleteUploadedFile" xml:space="preserve"><value>A uploaded file can't be deleted!</value></data>
|
||||||
|
<data name="page.StayExportList.editUploadStatus.msgNotPending" xml:space="preserve"><value>Upload status only can be edited for "pending" files!</value></data>
|
||||||
|
<data name="page.StayExportList.editUploadStatus.msgConfirm" xml:space="preserve"><value>Are you sure you want to change upload status for Export file ID: '{0}' to '{1}'. This operation can't be undone! Exported Stay entries will update as well!</value></data>
|
||||||
|
<data name="page.StayExportList.editUploadStatus.msgEditSuccess" xml:space="preserve"><value>ExportFile (ID: '{0}'): Upload status updated to '{1}'</value></data>
|
||||||
|
|
||||||
|
<data name="page.StayExportNew.pageTitle" xml:space="preserve"><value>New Stay Export</value></data>
|
||||||
|
<data name="page.StayExportNew.chkShowPeriodFields" xml:space="preserve"><value>Use custom date range</value></data>
|
||||||
|
<data name="page.StayExportNew.msgExportOk" xml:space="preserve"><value>Stay export completed with result: {0}</value></data>
|
||||||
|
<data name="page.StayExportNew.msgDownloadError" xml:space="preserve"><value>Error downloading export file</value></data>
|
||||||
|
<data name="page.StayExportNew.msgDownloadErrorNoFile" xml:space="preserve"><value>Export file can't be downloaded: no file associated with the export</value></data>
|
||||||
|
<data name="page.StayExportNew.msgDownloadOk" xml:space="preserve"><value>Export file downloaded</value></data>
|
||||||
|
|
||||||
|
|
||||||
|
<data name="control.GuestDocForm.sectionDocument" xml:space="preserve"><value>Document Details</value></data>
|
||||||
|
<data name="control.GuestDocForm.sectionGuest" xml:space="preserve"><value>Guest Details</value></data>
|
||||||
|
<data name="control.GuestDocForm.sectionContact" xml:space="preserve"><value>Contact Details</value></data>
|
||||||
|
<data name="control.GuestDocForm.sectionAddress" xml:space="preserve"><value>Guest Address</value></data>
|
||||||
|
<data name="control.GuestDocForm.btnSearchAddress" xml:space="preserve"><value>Search Address</value></data>
|
||||||
|
|
||||||
|
<data name="control.StayEntryForm.sectionDetails" xml:space="preserve"><value>Stay Details</value></data>
|
||||||
|
<data name="control.StayEntryForm.sectionGuests" xml:space="preserve"><value>Guest List</value></data>
|
||||||
|
<data name="control.StayEntryForm.sectionUploadStatus" xml:space="preserve"><value>Upload Status</value></data>
|
||||||
|
<data name="control.StayEntryForm.btnAddGuest" xml:space="preserve"><value>Add Guest</value></data>
|
||||||
|
|
||||||
|
<data name="control.AddressQueryDialog.dialogTitle" xml:space="preserve"><value>Search Address</value></data>
|
||||||
|
<data name="control.AddressQueryDialog.searchText" xml:space="preserve"><value>Search Address</value></data>
|
||||||
|
<data name="control.AddressQueryDialog.btnSearch" xml:space="preserve"><value>Search Address</value></data>
|
||||||
|
<data name="control.AddressQueryDialog.btnSelectAddress" xml:space="preserve"><value>Use Address</value></data>
|
||||||
|
|
||||||
|
<data name="control.GuestDocumentSearchDialog.dialogTitle" xml:space="preserve"><value>Search Guest Document</value></data>
|
||||||
|
<data name="control.GuestDocumentSearchDialog.btnSelectDocument" xml:space="preserve"><value>Use Guest</value></data>
|
||||||
|
<data name="control.GuestDocumentSearchDialog.txtSuggestedGuests" xml:space="preserve"><value>Suggested Guests</value></data>
|
||||||
|
|
||||||
|
<data name="control.UploadStatusSelectorDialog.dialogTitle" xml:space="preserve"><value>Edit Upload Status</value></data>
|
||||||
|
<data name="control.UploadStatusSelectorDialog.lbCurrentStatus" xml:space="preserve"><value>Current Upload Status</value></data>
|
||||||
|
<data name="control.UploadStatusSelectorDialog.lbSelectStatus" xml:space="preserve"><value>New Upload Status</value></data>
|
||||||
|
|
||||||
|
</root>
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
using Somnia.GuestLog.Enums.Services;
|
||||||
|
using Somnia.GuestLog.Models.Configuration;
|
||||||
|
using Somnia.GuestLog.Utils.DI;
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Services.AddressQuery;
|
||||||
|
|
||||||
|
public class ConfigFileAddressQueryFactory(
|
||||||
|
IServiceProvider serviceProvider,
|
||||||
|
IOptions<AddressQueryConfig> config
|
||||||
|
) : IAddressQueryFactory, IFactoryDI
|
||||||
|
{
|
||||||
|
public static void RegisterFactoryItems(IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddKeyedTransient<IAddressQueryService, NominatimAddressQueryService>(AddressQueryProvider.Nominatim);
|
||||||
|
services.AddKeyedTransient<IAddressQueryService, GoogleApiAddressQueryService>(AddressQueryProvider.GoogleApiV4);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IAddressQueryService GetService()
|
||||||
|
{
|
||||||
|
if (config.Value.EnableAddressQuery == false)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("AddressQuery is disabled. Enable and configure it first!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return serviceProvider.GetKeyedService<IAddressQueryService>(config.Value.Provider)
|
||||||
|
?? throw new InvalidOperationException($"AddressQueryService not found for provider: '{config.Value.Provider}'");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
using Microsoft.AspNetCore.WebUtilities;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
using Somnia.GuestLog.Models.Configuration;
|
||||||
|
using Somnia.GuestLog.Models.DTOs;
|
||||||
|
using Somnia.GuestLog.Utils;
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Services.AddressQuery;
|
||||||
|
|
||||||
|
public class GoogleApiAddressQueryService(
|
||||||
|
IHttpClientFactory httpClientFactory,
|
||||||
|
ILogger<GoogleApiAddressQueryService> logger,
|
||||||
|
IOptions<AddressQueryConfig> configOptions
|
||||||
|
) : IAddressQueryService
|
||||||
|
{
|
||||||
|
private const string defaultBaseAddr = "https://geocode.googleapis.com/v4/";
|
||||||
|
private const string defaultUserAgent = "Somnia-GuestLog";
|
||||||
|
private const string apiUri = "geocode/address/";
|
||||||
|
|
||||||
|
private readonly AddressQueryConfig config = configOptions.Value;
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<List<AddressResultDTO>> SearchAddressAsync(string query)
|
||||||
|
{
|
||||||
|
var http = GetHttpClient();
|
||||||
|
List<AddressResultDTO> rsList = [];
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string uri = GetRequestUri(query);
|
||||||
|
GeocodeAddressResponse? apiList = await http.GetFromJsonAsync<GeocodeAddressResponse>(uri)
|
||||||
|
?? throw new InvalidOperationException("Response without results??");
|
||||||
|
|
||||||
|
foreach (GeocodeResult result in apiList.Results)
|
||||||
|
{
|
||||||
|
if (result.PostalAddress is null)
|
||||||
|
{
|
||||||
|
logger.LogWarning("Skipping result without PostalAddress. '{result}'", result);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
string? alpha3CountryCode = CountryCodesUtils.Alpha2ToAlpha3(result.PostalAddress.RegionCode);
|
||||||
|
string? addressLine = result.PostalAddress.AddressLines is not null ? string.Join(", ", result.PostalAddress.AddressLines) : null;
|
||||||
|
|
||||||
|
string[]? formatedParts = result.FormattedAddress?.Split(",");
|
||||||
|
if (formatedParts is not null && formatedParts.Length < 2)
|
||||||
|
{
|
||||||
|
formatedParts = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
rsList.Add(new()
|
||||||
|
{
|
||||||
|
HouseNumber = null,
|
||||||
|
AddressRoad = addressLine,
|
||||||
|
AddressCity = result.PostalAddress.Locality,
|
||||||
|
AddressProvince = result.PostalAddress.AdministrativeArea,
|
||||||
|
AddressState = null,
|
||||||
|
AddressCountry = formatedParts?[^1],
|
||||||
|
ZipCode = result.PostalAddress.PostalCode,
|
||||||
|
AddressCountryCode = alpha3CountryCode
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return rsList;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.LogError(ex, "Error getting info from API!");
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal Methods
|
||||||
|
|
||||||
|
private HttpClient GetHttpClient()
|
||||||
|
{
|
||||||
|
HttpClient client = httpClientFactory.CreateClient();
|
||||||
|
|
||||||
|
Uri baseAddr = new(config.ServiceURL ?? defaultBaseAddr);
|
||||||
|
|
||||||
|
client.BaseAddress = baseAddr;
|
||||||
|
client.DefaultRequestHeaders.UserAgent.ParseAdd(config.UserAgent ?? defaultUserAgent);
|
||||||
|
client.DefaultRequestHeaders.Add("X-Goog-Api-Key", config.ApiKey);
|
||||||
|
|
||||||
|
return client;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetRequestUri(string query)
|
||||||
|
{
|
||||||
|
string escapedQuery = Uri.EscapeDataString(query).TrimStart('/');
|
||||||
|
string finalUri = $"{apiUri.TrimEnd('/')}/{escapedQuery}";
|
||||||
|
|
||||||
|
List<KeyValuePair<string, string?>> queryParams = [];
|
||||||
|
if (config.ResultLang is not null)
|
||||||
|
{
|
||||||
|
queryParams.Add(new KeyValuePair<string, string?>("languageCode", config.ResultLang));
|
||||||
|
}
|
||||||
|
|
||||||
|
return QueryHelpers.AddQueryString(finalUri, queryParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Internal Models
|
||||||
|
|
||||||
|
private record class PostalAddress(
|
||||||
|
string[]? AddressLines = null,
|
||||||
|
string? PostalCode = null,
|
||||||
|
|
||||||
|
string? AdministrativeArea = null, //Province
|
||||||
|
string? Locality = null, //City
|
||||||
|
string? RegionCode = null //Country Code (CLDR region code)
|
||||||
|
);
|
||||||
|
|
||||||
|
private record class GeocodeResult(
|
||||||
|
string? FormattedAddress = null,
|
||||||
|
PostalAddress? PostalAddress = null
|
||||||
|
);
|
||||||
|
|
||||||
|
private record class GeocodeAddressResponse(
|
||||||
|
GeocodeResult[] Results = null!
|
||||||
|
);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
namespace Somnia.GuestLog.Services.AddressQuery;
|
||||||
|
|
||||||
|
public interface IAddressQueryFactory
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the AddressQuery service implementation given current configuration.
|
||||||
|
/// </summary>
|
||||||
|
public IAddressQueryService GetService();
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using Somnia.GuestLog.Models.DTOs;
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Services.AddressQuery;
|
||||||
|
|
||||||
|
public interface IAddressQueryService
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Search an address by plain text query.
|
||||||
|
/// Data is returned as a structured address.
|
||||||
|
/// This service allow to complete and validate addresses.
|
||||||
|
///
|
||||||
|
/// Note: Not all fields are always available for a given query.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="query">Address to search</param>
|
||||||
|
/// <returns>List of resulting structured addresses</returns>
|
||||||
|
public Task<List<AddressResultDTO>> SearchAddressAsync(string query);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
using Microsoft.AspNetCore.WebUtilities;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
using Somnia.GuestLog.Models.Configuration;
|
||||||
|
using Somnia.GuestLog.Models.DTOs;
|
||||||
|
using Somnia.GuestLog.Utils;
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Services.AddressQuery;
|
||||||
|
|
||||||
|
public class NominatimAddressQueryService(
|
||||||
|
IHttpClientFactory httpClientFactory,
|
||||||
|
ILogger<NominatimAddressQueryService> logger,
|
||||||
|
IOptions<AddressQueryConfig> configOptions
|
||||||
|
) : IAddressQueryService
|
||||||
|
{
|
||||||
|
private const string defaultBaseAddr = "https://nominatim.openstreetmap.org";
|
||||||
|
private const string defaultUserAgent = "Somnia-GuestLog";
|
||||||
|
private const string apiUri = "/search";
|
||||||
|
|
||||||
|
private readonly AddressQueryConfig config = configOptions.Value;
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<List<AddressResultDTO>> SearchAddressAsync(string query)
|
||||||
|
{
|
||||||
|
var http = GetHttpClient();
|
||||||
|
List<AddressResultDTO> rsList = [];
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string uri = GetRequestUri(query);
|
||||||
|
List<ApiResult> apiList = (await http.GetFromJsonAsync<List<ApiResult>>(uri)) ?? [];
|
||||||
|
|
||||||
|
foreach (ApiResult result in apiList)
|
||||||
|
{
|
||||||
|
if (result.Address is null)
|
||||||
|
{
|
||||||
|
logger.LogWarning("Skipping result without address details. '{result}'", result);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
string? alpha3CountryCode = CountryCodesUtils.Alpha2ToAlpha3(result.Address.Country_code);
|
||||||
|
|
||||||
|
rsList.Add(new()
|
||||||
|
{
|
||||||
|
HouseNumber = result.Address.House_number,
|
||||||
|
AddressRoad = result.Address.Road ?? result.Address.Square,
|
||||||
|
AddressCity = result.Address.City ?? result.Address.Municipality ?? result.Address.Town ?? result.Address.Village,
|
||||||
|
AddressProvince = result.Address.Province ?? result.Address.State_district ?? result.Address.County,
|
||||||
|
AddressState = result.Address.State,
|
||||||
|
AddressCountry = result.Address.Country,
|
||||||
|
ZipCode = result.Address.Postcode,
|
||||||
|
AddressCountryCode = alpha3CountryCode
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return rsList;
|
||||||
|
}
|
||||||
|
catch (System.Exception ex)
|
||||||
|
{
|
||||||
|
logger.LogError(ex, "Error getting info from API!");
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private HttpClient GetHttpClient()
|
||||||
|
{
|
||||||
|
HttpClient client = httpClientFactory.CreateClient();
|
||||||
|
|
||||||
|
Uri baseAddr = new(config.ServiceURL ?? defaultBaseAddr);
|
||||||
|
|
||||||
|
client.BaseAddress = baseAddr;
|
||||||
|
client.DefaultRequestHeaders.UserAgent.ParseAdd(config.UserAgent ?? defaultUserAgent);
|
||||||
|
if (config.ResultLang is not null)
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.AcceptLanguage.ParseAdd(config.ResultLang);
|
||||||
|
}
|
||||||
|
|
||||||
|
return client;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GetRequestUri(string query)
|
||||||
|
{
|
||||||
|
return QueryHelpers.AddQueryString(apiUri, [
|
||||||
|
new KeyValuePair<string, string?>("format", "jsonv2"),
|
||||||
|
new KeyValuePair<string, string?>("addressdetails", "1"),
|
||||||
|
new KeyValuePair<string, string?>("layer", "address"),
|
||||||
|
new KeyValuePair<string, string?>("q", query),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private record class ApiResultAddress(
|
||||||
|
string? House_number = null,
|
||||||
|
string? Road = null,
|
||||||
|
string? Square = null,
|
||||||
|
string? City = null,
|
||||||
|
string? Municipality = null,
|
||||||
|
string? Village = null,
|
||||||
|
string? Town = null,
|
||||||
|
string? Province = null,
|
||||||
|
string? State_district = null,
|
||||||
|
string? County = null,
|
||||||
|
string? State = null,
|
||||||
|
string? Country = null,
|
||||||
|
string? Postcode = null,
|
||||||
|
string? Country_code = null
|
||||||
|
);
|
||||||
|
|
||||||
|
private record class ApiResult(
|
||||||
|
string? Osm_type = null,
|
||||||
|
long? Osm_id = null,
|
||||||
|
string? Category = null,
|
||||||
|
string? AddressType = null,
|
||||||
|
string? Name = null,
|
||||||
|
string? Display_name = null,
|
||||||
|
ApiResultAddress? Address = null
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,306 @@
|
|||||||
|
using FluentValidation;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Somnia.GuestLog.Enums.Services;
|
||||||
|
using Somnia.GuestLog.Infrastructure;
|
||||||
|
using Somnia.GuestLog.Models;
|
||||||
|
using Somnia.GuestLog.Models.DTOs;
|
||||||
|
using Somnia.GuestLog.Models.Entities;
|
||||||
|
using Somnia.GuestLog.Utils;
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Services.Entity;
|
||||||
|
|
||||||
|
public class GuestDocumentEntityService(
|
||||||
|
ILogger<GuestDocumentEntityService> logger,
|
||||||
|
IDbContextFactory<GuestLogContext> contextFactory,
|
||||||
|
IValidator<GuestDocumentDTO> dtoValidator,
|
||||||
|
IStayEntryEntityService stayEntityService
|
||||||
|
) : IGuestDocumentEntityService
|
||||||
|
{
|
||||||
|
public async Task<Result> CreateDocumentAsync(GuestDocumentDTO dto)
|
||||||
|
{
|
||||||
|
ArgumentNullException.ThrowIfNull(dto);
|
||||||
|
|
||||||
|
var valResult = dtoValidator.Validate(dto);
|
||||||
|
if (!valResult.IsValid)
|
||||||
|
{
|
||||||
|
logger.LogWarning("GuestDocumentService - CreateDocument: Dto validation failed. Fix the errors: {errorList}", valResult.Errors);
|
||||||
|
return Result.Fail(ResultCode.FailedValidation);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Dto must be valid, so null warings shouldn't matter.
|
||||||
|
GuestAddress addressItem = new()
|
||||||
|
{
|
||||||
|
Address = GetValueOrNull(dto.Address),
|
||||||
|
AddressCity = GetValueOrNull(dto.AddressCity),
|
||||||
|
AddressProvince = GetValueOrNull(dto.AddressProvince),
|
||||||
|
AddressState = GetValueOrNull(dto.AddressState),
|
||||||
|
AddressCountry = dto.AddressCountry!,
|
||||||
|
ZipCode = GetValueOrNull(dto.ZipCode),
|
||||||
|
};
|
||||||
|
|
||||||
|
DateTime createTime = DateTime.UtcNow;
|
||||||
|
GuestDocument dbItem = new()
|
||||||
|
{
|
||||||
|
Version = GuestConsts.GuestDocument_FirstVersion,
|
||||||
|
DocumentType = dto.DocumentType!,
|
||||||
|
DocumentNum = dto.DocumentNum!,
|
||||||
|
IssueDate = dto.IssueDate != null ? DateOnly.FromDateTime(dto.IssueDate!.Value) : null,
|
||||||
|
SupportNum = GetValueOrNull(dto.SupportNum),
|
||||||
|
Nationality = dto.Nationality!,
|
||||||
|
Name = dto.Name!,
|
||||||
|
Surname = dto.Surname!,
|
||||||
|
Surname2 = GetValueOrNull(dto.Surname2),
|
||||||
|
BirthDate = DateOnly.FromDateTime(dto.BirthDate!.Value),
|
||||||
|
Gender = GetValueOrNull(dto.Gender),
|
||||||
|
PhoneNumber = GetValueOrNull(dto.PhoneNumber),
|
||||||
|
EmailAddress = GetValueOrNull(dto.EmailAddress),
|
||||||
|
AddressDetails = addressItem,
|
||||||
|
CreateTime = createTime,
|
||||||
|
UpdateTime = createTime,
|
||||||
|
IsLastVersion = true, //On creation, created entity is last version.
|
||||||
|
};
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var dbContext = contextFactory.CreateDbContext();
|
||||||
|
await dbContext.AddAsync(dbItem);
|
||||||
|
await dbContext.SaveChangesAsync();
|
||||||
|
|
||||||
|
logger.LogInformation("GuestDocumentService - CreateDocument: GuestDocument Created: '{id}'", dbItem.GetFullKey());
|
||||||
|
return Result.Ok();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.LogError(ex, "GuestDocumentService - CreateDocument: Error creating GuestDocument: '{id}'", dbItem.GetFullKey());
|
||||||
|
return Result.FailUnknownError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result> UpdateDocumentAsync(GuestDocumentDTO dto)
|
||||||
|
{
|
||||||
|
var valResult = dtoValidator.Validate(dto);
|
||||||
|
if (!valResult.IsValid)
|
||||||
|
{
|
||||||
|
logger.LogWarning("GuestDocumentService - UpdateDocument: Dto validation failed. Fix the errors: {errorList}", valResult.Errors);
|
||||||
|
return Result.Fail(ResultCode.FailedValidation);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var dbContext = contextFactory.CreateDbContext();
|
||||||
|
//Get current entity from DB.
|
||||||
|
GuestDocument? dbItem = await dbContext.FindAsync<GuestDocument>(dto.Id, dto.Version);
|
||||||
|
|
||||||
|
if (dbItem == null)
|
||||||
|
{
|
||||||
|
logger.LogWarning("GuestDocumentService - UpdateDocument: Error updating GuestDocument (ID: '{id}'): GuestDocument not found!", dto.FullKey);
|
||||||
|
return Result.Fail(ResultCode.NotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Dto must be valid, so null warings shouldn't matter.
|
||||||
|
GuestAddress addressItem = new()
|
||||||
|
{
|
||||||
|
Address = GetValueOrNull(dto.Address),
|
||||||
|
AddressCity = GetValueOrNull(dto.AddressCity),
|
||||||
|
AddressProvince = GetValueOrNull(dto.AddressProvince),
|
||||||
|
AddressState = GetValueOrNull(dto.AddressState),
|
||||||
|
AddressCountry = dto.AddressCountry!,
|
||||||
|
ZipCode = GetValueOrNull(dto.ZipCode),
|
||||||
|
};
|
||||||
|
|
||||||
|
DateTime updateTime = DateTime.UtcNow;
|
||||||
|
GuestDocument updatedItem = new()
|
||||||
|
{
|
||||||
|
Id = dbItem.Id,
|
||||||
|
Version = dbItem.Version,
|
||||||
|
DocumentType = dbItem.DocumentType,
|
||||||
|
DocumentNum = dbItem.DocumentNum,
|
||||||
|
IssueDate = dto.IssueDate != null ? DateOnly.FromDateTime(dto.IssueDate!.Value) : null,
|
||||||
|
SupportNum = GetValueOrNull(dto.SupportNum),
|
||||||
|
Nationality = dto.Nationality!,
|
||||||
|
Name = dto.Name!,
|
||||||
|
Surname = dto.Surname!,
|
||||||
|
Surname2 = GetValueOrNull(dto.Surname2),
|
||||||
|
BirthDate = DateOnly.FromDateTime(dto.BirthDate!.Value),
|
||||||
|
Gender = GetValueOrNull(dto.Gender),
|
||||||
|
PhoneNumber = GetValueOrNull(dto.PhoneNumber),
|
||||||
|
EmailAddress = GetValueOrNull(dto.EmailAddress),
|
||||||
|
AddressDetails = addressItem,
|
||||||
|
CreateTime = dbItem.CreateTime,
|
||||||
|
UpdateTime = updateTime,
|
||||||
|
IsLastVersion = dbItem.IsLastVersion,
|
||||||
|
};
|
||||||
|
|
||||||
|
dbContext.Entry(dbItem).CurrentValues.SetValues(updatedItem);
|
||||||
|
var result = await dbContext.SaveChangesAsync();
|
||||||
|
|
||||||
|
if (result != 1)
|
||||||
|
{
|
||||||
|
logger.LogWarning("GuestDocumentService - UpdateDocument: Unexpected updated entity count: {count}", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.LogInformation("GuestDocumentService - UpdateDocument: GuestDocument Updated OK {id}", dbItem.GetFullKey());
|
||||||
|
return Result.Ok();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.LogError(ex, "GuestDocumentService - UpdateDocument: Error updating GuestDocument: '{id}'", dto.FullKey);
|
||||||
|
return Result.FailUnknownError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<Result> DeleteDocumentAsync(GuestDocumentDTO dto)
|
||||||
|
{
|
||||||
|
if (dto.Id is null)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("GuestDocumentService - DeleteDocument: A DTO without ID can't be deleted!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return DeleteDocumentAsync(dto.Id.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result> DeleteDocumentAsync(long id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var dbContext = contextFactory.CreateDbContext();
|
||||||
|
|
||||||
|
//Check if GuestDocument is used in a Stay.
|
||||||
|
bool isUsed = await stayEntityService.IsGuestInStay(id);
|
||||||
|
if (isUsed)
|
||||||
|
{
|
||||||
|
logger.LogWarning("GuestDocumentService - DeleteDocument: Error deleting GuestDocument. Guest (ID: '{ID}') is in a Stay", id);
|
||||||
|
return Result.FailWithContext(ResultCode.GuestInStay, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
int deletedCount = await dbContext.GuestDocuments
|
||||||
|
.Where(e => e.Id == id)
|
||||||
|
.ExecuteDeleteAsync();
|
||||||
|
|
||||||
|
if (deletedCount == 0)
|
||||||
|
{
|
||||||
|
logger.LogWarning("GuestDocumentService - DeleteDocument: Error deleting GuestDocument. Entity not found with ID: '{ID}'", id);
|
||||||
|
return Result.Fail(ResultCode.NotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.LogInformation(
|
||||||
|
"GuestDocumentService - DeleteDocument: GuestDocument deleted with Id: '{id}'. Versions deleted: '{Count}'",
|
||||||
|
id, deletedCount);
|
||||||
|
return Result.Ok();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.LogError(ex, "GuestDocumentService - CreateDocument: Error deleting GuestDocument: '{id}'", id);
|
||||||
|
return Result.FailUnknownError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<GuestDocumentDTO?> GetLastVersionDtoByIdAsync(long id)
|
||||||
|
{
|
||||||
|
using var dbContext = contextFactory.CreateDbContext();
|
||||||
|
GuestDocument? dbItem = await dbContext.GuestDocuments
|
||||||
|
.Where(e => e.Id == id)
|
||||||
|
.OrderByDescending(e => e.Version)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
return dbItem is not null ? GetDtoFromDb(dbItem) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<GuestDocumentDTO?> GetLastVersionDtoByDocumentAsync(string docType, string docNum)
|
||||||
|
{
|
||||||
|
using var dbContext = contextFactory.CreateDbContext();
|
||||||
|
GuestDocument? dbItem = await dbContext.GuestDocuments
|
||||||
|
.Where(e => e.DocumentType == docType && e.DocumentNum == docNum)
|
||||||
|
.OrderByDescending(e => e.Version)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
return dbItem is not null ? GetDtoFromDb(dbItem) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<GuestDocumentDTO>> GetDtoListAsync(bool onlyLastVersion)
|
||||||
|
{
|
||||||
|
using var dbContext = contextFactory.CreateDbContext();
|
||||||
|
|
||||||
|
// TEMP solution
|
||||||
|
var query = dbContext.GuestDocuments.AsQueryable();
|
||||||
|
if (onlyLastVersion)
|
||||||
|
{
|
||||||
|
query = query.Where(e => e.IsLastVersion == true);
|
||||||
|
}
|
||||||
|
var dbList = await query.OrderByDescending(e => e.UpdateTime)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
// TODO: Waiting for EF Core Window function improvements:
|
||||||
|
// See expected translation: https://github.com/dotnet/efcore/issues/36380#issuecomment-3082788964
|
||||||
|
// See window function status: https://github.com/dotnet/efcore/issues/12747
|
||||||
|
// var dbList = await dbContext.GuestDocuments
|
||||||
|
// .GroupBy(e => e.Id)
|
||||||
|
// .Select(g => g.OrderByDescending(e => e.Version).First())
|
||||||
|
// .ToListAsync();
|
||||||
|
|
||||||
|
return dbList.Select(GetDtoFromDb);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get GuestDocumentDTO from DB with the given filters.
|
||||||
|
/// Result count can be limited for perfomance reasons.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filter">Filters to use</param>
|
||||||
|
/// <param name="limit">Result count. Set to 0 for unlimited results</param>
|
||||||
|
/// <returns>Filtered GuestDocumentDTO result list</returns>
|
||||||
|
public async Task<IEnumerable<GuestDocumentDTO>> GetDtoListByFilterAsync(GuestDocFilterDTO filter, int limit = 0)
|
||||||
|
{
|
||||||
|
using var dbContext = contextFactory.CreateDbContext();
|
||||||
|
|
||||||
|
var query = dbContext.GuestDocuments.AsQueryable();
|
||||||
|
|
||||||
|
query = query.WhereIf(!string.IsNullOrEmpty(filter.DocumentType),
|
||||||
|
e => e.DocumentType == filter.DocumentType);
|
||||||
|
query = query.WhereIf(!string.IsNullOrEmpty(filter.DocumentNumber),
|
||||||
|
e => e.DocumentNum == filter.DocumentNumber);
|
||||||
|
|
||||||
|
query = query.WhereIf(!string.IsNullOrEmpty(filter.Name),
|
||||||
|
e => EF.Functions.Like(e.Name, filter.Name));
|
||||||
|
query = query.WhereIf(!string.IsNullOrEmpty(filter.Surname),
|
||||||
|
e => EF.Functions.Like(e.Surname, filter.Surname));
|
||||||
|
|
||||||
|
// TEMP while waiting for EF Core Window function improvements
|
||||||
|
query = query.WhereIf(filter.OnlyLastVersion,
|
||||||
|
e => e.IsLastVersion == true);
|
||||||
|
query = query.OrderByDescending(e => e.UpdateTime);
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: Waiting for EF Core Window function improvements:
|
||||||
|
// See: https://github.com/dotnet/efcore/issues/27470
|
||||||
|
// See window function status: https://github.com/dotnet/efcore/issues/12747
|
||||||
|
// For Ordering (or operations post-grouping), see: https://github.com/dotnet/efcore/pull/38687
|
||||||
|
// query = query
|
||||||
|
// .OrderByDescending(e => e.UpdateTime)
|
||||||
|
// .GroupBy(e => e.Id)
|
||||||
|
// .Select(g => g.OrderByDescending(e => e.Version).First());
|
||||||
|
|
||||||
|
if (limit > 0)
|
||||||
|
{
|
||||||
|
query = query.Take(limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
var dbList = await query.ToListAsync();
|
||||||
|
|
||||||
|
return dbList.Select(x => GetDtoFromDb(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#region Internal Methods
|
||||||
|
|
||||||
|
private static GuestDocumentDTO GetDtoFromDb(GuestDocument dbItem)
|
||||||
|
{
|
||||||
|
return EntityMapping.MapGuestDocumentEntityToDTO(dbItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string? GetValueOrNull(string? dtoValue)
|
||||||
|
{
|
||||||
|
return string.IsNullOrWhiteSpace(dtoValue) ? null : dtoValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using Somnia.GuestLog.Models.DTOs;
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Services.Entity;
|
||||||
|
|
||||||
|
public interface IGuestDocumentEntityService
|
||||||
|
{
|
||||||
|
public Task<Result> CreateDocumentAsync(GuestDocumentDTO dto);
|
||||||
|
public Task<Result> UpdateDocumentAsync(GuestDocumentDTO dto);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Same behavior as <see cref="DeleteDocumentAsync(long)"/>
|
||||||
|
/// </summary>
|
||||||
|
public Task<Result> DeleteDocumentAsync(GuestDocumentDTO dto);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Delete documents by ID.
|
||||||
|
/// This operation will delete all versions of a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">ID of the document to Delete</param>
|
||||||
|
public Task<Result> DeleteDocumentAsync(long id);
|
||||||
|
|
||||||
|
public Task<GuestDocumentDTO?> GetLastVersionDtoByIdAsync(long id);
|
||||||
|
public Task<GuestDocumentDTO?> GetLastVersionDtoByDocumentAsync(string docType, string docNum);
|
||||||
|
|
||||||
|
public Task<IEnumerable<GuestDocumentDTO>> GetDtoListAsync(bool onlyLastVersion);
|
||||||
|
public Task<IEnumerable<GuestDocumentDTO>> GetDtoListByFilterAsync(GuestDocFilterDTO filter, int limit = 0);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
using Somnia.GuestLog.Enums.Models;
|
||||||
|
using Somnia.GuestLog.Models.DTOs;
|
||||||
|
using Somnia.GuestLog.Models.QueryConfigs;
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Services.Entity;
|
||||||
|
|
||||||
|
public interface IStayEntryEntityService
|
||||||
|
{
|
||||||
|
public Task<Result> CreateEntryAsync(StayEntryDTO dto);
|
||||||
|
public Task<Result> UpdateEntryAsync(StayEntryDTO updatedDto);
|
||||||
|
public Task<Result> DeleteEntryAsync(StayEntryDTO dto);
|
||||||
|
public Task<Result> DeleteEntryAsync(long id);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update StayEntry Upload Status.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">StayEntry ID to update</param>
|
||||||
|
/// <param name="newStatus">New Upload Status</param>
|
||||||
|
public Task<Result> UpdateEntryUploadStatusAsync(long id, UploadStatus newStatus);
|
||||||
|
|
||||||
|
public Task<StayEntryDTO?> GetDtoByIdAsync(long id, StayEntryQueryConfig? queryConfig = null);
|
||||||
|
public Task<IEnumerable<StayEntryDTO>> GetDtoListAsync(StayEntryQueryConfig? queryConfig = null);
|
||||||
|
public Task<IEnumerable<StayEntryDTO>> GetDtoListByFilterAsync(StayEntryFilterDTO filter, int limit = 0, StayEntryQueryConfig? queryConfig = null);
|
||||||
|
|
||||||
|
|
||||||
|
public Task<bool> IsGuestInStay(long guestDocId);
|
||||||
|
public Task<bool> IsGuestInStayInPeriod(long guestDocId, DateTime startTime, DateTime endTime);
|
||||||
|
public Task<IEnumerable<StayEntryDTO>> GetStaysWithGuest(long guestDocId, StayEntryQueryConfig? queryConfig = null);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using Somnia.GuestLog.Enums.Models;
|
||||||
|
using Somnia.GuestLog.Models.DTOs;
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Services.Entity;
|
||||||
|
|
||||||
|
public interface IStayExportFileEntityService
|
||||||
|
{
|
||||||
|
public Task<Result> CreateStayExportAsync(StayExportFileDTO dto);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Delete StayExport entry from DB.
|
||||||
|
/// Exported File won't be deleted from Storage.
|
||||||
|
/// </summary>
|
||||||
|
public Task<Result> DeleteStayExportAsync(StayExportFileDTO dto);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update StayExport FileUploadStatus and execute required operations.
|
||||||
|
/// Only StayExport with UploadStatus "Pending" can be updated.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">ID of the StayExportFile to update</param>
|
||||||
|
/// <param name="newStatus">New UploadStatus</param>
|
||||||
|
public Task<Result> UpdateStayExportUploadStatusAsync(long id, UploadStatus newStatus);
|
||||||
|
|
||||||
|
|
||||||
|
public Task<StayExportFileDTO?> GetDtoByIdAsync(long id);
|
||||||
|
//public Task<IEnumerable<StayExportFileDTO>> GetDtoListByFilterAsync(StayExportFileFilterDTO filter, int limit = 0);
|
||||||
|
public Task<IEnumerable<StayExportFileDTO>> GetDtoListAsync(int limit = 0);
|
||||||
|
}
|
||||||
@@ -0,0 +1,352 @@
|
|||||||
|
using FluentStorage.Utils.Extensions;
|
||||||
|
using FluentValidation;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Somnia.GuestLog.Enums.Models;
|
||||||
|
using Somnia.GuestLog.Enums.Services;
|
||||||
|
using Somnia.GuestLog.Infrastructure;
|
||||||
|
using Somnia.GuestLog.Models;
|
||||||
|
using Somnia.GuestLog.Models.DTOs;
|
||||||
|
using Somnia.GuestLog.Models.Entities;
|
||||||
|
using Somnia.GuestLog.Models.QueryConfigs;
|
||||||
|
using Somnia.GuestLog.Utils;
|
||||||
|
|
||||||
|
namespace Somnia.GuestLog.Services.Entity;
|
||||||
|
|
||||||
|
public class StayEntryEntityService(
|
||||||
|
ILogger<StayEntryEntityService> logger,
|
||||||
|
IDbContextFactory<GuestLogContext> contextFactory,
|
||||||
|
IValidator<StayEntryDTO> dtoValidator
|
||||||
|
) : IStayEntryEntityService
|
||||||
|
{
|
||||||
|
public async Task<Result> CreateEntryAsync(StayEntryDTO dto)
|
||||||
|
{
|
||||||
|
ArgumentNullException.ThrowIfNull(dto);
|
||||||
|
|
||||||
|
var valResult = await dtoValidator.ValidateAsync(dto);
|
||||||
|
if (!valResult.IsValid)
|
||||||
|
{
|
||||||
|
logger.LogWarning("StayEntryService - CreateEntryAsync: Dto validation failed. Fix the errors: {errorList}", valResult.Errors);
|
||||||
|
return Result.Fail(ResultCode.FailedValidation);
|
||||||
|
}
|
||||||
|
|
||||||
|
DateTime createTime = DateTime.UtcNow;
|
||||||
|
StayEntry dbStay = new()
|
||||||
|
{
|
||||||
|
DateIn = dto.DateIn!.Value.ToUniversalTime(),
|
||||||
|
DateOut = dto.DateOut!.Value.ToUniversalTime(),
|
||||||
|
RoomCount = dto.RoomCount!.Value,
|
||||||
|
RoomNumber = dto.RoomNumber,
|
||||||
|
PaymentMethod = dto.PaymentMethod!,
|
||||||
|
StayUploadStatus = UploadStatus.Pending,
|
||||||
|
StayUploadStatusTime = null,
|
||||||
|
CreateTime = createTime,
|
||||||
|
UpdateTime = createTime,
|
||||||
|
};
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var dbContext = contextFactory.CreateDbContext();
|
||||||
|
|
||||||
|
//Check and add GuestDocuments
|
||||||
|
foreach (GuestDocumentDTO guestDto in dto.GuestDocuments!)
|
||||||
|
{
|
||||||
|
//Get guest from db.
|
||||||
|
GuestDocument dbGuest = await dbContext.GuestDocuments
|
||||||
|
.Where(gd => gd.Id == guestDto.Id && gd.Version == guestDto.Version)
|
||||||
|
.SingleAsync();
|
||||||
|
|
||||||
|
//Check if Guest is already in other stay during the same period.
|
||||||
|
bool isInOtherStay = await this.IsGuestInStayInPeriod(dbGuest.Id, dbStay.DateIn, dbStay.DateOut);
|
||||||
|
if (isInOtherStay)
|
||||||
|
{
|
||||||
|
string period = $"{dbStay.DateIn}-{dbStay.DateOut}";
|
||||||
|
return Result.FailWithContext(ResultCode.GuestCurrentlyInStay, dbGuest.FullDocument, period);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Add dbGuest to dbStay.
|
||||||
|
dbStay.GuestDocuments.Add(dbGuest);
|
||||||
|
}
|
||||||
|
|
||||||
|
await dbContext.AddAsync(dbStay);
|
||||||
|
await dbContext.SaveChangesAsync();
|
||||||
|
|
||||||
|
logger.LogInformation("StayEntryService - CreateEntryAsync: StayEntry Created: '{id}'", dbStay.GetFullKey());
|
||||||
|
return Result.OkWithContext(dbStay.GetFullKey());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.LogError(ex, "StayEntryService - CreateEntryAsync: Error creating StayEntry");
|
||||||
|
return Result.FailUnknownError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result> UpdateEntryAsync(StayEntryDTO updatedDto)
|
||||||
|
{
|
||||||
|
var valResult = dtoValidator.Validate(updatedDto);
|
||||||
|
if (!valResult.IsValid)
|
||||||
|
{
|
||||||
|
logger.LogWarning("StayEntryService - UpdateEntryAsync: Dto validation failed. Fix the errors: {errorList}", valResult.Errors);
|
||||||
|
return Result.Fail(ResultCode.FailedValidation);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var dbContext = contextFactory.CreateDbContext();
|
||||||
|
//Get current entity from DB.
|
||||||
|
StayEntry? dbItem = await dbContext.StayEntries
|
||||||
|
.Where(e => e.Id == updatedDto.Id)
|
||||||
|
.Include(e => e.GuestDocuments)
|
||||||
|
.SingleAsync();
|
||||||
|
|
||||||
|
if (dbItem == null)
|
||||||
|
{
|
||||||
|
logger.LogWarning("StayEntryService - UpdateEntryAsync: Error updating StayEntry (ID: '{id}'): StayEntry not found!", updatedDto.Id);
|
||||||
|
return Result.Fail(ResultCode.NotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dbItem.StayUploadStatus == UploadStatus.Uploaded)
|
||||||
|
{
|
||||||
|
logger.LogWarning("StayEntryService - UpdateEntryAsync: StayEntry (ID: '{id}') can't be updated: StayEntry is already uploaded!", updatedDto.Id);
|
||||||
|
return Result.Fail(ResultCode.DataIsFinal);
|
||||||
|
}
|
||||||
|
|
||||||
|
DateTime updateTime = DateTime.UtcNow;
|
||||||
|
StayEntry updatedItem = new()
|
||||||
|
{
|
||||||
|
Id = dbItem.Id,
|
||||||
|
DateIn = updatedDto.DateIn!.Value.ToUniversalTime(),
|
||||||
|
DateOut = updatedDto.DateOut!.Value.ToUniversalTime(),
|
||||||
|
RoomCount = updatedDto.RoomCount!.Value,
|
||||||
|
RoomNumber = updatedDto.RoomNumber,
|
||||||
|
PaymentMethod = updatedDto.PaymentMethod!,
|
||||||
|
StayUploadStatus = dbItem.StayUploadStatus,
|
||||||
|
StayUploadStatusTime = dbItem.StayUploadStatusTime,
|
||||||
|
CreateTime = dbItem.CreateTime,
|
||||||
|
UpdateTime = updateTime,
|
||||||
|
};
|
||||||
|
dbContext.Entry(dbItem).CurrentValues.SetValues(updatedItem);
|
||||||
|
|
||||||
|
//Update GuestDocuments
|
||||||
|
if (updatedDto.GuestDocuments != null)
|
||||||
|
{
|
||||||
|
var updatedGuestDocIdList = updatedDto.GuestDocuments.Select(e => e.Id);
|
||||||
|
List<GuestDocument> updatedDbGuests = await dbContext.GuestDocuments
|
||||||
|
.Where(e => updatedGuestDocIdList.Contains(e.Id))
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
foreach (GuestDocument guest in updatedDbGuests)
|
||||||
|
{
|
||||||
|
//Skip check for guests already in the stay.
|
||||||
|
if (dbItem.GuestDocuments.Any(e => e.Id == guest.Id))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Check if Guest is already in other stay during the same period.
|
||||||
|
bool isInOtherStay = await this.IsGuestInStayInPeriod(guest.Id, updatedItem.DateIn, updatedItem.DateOut);
|
||||||
|
if (isInOtherStay)
|
||||||
|
{
|
||||||
|
string period = $"{updatedItem.DateIn}-{updatedItem.DateOut}";
|
||||||
|
return Result.FailWithContext(ResultCode.GuestCurrentlyInStay, guest.FullDocument, period);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dbItem.GuestDocuments.Clear();
|
||||||
|
dbItem.GuestDocuments.AddRange(updatedDbGuests);
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await dbContext.SaveChangesAsync();
|
||||||
|
logger.LogInformation("StayEntryService - UpdateEntryAsync: StayEntry Updated OK {id}", dbItem.GetFullKey());
|
||||||
|
|
||||||
|
return Result.Ok();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.LogError(ex, "StayEntryService - UpdateEntryAsync: Error updating StayEntry: '{id}'", updatedDto.Id);
|
||||||
|
return Result.FailUnknownError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result> DeleteEntryAsync(StayEntryDTO dto)
|
||||||
|
{
|
||||||
|
if (dto.Id is null)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("StayEntryService - DeleteEntry: A DTO without key can't be deleted!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return await DeleteEntryAsync(dto.Id.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Result> DeleteEntryAsync(long id)
|
||||||
|
{
|
||||||
|
using var dbContext = contextFactory.CreateDbContext();
|
||||||
|
StayEntry? dbItem = await dbContext.StayEntries.FindAsync(id);
|
||||||
|
if (dbItem is null)
|
||||||
|
{
|
||||||
|
logger.LogWarning("StayEntryService - DeleteEntry: Error deleting StayEntry. Entity not found with key: '{key}'", id);
|
||||||
|
return Result.Fail(ResultCode.NotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dbItem.StayUploadStatus == UploadStatus.Uploaded)
|
||||||
|
{
|
||||||
|
return Result.Fail(ResultCode.DataIsFinal);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dbContext.StayEntries.Remove(dbItem);
|
||||||
|
await dbContext.SaveChangesAsync();
|
||||||
|
|
||||||
|
logger.LogInformation("StayEntryService - DeleteEntry: StayEntry deleted: '{id}'", dbItem.GetFullKey());
|
||||||
|
return Result.Ok();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.LogError(ex, "StayEntryService - DeleteEntry: Error deleting StayEntry: '{id}'", dbItem.GetFullKey());
|
||||||
|
return Result.FailUnknownError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<Result> UpdateEntryUploadStatusAsync(long id, UploadStatus newStatus)
|
||||||
|
{
|
||||||
|
using var dbContext = contextFactory.CreateDbContext();
|
||||||
|
StayEntry? dbItem = await dbContext.StayEntries.FindAsync(id);
|
||||||
|
|
||||||
|
if (dbItem == null)
|
||||||
|
{
|
||||||
|
return Result.Fail(ResultCode.NotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dbItem.StayUploadStatus == newStatus)
|
||||||
|
{
|
||||||
|
return Result.Fail(ResultCode.NoPendingChanges);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Update Status
|
||||||
|
dbItem.StayUploadStatus = newStatus;
|
||||||
|
dbItem.StayUploadStatusTime = DateTime.UtcNow;
|
||||||
|
|
||||||
|
await dbContext.SaveChangesAsync();
|
||||||
|
|
||||||
|
logger.LogInformation("StayEntryService - UpdateEntryUploadStatusAsync: StayEntry ('{id}') UploadStatus updated to '{status}'",
|
||||||
|
dbItem.GetFullKey(), newStatus);
|
||||||
|
return Result.Ok();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.LogError(ex, "StayEntryService - UpdateEntryUploadStatusAsync: Error updating StayEntry UploadStatus");
|
||||||
|
return Result.FailUnknownError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<StayEntryDTO?> GetDtoByIdAsync(long id, StayEntryQueryConfig? queryConfig = null)
|
||||||
|
{
|
||||||
|
using var dbContext = contextFactory.CreateDbContext();
|
||||||
|
StayEntry? dbItem = await dbContext.StayEntries
|
||||||
|
.Where(e => e.Id == id)
|
||||||
|
.AddQueryConfig(queryConfig)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
return dbItem is not null ? GetDtoFromDb(dbItem, queryConfig) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<StayEntryDTO>> GetDtoListAsync(StayEntryQueryConfig? queryConfig = null)
|
||||||
|
{
|
||||||
|
using var dbContext = contextFactory.CreateDbContext();
|
||||||
|
|
||||||
|
var dbList = await dbContext.StayEntries
|
||||||
|
.AddQueryConfig(queryConfig)
|
||||||
|
.OrderByDescending(e => e.UpdateTime)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
return dbList.Select(e => GetDtoFromDb(e, queryConfig));
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<StayEntryDTO>> GetDtoListByFilterAsync(StayEntryFilterDTO filter, int limit = 0, StayEntryQueryConfig? queryConfig = null)
|
||||||
|
{
|
||||||
|
using var dbContext = contextFactory.CreateDbContext();
|
||||||
|
|
||||||
|
var query = dbContext.StayEntries
|
||||||
|
.AddQueryConfig(queryConfig)
|
||||||
|
.AsQueryable();
|
||||||
|
|
||||||
|
query = query.WhereIf(filter.DateInStart is not null && filter.DateInEnd is not null,
|
||||||
|
e => e.DateIn >= filter.DateInStart!.Value.ToUniversalTime()
|
||||||
|
&& e.DateIn < filter.DateInEnd!.Value.ToUniversalTime());
|
||||||
|
query = query.WhereIf(!string.IsNullOrEmpty(filter.RoomNumber),
|
||||||
|
e => EF.Functions.Like(e.RoomNumber, $"%{filter.RoomNumber}%"));
|
||||||
|
query = query.WhereIf(!string.IsNullOrEmpty(filter.PaymentMethod),
|
||||||
|
e => e.PaymentMethod == filter.PaymentMethod);
|
||||||
|
query = query.WhereIf(filter.StayUploadStatus != null,
|
||||||
|
e => e.StayUploadStatus == filter.StayUploadStatus);
|
||||||
|
|
||||||
|
query = query.OrderByDescending(e => e.DateIn)
|
||||||
|
.ThenByDescending(e => e.UpdateTime);
|
||||||
|
|
||||||
|
if (limit > 0)
|
||||||
|
{
|
||||||
|
query = query.Take(limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
var dbList = await query
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
return dbList.Select(x => GetDtoFromDb(x, queryConfig));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<bool> IsGuestInStay(long guestDocId)
|
||||||
|
{
|
||||||
|
using var dbContext = contextFactory.CreateDbContext();
|
||||||
|
|
||||||
|
bool rs = await dbContext.StayEntries
|
||||||
|
.AnyAsync(s => s.GuestDocuments.Any(g => g.Id == guestDocId));
|
||||||
|
|
||||||
|
return rs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> IsGuestInStayInPeriod(long guestDocId, DateTime startTime, DateTime endTime)
|
||||||
|
{
|
||||||
|
using var dbContext = contextFactory.CreateDbContext();
|
||||||
|
|
||||||
|
bool rs = await dbContext.StayEntries
|
||||||
|
.AnyAsync(s => s.DateIn < endTime && s.DateOut > startTime
|
||||||
|
&& s.GuestDocuments.Any(g => g.Id == guestDocId)
|
||||||
|
);
|
||||||
|
|
||||||
|
return rs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<StayEntryDTO>> GetStaysWithGuest(long guestDocId, StayEntryQueryConfig? queryConfig = null)
|
||||||
|
{
|
||||||
|
using var dbContext = contextFactory.CreateDbContext();
|
||||||
|
|
||||||
|
var rs = await dbContext.StayEntries
|
||||||
|
.Where(s => s.GuestDocuments.Any(g => g.Id == guestDocId))
|
||||||
|
.AddQueryConfig(queryConfig)
|
||||||
|
.OrderByDescending(e => e.DateIn)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
return rs.Select(e => GetDtoFromDb(e, queryConfig));
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Internal Methods
|
||||||
|
|
||||||
|
private static StayEntryDTO GetDtoFromDb(StayEntry dbItem, StayEntryQueryConfig? queryConfig)
|
||||||
|
{
|
||||||
|
queryConfig ??= StayEntryQueryConfig.DefaultQueryConfig;
|
||||||
|
|
||||||
|
return EntityMapping.MapStayEntryEntityToDTO(dbItem, queryConfig.IncludeGuests);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string? GetValueOrNull(string? dtoValue)
|
||||||
|
{
|
||||||
|
return string.IsNullOrWhiteSpace(dtoValue) ? null : dtoValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
Loaded 100 of 134 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user