Restructure TAble

This commit is contained in:
Suphonchai Phoonsawat 2023-06-25 18:36:02 +07:00
parent 717b0f0a8e
commit 1ba2f2eec1
37 changed files with 1107 additions and 527 deletions

View file

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="7.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="7.0.8" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,13 @@
using BMA.EHR.Domain.Common.Interfaces;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace BMA.EHR.Domain.Common
{
public abstract class BaseDataEntity<T> : BaseEntity<T>, IActivableEntity
{
[Required, Column(Order = 990), Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true;
}
}

View file

@ -0,0 +1,13 @@
using BMA.EHR.Domain.Common.Interfaces;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace BMA.EHR.Domain.Common
{
public class BaseDraftEntity<T> : BaseDataEntity<T>, IPublishableEntity
{
[Required, Column(Order = 899), Comment("สถานะการเผยแพร่ข้อมูล")]
public bool IsPublished { get; set; } = false;
}
}

View file

@ -1,34 +1,36 @@
using BMA.EHR.Domain.Common.Interfaces;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BMA.EHR.Domain.Common
{
public abstract class BaseEntity<T> : IActivableEntity, IAuditableEntity
{
[Key, Column(Order = 0), Comment("คีย์หลัก")]
public virtual T Id { get; set; }
public class BaseEntity<T> : IAuditableEntity
{
[Key, Column(Order = 0), Comment("คีย์หลัก")]
public virtual T Id { get; set; }
[Required, Column(Order = 990), Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true;
[Required, Column(Order = 991), Comment("User Id ที่สร้างข้อมูล")]
public Guid CreatedUserId { get; set; } = Guid.Empty;
[Required, Column(Order = 991), Comment("User Id ที่สร้างข้อมูล")]
public Guid CreatedUserId { get; set; } = Guid.Empty;
[Required, Column(Order = 992), Comment("ชื่อ User ที่สร้างข้อมูล")]
public string CreatedUserFullName { get; set; } = string.Empty;
[Required, Column(Order = 992), Comment("ชื่อ User ที่สร้างข้อมูล")]
public string CreatedUserFullName { get; set; } = string.Empty;
[Required, Column(Order = 993), Comment("สร้างข้อมูลเมื่อ")]
public DateTime CreatedDate { get; set; } = DateTime.Now;
[Required, Column(Order = 993), Comment("สร้างข้อมูลเมื่อ")]
public DateTime CreatedDate { get; set; } = DateTime.Now;
[Column(Order = 994), Comment("User Id ที่แก้ไขข้อมูล")]
public Guid? ModifiedUserId { get; set; }
[Column(Order = 994), Comment("User Id ที่แก้ไขข้อมูล")]
public Guid? ModifiedUserId { get; set; }
[Column(Order = 995), Comment("ชื่อ User ที่แก้ไขข้อมูล")]
public string? ModifiedUserFullName { get; set; }
[Column(Order = 995), Comment("ชื่อ User ที่แก้ไจข้อมูล")]
public string? ModifiedUserFullName { get; set; }
[Column(Order = 996), Comment("แก้ไขข้อมูลเมื่อ")]
public DateTime? ModifiedDate { get; set; }
}
[Column(Order = 996), Comment("แก้ไขข้อมูลเมื่อ")]
public DateTime? ModifiedDate { get; set; }
}
}

View file

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BMA.EHR.Domain.Common.Interfaces
{
public interface IPublishableEntity
{
bool IsPublished { get; set; }
}
}

View file

@ -0,0 +1,11 @@
namespace BMA.EHR.Domain.Common
{
public class ResponseObject
{
public int Status { get; set; }
public string? Message { get; set; }
public object? Result { get; set; }
}
}

View file

@ -0,0 +1,13 @@
using BMA.EHR.Domain.Common;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace BMA.EHR.Domain.Entities.MetaData.BloodGroup
{
public class BloodGroupDraftEntity : BaseDraftEntity<Guid>
{
[Required, MaxLength(2), Column(Order = 1), Comment("ชื่อหมู่โลหิต")]
public string Name { get; set; } = string.Empty;
}
}

View file

@ -0,0 +1,13 @@
using BMA.EHR.Domain.Common;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace BMA.EHR.Domain.Entities.MetaData.BloodGroup
{
public class BloodGroupEntity : BaseDataEntity<Guid>
{
[Required, MaxLength(2), Column(Order = 1), Comment("ชื่อหมู่โลหิต")]
public string Name { get; set; } = string.Empty;
}
}

View file

@ -0,0 +1,15 @@
using BMA.EHR.Domain.Common;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
namespace BMA.EHR.Domain.Entities.MetaData.BloodGroup
{
public class BloodGroupPublishHistoryEntity : BaseEntity<Guid>
{
[Column(Order = 1), Comment("รายละเอียดการแก้ไข")]
public string Detail { get; set; } = string.Empty;
[Column(Order = 2), Comment("เก็บ Object ที่มีการอัพเดตในระบบ")]
public string ObjectValue { get; set; } = string.Empty;
}
}

View file

@ -1,13 +0,0 @@
using BMA.EHR.Domain.Common;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace BMA.EHR.Domain.Entities.MetaData
{
public class BloodGroupEntity : BaseEntity<Guid>
{
[Required, MaxLength(2), Column(Order = 1), Comment("ชื่อหมู่โลหิต")]
public string Name { get; set; } = string.Empty;
}
}

View file

@ -0,0 +1,13 @@
using BMA.EHR.Domain.Common;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace BMA.EHR.Domain.Entities.MetaData.Prefix
{
public class PrefixDraftEntity : BaseDraftEntity<Guid>
{
[Required, MaxLength(100), Column(Order = 1), Comment("รายละเอียดคำนำหน้า")]
public string Name { get; set; } = string.Empty;
}
}

View file

@ -3,9 +3,9 @@ using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace BMA.EHR.Domain.Entities.MetaData
namespace BMA.EHR.Domain.Entities.MetaData.Prefix
{
public class PrefixEntity : BaseEntity<Guid>
public class PrefixEntity : BaseDataEntity<Guid>
{
[Required, MaxLength(100), Column(Order = 1), Comment("รายละเอียดคำนำหน้า")]
public string Name { get; set; } = string.Empty;

View file

@ -0,0 +1,15 @@
using BMA.EHR.Domain.Common;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
namespace BMA.EHR.Domain.Entities.MetaData.Prefix
{
public class PrefixPublishHistoryEntity : BaseEntity<Guid>
{
[Column(Order = 1), Comment("รายละเอียดการแก้ไข")]
public string Detail { get; set; } = string.Empty;
[Column(Order = 2), Comment("เก็บ Object ที่มีการอัพเดตในระบบ")]
public string ObjectValue { get; set; } = string.Empty;
}
}

View file

@ -0,0 +1,27 @@
namespace BMA.EHR.Domain.Shared
{
public class GlobalMessages
{
public static readonly string Success = "สำเร็จ";
public static readonly string Error = "เกิดข้อผิดพลาด";
public static readonly string DataNotFound = "ไม่พบข้อมูลในระบบ";
#region " Meta Data "
public static readonly string DataExist5 = "เนื่องจากมีการกำหนดวันหยุดในการทำงาน 5 วันอยู่";
public static readonly string DataExist6 = "เนื่องจากมีการกำหนดวันหยุดในการทำงาน 6 วันอยู่";
public static readonly string NameDupicate = "ชื่อวันหยุดนี้มีอยู่ในระบบอยู่แล้ว";
public static readonly string HolidayOfYearNotFound = "ไม่พบข้อมูลวันหยุดในปีที่คุณระบุ";
public static readonly string HolidayOfYearNotCopy = "ไม่สามารถคัดลอกวันหยุดย้อนหลังได้";
public static readonly string DestinationHolidayIsExist = "ข้อมูลวันหยุดในปีที่ระบุมีอยู่แล้ว";
#endregion
}
}