add API จัดการปฏิทินวันหยุด ขรก

This commit is contained in:
Suphonchai Phoonsawat 2024-01-09 10:25:18 +07:00
parent 0e22e3886f
commit 77410d9fa3
4 changed files with 81 additions and 10 deletions

View file

@ -1,7 +1,3 @@
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;
@ -11,7 +7,7 @@ using Microsoft.Extensions.Configuration;
namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
{
public class UserCalendarRepository : GenericLeaveRepository<Guid, UserDutyTime>
public class UserCalendarRepository : GenericLeaveRepository<Guid, UserCalendar>
{
#region " Fields "

View file

@ -36,7 +36,7 @@ namespace BMA.EHR.Application.Repositories.MetaData
return data;
}
public int GetWeekEndCount(DateTime startDate, DateTime endDate)
public int GetWeekEndCount(DateTime startDate, DateTime endDate, string category = "NORMAL")
{
var dates = new List<DateTime>();
@ -45,7 +45,11 @@ namespace BMA.EHR.Application.Repositories.MetaData
dates.Add(i);
}
var count = dates.Where(d => d.DayOfWeek == DayOfWeek.Saturday || d.DayOfWeek == DayOfWeek.Sunday).Count();
var count = 0;
if (category == "NORMAL")
count = dates.Where(d => d.DayOfWeek == DayOfWeek.Saturday || d.DayOfWeek == DayOfWeek.Sunday).Count();
else
count = dates.Where(d => d.DayOfWeek == DayOfWeek.Sunday).Count();
return count;
}