using Dlhis.Entity.Basic.Enums;
using Kurisu.AspNetCore.Utils.Extensions;
namespace Dlhis.Basic.WorkGrids.Response;
public class WorkGridTimePeriodPageResponse
{
public long Id { get; set; }
///
/// 班次
///
public WorkGridTimePeriodEnumType Type { get; set; }
///
/// 班次描述
///
public string TypeDesc => Type.GetDescription();
///
/// 前
///
public int Before { get; set; }
///
/// 后
///
public int After { get; set; }
///
/// 开始时间
///
public TimeOnly Start { get; set; }
///
/// 结束时间
///
public TimeOnly End { get; set; }
///
/// 配置描述
///
public string Description
{
get { return Type.GetDescription() + "打卡时间从" + Start + "到" + End + "\r\n" + "上班允许提前" + GetTimeDescription(Before) + "\r\n" + "下班允许延迟" + GetTimeDescription(After); }
}
private string GetTimeDescription(int minutes)
{
string d;
if (minutes >= 60)
{
var remaining = minutes % 60;
d = $"{minutes / 60}小时";
if (remaining > 0)
{
d += $"{remaining}分钟";
}
}
else
{
d = $"{minutes}分钟";
}
return d;
}
}