Merge branch 'develop'
This commit is contained in:
commit
f0eea16d9c
3 changed files with 57 additions and 16 deletions
|
|
@ -20,8 +20,6 @@ namespace BMA.EHR.Infrastructure
|
||||||
public static IServiceCollection AddLeavePersistence(this IServiceCollection services,
|
public static IServiceCollection AddLeavePersistence(this IServiceCollection services,
|
||||||
IConfiguration configuration)
|
IConfiguration configuration)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
// leave db context
|
// leave db context
|
||||||
var connectionStringLeave = configuration.GetConnectionString("LeaveConnection");
|
var connectionStringLeave = configuration.GetConnectionString("LeaveConnection");
|
||||||
|
|
||||||
|
|
@ -31,6 +29,10 @@ namespace BMA.EHR.Infrastructure
|
||||||
{
|
{
|
||||||
b.MigrationsAssembly(typeof(LeaveDbContext).Assembly.FullName);
|
b.MigrationsAssembly(typeof(LeaveDbContext).Assembly.FullName);
|
||||||
b.MigrationsHistoryTable("__LeaveMigrationsHistory");
|
b.MigrationsHistoryTable("__LeaveMigrationsHistory");
|
||||||
|
b.EnableRetryOnFailure(
|
||||||
|
maxRetryCount: 5,
|
||||||
|
maxRetryDelay: System.TimeSpan.FromSeconds(30),
|
||||||
|
errorNumbersToAdd: null);
|
||||||
|
|
||||||
}),
|
}),
|
||||||
ServiceLifetime.Transient);
|
ServiceLifetime.Transient);
|
||||||
|
|
@ -43,8 +45,6 @@ namespace BMA.EHR.Infrastructure
|
||||||
public static IServiceCollection AddDisciplinePersistence(this IServiceCollection services,
|
public static IServiceCollection AddDisciplinePersistence(this IServiceCollection services,
|
||||||
IConfiguration configuration)
|
IConfiguration configuration)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
// discipline db context
|
// discipline db context
|
||||||
var connectionStringDiscipline = configuration.GetConnectionString("DisciplineConnection");
|
var connectionStringDiscipline = configuration.GetConnectionString("DisciplineConnection");
|
||||||
|
|
||||||
|
|
@ -54,7 +54,10 @@ namespace BMA.EHR.Infrastructure
|
||||||
{
|
{
|
||||||
b.MigrationsAssembly(typeof(DisciplineDbContext).Assembly.FullName);
|
b.MigrationsAssembly(typeof(DisciplineDbContext).Assembly.FullName);
|
||||||
b.MigrationsHistoryTable("__DisciplineMigrationsHistory");
|
b.MigrationsHistoryTable("__DisciplineMigrationsHistory");
|
||||||
|
b.EnableRetryOnFailure(
|
||||||
|
maxRetryCount: 5,
|
||||||
|
maxRetryDelay: System.TimeSpan.FromSeconds(30),
|
||||||
|
errorNumbersToAdd: null);
|
||||||
}),
|
}),
|
||||||
ServiceLifetime.Transient);
|
ServiceLifetime.Transient);
|
||||||
|
|
||||||
|
|
@ -67,8 +70,6 @@ namespace BMA.EHR.Infrastructure
|
||||||
IConfiguration configuration)
|
IConfiguration configuration)
|
||||||
{
|
{
|
||||||
services.AddTransient<MinIOService>();
|
services.AddTransient<MinIOService>();
|
||||||
|
|
||||||
|
|
||||||
var connectionString = configuration.GetConnectionString("DefaultConnection");
|
var connectionString = configuration.GetConnectionString("DefaultConnection");
|
||||||
|
|
||||||
services.AddDbContext<ApplicationDBContext>(options =>
|
services.AddDbContext<ApplicationDBContext>(options =>
|
||||||
|
|
@ -77,10 +78,15 @@ namespace BMA.EHR.Infrastructure
|
||||||
{
|
{
|
||||||
b.MigrationsAssembly(typeof(ApplicationDBContext).Assembly.FullName);
|
b.MigrationsAssembly(typeof(ApplicationDBContext).Assembly.FullName);
|
||||||
b.MigrationsHistoryTable("__EHRMigrationsHistory");
|
b.MigrationsHistoryTable("__EHRMigrationsHistory");
|
||||||
|
b.EnableRetryOnFailure(
|
||||||
|
maxRetryCount: 5,
|
||||||
|
maxRetryDelay: System.TimeSpan.FromSeconds(30),
|
||||||
|
errorNumbersToAdd: null);
|
||||||
|
|
||||||
}),
|
}),
|
||||||
ServiceLifetime.Transient);
|
ServiceLifetime.Transient);
|
||||||
|
|
||||||
|
|
||||||
services.AddTransient<IApplicationDBContext>(provider => provider.GetService<ApplicationDBContext>());
|
services.AddTransient<IApplicationDBContext>(provider => provider.GetService<ApplicationDBContext>());
|
||||||
|
|
||||||
var connectionStringExam = configuration.GetConnectionString("ExamConnection");
|
var connectionStringExam = configuration.GetConnectionString("ExamConnection");
|
||||||
|
|
@ -91,6 +97,10 @@ namespace BMA.EHR.Infrastructure
|
||||||
{
|
{
|
||||||
b.MigrationsAssembly(typeof(ApplicationDBExamContext).Assembly.FullName);
|
b.MigrationsAssembly(typeof(ApplicationDBExamContext).Assembly.FullName);
|
||||||
b.MigrationsHistoryTable("__EHRMigrationsHistory");
|
b.MigrationsHistoryTable("__EHRMigrationsHistory");
|
||||||
|
b.EnableRetryOnFailure(
|
||||||
|
maxRetryCount: 5,
|
||||||
|
maxRetryDelay: System.TimeSpan.FromSeconds(30),
|
||||||
|
errorNumbersToAdd: null);
|
||||||
|
|
||||||
}),
|
}),
|
||||||
ServiceLifetime.Transient);
|
ServiceLifetime.Transient);
|
||||||
|
|
|
||||||
|
|
@ -2373,9 +2373,30 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
|
|
||||||
//var endTime = DateTimeOffset.Parse($"{DateTime.Now.Date.ToString("yyyy-MM-dd")}T{duty.EndTimeAfternoon}:00.0000000+07:00").ToLocalTime().DateTime;
|
//var endTime = DateTimeOffset.Parse($"{DateTime.Now.Date.ToString("yyyy-MM-dd")}T{duty.EndTimeAfternoon}:00.0000000+07:00").ToLocalTime().DateTime;
|
||||||
|
|
||||||
var endTime = DateTime.Parse($"{DateTime.Now.Date.ToString("yyyy-MM-dd")}T{duty.EndTimeAfternoon}:00.0000000+07:00");
|
//var endTime = DateTime.Parse($"{DateTime.Now.Date.ToString("yyyy-MM-dd")}T{duty.EndTimeAfternoon}:00.0000000+07:00");
|
||||||
|
var endTime = DateTime.Parse($"{DateTime.Now.Date.ToString("yyyy-MM-dd")} {duty.EndTimeAfternoon}");
|
||||||
|
var status = string.Empty;
|
||||||
|
if(lastCheckIn == null)
|
||||||
|
{
|
||||||
|
status = "ABSENT";
|
||||||
|
}
|
||||||
|
else if (lastCheckIn.CheckIn.Date < DateTime.Now.Date)
|
||||||
|
{
|
||||||
|
status = "NORMAL";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (time < endTime)
|
||||||
|
{
|
||||||
|
status = "ABSENT";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = "NORMAL";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var status = lastCheckIn == null ? "ABSENT" : lastCheckIn.CheckIn.Date < DateTime.Now.Date ? "NORMAL" : time < endTime ? "ABSENT" : "NORMAL";
|
//var status = lastCheckIn == null ? "ABSENT" : lastCheckIn.CheckIn.Date < DateTime.Now.Date ? "NORMAL" : time < endTime ? "ABSENT" : "NORMAL";
|
||||||
|
|
||||||
return Success(new
|
return Success(new
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2079,11 +2079,20 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
remarkStr += "ครึ่งวันบ่าย";
|
remarkStr += "ครึ่งวันบ่าย";
|
||||||
|
|
||||||
|
|
||||||
|
// var leaveRangeEnd = leaveReq.LeaveRangeEnd == null ? "" : leaveReq.LeaveRangeEnd.ToUpper();
|
||||||
|
// if (leaveRangeEnd == "MORNING")
|
||||||
|
// remarkStr += "ครึ่งวันเช้า";
|
||||||
|
// else if (leaveRangeEnd == "AFTERNOON")
|
||||||
|
// remarkStr += "ครึ่งวันบ่าย";
|
||||||
|
|
||||||
var leaveRangeEnd = leaveReq.LeaveRangeEnd == null ? "" : leaveReq.LeaveRangeEnd.ToUpper();
|
var leaveRangeEnd = leaveReq.LeaveRangeEnd == null ? "" : leaveReq.LeaveRangeEnd.ToUpper();
|
||||||
if (leaveRangeEnd == "MORNING")
|
if(leaveRange != leaveRangeEnd)
|
||||||
remarkStr += "ครึ่งวันเช้า";
|
{
|
||||||
else if (leaveRangeEnd == "AFTERNOON")
|
if (leaveRangeEnd == "MORNING")
|
||||||
remarkStr += "ครึ่งวันบ่าย";
|
remarkStr += " - ครึ่งวันเช้า";
|
||||||
|
else if (leaveRangeEnd == "AFTERNOON")
|
||||||
|
remarkStr += " - ครึ่งวันบ่าย";
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
remarkStr += leaveReq.Type.Name;
|
remarkStr += leaveReq.Type.Name;
|
||||||
|
|
@ -2158,8 +2167,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
timeStamps.CheckOut != null ?
|
timeStamps.CheckOut != null ?
|
||||||
timeStamps.CheckOut.Value.ToThaiFullDate2() :
|
timeStamps.CheckOut.Value.ToThaiFullDate2() :
|
||||||
"",
|
"",
|
||||||
checkInTimeRaw = timeStamps?.CheckIn,
|
checkInTimeRaw = timeStamps == null ? dd.date.Date : timeStamps?.CheckIn,
|
||||||
checkOutTimeRaw = timeStamps?.CheckOut,
|
checkOutTimeRaw = timeStamps == null ? dd.date.Date : timeStamps?.CheckOut != null ? timeStamps?.CheckOut : null,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (timeStamps != null)
|
if (timeStamps != null)
|
||||||
|
|
@ -2195,7 +2204,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
employees = employees.OrderBy(x => x.checkInDate).ThenBy(x => x.checkInTimeRaw ?? DateTime.MaxValue).ThenBy(x => x.checkOutTimeRaw ?? DateTime.MaxValue).ToList();
|
//employees = employees.OrderBy(x => x.checkInDate).ThenBy(x => x.checkInTimeRaw ?? DateTime.MaxValue).ThenBy(x => x.checkOutTimeRaw ?? DateTime.MaxValue).ToList();
|
||||||
|
employees = employees.OrderBy(x => x.checkInTimeRaw ?? DateTime.MaxValue).ThenBy(x => x.checkOutTimeRaw ?? DateTime.MaxValue).ToList();
|
||||||
for (int i = 0; i < employees.Count; i++)
|
for (int i = 0; i < employees.Count; i++)
|
||||||
{
|
{
|
||||||
employees[i].no = i + 1;
|
employees[i].no = i + 1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue