Add LeaveType Seeder

This commit is contained in:
Suphonchai Phoonsawat 2023-11-28 12:28:20 +07:00
parent ef66c28f0e
commit 8037ad7e1e
11 changed files with 1111 additions and 2 deletions

View file

@ -1,6 +1,7 @@
using BMA.EHR.Application.Messaging;
using BMA.EHR.Application.Repositories;
using BMA.EHR.Application.Repositories.Commands;
using BMA.EHR.Application.Repositories.Leaves.LeaveRequests;
using BMA.EHR.Application.Repositories.Leaves.TimeAttendants;
using BMA.EHR.Application.Repositories.MessageQueue;
using BMA.EHR.Application.Repositories.Reports;
@ -49,6 +50,8 @@ namespace BMA.EHR.Application
services.AddTransient<UserDutyTimeRepository>();
services.AddTransient<AdditionalCheckRequestRepository>();
services.AddTransient<LeaveTypeRepository>();
return services;
}

View file

@ -0,0 +1,56 @@
using BMA.EHR.Application.Common.Interfaces;
using BMA.EHR.Application.Messaging;
using BMA.EHR.Domain.Models.Leave.Commons;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
{
public class LeaveTypeRepository : GenericLeaveRepository<Guid, LeaveType>
{
#region " Fields "
private readonly ILeaveDbContext _dbContext;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly OrganizationCommonRepository _organizationCommonRepository;
private readonly UserProfileRepository _userProfileRepository;
private readonly IConfiguration _configuration;
private readonly EmailSenderService _emailSenderService;
#endregion
#region " Constructor and Destuctor "
public LeaveTypeRepository(ILeaveDbContext dbContext,
IHttpContextAccessor httpContextAccessor,
OrganizationCommonRepository organizationCommonRepository,
UserProfileRepository userProfileRepository,
IConfiguration configuration,
EmailSenderService emailSenderService) : base(dbContext, httpContextAccessor)
{
_dbContext = dbContext;
_httpContextAccessor = httpContextAccessor;
_organizationCommonRepository = organizationCommonRepository;
_userProfileRepository = userProfileRepository;
_configuration = configuration;
_emailSenderService = emailSenderService;
}
#endregion
#region " Properties "
protected Guid UserOrganizationId
{
get
{
if (UserId != null || UserId != "")
return _userProfileRepository.GetUserOCId(Guid.Parse(UserId!));
else
return Guid.Empty;
}
}
#endregion
}
}