Solved time discrepancies in attendance/record
This commit is contained in:
parent
a42a924884
commit
212fe250c1
@ -38,12 +38,17 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
//var tenant = User.FindFirst("TenantId")?.Value;
|
//var tenant = User.FindFirst("TenantId")?.Value;
|
||||||
//return (tenant != null ? Convert.ToInt32(tenant) : 1);
|
//return (tenant != null ? Convert.ToInt32(tenant) : 1);
|
||||||
}
|
}
|
||||||
|
private int GetUserId()
|
||||||
|
{
|
||||||
|
var tenant = User.FindFirst("Id")?.Value;
|
||||||
|
return (tenant != null ? Convert.ToInt32(tenant) : 1);
|
||||||
|
}
|
||||||
|
|
||||||
[HttpGet("log/attendance/{attendanceid}")]
|
[HttpGet("log/attendance/{attendanceid}")]
|
||||||
|
|
||||||
public async Task<IActionResult> GetAttendanceLogById(int attendanceid)
|
public async Task<IActionResult> GetAttendanceLogById(int attendanceid)
|
||||||
{
|
{
|
||||||
int TenantId = GetTenantId();
|
int TenantId = GetUserId();
|
||||||
|
|
||||||
List<AttendanceLog> lstAttendance = await _context.AttendanceLogs.Where(c => c.AttendanceId == attendanceid && c.TenantId == TenantId).ToListAsync();
|
List<AttendanceLog> lstAttendance = await _context.AttendanceLogs.Where(c => c.AttendanceId == attendanceid && c.TenantId == TenantId).ToListAsync();
|
||||||
|
|
||||||
@ -54,7 +59,7 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
|
|
||||||
public async Task<IActionResult> GetAttendanceLogByEmployeeId(int employeeid, [FromQuery] string? date = null)
|
public async Task<IActionResult> GetAttendanceLogByEmployeeId(int employeeid, [FromQuery] string? date = null)
|
||||||
{
|
{
|
||||||
int TenantId = GetTenantId();
|
int TenantId = GetUserId();
|
||||||
DateOnly forDate = new DateOnly();
|
DateOnly forDate = new DateOnly();
|
||||||
|
|
||||||
if (date != null && DateOnly.TryParse(date, out forDate) == false)
|
if (date != null && DateOnly.TryParse(date, out forDate) == false)
|
||||||
@ -79,7 +84,7 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
|
|
||||||
public async Task<IActionResult> EmployeeAttendanceByDateRange([FromQuery] int projectId, [FromQuery] string? dateFrom = null, [FromQuery] string? dateTo = null)
|
public async Task<IActionResult> EmployeeAttendanceByDateRange([FromQuery] int projectId, [FromQuery] string? dateFrom = null, [FromQuery] string? dateTo = null)
|
||||||
{
|
{
|
||||||
int TenantId = GetTenantId();
|
int TenantId = GetUserId();
|
||||||
DateTime fromDate = new DateTime();
|
DateTime fromDate = new DateTime();
|
||||||
DateTime toDate = new DateTime();
|
DateTime toDate = new DateTime();
|
||||||
|
|
||||||
@ -144,9 +149,9 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("project/team")]
|
[HttpGet("project/team")]
|
||||||
|
|
||||||
public async Task<IActionResult> EmployeeAttendanceByProject([FromQuery] int projectId, [FromQuery] bool IncludeInActive, [FromQuery] string? date = null)
|
public async Task<IActionResult> EmployeeAttendanceByProject([FromQuery] int projectId, [FromQuery] string? date = null)
|
||||||
{
|
{
|
||||||
int TenantId = GetTenantId();
|
int TenantId = GetUserId();
|
||||||
DateTime forDate = new DateTime();
|
DateTime forDate = new DateTime();
|
||||||
|
|
||||||
if (date != null && DateTime.TryParse(date, out forDate) == false)
|
if (date != null && DateTime.TryParse(date, out forDate) == false)
|
||||||
@ -167,7 +172,7 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
List<Attendance> lstAttendance = await _context.Attendes.Where(c => c.ProjectID == projectId && c.AttendanceDate.Date == forDate && c.TenantId == TenantId).ToListAsync();
|
List<Attendance> lstAttendance = await _context.Attendes.Where(c => c.ProjectID == projectId && c.AttendanceDate.Date == forDate && c.TenantId == TenantId).ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
List<ProjectAllocation> projectteam = await _projectsHelper.GetTeamByProject(TenantId, projectId, IncludeInActive);
|
List<ProjectAllocation> projectteam = await _projectsHelper.GetTeamByProject(TenantId, projectId, true);
|
||||||
foreach (ProjectAllocation teamMember in projectteam)
|
foreach (ProjectAllocation teamMember in projectteam)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -299,7 +304,7 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
Longitude = recordAttendanceDot.Longitude,
|
Longitude = recordAttendanceDot.Longitude,
|
||||||
|
|
||||||
TenantId = TenantId,
|
TenantId = TenantId,
|
||||||
UpdatedBy = recordAttendanceDot.EmployeeID,
|
UpdatedBy = GetUserId(),
|
||||||
UpdatedOn = recordAttendanceDot.Date
|
UpdatedOn = recordAttendanceDot.Date
|
||||||
};
|
};
|
||||||
//if (recordAttendanceDot.Image != null && recordAttendanceDot.Image.Count > 0)
|
//if (recordAttendanceDot.Image != null && recordAttendanceDot.Image.Count > 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user