124 lines
2.7 KiB
C#
124 lines
2.7 KiB
C#
namespace Brizco.Domain.Entities.Task;
|
|
|
|
|
|
public partial class Task
|
|
{
|
|
|
|
public static Task Create(
|
|
string title,
|
|
string description,
|
|
TaskType type,
|
|
bool isRelatedToShift,
|
|
bool isRelatedToRole,
|
|
bool isRelatedToPerson,
|
|
bool isDisposable,
|
|
DateTime setFor,
|
|
bool hasDisposed,
|
|
int amount,
|
|
PurchaseAmountType amountType,
|
|
Guid complexId)
|
|
{
|
|
return new Task(type,
|
|
isRelatedToShift,
|
|
isRelatedToRole,
|
|
isRelatedToPerson,
|
|
isDisposable,
|
|
setFor,
|
|
hasDisposed,
|
|
amount,
|
|
amountType,
|
|
title,
|
|
description,
|
|
complexId);
|
|
}
|
|
|
|
public void AddShift(params Guid[] shiftIds)
|
|
{
|
|
foreach (var shiftId in shiftIds)
|
|
{
|
|
var plan = new TaskShift(Id, shiftId);
|
|
Shifts.Add(plan);
|
|
}
|
|
}
|
|
public TaskShift AddShift(Guid shiftId)
|
|
{
|
|
var plan = new TaskShift(Id, shiftId);
|
|
Shifts.Add(plan);
|
|
return plan;
|
|
}
|
|
|
|
public void AddUser(params Guid[] userIds)
|
|
{
|
|
foreach (var userId in userIds)
|
|
{
|
|
var plan = new TaskUser(Id, userId);
|
|
Users.Add(plan);
|
|
}
|
|
}
|
|
public TaskUser AddUser(Guid userId)
|
|
{
|
|
var plan = new TaskUser(Id, userId);
|
|
Users.Add(plan);
|
|
return plan;
|
|
}
|
|
|
|
public TaskRole AddRole(Guid roleId)
|
|
{
|
|
var plan = new TaskRole(Id, roleId);
|
|
Roles.Add(plan);
|
|
return plan;
|
|
}
|
|
public void AddRole(params Guid[] roleIds)
|
|
{
|
|
foreach (var roleId in roleIds)
|
|
{
|
|
var plan = new TaskRole(Id, roleId);
|
|
Roles.Add(plan);
|
|
}
|
|
}
|
|
}
|
|
|
|
public partial class Activity
|
|
{
|
|
|
|
public static Activity Create(
|
|
ActivityStatus status,
|
|
DateTime doneAt,
|
|
string performanceDescription,
|
|
string title,
|
|
string description,
|
|
TaskType type,
|
|
bool isRelatedToShift,
|
|
bool isRelatedToRole,
|
|
bool isRelatedToPerson,
|
|
bool isDisposable,
|
|
DateTime setFor,
|
|
bool hasDisposed,
|
|
int amount,
|
|
PurchaseAmountType amountType,
|
|
Guid complexId)
|
|
{
|
|
return new Activity(
|
|
status,
|
|
doneAt,
|
|
performanceDescription,
|
|
type,
|
|
isRelatedToShift,
|
|
isRelatedToRole,
|
|
isRelatedToPerson,
|
|
isDisposable,
|
|
setFor,
|
|
hasDisposed,
|
|
amount,
|
|
amountType,
|
|
title,
|
|
description,
|
|
complexId);
|
|
}
|
|
|
|
public void DoneActivity()
|
|
{
|
|
DoneAt = DateTime.UtcNow;
|
|
IsDone = true;
|
|
}
|
|
} |