API การลา 01-03

This commit is contained in:
Suphonchai Phoonsawat 2023-11-29 17:28:15 +07:00
parent 32686c3e0b
commit cffb53c1f5
29 changed files with 6391 additions and 4 deletions

View file

@ -10,6 +10,7 @@
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.8" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="7.0.9" />
<PackageReference Include="ThaiBahtText" Version="1.0.103" />
</ItemGroup>
</Project>

View file

@ -12,6 +12,15 @@ namespace BMA.EHR.Domain.Extensions
#region " Public "
public static int DiffDay(this DateTime startDate, DateTime endDate)
{
if (endDate < startDate)
{
throw new ArgumentException("End Date must greater than start date.");
}
return (int)(endDate.Date - startDate.Date).TotalDays;
}
public static double DiffYear(this DateTime currentDate)
{
return (DateTime.Today - currentDate).TotalDays / 365.2425;

View file

@ -1,9 +1,17 @@
using System.Text;
using GreatFriends.ThaiBahtText;
namespace BMA.EHR.Domain.Extensions
{
public static class IntegerExtension
{
public static string ToThaiBahtText(this int value, bool appendBahtOnly)
{
var decValue = (decimal)value;
return decValue.ThaiBahtText(appendBahtOnly: appendBahtOnly);
}
public static string ToThaiMonth(this int value)
{
switch (value)

View file

@ -11,5 +11,8 @@ namespace BMA.EHR.Domain.Models.Leave.Commons
[Required, Comment("รหัสประเภทการลา")]
public string Code { get; set; } = string.Empty;
[Required, Comment("จำนวนวันลาสูงสุดประจำปี")]
public int Limit { get; set; } = 30;
}
}

View file

@ -104,5 +104,17 @@ namespace BMA.EHR.Domain.Models.Leave.Requests
public string LeaveStatus { get; set; } = string.Empty;
public string LeaveComment { get; set; } = string.Empty;
public int LeaveTotal { get; set; } = 0;
public DateTime? LeaveLast { get; set; }
public Guid KeycloakUserId { get; set; } = Guid.Empty;
public DateTime? LeaveBirthDate { get; set; }
public DateTime? LeaveGovernmentDate { get; set; }
public int? LeaveSalary { get; set; }
}
}