|
@@ -125,6 +125,8 @@ namespace MTWorkHR.Application.Services
|
|
|
|
|
|
return response;
|
|
return response;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ #region HR data____________________________
|
|
public async Task<PagingResultDto<ContractDto>> GetAllForHr(ContractPagingInputDto PagingInputDto)
|
|
public async Task<PagingResultDto<ContractDto>> GetAllForHr(ContractPagingInputDto PagingInputDto)
|
|
{
|
|
{
|
|
var res = await _unitOfWork.Contract.GetAllWithChildrenAsync();
|
|
var res = await _unitOfWork.Contract.GetAllWithChildrenAsync();
|
|
@@ -193,7 +195,36 @@ namespace MTWorkHR.Application.Services
|
|
|
|
|
|
return response;
|
|
return response;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ public async Task<ContractDto> GetByIdHRDetails(long id)
|
|
|
|
+ {
|
|
|
|
+ var entity = await _unitOfWork.Contract.GetByIdWithAllChildren(id);
|
|
|
|
+ if (entity != null)
|
|
|
|
+ {
|
|
|
|
+ var response = MapperObject.Mapper.Map<ContractDto>(entity);
|
|
|
|
+ response.WorkingDays = entity.WorkingDays != null ? entity.WorkingDays.Split(",").ToList() : null;
|
|
|
|
+ //--------------------
|
|
|
|
+ var user = await _userService.GetUserWithAttachmentById(entity.UserId);
|
|
|
|
+ response.EmployeeName = user.FirstName + " " + user.LastName;
|
|
|
|
+ response.EmployeeEmail = user.Email;
|
|
|
|
+ //___________Get Teams
|
|
|
|
+ var teamUsersList = await _unitOfWork.TeamUser.GetUserTeams(entity.UserId);
|
|
|
|
+ var teamsList = MapperObject.Mapper.Map<List<TeamDto>>(teamUsersList.Item1);
|
|
|
|
+
|
|
|
|
+ response.TeamList = teamsList;
|
|
|
|
+ //_____________Get vacation balance
|
|
|
|
+ var vacationAllocations = await _unitOfWork.OrderAllocation.GetUserAllocations(entity.UserId, 1, 1, entity.Id, DateTime.Now.Year);
|
|
|
|
+ var remainVacations = vacationAllocations;
|
|
|
|
+ response.Vacations = remainVacations == null ? "" : remainVacations.NumberOfDays + " / " + entity.VacationDays;
|
|
|
|
+ //__-----------Order Requests----
|
|
|
|
+ var orderRequestsList = await _unitOfWork.OrderRequest.GetAllUserOrdersAsync(entity.UserId);
|
|
|
|
+ var orderList = MapperObject.Mapper.Map<List<OrderRequestDto>>(orderRequestsList.Item1);
|
|
|
|
+
|
|
|
|
+ response.OrderList = orderList;
|
|
|
|
+ return response;
|
|
|
|
+ }
|
|
|
|
+ return new ContractDto();
|
|
|
|
+ }
|
|
|
|
+ #endregion
|
|
public async Task<bool> ChangeStatus(long contractId, int statusId)
|
|
public async Task<bool> ChangeStatus(long contractId, int statusId)
|
|
{
|
|
{
|
|
var entity = await _unitOfWork.Contract.GetByIdAsync(contractId);
|
|
var entity = await _unitOfWork.Contract.GetByIdAsync(contractId);
|