You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.5 KiB
C#

using Microsoft.Extensions.Logging;
using Microsoft.IdentityModel.Tokens;
using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
namespace SlnMesnac.Repository.service.Impl
{
public class RecordStaffCommuteServiceImpl : BaseServiceImpl<RecordStaffCommute>, IRecordStaffCommuteService
{
private readonly ILogger<RecordStaffCommute> _logger;
public RecordStaffCommuteServiceImpl(Repository<RecordStaffCommute> rep, ILogger<RecordStaffCommute> logger) : base(rep)
{
_logger = logger;
}
public List<RecordStaffCommute> GetRecordStaffCommutes()
{
return null;
}
public RecordStaffCommute GetStaffCommuteByIdAndDuration(string id, string currentTime)
{
DateTime currentDateTime = DateTime.ParseExact(currentTime, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
RecordStaffCommute recordStaffCommute = _rep.AsQueryable().Where(x => x.StaffId == id)
.Where(x =>
(DateTime.ParseExact(x.StartWorkTime, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture) - currentDateTime).TotalHours > 10)
.First();
return recordStaffCommute;
}
}
}