Files
Backend-Api/Company.Domain/RollCallAgg/RollCall.cs

79 lines
2.3 KiB
C#

using _0_Framework.Domain;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using System;
using Company.Domain.RollCallAgg.DomainService;
using _0_Framework.Domain.CustomizeCheckoutShared.Base;
using System.Collections.Generic;
using _0_Framework.Application;
using Company.Domain.EmployeeAgg;
using Company.Domain.WorkshopAgg;
namespace Company.Domain.RollCallAgg
{
public class RollCall : EntityBase
{
private RollCall()
{
}
public RollCall(long workshopId, long employeeId, string employeeFullName, DateTime startDate, DateTime? endDate, int year, int month,
IRollCallDomainService service, RollCallModifyType rollCallModifyType = RollCallModifyType.None)
{
WorkshopId = workshopId;
EmployeeId = employeeId;
EmployeeFullName = employeeFullName;
StartDate = startDate;
EndDate = endDate;
Year = year;
Month = month;
RollCallModifyType = rollCallModifyType;
SetShiftDate(service);
}
public long WorkshopId { get; private set; }
public long EmployeeId { get; private set; }
public string EmployeeFullName { get; private set; }
public DateTime? StartDate { get; private set; }
public DateTime? EndDate { get; private set; }
public int Year { get; private set; }
public int Month { get; private set; }
public RollCallModifyType RollCallModifyType { get; private set; }
public DateTime ShiftDate { get; set; }
public void SetEndDateTime(DateTime? endDate)
{
EndDate = endDate;
}
public void Edit(DateTime start, DateTime end)
{
StartDate = start;
EndDate = end;
}
public RollCall SetModifyType(RollCallModifyType modifyType)
{
RollCallModifyType = modifyType;
return this;
}
public void SetShiftDate(IRollCallDomainService service)
{
ShiftDate = service.GetEmployeeShiftDateByRollCallStartDate(WorkshopId, EmployeeId, StartDate!.Value);
}
}
public enum RollCallModifyType
{
None,
CutByBgService,
EditByEmployer,
Undefined
}
}