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.

53 lines
1.8 KiB
C#

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
{
/// <summary>
/// SysUserInfoServices
/// </summary>
public class SysUserInfoServices : BaseServices<SysUserInfo>, ISysUserInfoServices
{
private readonly IBaseRepository<SysUserInfo> _dal;
private readonly ISysUserInfoRepository _sysUserInfoRepository;
public SysUserInfoServices(IBaseRepository<SysUserInfo> dal, ISysUserInfoRepository sysUserInfoRepository)
{
this._dal = dal;
base.BaseDal = dal;
_sysUserInfoRepository = sysUserInfoRepository;
}
public async Task<List<CurrentTeamTimeView>> GetTeamData()
{
return await _sysUserInfoRepository.GetTeamData();
}
public async Task<CurrentTeamTimeView> 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<ProductInfoView> 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;
}
}
}