2023-11-09 14:35:08 +07:00
|
|
|
|
using BMA.EHR.Application.Common.Interfaces;
|
2023-11-27 11:52:28 +07:00
|
|
|
|
using BMA.EHR.Domain.Models.Leave.Commons;
|
|
|
|
|
|
using BMA.EHR.Domain.Models.Leave.Requests;
|
2023-11-10 14:40:53 +07:00
|
|
|
|
using BMA.EHR.Domain.Models.Leave.TimeAttendants;
|
2023-11-09 14:35:08 +07:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
|
|
|
|
|
|
namespace BMA.EHR.Infrastructure.Persistence
|
|
|
|
|
|
{
|
2023-11-13 16:56:17 +07:00
|
|
|
|
public class LeaveDbContext : DbContext, ILeaveDbContext
|
2023-11-09 14:35:08 +07:00
|
|
|
|
{
|
2023-11-10 14:40:53 +07:00
|
|
|
|
#region " Check-In "
|
2023-11-09 14:35:08 +07:00
|
|
|
|
|
|
|
|
|
|
public DbSet<DutyTime> DutyTimes { get; set; }
|
|
|
|
|
|
|
2023-11-10 14:40:53 +07:00
|
|
|
|
public DbSet<UserTimeStamp> UserTimeStamps { get; set; }
|
|
|
|
|
|
|
2024-01-09 09:41:26 +07:00
|
|
|
|
public DbSet<ProcessUserTimeStamp> ProcessUserTimeStamps { get; set; }
|
2023-11-23 10:35:55 +07:00
|
|
|
|
|
|
|
|
|
|
public DbSet<UserDutyTime> UserDutyTimes { get; set; }
|
|
|
|
|
|
|
2023-11-24 11:23:18 +07:00
|
|
|
|
public DbSet<AdditionalCheckRequest> AdditionalCheckRequests { get; set; }
|
|
|
|
|
|
|
2024-01-09 09:41:26 +07:00
|
|
|
|
public DbSet<UserCalendar> UserCalendars { get; set; }
|
|
|
|
|
|
|
2026-01-20 10:49:13 +07:00
|
|
|
|
public DbSet<CheckInJobStatus> CheckInJobStatuses { get; set; }
|
|
|
|
|
|
|
2023-11-27 11:52:28 +07:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " Leave System "
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<LeaveType> LeaveTypes { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<LeaveRequest> LeaveRequests { get; set; }
|
|
|
|
|
|
|
2024-01-09 11:26:36 +07:00
|
|
|
|
public DbSet<LeaveDocument> LeaveDocuments { get; set; }
|
|
|
|
|
|
|
2025-03-26 12:11:41 +07:00
|
|
|
|
public DbSet<LeaveBeginning> LeaveBeginnings { get; set; }
|
2023-11-27 11:52:28 +07:00
|
|
|
|
|
2025-04-17 09:31:05 +07:00
|
|
|
|
public DbSet<LeaveRequestApprover> LeaveRequestApprovers { get; set; }
|
|
|
|
|
|
|
2023-11-09 14:35:08 +07:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public LeaveDbContext(DbContextOptions<LeaveDbContext> options) : base(options)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Task<int> SaveChangesAsync()
|
|
|
|
|
|
{
|
|
|
|
|
|
return base.SaveChangesAsync();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Attatch<T>(T entity) where T : class
|
|
|
|
|
|
{
|
|
|
|
|
|
Attach(entity);
|
|
|
|
|
|
}
|
2024-09-13 09:56:30 +07:00
|
|
|
|
|
|
|
|
|
|
public void Detach<T>(T entity) where T : class
|
|
|
|
|
|
{
|
|
|
|
|
|
base.Entry(entity).State = EntityState.Detached;
|
|
|
|
|
|
}
|
2023-11-09 14:35:08 +07:00
|
|
|
|
}
|
|
|
|
|
|
}
|