SHA256
StayExportTracking - Changes to Models
- Added new fields to track stay export uploading. - Added methods in EntityServices to update this fields. - Show new fields in UI (with required locale).
This commit is contained in:
1 parent
34b61e7fde
commit
2f0062b313
20 files changed
+586
-8
No files matched your search
@@ -8,6 +8,8 @@
|
|||||||
@inject IUserMessageService userMessage
|
@inject IUserMessageService userMessage
|
||||||
@inject IDialogService DialogService
|
@inject IDialogService DialogService
|
||||||
@inject IDataListService dataListService;
|
@inject IDataListService dataListService;
|
||||||
|
@inject ILocalizerService Localizer;
|
||||||
|
|
||||||
|
|
||||||
<PageTitle>Somnia - Stay Entries</PageTitle>
|
<PageTitle>Somnia - Stay Entries</PageTitle>
|
||||||
|
|
||||||
@@ -46,6 +48,8 @@
|
|||||||
Property="x => dataListService.GetLocalizedValue(GuestConsts.DataList_PaymentMethods, x.PaymentMethod)" />
|
Property="x => dataListService.GetLocalizedValue(GuestConsts.DataList_PaymentMethods, x.PaymentMethod)" />
|
||||||
|
|
||||||
<PropertyColumn Property="x => x.UpdateTime" Title="@LanguageLocale.dto_GuestDocument_UpdateTime" />
|
<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"
|
<TemplateColumn CellClass="d-flex justify-between" Title="Options" StickyRight Hideable="false"
|
||||||
ShowColumnOptions="false">
|
ShowColumnOptions="false">
|
||||||
@@ -124,6 +128,12 @@
|
|||||||
|
|
||||||
private async Task BtnDeleteItem(StayEntryDTO item)
|
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();
|
bool? confirmDelete = await _confirmDeleteMsgBox.MsgBox.ShowAsync();
|
||||||
|
|
||||||
if (confirmDelete is null || confirmDelete.Value == false)
|
if (confirmDelete is null || confirmDelete.Value == false)
|
||||||
|
|||||||
@@ -59,6 +59,10 @@
|
|||||||
OnClick="() => ShowExportDetails(context.Item)" />
|
OnClick="() => ShowExportDetails(context.Item)" />
|
||||||
</CellTemplate>
|
</CellTemplate>
|
||||||
</TemplateColumn>
|
</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"
|
<TemplateColumn CellClass="d-flex justify-between" Title="Options" StickyRight Hideable="false"
|
||||||
ShowColumnOptions="false">
|
ShowColumnOptions="false">
|
||||||
@@ -173,6 +177,12 @@
|
|||||||
|
|
||||||
private async Task BtnDeleteItem(StayExportFileDTO item)
|
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();
|
bool? confirmDelete = await _confirmDeleteMsgBox.MsgBox.ShowAsync();
|
||||||
|
|
||||||
if (confirmDelete is null || confirmDelete.Value == false)
|
if (confirmDelete is null || confirmDelete.Value == false)
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Somnia.GuestLog.Enums.Models;
|
||||||
|
|
||||||
|
public enum UploadStatus
|
||||||
|
{
|
||||||
|
Pending = 0,
|
||||||
|
Uploaded = 1,
|
||||||
|
Skipped = 2,
|
||||||
|
}
|
||||||
@@ -8,8 +8,11 @@ public enum ResultCode
|
|||||||
FailedValidation,
|
FailedValidation,
|
||||||
NotFound,
|
NotFound,
|
||||||
FileStorageError,
|
FileStorageError,
|
||||||
|
NoPendingChanges,
|
||||||
|
DataIsFinal,
|
||||||
|
|
||||||
//Specific Codes
|
//Specific Codes
|
||||||
GuestInStay,
|
GuestInStay,
|
||||||
GuestCurrentlyInStay,
|
GuestCurrentlyInStay,
|
||||||
|
UploadStatusIsFinal,
|
||||||
}
|
}
|
||||||
@@ -30,6 +30,10 @@ public class StayEntryEntityConfig : IEntityTypeConfiguration<StayEntry>
|
|||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(5);
|
.HasMaxLength(5);
|
||||||
|
|
||||||
|
builder.Property(e => e.StayUploadStatus)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(e => e.StayUploadStatusTime)
|
||||||
|
.HasColumnType(DbConsts.DbType_Timestamptz);
|
||||||
|
|
||||||
builder.Property(e => e.CreateTime)
|
builder.Property(e => e.CreateTime)
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
|
|||||||
@@ -32,5 +32,10 @@ public class StayExportFileEntityConfig : IEntityTypeConfiguration<StayExportFil
|
|||||||
builder.Property(e => e.ExportTime)
|
builder.Property(e => e.ExportTime)
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType(DbConsts.DbType_Timestamptz);
|
.HasColumnType(DbConsts.DbType_Timestamptz);
|
||||||
|
|
||||||
|
builder.Property(e => e.FileUploadStatus)
|
||||||
|
.IsRequired();
|
||||||
|
builder.Property(e => e.FileUploadStatusTime)
|
||||||
|
.HasColumnType(DbConsts.DbType_Timestamptz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,7 +18,7 @@ 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:ChangeTracking", false)
|
||||||
.HasAnnotation("Proxies:CheckEquality", false)
|
.HasAnnotation("Proxies:CheckEquality", false)
|
||||||
.HasAnnotation("Proxies:LazyLoading", true)
|
.HasAnnotation("Proxies:LazyLoading", true)
|
||||||
@@ -177,6 +177,12 @@ namespace Somnia.GuestLog.Infrastructure.Migrations
|
|||||||
.HasMaxLength(32)
|
.HasMaxLength(32)
|
||||||
.HasColumnType("character varying(32)");
|
.HasColumnType("character varying(32)");
|
||||||
|
|
||||||
|
b.Property<int>("StayUploadStatus")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("StayUploadStatusTime")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
b.Property<DateTime>("UpdateTime")
|
b.Property<DateTime>("UpdateTime")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
@@ -209,6 +215,12 @@ namespace Somnia.GuestLog.Infrastructure.Migrations
|
|||||||
.HasMaxLength(256)
|
.HasMaxLength(256)
|
||||||
.HasColumnType("character varying(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 =>
|
b.ComplexProperty(typeof(Dictionary<string, object>), "ExportParams", "Somnia.GuestLog.Models.Entities.StayExportFile.ExportParams#StayExportParams", b1 =>
|
||||||
{
|
{
|
||||||
b1.IsRequired();
|
b1.IsRequired();
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
using Somnia.GuestLog.Enums.Models;
|
||||||
|
|
||||||
namespace Somnia.GuestLog.Models.DTOs;
|
namespace Somnia.GuestLog.Models.DTOs;
|
||||||
|
|
||||||
public class StayEntryDTO
|
public class StayEntryDTO
|
||||||
@@ -12,6 +14,10 @@ public class StayEntryDTO
|
|||||||
public string? PaymentMethod { 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 List<GuestDocumentDTO>? GuestDocuments { get; set; } = null;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,11 +13,15 @@ public class StayExportFileDTO
|
|||||||
public StayExportFileResult? ExportResult { get; set; }
|
public StayExportFileResult? ExportResult { get; set; }
|
||||||
|
|
||||||
public string? ExportedPath { get; set; }
|
public string? ExportedPath { get; set; }
|
||||||
|
|
||||||
public string? ExportDetails { get; set; }
|
public string? ExportDetails { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public DateTime? ExportTime { get; set; }
|
public DateTime? ExportTime { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public UploadStatus FileUploadStatus { get; set; }
|
||||||
|
public DateTime? FileUploadStatusTime { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class StayExportParamsDTO
|
public class StayExportParamsDTO
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
using Somnia.GuestLog.Enums.Models;
|
||||||
|
|
||||||
namespace Somnia.GuestLog.Models.Entities;
|
namespace Somnia.GuestLog.Models.Entities;
|
||||||
|
|
||||||
public class StayEntry : BaseEntity
|
public class StayEntry : BaseEntity
|
||||||
@@ -12,6 +14,19 @@ public class StayEntry : BaseEntity
|
|||||||
|
|
||||||
public required string PaymentMethod { 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; } = [];
|
public virtual ICollection<GuestDocument> GuestDocuments { get; } = [];
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -29,5 +29,17 @@ public class StayExportFile : BaseEntity
|
|||||||
public required DateTime ExportTime { get; set; }
|
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}";
|
public override string GetFullKey() => $"{Id}";
|
||||||
}
|
}
|
||||||
@@ -45,6 +45,8 @@ internal static class EntityMapping
|
|||||||
RoomCount = entity.RoomCount,
|
RoomCount = entity.RoomCount,
|
||||||
RoomNumber = entity.RoomNumber,
|
RoomNumber = entity.RoomNumber,
|
||||||
PaymentMethod = entity.PaymentMethod,
|
PaymentMethod = entity.PaymentMethod,
|
||||||
|
StayUploadStatus = entity.StayUploadStatus,
|
||||||
|
StayUploadStatusTime = entity.StayUploadStatusTime?.ToLocalTime(),
|
||||||
CreateTime = entity.CreateTime.ToLocalTime(),
|
CreateTime = entity.CreateTime.ToLocalTime(),
|
||||||
UpdateTime = entity.UpdateTime.ToLocalTime(),
|
UpdateTime = entity.UpdateTime.ToLocalTime(),
|
||||||
GuestDocuments = includeGuests ? [.. entity.GuestDocuments.Select(e => MapGuestDocumentEntityToDTO(e))] : null,
|
GuestDocuments = includeGuests ? [.. entity.GuestDocuments.Select(e => MapGuestDocumentEntityToDTO(e))] : null,
|
||||||
@@ -69,6 +71,8 @@ internal static class EntityMapping
|
|||||||
ExportedPath = entity.ExportedPath,
|
ExportedPath = entity.ExportedPath,
|
||||||
ExportDetails = entity.ExportDetails,
|
ExportDetails = entity.ExportDetails,
|
||||||
ExportTime = entity.ExportTime.ToLocalTime(),
|
ExportTime = entity.ExportTime.ToLocalTime(),
|
||||||
|
FileUploadStatus = entity.FileUploadStatus,
|
||||||
|
FileUploadStatusTime = entity.FileUploadStatusTime?.ToLocalTime(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -153,6 +153,8 @@
|
|||||||
<data name="dto.StayEntry.GuestDocuments" xml:space="preserve"><value>Huéspedes</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.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.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.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.ExportFormat" xml:space="preserve"><value>Formato Exportación</value></data>
|
||||||
@@ -161,6 +163,8 @@
|
|||||||
<data name="dto.StayExportFile.ExportedPath" xml:space="preserve"><value>Ruta 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.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.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.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.ExportPeriodStart" xml:space="preserve"><value>Fecha Desde</value></data>
|
||||||
@@ -207,9 +211,12 @@
|
|||||||
<data name="enum.ResultCode.FailedValidation" xml:space="preserve"><value>Fallo de validación de datos</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.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.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 -->
|
<!-- 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.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.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.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.NoData" xml:space="preserve"><value>Sin datos</value></data>
|
||||||
@@ -221,6 +228,10 @@
|
|||||||
|
|
||||||
<data name="enum.StayExportParamType.PeriodDateIn" xml:space="preserve"><value>'Date Entrada' Estancia</value></data>
|
<data name="enum.StayExportParamType.PeriodDateIn" xml:space="preserve"><value>'Date Entrada' Estancia</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.GuestDocumentList" xml:space="preserve"><value>Huéspedes</value></data>
|
||||||
<data name="navMenu.StayEntryList" xml:space="preserve"><value>Estancias</value></data>
|
<data name="navMenu.StayEntryList" xml:space="preserve"><value>Estancias</value></data>
|
||||||
@@ -242,12 +253,14 @@
|
|||||||
<data name="page.StayEntryList.pageTitle" xml:space="preserve"><value>Lista Estancias</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.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.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.StayEntryNew.pageTitle" xml:space="preserve"><value>Nueva Estancia</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.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.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.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.StayExportNew.pageTitle" xml:space="preserve"><value>Nueva Exportación de Estancias</value></data>
|
<data name="page.StayExportNew.pageTitle" xml:space="preserve"><value>Nueva Exportación de Estancias</value></data>
|
||||||
|
|
||||||
|
|||||||
@@ -122,6 +122,7 @@
|
|||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0,
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0,
|
||||||
Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
|
|
||||||
<data name="dto.GuestDocument.Id" xml:space="preserve"><value>ID</value></data>
|
<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.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.DocumentType" xml:space="preserve"><value>Document Type</value></data>
|
||||||
@@ -152,6 +153,8 @@
|
|||||||
<data name="dto.StayEntry.GuestDocuments" xml:space="preserve"><value>Guests</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.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.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.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.ExportFormat" xml:space="preserve"><value>Export Format</value></data>
|
||||||
@@ -160,6 +163,8 @@
|
|||||||
<data name="dto.StayExportFile.ExportedPath" xml:space="preserve"><value>Export Path</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.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.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.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.ExportPeriodStart" xml:space="preserve"><value>Date From</value></data>
|
||||||
@@ -206,9 +211,12 @@
|
|||||||
<data name="enum.ResultCode.FailedValidation" xml:space="preserve"><value>Failed entity validation</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.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.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 -->
|
<!-- Specific codes -->
|
||||||
<data name="enum.ResultCode.GuestInStay" xml:space="preserve"><value>Guest (ID: '{0}') is in a stay.</value></data>
|
<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.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.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.NoData" xml:space="preserve"><value>No Data</value></data>
|
||||||
@@ -220,6 +228,10 @@
|
|||||||
|
|
||||||
<data name="enum.StayExportParamType.PeriodDateIn" xml:space="preserve"><value>Stay 'Date In' Period</value></data>
|
<data name="enum.StayExportParamType.PeriodDateIn" xml:space="preserve"><value>Stay 'Date In' Period</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.GuestDocumentList" xml:space="preserve"><value>Guests</value></data>
|
||||||
<data name="navMenu.StayEntryList" xml:space="preserve"><value>Stays</value></data>
|
<data name="navMenu.StayEntryList" xml:space="preserve"><value>Stays</value></data>
|
||||||
@@ -241,12 +253,14 @@
|
|||||||
<data name="page.StayEntryList.pageTitle" xml:space="preserve"><value>Stay Entries</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.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.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.StayEntryNew.pageTitle" xml:space="preserve"><value>New Stay</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.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.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.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.StayExportNew.pageTitle" xml:space="preserve"><value>New Stay Export</value></data>
|
<data name="page.StayExportNew.pageTitle" xml:space="preserve"><value>New Stay Export</value></data>
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Somnia.GuestLog.Enums.Models;
|
||||||
using Somnia.GuestLog.Models.DTOs;
|
using Somnia.GuestLog.Models.DTOs;
|
||||||
using Somnia.GuestLog.Models.QueryConfigs;
|
using Somnia.GuestLog.Models.QueryConfigs;
|
||||||
|
|
||||||
@@ -10,6 +11,13 @@ public interface IStayEntryEntityService
|
|||||||
public Task<Result> DeleteEntryAsync(StayEntryDTO dto);
|
public Task<Result> DeleteEntryAsync(StayEntryDTO dto);
|
||||||
public Task<Result> DeleteEntryAsync(long id);
|
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<StayEntryDTO?> GetDtoByIdAsync(long id, StayEntryQueryConfig? queryConfig = null);
|
||||||
public Task<IEnumerable<StayEntryDTO>> GetDtoListAsync(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<IEnumerable<StayEntryDTO>> GetDtoListByFilterAsync(StayEntryFilterDTO filter, int limit = 0, StayEntryQueryConfig? queryConfig = null);
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Somnia.GuestLog.Enums.Models;
|
||||||
using Somnia.GuestLog.Models.DTOs;
|
using Somnia.GuestLog.Models.DTOs;
|
||||||
|
|
||||||
namespace Somnia.GuestLog.Services.Entity;
|
namespace Somnia.GuestLog.Services.Entity;
|
||||||
@@ -5,7 +6,6 @@ namespace Somnia.GuestLog.Services.Entity;
|
|||||||
public interface IStayExportFileEntityService
|
public interface IStayExportFileEntityService
|
||||||
{
|
{
|
||||||
public Task<Result> CreateStayExportAsync(StayExportFileDTO dto);
|
public Task<Result> CreateStayExportAsync(StayExportFileDTO dto);
|
||||||
public Task<Result> UpdateStayExportAsync(StayExportFileDTO dto);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delete StayExport entry from DB.
|
/// Delete StayExport entry from DB.
|
||||||
@@ -13,6 +13,15 @@ public interface IStayExportFileEntityService
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Task<Result> DeleteStayExportAsync(StayExportFileDTO dto);
|
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<StayExportFileDTO?> GetDtoByIdAsync(long id);
|
||||||
//public Task<IEnumerable<StayExportFileDTO>> GetDtoListByFilterAsync(StayExportFileFilterDTO filter, int limit = 0);
|
//public Task<IEnumerable<StayExportFileDTO>> GetDtoListByFilterAsync(StayExportFileFilterDTO filter, int limit = 0);
|
||||||
public Task<IEnumerable<StayExportFileDTO>> GetDtoListAsync(int limit = 0);
|
public Task<IEnumerable<StayExportFileDTO>> GetDtoListAsync(int limit = 0);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Somnia.GuestLog.Enums.Models;
|
||||||
using Somnia.GuestLog.Enums.Services;
|
using Somnia.GuestLog.Enums.Services;
|
||||||
using Somnia.GuestLog.Infrastructure;
|
using Somnia.GuestLog.Infrastructure;
|
||||||
using Somnia.GuestLog.Models;
|
using Somnia.GuestLog.Models;
|
||||||
@@ -35,6 +36,8 @@ public class StayEntryEntityService(
|
|||||||
RoomCount = dto.RoomCount!.Value,
|
RoomCount = dto.RoomCount!.Value,
|
||||||
RoomNumber = dto.RoomNumber,
|
RoomNumber = dto.RoomNumber,
|
||||||
PaymentMethod = dto.PaymentMethod!,
|
PaymentMethod = dto.PaymentMethod!,
|
||||||
|
StayUploadStatus = UploadStatus.Pending,
|
||||||
|
StayUploadStatusTime = null,
|
||||||
CreateTime = createTime,
|
CreateTime = createTime,
|
||||||
UpdateTime = createTime,
|
UpdateTime = createTime,
|
||||||
};
|
};
|
||||||
@@ -101,6 +104,11 @@ public class StayEntryEntityService(
|
|||||||
return Result.Fail(ResultCode.NotFound);
|
return Result.Fail(ResultCode.NotFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dbItem.StayUploadStatus == UploadStatus.Uploaded)
|
||||||
|
{
|
||||||
|
return Result.Fail(ResultCode.DataIsFinal);
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dbContext.StayEntries.Remove(dbItem);
|
dbContext.StayEntries.Remove(dbItem);
|
||||||
@@ -116,6 +124,42 @@ public class StayEntryEntityService(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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)
|
public async Task<StayEntryDTO?> GetDtoByIdAsync(long id, StayEntryQueryConfig? queryConfig = null)
|
||||||
{
|
{
|
||||||
using var dbContext = contextFactory.CreateDbContext();
|
using var dbContext = contextFactory.CreateDbContext();
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Somnia.GuestLog.Enums.Models;
|
||||||
using Somnia.GuestLog.Enums.Services;
|
using Somnia.GuestLog.Enums.Services;
|
||||||
using Somnia.GuestLog.Infrastructure;
|
using Somnia.GuestLog.Infrastructure;
|
||||||
using Somnia.GuestLog.Models;
|
using Somnia.GuestLog.Models;
|
||||||
@@ -38,6 +39,8 @@ public class StayExportFileEntityService(
|
|||||||
ExportedPath = dto.ExportedPath,
|
ExportedPath = dto.ExportedPath,
|
||||||
ExportDetails = dto.ExportDetails,
|
ExportDetails = dto.ExportDetails,
|
||||||
ExportTime = dto.ExportTime?.ToUniversalTime() ?? DateTime.UtcNow,
|
ExportTime = dto.ExportTime?.ToUniversalTime() ?? DateTime.UtcNow,
|
||||||
|
FileUploadStatus = UploadStatus.Pending,
|
||||||
|
FileUploadStatusTime = null
|
||||||
};
|
};
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -58,13 +61,13 @@ public class StayExportFileEntityService(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<Result> UpdateStayExportAsync(StayExportFileDTO dto)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<Result> DeleteStayExportAsync(StayExportFileDTO dto)
|
public async Task<Result> DeleteStayExportAsync(StayExportFileDTO dto)
|
||||||
{
|
{
|
||||||
|
if (dto.FileUploadStatus == UploadStatus.Uploaded)
|
||||||
|
{
|
||||||
|
return Result.Fail(ResultCode.DataIsFinal);
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using var dbContext = contextFactory.CreateDbContext();
|
using var dbContext = contextFactory.CreateDbContext();
|
||||||
@@ -91,6 +94,50 @@ public class StayExportFileEntityService(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<Result> UpdateStayExportUploadStatusAsync(long id, UploadStatus newStatus)
|
||||||
|
{
|
||||||
|
//Try get StayExport
|
||||||
|
using var dbContext = contextFactory.CreateDbContext();
|
||||||
|
StayExportFile? dbItem = await dbContext.StayExportFiles
|
||||||
|
.Where(e => e.Id == id)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
if (dbItem == null)
|
||||||
|
{
|
||||||
|
return Result.Fail(ResultCode.NotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dbItem.FileUploadStatus == newStatus)
|
||||||
|
{
|
||||||
|
return Result.Fail(ResultCode.NoPendingChanges);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Status can be updated only when current status is "Pending"
|
||||||
|
if (dbItem.FileUploadStatus != UploadStatus.Pending)
|
||||||
|
{
|
||||||
|
return Result.FailWithContext(ResultCode.UploadStatusIsFinal, context: dbItem.FileUploadStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Update Status
|
||||||
|
dbItem.FileUploadStatus = newStatus;
|
||||||
|
dbItem.FileUploadStatusTime = DateTime.UtcNow;
|
||||||
|
|
||||||
|
await dbContext.SaveChangesAsync();
|
||||||
|
|
||||||
|
logger.LogInformation("StayExportFileService - UpdateStayExportUploadStatusAsync: StayExport ('{id}') UploadStatus updated to '{status}'",
|
||||||
|
dbItem.GetFullKey(), newStatus);
|
||||||
|
return Result.Ok();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.LogError(ex, "StayExportFileService - UpdateStayExportUploadStatusAsync: Error updating StayExport UploadStatus");
|
||||||
|
return Result.FailUnknownError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task<StayExportFileDTO?> GetDtoByIdAsync(long id)
|
public async Task<StayExportFileDTO?> GetDtoByIdAsync(long id)
|
||||||
{
|
{
|
||||||
using var dbContext = contextFactory.CreateDbContext();
|
using var dbContext = contextFactory.CreateDbContext();
|
||||||
|
|||||||
Reference in new issue
Block a user