using Admin.Core.Common; using Admin.Core.IRepository; using Admin.Core.IService; using Admin.Core.Model; using Admin.Core.Model.ViewModels; using Admin.Core.Service; using log4net; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Admin.Core.IService { /// /// SysUserInfoServices /// public class SysUserInfoServices : BaseServices, ISysUserInfoServices { private readonly IBaseRepository _dal; private readonly ISysUserInfoRepository _sysUserInfoRepository; public SysUserInfoServices(IBaseRepository dal, ISysUserInfoRepository sysUserInfoRepository) { this._dal = dal; base.BaseDal = dal; _sysUserInfoRepository = sysUserInfoRepository; } public async Task> GetTeamData() { return await _sysUserInfoRepository.GetTeamData(); } public async Task GetTeamData(DateTime nowDate) { var list= await _sysUserInfoRepository.GetTeamData(); if (list.Count() == 0) return null; CurrentTeamTimeView view = list.SingleOrDefault(d=>d.StartTime<= nowDate && nowDate <= d.EndTime); if (view != null) return view; else return null; } public async Task GetStationData(string code) { string productLineCode = Appsettings.app("StationInfo", "ProductLineCode"); var list = await _sysUserInfoRepository.GetStationData(code); if (list == null) return null; var obj = list.SingleOrDefault(d => d.ProductLineCode == "productLineCode"); return obj; } } }