Fixed bug regrading passing incorrect tenantId and sending list of active and inactive employees rather than list of active or inc=active employees
This commit is contained in:
parent
7b0a1b0073
commit
ac6f52ce16
@ -40,15 +40,15 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
}
|
}
|
||||||
private int GetUserId()
|
private int GetUserId()
|
||||||
{
|
{
|
||||||
var tenant = User.FindFirst("Id")?.Value;
|
var user = _userHelper.GetCurrentUserAsync();
|
||||||
return (tenant != null ? Convert.ToInt32(tenant) : 1);
|
return user.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("log/attendance/{attendanceid}")]
|
[HttpGet("log/attendance/{attendanceid}")]
|
||||||
|
|
||||||
public async Task<IActionResult> GetAttendanceLogById(int attendanceid)
|
public async Task<IActionResult> GetAttendanceLogById(int attendanceid)
|
||||||
{
|
{
|
||||||
int TenantId = GetUserId();
|
int TenantId = GetTenantId();
|
||||||
|
|
||||||
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();
|
||||||
|
|
||||||
@ -59,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 = GetUserId();
|
int TenantId = GetTenantId();
|
||||||
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)
|
||||||
@ -84,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 = GetUserId();
|
int TenantId = GetTenantId();
|
||||||
DateTime fromDate = new DateTime();
|
DateTime fromDate = new DateTime();
|
||||||
DateTime toDate = new DateTime();
|
DateTime toDate = new DateTime();
|
||||||
|
|
||||||
@ -149,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] string? date = null)
|
public async Task<IActionResult> EmployeeAttendanceByProject([FromQuery] int projectId, [FromQuery] bool IncludeInActive, [FromQuery] string? date = null)
|
||||||
{
|
{
|
||||||
int TenantId = GetUserId();
|
int TenantId = GetTenantId();
|
||||||
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)
|
||||||
@ -172,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, true);
|
List<ProjectAllocation> projectteam = await _projectsHelper.GetTeamByProject(TenantId, projectId, IncludeInActive);
|
||||||
foreach (ProjectAllocation teamMember in projectteam)
|
foreach (ProjectAllocation teamMember in projectteam)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user