เพิ่มการจัดการตารางการทำงาานของ ขรก ในส่วนของ Model และ Repository
This commit is contained in:
parent
6d7aebaeb5
commit
0e22e3886f
7 changed files with 1252 additions and 1 deletions
|
|
@ -0,0 +1,84 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Application.Messaging;
|
||||
using BMA.EHR.Domain.Models.Leave.TimeAttendants;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
||||
{
|
||||
public class UserCalendarRepository : GenericLeaveRepository<Guid, UserDutyTime>
|
||||
{
|
||||
#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 UserCalendarRepository(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
|
||||
|
||||
#region " Methods "
|
||||
|
||||
public async Task<List<UserCalendar>> GetListByProfileIdAsync(Guid profileId)
|
||||
{
|
||||
var data = await _dbContext.Set<UserCalendar>().AsQueryable()
|
||||
.Where(x => x.ProfileId == profileId)
|
||||
.ToListAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<UserCalendar?> GetExist(Guid profileId)
|
||||
{
|
||||
var data = await _dbContext.Set<UserCalendar>()
|
||||
.Where(x => x.ProfileId == profileId)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue