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, IRecordStaffCommuteService { private readonly ILogger _logger; public RecordStaffCommuteServiceImpl(Repository rep, ILogger logger) : base(rep) { _logger = logger; } public List 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; } } }