add version 0.1.2.0

complete change db for position and section , complete createing task
master
Amir Hossein Khademi 2023-11-18 22:23:23 +03:30
parent ab133ed004
commit 56ee887fab
44 changed files with 1214 additions and 385 deletions

View File

@ -1 +1 @@
0.1.1.0 0.1.2.0

View File

@ -6,8 +6,8 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath> <DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
<AssemblyVersion>0.1.1.0</AssemblyVersion> <AssemblyVersion>0.1.2.0</AssemblyVersion>
<FileVersion>0.1.1.0</FileVersion> <FileVersion>0.1.2.0</FileVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -114,12 +114,6 @@ public class UserService : IUserService
if (role != null) if (role != null)
dto.RoleIds.Add(role.Id); dto.RoleIds.Add(role.Id);
} }
var positionUser = await _repositoryWrapper.SetRepository<PositionUser>()
.TableNoTracking
.FirstOrDefaultAsync(f => f.ApplicationUserId == userId);
if (positionUser != null)
dto.PositionId = positionUser.PositionId;
return dto; return dto;
} }
@ -168,7 +162,6 @@ public class UserService : IUserService
throw new AppException(string.Join('|', result.Errors.Select(e => e.Description))); throw new AppException(string.Join('|', result.Errors.Select(e => e.Description)));
} }
await _sender.Send(new CreatePositionUserCommand(request.PositionId, user.Id), cancellationToken);
await _sender.Send(new CreateComplexUserCommand(complexId, user.Id, request.RoleIds), cancellationToken); await _sender.Send(new CreateComplexUserCommand(complexId, user.Id, request.RoleIds), cancellationToken);
return user; return user;
} }
@ -208,7 +201,6 @@ public class UserService : IUserService
throw new AppException(string.Join('|', addPassResult.Errors.Select(e => e.Description))); throw new AppException(string.Join('|', addPassResult.Errors.Select(e => e.Description)));
} }
await _sender.Send(new UpdatePositionUserCommand(request.PositionId, user.Id), cancellationToken);
await _sender.Send(new UpdateComplexUserCommand(user.Id, complexId, request.RoleIds), cancellationToken); await _sender.Send(new UpdateComplexUserCommand(user.Id, complexId, request.RoleIds), cancellationToken);
return true; return true;
} }

View File

@ -12,6 +12,8 @@ public sealed record CreateActivityCommand(
bool HasDisposed, bool HasDisposed,
int Amount, int Amount,
PurchaseAmountType AmountType, PurchaseAmountType AmountType,
TaskScheduleType ScheduleType,
List<Guid> Routines,
List<Guid> Shifts, List<Guid> Shifts,
List<Guid> Positions) : IRequest<ActivityLDto>; List<Guid> Positions) : IRequest<ActivityLDto>;
@ -27,6 +29,8 @@ public sealed record UpdateActivityCommand(Guid Id,
bool HasDisposed, bool HasDisposed,
int Amount, int Amount,
PurchaseAmountType AmountType, PurchaseAmountType AmountType,
TaskScheduleType ScheduleType,
List<Guid> Routines,
List<Guid> Shifts, List<Guid> Shifts,
List<Guid> Positions) : IRequest<bool>; List<Guid> Positions) : IRequest<bool>;

View File

@ -9,8 +9,11 @@ public sealed record UpdatePositionCommand(Guid Id, string Title, string Descrip
public sealed record DeletePositionCommand(Guid Id) public sealed record DeletePositionCommand(Guid Id)
: IRequest<bool>; : IRequest<bool>;
public sealed record CreatePositionUserCommand(Guid PositionId,Guid UserId) public sealed record CreatePositionUserCommand(Guid PositionId,Guid UserId, Guid ShiftPlanId)
: IRequest<bool>; : IRequest<bool>;
public sealed record UpdatePositionUserCommand(Guid PositionId, Guid UserId) public sealed record UpdatePositionUserCommand(Guid PositionId, Guid UserId, Guid ShiftPlanId)
: IRequest<bool>;
public sealed record DeletePositionUserCommand(Guid PositionId, Guid UserId, Guid ShiftPlanId)
: IRequest<bool>; : IRequest<bool>;

View File

@ -2,10 +2,10 @@
namespace Brizco.Domain.CommandQueries.Commands; namespace Brizco.Domain.CommandQueries.Commands;
public sealed record CreateShiftCommand(string Title, TimeSpan StartAt, TimeSpan EndAt, string Description, List<DayOfWeek> DayOfWeeks) public sealed record CreateShiftCommand(string Title, TimeSpan StartAt, TimeSpan EndAt, string Description, List<DayOfWeek> DayOfWeeks, List<Guid> Routines)
: IRequest<ShiftSDto>; : IRequest<ShiftSDto>;
public sealed record UpdateShiftCommand(Guid Id,string Title, TimeSpan StartAt, TimeSpan EndAt, string Description, List<DayOfWeek> DayOfWeeks) public sealed record UpdateShiftCommand(Guid Id,string Title, TimeSpan StartAt, TimeSpan EndAt, string Description, List<DayOfWeek> DayOfWeeks, List<Guid> Routines)
: IRequest<bool>; : IRequest<bool>;
public sealed record DeleteShiftCommand(Guid Id) public sealed record DeleteShiftCommand(Guid Id)

View File

@ -4,10 +4,12 @@ public sealed record CreateTaskCommand(TaskType Type,
string Title, string Title,
string Description, string Description,
bool IsDisposable, bool IsDisposable,
DateTime SetFor, long SetFor,
bool HasDisposed, bool HasDisposed,
int Amount, int Amount,
PurchaseAmountType AmountType, PurchaseAmountType AmountType,
TaskScheduleType ScheduleType,
List<Guid> Routines,
List<Guid> Shifts, List<Guid> Shifts,
List<Guid> Positions, List<Guid> Positions,
List<DayOfWeek> Days) : IRequest<TaskLDto>; List<DayOfWeek> Days) : IRequest<TaskLDto>;
@ -17,10 +19,12 @@ public sealed record UpdateTaskCommand(Guid Id,
string Title, string Title,
string Description, string Description,
bool IsDisposable, bool IsDisposable,
DateTime SetFor, long SetFor,
bool HasDisposed, bool HasDisposed,
int Amount, int Amount,
PurchaseAmountType AmountType, PurchaseAmountType AmountType,
TaskScheduleType ScheduleType,
List<Guid> Routines,
List<Guid> Shifts, List<Guid> Shifts,
List<Guid> Positions, List<Guid> Positions,
List<DayOfWeek> Days) : IRequest<bool>; List<DayOfWeek> Days) : IRequest<bool>;

View File

@ -1,7 +1,7 @@
namespace Brizco.Domain.CommandQueries.Queries; namespace Brizco.Domain.CommandQueries.Queries;
public sealed record GetShiftsQuery(int page = 0) : public sealed record GetShiftsQuery(int Page = 0) :
IRequest<List<ShiftSDto>>; IRequest<List<ShiftSDto>>;
public sealed record GetShiftQuery(Guid id) : public sealed record GetShiftQuery(Guid Id) :
IRequest<ShiftSDto>; IRequest<ShiftLDto>;

View File

@ -7,5 +7,6 @@ public class ShiftLDto : BaseDto<ShiftLDto,Shift>
public TimeSpan StartAt { get; set; } public TimeSpan StartAt { get; set; }
public TimeSpan EndAt { get; set; } public TimeSpan EndAt { get; set; }
public Guid ComplexId { get; set; } public Guid ComplexId { get; set; }
public List<ShiftDaySDto> Days { get; set; } = new(); public List<DayOfWeek> Days { get; set; } = new();
public List<ShiftRoutineSDto> Routines { get; set; } = new();
} }

View File

@ -10,6 +10,7 @@ public class TaskLDto : BaseDto<TaskLDto, Entities.Task.Task>
public bool IsDisposable { get; set; } public bool IsDisposable { get; set; }
public DateTime SetFor { get; set; } public DateTime SetFor { get; set; }
public bool HasDisposed { get; set; } public bool HasDisposed { get; set; }
public TaskScheduleType ScheduleType { get; set; }
public int Amount { get; set; } public int Amount { get; set; }
@ -20,4 +21,8 @@ public class TaskLDto : BaseDto<TaskLDto, Entities.Task.Task>
public List<TaskShiftSDto> Shifts { get; set; } = new(); public List<TaskShiftSDto> Shifts { get; set; } = new();
public List<TaskPositionSDto> Positions { get; set; } = new(); public List<TaskPositionSDto> Positions { get; set; } = new();
public List<TaskDaySDto> Days { get; internal set; } = new();
public List<TaskRoutineSDto> Routines { get; internal set; } = new();
} }

View File

@ -11,7 +11,6 @@ public class UserActionRequestDto
public string NationalId { get; set; } = string.Empty; public string NationalId { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty; public string Password { get; set; } = string.Empty;
public List<Guid> RoleIds { get; set; } = new(); public List<Guid> RoleIds { get; set; } = new();
public Guid PositionId { get; set; }
public string SelectedRoleName { get; set; } = string.Empty; public string SelectedRoleName { get; set; } = string.Empty;

View File

@ -0,0 +1,7 @@
namespace Brizco.Domain.Dtos.SmallDtos;
public class ShiftRoutineSDto : BaseDto<ShiftRoutineSDto, ShiftRoutine>
{
public Guid RoutineId { get; set; }
public Guid ShiftId { get; set; }
}

View File

@ -0,0 +1,8 @@
namespace Brizco.Domain.Dtos.SmallDtos;
public class TaskDaySDto : BaseDto<TaskDaySDto, TaskDay>
{
public DayOfWeek DayOfWeek { get; internal set; }
public Guid TaskId { get; internal set; }
}

View File

@ -0,0 +1,7 @@
namespace Brizco.Domain.Dtos.SmallDtos;
public class TaskRoutineSDto : BaseDto<TaskRoutineSDto,TaskRoutine>
{
public Guid TaskId { get; set; }
public Guid RoutineId { get; set; }
}

View File

@ -9,6 +9,7 @@ public class TaskSDto : BaseDto<TaskSDto,Entities.Task.Task>
public DateTime SetFor { get; set; } public DateTime SetFor { get; set; }
public bool HasDisposed { get; set; } public bool HasDisposed { get; set; }
public Guid ComplexId { get; set; } public Guid ComplexId { get; set; }
public TaskScheduleType ScheduleType { get; set; }
public int Amount { get; set; } public int Amount { get; set; }

View File

@ -51,9 +51,9 @@ public partial class Position
return new Position(name, description, complexId, sectionId); return new Position(name, description, complexId, sectionId);
} }
public PositionUser AddUser(Guid userId) public PositionUser AddUser(Guid userId , Guid shiftPlanId)
{ {
var positionUser = PositionUser.Create(this.Id, userId); var positionUser = PositionUser.Create(this.Id, userId, shiftPlanId);
this.Users.Add(positionUser); this.Users.Add(positionUser);
return positionUser; return positionUser;
} }
@ -61,8 +61,8 @@ public partial class Position
public partial class PositionUser public partial class PositionUser
{ {
public static PositionUser Create(Guid positionId, Guid userId) public static PositionUser Create(Guid positionId, Guid userId, Guid shiftPlanId)
{ {
return new PositionUser(positionId, userId); return new PositionUser(positionId, userId, shiftPlanId);
} }
} }

View File

@ -9,9 +9,10 @@ public partial class PositionUser : ApiEntity
{ {
} }
public PositionUser(Guid positionId,Guid applicationUserId) public PositionUser(Guid positionId,Guid applicationUserId ,Guid shiftPlanId)
{ {
ApplicationUserId = applicationUserId; ApplicationUserId = applicationUserId;
ShiftPlanId = shiftPlanId;
PositionId = positionId; PositionId = positionId;
} }
@ -20,4 +21,7 @@ public partial class PositionUser : ApiEntity
public Guid PositionId { get; set; } public Guid PositionId { get; set; }
public Position? Position { get; set; } public Position? Position { get; set; }
public Guid ShiftPlanId { get; set; }
public ShiftPlan? ShiftPlan { get; set; }
} }

View File

@ -20,6 +20,13 @@ public partial class Shift
Plans.Add(plan); Plans.Add(plan);
return plan; return plan;
} }
public ShiftRoutine AddRoutine(Guid routineId)
{
var routine = new ShiftRoutine(routineId, this.Id);
Routines.Add(routine);
return routine;
}
} }
public partial class ShiftPlan public partial class ShiftPlan

View File

@ -13,9 +13,9 @@ public class ShiftRoutine : ApiEntity
RoutineId = routineId; RoutineId = routineId;
ShiftId = shiftId; ShiftId = shiftId;
} }
public Guid RoutineId { get; set; } public Guid RoutineId { get; internal set; }
public Routine.Routine? Routine { get; set; } public Routine.Routine? Routine { get; internal set; }
public Guid ShiftId { get; set; } public Guid ShiftId { get; internal set; }
public Shift? Shift { get; set; } public Shift? Shift { get; internal set; }
} }

View File

@ -1,4 +1,4 @@
using System; using Brizco.Domain.Entities.User;
namespace Brizco.Domain.Entities.Task; namespace Brizco.Domain.Entities.Task;
@ -22,15 +22,19 @@ public partial class Activity : Task
PurchaseAmountType amountType, PurchaseAmountType amountType,
string title, string title,
string description, string description,
Guid complexId) : base( Guid complexId,
type, isDisposable, setFor, hasDisposed, amount, amountType, title, description, complexId) TaskScheduleType scheduleType) : base(
type, isDisposable, setFor, hasDisposed, amount, amountType, title, description, complexId, scheduleType)
{ {
Status = status; Status = status;
DoneAt = doneAt; DoneAt = doneAt;
PerformanceDescription = performanceDescription; PerformanceDescription = performanceDescription;
} }
public ActivityStatus Status { get; internal set; } public ActivityStatus Status { get; internal set; }
public DateTime DoneAt { get; internal set; } public DateTime DoneAt { get; internal set; }
public bool IsDone { get; internal set; } public bool IsDone { get; internal set; }
public string PerformanceDescription { get; internal set; } = string.Empty; public string PerformanceDescription { get; internal set; } = string.Empty;
public Guid UserId { get; internal set; }
public ApplicationUser? User { get; internal set; }
} }

View File

@ -1,4 +1,5 @@
using Brizco.Domain.Entities.Routine; using Brizco.Common.Models.Exception;
using Brizco.Domain.Entities.Routine;
namespace Brizco.Domain.Entities.Task; namespace Brizco.Domain.Entities.Task;
@ -15,8 +16,13 @@ public partial class Task
bool hasDisposed, bool hasDisposed,
int amount, int amount,
PurchaseAmountType amountType, PurchaseAmountType amountType,
Guid complexId) Guid complexId,
TaskScheduleType scheduleType)
{ {
if (scheduleType == TaskScheduleType.Custom && setFor == DateTime.MinValue)
throw new AppException("اگر تکرار وظیفه یک روز خاص باشد باید ان روز را انتخاب کنید");
if (scheduleType == TaskScheduleType.Custom)
isDisposable = true;
return new Task( return new Task(
type, type,
isDisposable, isDisposable,
@ -26,7 +32,8 @@ public partial class Task
amountType, amountType,
title, title,
description, description,
complexId); complexId,
scheduleType);
} }
@ -58,13 +65,13 @@ public partial class Task
{ {
foreach (var positionId in positionIds) foreach (var positionId in positionIds)
{ {
var position = new TaskPosition(Id, positionId); var position = new TaskPosition(positionId,Id);
Positions.Add(position); Positions.Add(position);
} }
} }
public TaskPosition AddPosition(Guid positionId) public TaskPosition AddPosition(Guid positionId)
{ {
var position = new TaskPosition(Id, positionId); var position = new TaskPosition(positionId,Id);
Positions.Add(position); Positions.Add(position);
return position; return position;
} }
@ -75,13 +82,13 @@ public partial class Task
{ {
foreach (var routineId in routineIds) foreach (var routineId in routineIds)
{ {
var routine = new TaskRoutine(Id, routineId); var routine = new TaskRoutine(routineId,Id);
Routines.Add(routine); Routines.Add(routine);
} }
} }
public TaskRoutine AddRoutine(Guid routineId) public TaskRoutine AddRoutine(Guid routineId)
{ {
var routine = new TaskRoutine(Id, routineId); var routine = new TaskRoutine(routineId,Id);
Routines.Add(routine); Routines.Add(routine);
return routine; return routine;
} }
@ -102,7 +109,8 @@ public partial class Activity
bool hasDisposed, bool hasDisposed,
int amount, int amount,
PurchaseAmountType amountType, PurchaseAmountType amountType,
Guid complexId) Guid complexId,
TaskScheduleType scheduleType)
{ {
return new Activity( return new Activity(
status, status,
@ -116,7 +124,8 @@ public partial class Activity
amountType, amountType,
title, title,
description, description,
complexId); complexId,
scheduleType);
} }
public void DoneActivity() public void DoneActivity()

View File

@ -19,7 +19,8 @@ public partial class Task : ApiEntity
PurchaseAmountType amountType, PurchaseAmountType amountType,
string title, string title,
string description, string description,
Guid complexId) Guid complexId,
TaskScheduleType scheduleType)
{ {
Type = type; Type = type;
IsDisposable = isDisposable; IsDisposable = isDisposable;
@ -30,6 +31,7 @@ public partial class Task : ApiEntity
Title = title; Title = title;
Description = description; Description = description;
ComplexId = complexId; ComplexId = complexId;
ScheduleType = scheduleType;
} }
public TaskType Type { get; internal set; } public TaskType Type { get; internal set; }
@ -38,6 +40,7 @@ public partial class Task : ApiEntity
public bool IsDisposable { get; internal set; } public bool IsDisposable { get; internal set; }
public DateTime SetFor { get; internal set; } public DateTime SetFor { get; internal set; }
public bool HasDisposed { get; internal set; } public bool HasDisposed { get; internal set; }
public TaskScheduleType ScheduleType { get; set; }
public Guid ComplexId { get; set; } public Guid ComplexId { get; set; }
public Complex.Complex? Complex { get; set; } public Complex.Complex? Complex { get; set; }
@ -47,12 +50,12 @@ public partial class Task : ApiEntity
public PurchaseAmountType AmountType { get; internal set; } public PurchaseAmountType AmountType { get; internal set; }
public List<TaskShift> Shifts { get; internal set; } = new(); public List<TaskShift> Shifts { get; internal set; } = new();
public List<TaskDay> Days { get; internal set; } = new(); public List<TaskDay> Days { get; internal set; } = new();
public List<TaskRoutine> Routines { get; internal set; } = new();
public List<TaskPosition> Positions { get; internal set; } = new(); public List<TaskPosition> Positions { get; internal set; } = new();
public List<TaskRoutine> Routines { get; internal set; } = new();
} }

View File

@ -1,5 +1,7 @@
namespace Brizco.Domain.Entities.Task; namespace Brizco.Domain.Entities.Task;
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
[GenerateMapper]
public class TaskDay : ApiEntity public class TaskDay : ApiEntity
{ {
public TaskDay() public TaskDay()

View File

@ -0,0 +1,11 @@
namespace Brizco.Domain.Enums;
public enum TaskScheduleType
{
[Display(Name = "روزانه")]
Daily,
[Display(Name = "هفتگی")]
Weekly,
[Display(Name = "روز مشخص")]
Custom
}

View File

@ -106,89 +106,98 @@ namespace Brizco.Domain.Mappers
EndAt = p18.EndAt, EndAt = p18.EndAt,
Description = p18.Description, Description = p18.Description,
ComplexId = p18.ComplexId, ComplexId = p18.ComplexId,
Complex = new Complex() {Id = p18.ComplexId},
Days = funcMain7(p18.Days), Days = funcMain7(p18.Days),
Routines = funcMain8(p18.Routines),
Id = p18.Id Id = p18.Id
}; };
} }
public static Shift AdaptTo(this ShiftLDto p20, Shift p21) public static Shift AdaptTo(this ShiftLDto p21, Shift p22)
{ {
if (p20 == null) if (p21 == null)
{ {
return null; return null;
} }
Shift result = p21 ?? new Shift(); Shift result = p22 ?? new Shift();
result.Title = p20.Title; result.Title = p21.Title;
result.StartAt = p20.StartAt; result.StartAt = p21.StartAt;
result.EndAt = p20.EndAt; result.EndAt = p21.EndAt;
result.Description = p20.Description; result.Description = p21.Description;
result.ComplexId = p20.ComplexId; result.ComplexId = p21.ComplexId;
result.Days = funcMain8(p20.Days, result.Days); result.Complex = funcMain9(new Never(), result.Complex, p21);
result.Id = p20.Id; result.Days = funcMain10(p21.Days, result.Days);
result.Routines = funcMain11(p21.Routines, result.Routines);
result.Id = p21.Id;
return result; return result;
} }
public static Expression<Func<ShiftLDto, Shift>> ProjectLDtoToShift => p24 => new Shift() public static Expression<Func<ShiftLDto, Shift>> ProjectLDtoToShift => p29 => new Shift()
{ {
Title = p24.Title, Title = p29.Title,
StartAt = p24.StartAt, StartAt = p29.StartAt,
EndAt = p24.EndAt, EndAt = p29.EndAt,
Description = p24.Description, Description = p29.Description,
ComplexId = p24.ComplexId, ComplexId = p29.ComplexId,
Days = p24.Days.Select<ShiftDaySDto, ShiftDay>(p25 => new ShiftDay() Complex = new Complex() {Id = p29.ComplexId},
Days = p29.Days.Select<DayOfWeek, ShiftDay>(p30 => new ShiftDay() {}).ToList<ShiftDay>(),
Routines = p29.Routines.Select<ShiftRoutineSDto, ShiftRoutine>(p31 => new ShiftRoutine()
{ {
DayOfWeek = p25.DayOfWeek, RoutineId = p31.RoutineId,
ShiftId = p25.ShiftId, ShiftId = p31.ShiftId,
Id = p25.Id Id = p31.Id
}).ToList<ShiftDay>(), }).ToList<ShiftRoutine>(),
Id = p24.Id Id = p29.Id
}; };
public static ShiftLDto AdaptToLDto(this Shift p26) public static ShiftLDto AdaptToLDto(this Shift p32)
{ {
return p26 == null ? null : new ShiftLDto() return p32 == null ? null : new ShiftLDto()
{
Title = p26.Title,
Description = p26.Description,
StartAt = p26.StartAt,
EndAt = p26.EndAt,
ComplexId = p26.ComplexId,
Days = funcMain9(p26.Days),
Id = p26.Id
};
}
public static ShiftLDto AdaptTo(this Shift p28, ShiftLDto p29)
{
if (p28 == null)
{
return null;
}
ShiftLDto result = p29 ?? new ShiftLDto();
result.Title = p28.Title;
result.Description = p28.Description;
result.StartAt = p28.StartAt;
result.EndAt = p28.EndAt;
result.ComplexId = p28.ComplexId;
result.Days = funcMain10(p28.Days, result.Days);
result.Id = p28.Id;
return result;
}
public static Expression<Func<Shift, ShiftLDto>> ProjectToLDto => p32 => new ShiftLDto()
{ {
Title = p32.Title, Title = p32.Title,
Description = p32.Description, Description = p32.Description,
StartAt = p32.StartAt, StartAt = p32.StartAt,
EndAt = p32.EndAt, EndAt = p32.EndAt,
ComplexId = p32.ComplexId, ComplexId = p32.ComplexId,
Days = p32.Days.Select<ShiftDay, ShiftDaySDto>(p33 => new ShiftDaySDto() Days = funcMain12(p32.Days.Select<ShiftDay, DayOfWeek>(funcMain13).ToList<DayOfWeek>()),
{ Routines = funcMain14(p32.Routines),
DayOfWeek = p33.DayOfWeek,
ShiftId = p33.ShiftId,
Id = p33.Id
}).ToList<ShiftDaySDto>(),
Id = p32.Id Id = p32.Id
}; };
}
public static ShiftLDto AdaptTo(this Shift p35, ShiftLDto p36)
{
if (p35 == null)
{
return null;
}
ShiftLDto result = p36 ?? new ShiftLDto();
result.Title = p35.Title;
result.Description = p35.Description;
result.StartAt = p35.StartAt;
result.EndAt = p35.EndAt;
result.ComplexId = p35.ComplexId;
result.Days = funcMain15(p35.Days.Select<ShiftDay, DayOfWeek>(funcMain13).ToList<DayOfWeek>(), result.Days);
result.Routines = funcMain16(p35.Routines, result.Routines);
result.Id = p35.Id;
return result;
}
public static Expression<Func<Shift, ShiftLDto>> ProjectToLDto => p41 => new ShiftLDto()
{
Title = p41.Title,
Description = p41.Description,
StartAt = p41.StartAt,
EndAt = p41.EndAt,
ComplexId = p41.ComplexId,
Days = p41.Days.Select<ShiftDay, DayOfWeek>(d => d.DayOfWeek).ToList<DayOfWeek>(),
Routines = p41.Routines.Select<ShiftRoutine, ShiftRoutineSDto>(p42 => new ShiftRoutineSDto()
{
RoutineId = p42.RoutineId,
ShiftId = p42.ShiftId,
Id = p42.Id
}).ToList<ShiftRoutineSDto>(),
Id = p41.Id
};
private static List<ShiftDay> funcMain1(List<DayOfWeek> p2) private static List<ShiftDay> funcMain1(List<DayOfWeek> p2)
{ {
@ -288,7 +297,7 @@ namespace Brizco.Domain.Mappers
} }
private static List<ShiftDay> funcMain7(List<ShiftDaySDto> p19) private static List<ShiftDay> funcMain7(List<DayOfWeek> p19)
{ {
if (p19 == null) if (p19 == null)
{ {
@ -301,36 +310,31 @@ namespace Brizco.Domain.Mappers
while (i < len) while (i < len)
{ {
ShiftDaySDto item = p19[i]; DayOfWeek item = p19[i];
result.Add(item == null ? null : new ShiftDay() result.Add(new ShiftDay() {});
{
DayOfWeek = item.DayOfWeek,
ShiftId = item.ShiftId,
Id = item.Id
});
i++; i++;
} }
return result; return result;
} }
private static List<ShiftDay> funcMain8(List<ShiftDaySDto> p22, List<ShiftDay> p23) private static List<ShiftRoutine> funcMain8(List<ShiftRoutineSDto> p20)
{ {
if (p22 == null) if (p20 == null)
{ {
return null; return null;
} }
List<ShiftDay> result = new List<ShiftDay>(p22.Count); List<ShiftRoutine> result = new List<ShiftRoutine>(p20.Count);
int i = 0; int i = 0;
int len = p22.Count; int len = p20.Count;
while (i < len) while (i < len)
{ {
ShiftDaySDto item = p22[i]; ShiftRoutineSDto item = p20[i];
result.Add(item == null ? null : new ShiftDay() result.Add(item == null ? null : new ShiftRoutine()
{ {
DayOfWeek = item.DayOfWeek, RoutineId = item.RoutineId,
ShiftId = item.ShiftId, ShiftId = item.ShiftId,
Id = item.Id Id = item.Id
}); });
@ -340,23 +344,53 @@ namespace Brizco.Domain.Mappers
} }
private static List<ShiftDaySDto> funcMain9(List<ShiftDay> p27) private static Complex funcMain9(Never p23, Complex p24, ShiftLDto p21)
{
Complex result = p24 ?? new Complex();
result.Id = p21.ComplexId;
return result;
}
private static List<ShiftDay> funcMain10(List<DayOfWeek> p25, List<ShiftDay> p26)
{
if (p25 == null)
{
return null;
}
List<ShiftDay> result = new List<ShiftDay>(p25.Count);
int i = 0;
int len = p25.Count;
while (i < len)
{
DayOfWeek item = p25[i];
result.Add(new ShiftDay() {});
i++;
}
return result;
}
private static List<ShiftRoutine> funcMain11(List<ShiftRoutineSDto> p27, List<ShiftRoutine> p28)
{ {
if (p27 == null) if (p27 == null)
{ {
return null; return null;
} }
List<ShiftDaySDto> result = new List<ShiftDaySDto>(p27.Count); List<ShiftRoutine> result = new List<ShiftRoutine>(p27.Count);
int i = 0; int i = 0;
int len = p27.Count; int len = p27.Count;
while (i < len) while (i < len)
{ {
ShiftDay item = p27[i]; ShiftRoutineSDto item = p27[i];
result.Add(item == null ? null : new ShiftDaySDto() result.Add(item == null ? null : new ShiftRoutine()
{ {
DayOfWeek = item.DayOfWeek, RoutineId = item.RoutineId,
ShiftId = item.ShiftId, ShiftId = item.ShiftId,
Id = item.Id Id = item.Id
}); });
@ -366,23 +400,96 @@ namespace Brizco.Domain.Mappers
} }
private static List<ShiftDaySDto> funcMain10(List<ShiftDay> p30, List<ShiftDaySDto> p31) private static List<DayOfWeek> funcMain12(List<DayOfWeek> p33)
{ {
if (p30 == null) if (p33 == null)
{ {
return null; return null;
} }
List<ShiftDaySDto> result = new List<ShiftDaySDto>(p30.Count); List<DayOfWeek> result = new List<DayOfWeek>(p33.Count);
int i = 0; int i = 0;
int len = p30.Count; int len = p33.Count;
while (i < len) while (i < len)
{ {
ShiftDay item = p30[i]; DayOfWeek item = p33[i];
result.Add(item == null ? null : new ShiftDaySDto() result.Add(item);
i++;
}
return result;
}
private static DayOfWeek funcMain13(ShiftDay d)
{ {
DayOfWeek = item.DayOfWeek, return d.DayOfWeek;
}
private static List<ShiftRoutineSDto> funcMain14(List<ShiftRoutine> p34)
{
if (p34 == null)
{
return null;
}
List<ShiftRoutineSDto> result = new List<ShiftRoutineSDto>(p34.Count);
int i = 0;
int len = p34.Count;
while (i < len)
{
ShiftRoutine item = p34[i];
result.Add(item == null ? null : new ShiftRoutineSDto()
{
RoutineId = item.RoutineId,
ShiftId = item.ShiftId,
Id = item.Id
});
i++;
}
return result;
}
private static List<DayOfWeek> funcMain15(List<DayOfWeek> p37, List<DayOfWeek> p38)
{
if (p37 == null)
{
return null;
}
List<DayOfWeek> result = new List<DayOfWeek>(p37.Count);
int i = 0;
int len = p37.Count;
while (i < len)
{
DayOfWeek item = p37[i];
result.Add(item);
i++;
}
return result;
}
private static List<ShiftRoutineSDto> funcMain16(List<ShiftRoutine> p39, List<ShiftRoutineSDto> p40)
{
if (p39 == null)
{
return null;
}
List<ShiftRoutineSDto> result = new List<ShiftRoutineSDto>(p39.Count);
int i = 0;
int len = p39.Count;
while (i < len)
{
ShiftRoutine item = p39[i];
result.Add(item == null ? null : new ShiftRoutineSDto()
{
RoutineId = item.RoutineId,
ShiftId = item.ShiftId, ShiftId = item.ShiftId,
Id = item.Id Id = item.Id
}); });

View File

@ -1,6 +1,69 @@
using System;
using System.Linq.Expressions;
using Brizco.Domain.Dtos.SmallDtos;
using Brizco.Domain.Entities.Shift;
namespace Brizco.Domain.Mappers namespace Brizco.Domain.Mappers
{ {
public static partial class ShiftRoutineMapper public static partial class ShiftRoutineMapper
{ {
public static ShiftRoutine AdaptToShiftRoutine(this ShiftRoutineSDto p1)
{
return p1 == null ? null : new ShiftRoutine()
{
RoutineId = p1.RoutineId,
ShiftId = p1.ShiftId,
Id = p1.Id
};
}
public static ShiftRoutine AdaptTo(this ShiftRoutineSDto p2, ShiftRoutine p3)
{
if (p2 == null)
{
return null;
}
ShiftRoutine result = p3 ?? new ShiftRoutine();
result.RoutineId = p2.RoutineId;
result.ShiftId = p2.ShiftId;
result.Id = p2.Id;
return result;
}
public static Expression<Func<ShiftRoutineSDto, ShiftRoutine>> ProjectToShiftRoutine => p4 => new ShiftRoutine()
{
RoutineId = p4.RoutineId,
ShiftId = p4.ShiftId,
Id = p4.Id
};
public static ShiftRoutineSDto AdaptToSDto(this ShiftRoutine p5)
{
return p5 == null ? null : new ShiftRoutineSDto()
{
RoutineId = p5.RoutineId,
ShiftId = p5.ShiftId,
Id = p5.Id
};
}
public static ShiftRoutineSDto AdaptTo(this ShiftRoutine p6, ShiftRoutineSDto p7)
{
if (p6 == null)
{
return null;
}
ShiftRoutineSDto result = p7 ?? new ShiftRoutineSDto();
result.RoutineId = p6.RoutineId;
result.ShiftId = p6.ShiftId;
result.Id = p6.Id;
return result;
}
public static Expression<Func<ShiftRoutine, ShiftRoutineSDto>> ProjectToSDto => p8 => new ShiftRoutineSDto()
{
RoutineId = p8.RoutineId,
ShiftId = p8.ShiftId,
Id = p8.Id
};
} }
} }

View File

@ -0,0 +1,69 @@
using System;
using System.Linq.Expressions;
using Brizco.Domain.Dtos.SmallDtos;
using Brizco.Domain.Entities.Task;
namespace Brizco.Domain.Mappers
{
public static partial class TaskDayMapper
{
public static TaskDay AdaptToTaskDay(this TaskDaySDto p1)
{
return p1 == null ? null : new TaskDay()
{
DayOfWeek = p1.DayOfWeek,
TaskId = p1.TaskId,
Id = p1.Id
};
}
public static TaskDay AdaptTo(this TaskDaySDto p2, TaskDay p3)
{
if (p2 == null)
{
return null;
}
TaskDay result = p3 ?? new TaskDay();
result.DayOfWeek = p2.DayOfWeek;
result.TaskId = p2.TaskId;
result.Id = p2.Id;
return result;
}
public static Expression<Func<TaskDaySDto, TaskDay>> ProjectToTaskDay => p4 => new TaskDay()
{
DayOfWeek = p4.DayOfWeek,
TaskId = p4.TaskId,
Id = p4.Id
};
public static TaskDaySDto AdaptToSDto(this TaskDay p5)
{
return p5 == null ? null : new TaskDaySDto()
{
DayOfWeek = p5.DayOfWeek,
TaskId = p5.TaskId,
Id = p5.Id
};
}
public static TaskDaySDto AdaptTo(this TaskDay p6, TaskDaySDto p7)
{
if (p6 == null)
{
return null;
}
TaskDaySDto result = p7 ?? new TaskDaySDto();
result.DayOfWeek = p6.DayOfWeek;
result.TaskId = p6.TaskId;
result.Id = p6.Id;
return result;
}
public static Expression<Func<TaskDay, TaskDaySDto>> ProjectToSDto => p8 => new TaskDaySDto()
{
DayOfWeek = p8.DayOfWeek,
TaskId = p8.TaskId,
Id = p8.Id
};
}
}

View File

@ -21,6 +21,7 @@ namespace Brizco.Domain.Mappers
IsDisposable = p1.IsDisposable, IsDisposable = p1.IsDisposable,
SetFor = p1.SetFor, SetFor = p1.SetFor,
HasDisposed = p1.HasDisposed, HasDisposed = p1.HasDisposed,
ScheduleType = p1.ScheduleType,
ComplexId = p1.ComplexId, ComplexId = p1.ComplexId,
Amount = p1.Amount, Amount = p1.Amount,
AmountType = p1.AmountType, AmountType = p1.AmountType,
@ -41,6 +42,7 @@ namespace Brizco.Domain.Mappers
result.IsDisposable = p2.IsDisposable; result.IsDisposable = p2.IsDisposable;
result.SetFor = p2.SetFor; result.SetFor = p2.SetFor;
result.HasDisposed = p2.HasDisposed; result.HasDisposed = p2.HasDisposed;
result.ScheduleType = p2.ScheduleType;
result.ComplexId = p2.ComplexId; result.ComplexId = p2.ComplexId;
result.Amount = p2.Amount; result.Amount = p2.Amount;
result.AmountType = p2.AmountType; result.AmountType = p2.AmountType;
@ -56,6 +58,7 @@ namespace Brizco.Domain.Mappers
IsDisposable = p4.IsDisposable, IsDisposable = p4.IsDisposable,
SetFor = p4.SetFor, SetFor = p4.SetFor,
HasDisposed = p4.HasDisposed, HasDisposed = p4.HasDisposed,
ScheduleType = p4.ScheduleType,
ComplexId = p4.ComplexId, ComplexId = p4.ComplexId,
Amount = p4.Amount, Amount = p4.Amount,
AmountType = p4.AmountType, AmountType = p4.AmountType,
@ -72,6 +75,7 @@ namespace Brizco.Domain.Mappers
SetFor = p5.SetFor, SetFor = p5.SetFor,
HasDisposed = p5.HasDisposed, HasDisposed = p5.HasDisposed,
ComplexId = p5.ComplexId, ComplexId = p5.ComplexId,
ScheduleType = p5.ScheduleType,
Amount = p5.Amount, Amount = p5.Amount,
AmountType = p5.AmountType, AmountType = p5.AmountType,
Id = p5.Id Id = p5.Id
@ -92,6 +96,7 @@ namespace Brizco.Domain.Mappers
result.SetFor = p6.SetFor; result.SetFor = p6.SetFor;
result.HasDisposed = p6.HasDisposed; result.HasDisposed = p6.HasDisposed;
result.ComplexId = p6.ComplexId; result.ComplexId = p6.ComplexId;
result.ScheduleType = p6.ScheduleType;
result.Amount = p6.Amount; result.Amount = p6.Amount;
result.AmountType = p6.AmountType; result.AmountType = p6.AmountType;
result.Id = p6.Id; result.Id = p6.Id;
@ -107,6 +112,7 @@ namespace Brizco.Domain.Mappers
SetFor = p8.SetFor, SetFor = p8.SetFor,
HasDisposed = p8.HasDisposed, HasDisposed = p8.HasDisposed,
ComplexId = p8.ComplexId, ComplexId = p8.ComplexId,
ScheduleType = p8.ScheduleType,
Amount = p8.Amount, Amount = p8.Amount,
AmountType = p8.AmountType, AmountType = p8.AmountType,
Id = p8.Id Id = p8.Id
@ -121,119 +127,157 @@ namespace Brizco.Domain.Mappers
IsDisposable = p9.IsDisposable, IsDisposable = p9.IsDisposable,
SetFor = p9.SetFor, SetFor = p9.SetFor,
HasDisposed = p9.HasDisposed, HasDisposed = p9.HasDisposed,
ScheduleType = p9.ScheduleType,
Amount = p9.Amount, Amount = p9.Amount,
AmountType = p9.AmountType, AmountType = p9.AmountType,
Shifts = funcMain1(p9.Shifts), Shifts = funcMain1(p9.Shifts),
Positions = funcMain2(p9.Positions), Days = funcMain2(p9.Days),
Routines = funcMain3(p9.Routines),
Positions = funcMain4(p9.Positions),
Id = p9.Id Id = p9.Id
}; };
} }
public static Task AdaptTo(this TaskLDto p12, Task p13) public static Task AdaptTo(this TaskLDto p14, Task p15)
{ {
if (p12 == null) if (p14 == null)
{ {
return null; return null;
} }
Task result = p13 ?? new Task(); Task result = p15 ?? new Task();
result.Type = p12.Type; result.Type = p14.Type;
result.Title = p12.Title; result.Title = p14.Title;
result.Description = p12.Description; result.Description = p14.Description;
result.IsDisposable = p12.IsDisposable; result.IsDisposable = p14.IsDisposable;
result.SetFor = p12.SetFor; result.SetFor = p14.SetFor;
result.HasDisposed = p12.HasDisposed; result.HasDisposed = p14.HasDisposed;
result.Amount = p12.Amount; result.ScheduleType = p14.ScheduleType;
result.AmountType = p12.AmountType; result.Amount = p14.Amount;
result.Shifts = funcMain3(p12.Shifts, result.Shifts); result.AmountType = p14.AmountType;
result.Positions = funcMain4(p12.Positions, result.Positions); result.Shifts = funcMain5(p14.Shifts, result.Shifts);
result.Id = p12.Id; result.Days = funcMain6(p14.Days, result.Days);
result.Routines = funcMain7(p14.Routines, result.Routines);
result.Positions = funcMain8(p14.Positions, result.Positions);
result.Id = p14.Id;
return result; return result;
} }
public static Expression<Func<TaskLDto, Task>> ProjectLDtoToTask => p18 => new Task() public static Expression<Func<TaskLDto, Task>> ProjectLDtoToTask => p24 => new Task()
{ {
Type = p18.Type, Type = p24.Type,
Title = p18.Title, Title = p24.Title,
Description = p18.Description, Description = p24.Description,
IsDisposable = p18.IsDisposable, IsDisposable = p24.IsDisposable,
SetFor = p18.SetFor, SetFor = p24.SetFor,
HasDisposed = p18.HasDisposed, HasDisposed = p24.HasDisposed,
Amount = p18.Amount, ScheduleType = p24.ScheduleType,
AmountType = p18.AmountType, Amount = p24.Amount,
Shifts = p18.Shifts.Select<TaskShiftSDto, TaskShift>(p19 => new TaskShift() AmountType = p24.AmountType,
Shifts = p24.Shifts.Select<TaskShiftSDto, TaskShift>(p25 => new TaskShift()
{ {
TaskId = p19.TaskId, TaskId = p25.TaskId,
ShiftId = p19.ShiftId ShiftId = p25.ShiftId
}).ToList<TaskShift>(), }).ToList<TaskShift>(),
Positions = p18.Positions.Select<TaskPositionSDto, TaskPosition>(p20 => new TaskPosition() Days = p24.Days.Select<TaskDaySDto, TaskDay>(p26 => new TaskDay()
{ {
PositionId = p20.PositionId, DayOfWeek = p26.DayOfWeek,
TaskId = p20.TaskId, TaskId = p26.TaskId,
Id = p20.Id Id = p26.Id
}).ToList<TaskDay>(),
Routines = p24.Routines.Select<TaskRoutineSDto, TaskRoutine>(p27 => new TaskRoutine()
{
TaskId = p27.TaskId,
RoutineId = p27.RoutineId,
Id = p27.Id
}).ToList<TaskRoutine>(),
Positions = p24.Positions.Select<TaskPositionSDto, TaskPosition>(p28 => new TaskPosition()
{
PositionId = p28.PositionId,
TaskId = p28.TaskId,
Id = p28.Id
}).ToList<TaskPosition>(), }).ToList<TaskPosition>(),
Id = p18.Id Id = p24.Id
}; };
public static TaskLDto AdaptToLDto(this Task p21) public static TaskLDto AdaptToLDto(this Task p29)
{ {
return p21 == null ? null : new TaskLDto() return p29 == null ? null : new TaskLDto()
{ {
Type = p21.Type, Type = p29.Type,
Title = p21.Title, Title = p29.Title,
Description = p21.Description, Description = p29.Description,
IsDisposable = p21.IsDisposable, IsDisposable = p29.IsDisposable,
SetFor = p21.SetFor, SetFor = p29.SetFor,
HasDisposed = p21.HasDisposed, HasDisposed = p29.HasDisposed,
Amount = p21.Amount, ScheduleType = p29.ScheduleType,
AmountType = p21.AmountType, Amount = p29.Amount,
Shifts = funcMain5(p21.Shifts), AmountType = p29.AmountType,
Positions = funcMain6(p21.Positions), Shifts = funcMain9(p29.Shifts),
Id = p21.Id Positions = funcMain10(p29.Positions),
Days = funcMain11(p29.Days),
Routines = funcMain12(p29.Routines),
Id = p29.Id
}; };
} }
public static TaskLDto AdaptTo(this Task p24, TaskLDto p25) public static TaskLDto AdaptTo(this Task p34, TaskLDto p35)
{ {
if (p24 == null) if (p34 == null)
{ {
return null; return null;
} }
TaskLDto result = p25 ?? new TaskLDto(); TaskLDto result = p35 ?? new TaskLDto();
result.Type = p24.Type; result.Type = p34.Type;
result.Title = p24.Title; result.Title = p34.Title;
result.Description = p24.Description; result.Description = p34.Description;
result.IsDisposable = p24.IsDisposable; result.IsDisposable = p34.IsDisposable;
result.SetFor = p24.SetFor; result.SetFor = p34.SetFor;
result.HasDisposed = p24.HasDisposed; result.HasDisposed = p34.HasDisposed;
result.Amount = p24.Amount; result.ScheduleType = p34.ScheduleType;
result.AmountType = p24.AmountType; result.Amount = p34.Amount;
result.Shifts = funcMain7(p24.Shifts, result.Shifts); result.AmountType = p34.AmountType;
result.Positions = funcMain8(p24.Positions, result.Positions); result.Shifts = funcMain13(p34.Shifts, result.Shifts);
result.Id = p24.Id; result.Positions = funcMain14(p34.Positions, result.Positions);
result.Days = funcMain15(p34.Days, result.Days);
result.Routines = funcMain16(p34.Routines, result.Routines);
result.Id = p34.Id;
return result; return result;
} }
public static Expression<Func<Task, TaskLDto>> ProjectToLDto => p30 => new TaskLDto() public static Expression<Func<Task, TaskLDto>> ProjectToLDto => p44 => new TaskLDto()
{ {
Type = p30.Type, Type = p44.Type,
Title = p30.Title, Title = p44.Title,
Description = p30.Description, Description = p44.Description,
IsDisposable = p30.IsDisposable, IsDisposable = p44.IsDisposable,
SetFor = p30.SetFor, SetFor = p44.SetFor,
HasDisposed = p30.HasDisposed, HasDisposed = p44.HasDisposed,
Amount = p30.Amount, ScheduleType = p44.ScheduleType,
AmountType = p30.AmountType, Amount = p44.Amount,
Shifts = p30.Shifts.Select<TaskShift, TaskShiftSDto>(p31 => new TaskShiftSDto() AmountType = p44.AmountType,
Shifts = p44.Shifts.Select<TaskShift, TaskShiftSDto>(p45 => new TaskShiftSDto()
{ {
ShiftId = p31.ShiftId, ShiftId = p45.ShiftId,
TaskId = p31.TaskId TaskId = p45.TaskId
}).ToList<TaskShiftSDto>(), }).ToList<TaskShiftSDto>(),
Positions = p30.Positions.Select<TaskPosition, TaskPositionSDto>(p32 => new TaskPositionSDto() Positions = p44.Positions.Select<TaskPosition, TaskPositionSDto>(p46 => new TaskPositionSDto()
{ {
PositionId = p32.PositionId, PositionId = p46.PositionId,
TaskId = p32.TaskId, TaskId = p46.TaskId,
Id = p32.Id Id = p46.Id
}).ToList<TaskPositionSDto>(), }).ToList<TaskPositionSDto>(),
Id = p30.Id Days = p44.Days.Select<TaskDay, TaskDaySDto>(p47 => new TaskDaySDto()
{
DayOfWeek = p47.DayOfWeek,
TaskId = p47.TaskId,
Id = p47.Id
}).ToList<TaskDaySDto>(),
Routines = p44.Routines.Select<TaskRoutine, TaskRoutineSDto>(p48 => new TaskRoutineSDto()
{
TaskId = p48.TaskId,
RoutineId = p48.RoutineId,
Id = p48.Id
}).ToList<TaskRoutineSDto>(),
Id = p44.Id
}; };
private static List<TaskShift> funcMain1(List<TaskShiftSDto> p10) private static List<TaskShift> funcMain1(List<TaskShiftSDto> p10)
@ -261,20 +305,72 @@ namespace Brizco.Domain.Mappers
} }
private static List<TaskPosition> funcMain2(List<TaskPositionSDto> p11) private static List<TaskDay> funcMain2(List<TaskDaySDto> p11)
{ {
if (p11 == null) if (p11 == null)
{ {
return null; return null;
} }
List<TaskPosition> result = new List<TaskPosition>(p11.Count); List<TaskDay> result = new List<TaskDay>(p11.Count);
int i = 0; int i = 0;
int len = p11.Count; int len = p11.Count;
while (i < len) while (i < len)
{ {
TaskPositionSDto item = p11[i]; TaskDaySDto item = p11[i];
result.Add(item == null ? null : new TaskDay()
{
DayOfWeek = item.DayOfWeek,
TaskId = item.TaskId,
Id = item.Id
});
i++;
}
return result;
}
private static List<TaskRoutine> funcMain3(List<TaskRoutineSDto> p12)
{
if (p12 == null)
{
return null;
}
List<TaskRoutine> result = new List<TaskRoutine>(p12.Count);
int i = 0;
int len = p12.Count;
while (i < len)
{
TaskRoutineSDto item = p12[i];
result.Add(item == null ? null : new TaskRoutine()
{
TaskId = item.TaskId,
RoutineId = item.RoutineId,
Id = item.Id
});
i++;
}
return result;
}
private static List<TaskPosition> funcMain4(List<TaskPositionSDto> p13)
{
if (p13 == null)
{
return null;
}
List<TaskPosition> result = new List<TaskPosition>(p13.Count);
int i = 0;
int len = p13.Count;
while (i < len)
{
TaskPositionSDto item = p13[i];
result.Add(item == null ? null : new TaskPosition() result.Add(item == null ? null : new TaskPosition()
{ {
PositionId = item.PositionId, PositionId = item.PositionId,
@ -287,20 +383,20 @@ namespace Brizco.Domain.Mappers
} }
private static List<TaskShift> funcMain3(List<TaskShiftSDto> p14, List<TaskShift> p15) private static List<TaskShift> funcMain5(List<TaskShiftSDto> p16, List<TaskShift> p17)
{ {
if (p14 == null) if (p16 == null)
{ {
return null; return null;
} }
List<TaskShift> result = new List<TaskShift>(p14.Count); List<TaskShift> result = new List<TaskShift>(p16.Count);
int i = 0; int i = 0;
int len = p14.Count; int len = p16.Count;
while (i < len) while (i < len)
{ {
TaskShiftSDto item = p14[i]; TaskShiftSDto item = p16[i];
result.Add(item == null ? null : new TaskShift() result.Add(item == null ? null : new TaskShift()
{ {
TaskId = item.TaskId, TaskId = item.TaskId,
@ -312,20 +408,72 @@ namespace Brizco.Domain.Mappers
} }
private static List<TaskPosition> funcMain4(List<TaskPositionSDto> p16, List<TaskPosition> p17) private static List<TaskDay> funcMain6(List<TaskDaySDto> p18, List<TaskDay> p19)
{ {
if (p16 == null) if (p18 == null)
{ {
return null; return null;
} }
List<TaskPosition> result = new List<TaskPosition>(p16.Count); List<TaskDay> result = new List<TaskDay>(p18.Count);
int i = 0; int i = 0;
int len = p16.Count; int len = p18.Count;
while (i < len) while (i < len)
{ {
TaskPositionSDto item = p16[i]; TaskDaySDto item = p18[i];
result.Add(item == null ? null : new TaskDay()
{
DayOfWeek = item.DayOfWeek,
TaskId = item.TaskId,
Id = item.Id
});
i++;
}
return result;
}
private static List<TaskRoutine> funcMain7(List<TaskRoutineSDto> p20, List<TaskRoutine> p21)
{
if (p20 == null)
{
return null;
}
List<TaskRoutine> result = new List<TaskRoutine>(p20.Count);
int i = 0;
int len = p20.Count;
while (i < len)
{
TaskRoutineSDto item = p20[i];
result.Add(item == null ? null : new TaskRoutine()
{
TaskId = item.TaskId,
RoutineId = item.RoutineId,
Id = item.Id
});
i++;
}
return result;
}
private static List<TaskPosition> funcMain8(List<TaskPositionSDto> p22, List<TaskPosition> p23)
{
if (p22 == null)
{
return null;
}
List<TaskPosition> result = new List<TaskPosition>(p22.Count);
int i = 0;
int len = p22.Count;
while (i < len)
{
TaskPositionSDto item = p22[i];
result.Add(item == null ? null : new TaskPosition() result.Add(item == null ? null : new TaskPosition()
{ {
PositionId = item.PositionId, PositionId = item.PositionId,
@ -338,20 +486,20 @@ namespace Brizco.Domain.Mappers
} }
private static List<TaskShiftSDto> funcMain5(List<TaskShift> p22) private static List<TaskShiftSDto> funcMain9(List<TaskShift> p30)
{ {
if (p22 == null) if (p30 == null)
{ {
return null; return null;
} }
List<TaskShiftSDto> result = new List<TaskShiftSDto>(p22.Count); List<TaskShiftSDto> result = new List<TaskShiftSDto>(p30.Count);
int i = 0; int i = 0;
int len = p22.Count; int len = p30.Count;
while (i < len) while (i < len)
{ {
TaskShift item = p22[i]; TaskShift item = p30[i];
result.Add(item == null ? null : new TaskShiftSDto() result.Add(item == null ? null : new TaskShiftSDto()
{ {
ShiftId = item.ShiftId, ShiftId = item.ShiftId,
@ -363,20 +511,20 @@ namespace Brizco.Domain.Mappers
} }
private static List<TaskPositionSDto> funcMain6(List<TaskPosition> p23) private static List<TaskPositionSDto> funcMain10(List<TaskPosition> p31)
{ {
if (p23 == null) if (p31 == null)
{ {
return null; return null;
} }
List<TaskPositionSDto> result = new List<TaskPositionSDto>(p23.Count); List<TaskPositionSDto> result = new List<TaskPositionSDto>(p31.Count);
int i = 0; int i = 0;
int len = p23.Count; int len = p31.Count;
while (i < len) while (i < len)
{ {
TaskPosition item = p23[i]; TaskPosition item = p31[i];
result.Add(item == null ? null : new TaskPositionSDto() result.Add(item == null ? null : new TaskPositionSDto()
{ {
PositionId = item.PositionId, PositionId = item.PositionId,
@ -389,20 +537,72 @@ namespace Brizco.Domain.Mappers
} }
private static List<TaskShiftSDto> funcMain7(List<TaskShift> p26, List<TaskShiftSDto> p27) private static List<TaskDaySDto> funcMain11(List<TaskDay> p32)
{ {
if (p26 == null) if (p32 == null)
{ {
return null; return null;
} }
List<TaskShiftSDto> result = new List<TaskShiftSDto>(p26.Count); List<TaskDaySDto> result = new List<TaskDaySDto>(p32.Count);
int i = 0; int i = 0;
int len = p26.Count; int len = p32.Count;
while (i < len) while (i < len)
{ {
TaskShift item = p26[i]; TaskDay item = p32[i];
result.Add(item == null ? null : new TaskDaySDto()
{
DayOfWeek = item.DayOfWeek,
TaskId = item.TaskId,
Id = item.Id
});
i++;
}
return result;
}
private static List<TaskRoutineSDto> funcMain12(List<TaskRoutine> p33)
{
if (p33 == null)
{
return null;
}
List<TaskRoutineSDto> result = new List<TaskRoutineSDto>(p33.Count);
int i = 0;
int len = p33.Count;
while (i < len)
{
TaskRoutine item = p33[i];
result.Add(item == null ? null : new TaskRoutineSDto()
{
TaskId = item.TaskId,
RoutineId = item.RoutineId,
Id = item.Id
});
i++;
}
return result;
}
private static List<TaskShiftSDto> funcMain13(List<TaskShift> p36, List<TaskShiftSDto> p37)
{
if (p36 == null)
{
return null;
}
List<TaskShiftSDto> result = new List<TaskShiftSDto>(p36.Count);
int i = 0;
int len = p36.Count;
while (i < len)
{
TaskShift item = p36[i];
result.Add(item == null ? null : new TaskShiftSDto() result.Add(item == null ? null : new TaskShiftSDto()
{ {
ShiftId = item.ShiftId, ShiftId = item.ShiftId,
@ -414,20 +614,20 @@ namespace Brizco.Domain.Mappers
} }
private static List<TaskPositionSDto> funcMain8(List<TaskPosition> p28, List<TaskPositionSDto> p29) private static List<TaskPositionSDto> funcMain14(List<TaskPosition> p38, List<TaskPositionSDto> p39)
{ {
if (p28 == null) if (p38 == null)
{ {
return null; return null;
} }
List<TaskPositionSDto> result = new List<TaskPositionSDto>(p28.Count); List<TaskPositionSDto> result = new List<TaskPositionSDto>(p38.Count);
int i = 0; int i = 0;
int len = p28.Count; int len = p38.Count;
while (i < len) while (i < len)
{ {
TaskPosition item = p28[i]; TaskPosition item = p38[i];
result.Add(item == null ? null : new TaskPositionSDto() result.Add(item == null ? null : new TaskPositionSDto()
{ {
PositionId = item.PositionId, PositionId = item.PositionId,
@ -439,5 +639,57 @@ namespace Brizco.Domain.Mappers
return result; return result;
} }
private static List<TaskDaySDto> funcMain15(List<TaskDay> p40, List<TaskDaySDto> p41)
{
if (p40 == null)
{
return null;
}
List<TaskDaySDto> result = new List<TaskDaySDto>(p40.Count);
int i = 0;
int len = p40.Count;
while (i < len)
{
TaskDay item = p40[i];
result.Add(item == null ? null : new TaskDaySDto()
{
DayOfWeek = item.DayOfWeek,
TaskId = item.TaskId,
Id = item.Id
});
i++;
}
return result;
}
private static List<TaskRoutineSDto> funcMain16(List<TaskRoutine> p42, List<TaskRoutineSDto> p43)
{
if (p42 == null)
{
return null;
}
List<TaskRoutineSDto> result = new List<TaskRoutineSDto>(p42.Count);
int i = 0;
int len = p42.Count;
while (i < len)
{
TaskRoutine item = p42[i];
result.Add(item == null ? null : new TaskRoutineSDto()
{
TaskId = item.TaskId,
RoutineId = item.RoutineId,
Id = item.Id
});
i++;
}
return result;
}
} }
} }

View File

@ -1,6 +1,69 @@
using System;
using System.Linq.Expressions;
using Brizco.Domain.Dtos.SmallDtos;
using Brizco.Domain.Entities.Task;
namespace Brizco.Domain.Mappers namespace Brizco.Domain.Mappers
{ {
public static partial class TaskRoutineMapper public static partial class TaskRoutineMapper
{ {
public static TaskRoutine AdaptToTaskRoutine(this TaskRoutineSDto p1)
{
return p1 == null ? null : new TaskRoutine()
{
TaskId = p1.TaskId,
RoutineId = p1.RoutineId,
Id = p1.Id
};
}
public static TaskRoutine AdaptTo(this TaskRoutineSDto p2, TaskRoutine p3)
{
if (p2 == null)
{
return null;
}
TaskRoutine result = p3 ?? new TaskRoutine();
result.TaskId = p2.TaskId;
result.RoutineId = p2.RoutineId;
result.Id = p2.Id;
return result;
}
public static Expression<Func<TaskRoutineSDto, TaskRoutine>> ProjectToTaskRoutine => p4 => new TaskRoutine()
{
TaskId = p4.TaskId,
RoutineId = p4.RoutineId,
Id = p4.Id
};
public static TaskRoutineSDto AdaptToSDto(this TaskRoutine p5)
{
return p5 == null ? null : new TaskRoutineSDto()
{
TaskId = p5.TaskId,
RoutineId = p5.RoutineId,
Id = p5.Id
};
}
public static TaskRoutineSDto AdaptTo(this TaskRoutine p6, TaskRoutineSDto p7)
{
if (p6 == null)
{
return null;
}
TaskRoutineSDto result = p7 ?? new TaskRoutineSDto();
result.TaskId = p6.TaskId;
result.RoutineId = p6.RoutineId;
result.Id = p6.Id;
return result;
}
public static Expression<Func<TaskRoutine, TaskRoutineSDto>> ProjectToSDto => p8 => new TaskRoutineSDto()
{
TaskId = p8.TaskId,
RoutineId = p8.RoutineId,
Id = p8.Id
};
} }
} }

View File

@ -12,6 +12,9 @@ public class MapsterRegister : IRegister
.Map("Days",o=>o.Days.Select(d=>d.DayOfWeek).ToList()) .Map("Days",o=>o.Days.Select(d=>d.DayOfWeek).ToList())
.TwoWays(); .TwoWays();
config.NewConfig<Shift, ShiftLDto>()
.Map("Days", o => o.Days.Select(d => d.DayOfWeek).ToList())
.TwoWays();
config.NewConfig<ComplexUserRole, ComplexUserRoleSDto>() config.NewConfig<ComplexUserRole, ComplexUserRoleSDto>()
.Map("RoleName", org => org.Role!.PersianName) .Map("RoleName", org => org.Role!.PersianName)

View File

@ -33,21 +33,11 @@ public class CreateActivityCommandHandler : IRequestHandler<CreateActivityComman
request.HasDisposed, request.HasDisposed,
request.Amount, request.Amount,
request.AmountType, request.AmountType,
complexId); complexId,
request.ScheduleType);
if (request.Shifts.Count == 0)
throw new AppException(
"اگر فعالیت برای یک شیفت نقش انتخاب شده باشد باید لیست شیفت ها را ارسال نمایید");
task.AddShift(request.Shifts.ToArray());
if (request.Positions.Count == 0)
throw new AppException(
"اگر فعالیت برای یک پوزیشن نقش انتخاب شده باشد باید لیست پوزیشن ها را ارسال نمایید");
task.AddPosition(request.Positions.ToArray());
_repositoryWrapper.SetRepository<Domain.Entities.Task.Activity>().Add(task); _repositoryWrapper.SetRepository<Domain.Entities.Task.Activity>().Add(task);
await _repositoryWrapper.SaveChangesAsync(cancellationToken); await _repositoryWrapper.SaveChangesAsync(cancellationToken);
await _repositoryWrapper.CommitAsync(cancellationToken); await _repositoryWrapper.CommitAsync(cancellationToken);

View File

@ -37,7 +37,8 @@ public class UpdateActivityCommandHandler : IRequestHandler<UpdateActivityComman
request.HasDisposed, request.HasDisposed,
request.Amount, request.Amount,
request.AmountType, request.AmountType,
complexId); complexId,
request.ScheduleType);
newTask.Id = request.Id; newTask.Id = request.Id;

View File

@ -22,7 +22,7 @@ public class CreatePositionUserCommandHandler : IRequestHandler<CreatePositionUs
.FirstOrDefaultAsync(p => p.Id == request.PositionId, cancellationToken); .FirstOrDefaultAsync(p => p.Id == request.PositionId, cancellationToken);
if (entity == null) if (entity == null)
throw new AppException("Position not found"); throw new AppException("Position not found");
entity.AddUser(request.UserId); entity.AddUser(request.UserId,request.ShiftPlanId);
_repositoryWrapper.SetRepository<Domain.Entities.Complex.Position>().Update(entity); _repositoryWrapper.SetRepository<Domain.Entities.Complex.Position>().Update(entity);
await _repositoryWrapper.SaveChangesAsync(cancellationToken); await _repositoryWrapper.SaveChangesAsync(cancellationToken);
await _repositoryWrapper.CommitAsync(cancellationToken); await _repositoryWrapper.CommitAsync(cancellationToken);

View File

@ -20,7 +20,7 @@ public class UpdatePositionUserCommandHandler : IRequestHandler<UpdatePositionUs
.FirstOrDefaultAsync(p => p.ApplicationUserId == request.UserId , cancellationToken); .FirstOrDefaultAsync(p => p.ApplicationUserId == request.UserId , cancellationToken);
if (entity == null) if (entity == null)
throw new AppException("PositionUser not found"); throw new AppException("PositionUser not found");
var newEntity = PositionUser.Create(request.PositionId, request.UserId); var newEntity = PositionUser.Create(request.PositionId, request.UserId, request.ShiftPlanId);
newEntity.Id = entity.Id; newEntity.Id = entity.Id;
_repositoryWrapper.SetRepository<Domain.Entities.Complex.PositionUser>().Update(newEntity); _repositoryWrapper.SetRepository<Domain.Entities.Complex.PositionUser>().Update(newEntity);

View File

@ -14,7 +14,15 @@ public class DeleteSectionCommandHandler : IRequestHandler<DeleteSectionCommand,
.TableNoTracking .TableNoTracking
.FirstOrDefaultAsync(s => s.Id == request.Id, cancellationToken); .FirstOrDefaultAsync(s => s.Id == request.Id, cancellationToken);
if (section == null) if (section == null)
throw new AppException("Postion not found", ApiResultStatusCode.NotFound); throw new AppException("Section not found", ApiResultStatusCode.NotFound);
var positions = await _repositoryWrapper.SetRepository<Domain.Entities.Complex.Position>()
.TableNoTracking
.Where(p => p.SectionId == section.Id)
.CountAsync(cancellationToken);
if (positions > 0)
throw new AppException("این سکشن پوزیشن فعال دارد ، نخست پوزیشن های سکشن را حذف کرده یا منتقل کنید");
_repositoryWrapper.SetRepository<Domain.Entities.Complex.Section>() _repositoryWrapper.SetRepository<Domain.Entities.Complex.Section>()
.Delete(section); .Delete(section);

View File

@ -27,8 +27,12 @@ public class CreateShiftCommandHandler : IRequestHandler<CreateShiftCommand, Shi
request.StartAt, request.StartAt,
request.EndAt, request.EndAt,
complexId); complexId);
if (request.DayOfWeeks.Count == 0)
throw new AppException("روزهای شیفت را انتخاب کنید");
request.DayOfWeeks.ForEach(d => shift.SetDay(d)); request.DayOfWeeks.ForEach(d => shift.SetDay(d));
if (request.Routines.Count == 0)
throw new AppException("روتین شیفت را انتخاب کنید");
request.Routines.ForEach(r=>shift.AddRoutine(r));
_repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>().Add(shift); _repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>().Add(shift);
await _repositoryWrapper.SaveChangesAsync(cancellationToken); await _repositoryWrapper.SaveChangesAsync(cancellationToken);

View File

@ -2,7 +2,7 @@
namespace Brizco.Repository.Handlers.Shift; namespace Brizco.Repository.Handlers.Shift;
public class GetShiftPlanQueryHandler : IRequestHandler<GetShiftQuery, ShiftSDto> public class GetShiftPlanQueryHandler : IRequestHandler<GetShiftQuery, ShiftLDto>
{ {
private readonly IRepositoryWrapper _repositoryWrapper; private readonly IRepositoryWrapper _repositoryWrapper;
@ -10,19 +10,19 @@ public class GetShiftPlanQueryHandler : IRequestHandler<GetShiftQuery, ShiftSDto
{ {
_repositoryWrapper = repositoryWrapper; _repositoryWrapper = repositoryWrapper;
} }
public async Task<ShiftSDto> Handle(GetShiftQuery request, CancellationToken cancellationToken) public async Task<ShiftLDto> Handle(GetShiftQuery request, CancellationToken cancellationToken)
{ {
var shift = await _repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>() var shift = await _repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>()
.TableNoTracking .TableNoTracking
.Where(s => s.Id == request.id) .Where(s => s.Id == request.Id)
.Select(ShiftMapper.ProjectToSDto) .Select(ShiftMapper.ProjectToLDto)
.FirstOrDefaultAsync(cancellationToken); .FirstOrDefaultAsync(cancellationToken);
if (shift == null) if (shift == null)
throw new AppException("Shift not found", ApiResultStatusCode.NotFound); throw new AppException("Shift not found", ApiResultStatusCode.NotFound);
//var shiftDays = await _repositoryWrapper.SetRepository<ShiftDay>() //var shiftDays = await _repositoryWrapper.SetRepository<ShiftDay>()
// .TableNoTracking // .TableNoTracking
// .Where(sd => sd.ShiftId == request.id) // .Where(sd => sd.ShiftId == request.Id)
// .ToListAsync(cancellationToken); // .ToListAsync(cancellationToken);
//shift.Days = shiftDays.Select(s => s.DayOfWeek).ToList(); //shift.Days = shiftDays.Select(s => s.DayOfWeek).ToList();

View File

@ -20,7 +20,7 @@ public class GetShiftPlansQueryHandler : IRequestHandler<GetShiftsQuery, List<Sh
var shifts = await _repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>().TableNoTracking var shifts = await _repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>().TableNoTracking
.Where(s=>s.ComplexId==complexId) .Where(s=>s.ComplexId==complexId)
.OrderByDescending(s => s.CreatedAt) .OrderByDescending(s => s.CreatedAt)
.Skip(request.page * 15).Take(15) .Skip(request.Page * 15).Take(15)
.Select(ShiftMapper.ProjectToSDto) .Select(ShiftMapper.ProjectToSDto)
.ToListAsync(cancellationToken); .ToListAsync(cancellationToken);

View File

@ -32,6 +32,8 @@ public class UpdatePositionCommandHandler : IRequestHandler<UpdateShiftCommand,
complexId); complexId);
newShift.Id = request.Id; newShift.Id = request.Id;
if (request.DayOfWeeks.Count == 0)
throw new AppException("روزهای شیفت را انتخاب کنید");
var shiftDays = await _repositoryWrapper.SetRepository<ShiftDay>() var shiftDays = await _repositoryWrapper.SetRepository<ShiftDay>()
.TableNoTracking.Where(sd => sd.ShiftId == request.Id) .TableNoTracking.Where(sd => sd.ShiftId == request.Id)
.ToListAsync(cancellationToken); .ToListAsync(cancellationToken);
@ -43,13 +45,30 @@ public class UpdatePositionCommandHandler : IRequestHandler<UpdateShiftCommand,
await _repositoryWrapper.SaveChangesAsync(cancellationToken); await _repositoryWrapper.SaveChangesAsync(cancellationToken);
} }
foreach (var dayOfWeek in request.DayOfWeeks) foreach (var dayOfWeek in from dayOfWeek in request.DayOfWeeks let findDay = shiftDays.FirstOrDefault(sf => sf.DayOfWeek == dayOfWeek) where findDay == null select dayOfWeek)
{ {
var findDay = shiftDays.FirstOrDefault(sf => sf.DayOfWeek == dayOfWeek);
if (findDay == null)
newShift.SetDay(dayOfWeek); newShift.SetDay(dayOfWeek);
} }
if (request.Routines.Count == 0)
throw new AppException("روتین شیفت را انتخاب کنید");
var shiftRoutines = await _repositoryWrapper.SetRepository<ShiftRoutine>()
.TableNoTracking.Where(sd => sd.ShiftId == request.Id)
.ToListAsync(cancellationToken);
foreach (var shiftRoutine in shiftRoutines.Where(shiftRoutine => !request.Routines.Contains(shiftRoutine.RoutineId)))
{
_repositoryWrapper.SetRepository<ShiftRoutine>()
.Delete(shiftRoutine);
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
}
foreach (var routine in request.Routines.Where(r=>!shiftRoutines.Exists(routine=>routine.RoutineId==r)))
{
newShift.AddRoutine(routine);
}
_repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>() _repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>()
.Update(newShift); .Update(newShift);
await _repositoryWrapper.SaveChangesAsync(cancellationToken); await _repositoryWrapper.SaveChangesAsync(cancellationToken);

View File

@ -21,13 +21,16 @@ public class CreateActivityCommandHandler : IRequestHandler<CreateTaskCommand, T
request.Description, request.Description,
request.Type, request.Type,
request.IsDisposable, request.IsDisposable,
request.SetFor, DateTimeExtensions.UnixTimeStampToDateTime(request.SetFor),
request.HasDisposed, request.HasDisposed,
request.Amount, request.Amount,
request.AmountType, request.AmountType,
complexId); complexId,
request.ScheduleType);
if (request.Routines.Count == 0)
throw new AppException("لطفا روتین های وظیفه را انتخاب نمایید");
task.AddRoutine(request.Routines.ToArray());
if (request.Shifts.Count == 0) if (request.Shifts.Count == 0)
throw new AppException("اگر فعالیت برای یک گروه نقش انتخاب شده باشد باید لیست نقش ها را ارسال نمایید"); throw new AppException("اگر فعالیت برای یک گروه نقش انتخاب شده باشد باید لیست نقش ها را ارسال نمایید");
@ -35,7 +38,12 @@ public class CreateActivityCommandHandler : IRequestHandler<CreateTaskCommand, T
if (request.Positions.Count == 0) if (request.Positions.Count == 0)
throw new AppException("اگر فعالیت برای یک گروه نقش انتخاب شده باشد باید لیست نقش ها را ارسال نمایید"); throw new AppException("اگر فعالیت برای یک گروه نقش انتخاب شده باشد باید لیست نقش ها را ارسال نمایید");
task.AddShift(request.Positions.ToArray()); task.AddPosition(request.Positions.ToArray());
if (task.ScheduleType == TaskScheduleType.Weekly && request.Days.Count == 0)
throw new AppException("اگر تکرار فعالیت به صورت هفتگی باشد باید روزهای ان هفته را انتخاب کنید");
request.Days.ForEach(d=>task.SetDay(d));
_repositoryWrapper.SetRepository<Domain.Entities.Task.Task>().Add(task); _repositoryWrapper.SetRepository<Domain.Entities.Task.Task>().Add(task);
await _repositoryWrapper.SaveChangesAsync(cancellationToken); await _repositoryWrapper.SaveChangesAsync(cancellationToken);

View File

@ -1,4 +1,6 @@
namespace Brizco.Repository.Handlers.Task; using Brizco.Domain.Entities.Task;
namespace Brizco.Repository.Handlers.Task;
public class UpdateActivityCommandHandler : IRequestHandler<UpdateTaskCommand, bool> public class UpdateActivityCommandHandler : IRequestHandler<UpdateTaskCommand, bool>
{ {
@ -27,13 +29,89 @@ public class UpdateActivityCommandHandler : IRequestHandler<UpdateTaskCommand, b
request.Description, request.Description,
request.Type, request.Type,
request.IsDisposable, request.IsDisposable,
request.SetFor, DateTimeExtensions.UnixTimeStampToDateTime(request.SetFor),
request.HasDisposed, request.HasDisposed,
request.Amount, request.Amount,
request.AmountType, request.AmountType,
complexId); complexId,
request.ScheduleType);
newTask.Id = request.Id; newTask.Id = request.Id;
if (request.Routines.Count == 0)
throw new AppException("لطفا روتین های وظیفه را انتخاب نمایید");
var routines = await _repositoryWrapper.SetRepository<TaskRoutine>()
.TableNoTracking
.Where(tr => tr.TaskId == newTask.Id)
.ToListAsync(cancellationToken);
foreach (var taskRoutine in routines.Where(taskR => !request.Routines.Exists(r=>r== taskR.RoutineId)))
{
_repositoryWrapper.SetRepository<TaskRoutine>()
.Delete(taskRoutine);
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
}
foreach (var routine in request.Routines.Where(requestRoutine => !routines.Exists(r=>r.RoutineId==requestRoutine)))
{
newTask.AddRoutine(routine);
}
if (request.Shifts.Count == 0)
throw new AppException("اگر فعالیت برای یک گروه نقش انتخاب شده باشد باید لیست نقش ها را ارسال نمایید");
var shifts = await _repositoryWrapper.SetRepository<TaskShift>()
.TableNoTracking
.Where(tr => tr.TaskId == newTask.Id)
.ToListAsync(cancellationToken);
foreach (var taskShift in shifts.Where(taskS => !request.Shifts.Exists(r => r == taskS.ShiftId)))
{
_repositoryWrapper.SetRepository<TaskShift>()
.Delete(taskShift);
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
}
foreach (var shift in request.Shifts.Where(requestShift => !shifts.Exists(r => r.ShiftId == requestShift)))
{
newTask.AddShift(shift);
}
if (request.Positions.Count == 0)
throw new AppException("اگر فعالیت برای یک گروه نقش انتخاب شده باشد باید لیست نقش ها را ارسال نمایید");
var positions = await _repositoryWrapper.SetRepository<TaskPosition>()
.TableNoTracking
.Where(tr => tr.TaskId == newTask.Id)
.ToListAsync(cancellationToken);
foreach (var taskPosition in positions.Where(taskP => !request.Positions.Exists(r => r == taskP.PositionId)))
{
_repositoryWrapper.SetRepository<TaskPosition>()
.Delete(taskPosition);
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
}
foreach (var position in request.Positions.Where(requestP => !positions.Exists(r => r.PositionId == requestP)))
{
newTask.AddPosition(position);
}
if (task.ScheduleType == TaskScheduleType.Weekly && request.Days.Count == 0)
throw new AppException("اگر تکرار فعالیت به صورت هفتگی باشد باید روزهای ان هفته را انتخاب کنید");
request.Days.ForEach(d => task.SetDay(d));
var days = await _repositoryWrapper.SetRepository<TaskDay>()
.TableNoTracking
.Where(tr => tr.TaskId == newTask.Id)
.ToListAsync(cancellationToken);
foreach (var taskDay in days.Where(taskD => !request.Days.Exists(r => r == taskD.DayOfWeek)))
{
_repositoryWrapper.SetRepository<TaskDay>()
.Delete(taskDay);
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
}
foreach (var day in request.Days.Where(requestP => !days.Exists(r => r.DayOfWeek == requestP)))
{
newTask.SetDay(day);
}
_repositoryWrapper.SetRepository<Domain.Entities.Task.Task>() _repositoryWrapper.SetRepository<Domain.Entities.Task.Task>()
.Update(newTask); .Update(newTask);
await _repositoryWrapper.SaveChangesAsync(cancellationToken); await _repositoryWrapper.SaveChangesAsync(cancellationToken);

View File

@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Brizco.Repository.Migrations namespace Brizco.Repository.Migrations
{ {
[DbContext(typeof(ApplicationContext))] [DbContext(typeof(ApplicationContext))]
[Migration("20231113110204_init")] [Migration("20231116063836_init")]
partial class init partial class init
{ {
/// <inheritdoc /> /// <inheritdoc />
@ -252,12 +252,17 @@ namespace Brizco.Repository.Migrations
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<Guid>("ShiftPlanId")
.HasColumnType("uuid");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("ApplicationUserId"); b.HasIndex("ApplicationUserId");
b.HasIndex("PositionId"); b.HasIndex("PositionId");
b.HasIndex("ShiftPlanId");
b.ToTable("PositionUsers", "public"); b.ToTable("PositionUsers", "public");
}); });
@ -640,6 +645,9 @@ namespace Brizco.Repository.Migrations
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<int>("ScheduleType")
.HasColumnType("integer");
b.Property<DateTime>("SetFor") b.Property<DateTime>("SetFor")
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
@ -1092,6 +1100,11 @@ namespace Brizco.Repository.Migrations
b.Property<int>("Status") b.Property<int>("Status")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.HasIndex("UserId");
b.HasDiscriminator().HasValue("Activity"); b.HasDiscriminator().HasValue("Activity");
}); });
@ -1166,9 +1179,17 @@ namespace Brizco.Repository.Migrations
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict)
.IsRequired(); .IsRequired();
b.HasOne("Brizco.Domain.Entities.Shift.ShiftPlan", "ShiftPlan")
.WithMany()
.HasForeignKey("ShiftPlanId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("ApplicationUser"); b.Navigation("ApplicationUser");
b.Navigation("Position"); b.Navigation("Position");
b.Navigation("ShiftPlan");
}); });
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b => modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b =>
@ -1403,6 +1424,17 @@ namespace Brizco.Repository.Migrations
.IsRequired(); .IsRequired();
}); });
modelBuilder.Entity("Brizco.Domain.Entities.Task.Activity", b =>
{
b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Complex", b => modelBuilder.Entity("Brizco.Domain.Entities.Complex.Complex", b =>
{ {
b.Navigation("Roles"); b.Navigation("Roles");

View File

@ -184,46 +184,6 @@ namespace Brizco.Repository.Migrations
onDelete: ReferentialAction.Restrict); onDelete: ReferentialAction.Restrict);
}); });
migrationBuilder.CreateTable(
name: "Tasks",
schema: "public",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Type = table.Column<int>(type: "integer", nullable: false),
Title = table.Column<string>(type: "text", nullable: false),
Description = table.Column<string>(type: "text", nullable: false),
IsDisposable = table.Column<bool>(type: "boolean", nullable: false),
SetFor = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
HasDisposed = table.Column<bool>(type: "boolean", nullable: false),
ComplexId = table.Column<Guid>(type: "uuid", nullable: false),
Amount = table.Column<int>(type: "integer", nullable: false),
AmountType = table.Column<int>(type: "integer", nullable: false),
Discriminator = table.Column<string>(type: "text", nullable: false),
Status = table.Column<int>(type: "integer", nullable: true),
DoneAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
IsDone = table.Column<bool>(type: "boolean", nullable: true),
PerformanceDescription = table.Column<string>(type: "text", nullable: true),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedBy = table.Column<string>(type: "text", nullable: false),
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
RemovedBy = table.Column<string>(type: "text", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ModifiedBy = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Tasks", x => x.Id);
table.ForeignKey(
name: "FK_Tasks_Complexes_ComplexId",
column: x => x.ComplexId,
principalSchema: "public",
principalTable: "Complexes",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "Claims", name: "Claims",
schema: "public", schema: "public",
@ -304,6 +264,55 @@ namespace Brizco.Repository.Migrations
onDelete: ReferentialAction.Restrict); onDelete: ReferentialAction.Restrict);
}); });
migrationBuilder.CreateTable(
name: "Tasks",
schema: "public",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Type = table.Column<int>(type: "integer", nullable: false),
Title = table.Column<string>(type: "text", nullable: false),
Description = table.Column<string>(type: "text", nullable: false),
IsDisposable = table.Column<bool>(type: "boolean", nullable: false),
SetFor = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
HasDisposed = table.Column<bool>(type: "boolean", nullable: false),
ScheduleType = table.Column<int>(type: "integer", nullable: false),
ComplexId = table.Column<Guid>(type: "uuid", nullable: false),
Amount = table.Column<int>(type: "integer", nullable: false),
AmountType = table.Column<int>(type: "integer", nullable: false),
Discriminator = table.Column<string>(type: "text", nullable: false),
Status = table.Column<int>(type: "integer", nullable: true),
DoneAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
IsDone = table.Column<bool>(type: "boolean", nullable: true),
PerformanceDescription = table.Column<string>(type: "text", nullable: true),
UserId = table.Column<Guid>(type: "uuid", nullable: true),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedBy = table.Column<string>(type: "text", nullable: false),
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
RemovedBy = table.Column<string>(type: "text", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ModifiedBy = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Tasks", x => x.Id);
table.ForeignKey(
name: "FK_Tasks_Complexes_ComplexId",
column: x => x.ComplexId,
principalSchema: "public",
principalTable: "Complexes",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Tasks_Users_UserId",
column: x => x.UserId,
principalSchema: "public",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "Tokens", name: "Tokens",
schema: "public", schema: "public",
@ -504,6 +513,41 @@ namespace Brizco.Repository.Migrations
onDelete: ReferentialAction.Restrict); onDelete: ReferentialAction.Restrict);
}); });
migrationBuilder.CreateTable(
name: "ComplexUserRoles",
schema: "public",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
ComplexUserId = table.Column<Guid>(type: "uuid", nullable: false),
RoleId = table.Column<Guid>(type: "uuid", nullable: false),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedBy = table.Column<string>(type: "text", nullable: false),
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
RemovedBy = table.Column<string>(type: "text", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ModifiedBy = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ComplexUserRoles", x => x.Id);
table.ForeignKey(
name: "FK_ComplexUserRoles_ComplexUsers_ComplexUserId",
column: x => x.ComplexUserId,
principalSchema: "public",
principalTable: "ComplexUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_ComplexUserRoles_Roles_RoleId",
column: x => x.RoleId,
principalSchema: "public",
principalTable: "Roles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "TaskDays", name: "TaskDays",
schema: "public", schema: "public",
@ -602,76 +646,6 @@ namespace Brizco.Repository.Migrations
onDelete: ReferentialAction.Restrict); onDelete: ReferentialAction.Restrict);
}); });
migrationBuilder.CreateTable(
name: "ComplexUserRoles",
schema: "public",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
ComplexUserId = table.Column<Guid>(type: "uuid", nullable: false),
RoleId = table.Column<Guid>(type: "uuid", nullable: false),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedBy = table.Column<string>(type: "text", nullable: false),
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
RemovedBy = table.Column<string>(type: "text", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ModifiedBy = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ComplexUserRoles", x => x.Id);
table.ForeignKey(
name: "FK_ComplexUserRoles_ComplexUsers_ComplexUserId",
column: x => x.ComplexUserId,
principalSchema: "public",
principalTable: "ComplexUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_ComplexUserRoles_Roles_RoleId",
column: x => x.RoleId,
principalSchema: "public",
principalTable: "Roles",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "PositionUsers",
schema: "public",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
ApplicationUserId = table.Column<Guid>(type: "uuid", nullable: false),
PositionId = table.Column<Guid>(type: "uuid", nullable: false),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedBy = table.Column<string>(type: "text", nullable: false),
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
RemovedBy = table.Column<string>(type: "text", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ModifiedBy = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PositionUsers", x => x.Id);
table.ForeignKey(
name: "FK_PositionUsers_Positions_PositionId",
column: x => x.PositionId,
principalSchema: "public",
principalTable: "Positions",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_PositionUsers_Users_ApplicationUserId",
column: x => x.ApplicationUserId,
principalSchema: "public",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "TaskPositions", name: "TaskPositions",
schema: "public", schema: "public",
@ -707,6 +681,49 @@ namespace Brizco.Repository.Migrations
onDelete: ReferentialAction.Restrict); onDelete: ReferentialAction.Restrict);
}); });
migrationBuilder.CreateTable(
name: "PositionUsers",
schema: "public",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
ApplicationUserId = table.Column<Guid>(type: "uuid", nullable: false),
PositionId = table.Column<Guid>(type: "uuid", nullable: false),
ShiftPlanId = table.Column<Guid>(type: "uuid", nullable: false),
RemovedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CreatedBy = table.Column<string>(type: "text", nullable: false),
IsRemoved = table.Column<bool>(type: "boolean", nullable: false),
RemovedBy = table.Column<string>(type: "text", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
ModifiedBy = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PositionUsers", x => x.Id);
table.ForeignKey(
name: "FK_PositionUsers_Positions_PositionId",
column: x => x.PositionId,
principalSchema: "public",
principalTable: "Positions",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_PositionUsers_ShiftPlans_ShiftPlanId",
column: x => x.ShiftPlanId,
principalSchema: "public",
principalTable: "ShiftPlans",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_PositionUsers_Users_ApplicationUserId",
column: x => x.ApplicationUserId,
principalSchema: "public",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "ShiftPlanUsers", name: "ShiftPlanUsers",
schema: "public", schema: "public",
@ -802,6 +819,12 @@ namespace Brizco.Repository.Migrations
table: "PositionUsers", table: "PositionUsers",
column: "PositionId"); column: "PositionId");
migrationBuilder.CreateIndex(
name: "IX_PositionUsers_ShiftPlanId",
schema: "public",
table: "PositionUsers",
column: "ShiftPlanId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_RoleClaims_RoleId", name: "IX_RoleClaims_RoleId",
schema: "public", schema: "public",
@ -911,6 +934,12 @@ namespace Brizco.Repository.Migrations
table: "Tasks", table: "Tasks",
column: "ComplexId"); column: "ComplexId");
migrationBuilder.CreateIndex(
name: "IX_Tasks_UserId",
schema: "public",
table: "Tasks",
column: "UserId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_TaskShifts_ShiftId", name: "IX_TaskShifts_ShiftId",
schema: "public", schema: "public",
@ -1026,10 +1055,6 @@ namespace Brizco.Repository.Migrations
name: "Roles", name: "Roles",
schema: "public"); schema: "public");
migrationBuilder.DropTable(
name: "Users",
schema: "public");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Shifts", name: "Shifts",
schema: "public"); schema: "public");
@ -1038,6 +1063,10 @@ namespace Brizco.Repository.Migrations
name: "Sections", name: "Sections",
schema: "public"); schema: "public");
migrationBuilder.DropTable(
name: "Users",
schema: "public");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Complexes", name: "Complexes",
schema: "public"); schema: "public");

View File

@ -249,12 +249,17 @@ namespace Brizco.Repository.Migrations
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<Guid>("ShiftPlanId")
.HasColumnType("uuid");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("ApplicationUserId"); b.HasIndex("ApplicationUserId");
b.HasIndex("PositionId"); b.HasIndex("PositionId");
b.HasIndex("ShiftPlanId");
b.ToTable("PositionUsers", "public"); b.ToTable("PositionUsers", "public");
}); });
@ -637,6 +642,9 @@ namespace Brizco.Repository.Migrations
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<int>("ScheduleType")
.HasColumnType("integer");
b.Property<DateTime>("SetFor") b.Property<DateTime>("SetFor")
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
@ -1089,6 +1097,11 @@ namespace Brizco.Repository.Migrations
b.Property<int>("Status") b.Property<int>("Status")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.HasIndex("UserId");
b.HasDiscriminator().HasValue("Activity"); b.HasDiscriminator().HasValue("Activity");
}); });
@ -1163,9 +1176,17 @@ namespace Brizco.Repository.Migrations
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict)
.IsRequired(); .IsRequired();
b.HasOne("Brizco.Domain.Entities.Shift.ShiftPlan", "ShiftPlan")
.WithMany()
.HasForeignKey("ShiftPlanId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("ApplicationUser"); b.Navigation("ApplicationUser");
b.Navigation("Position"); b.Navigation("Position");
b.Navigation("ShiftPlan");
}); });
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b => modelBuilder.Entity("Brizco.Domain.Entities.Complex.Section", b =>
@ -1400,6 +1421,17 @@ namespace Brizco.Repository.Migrations
.IsRequired(); .IsRequired();
}); });
modelBuilder.Entity("Brizco.Domain.Entities.Task.Activity", b =>
{
b.HasOne("Brizco.Domain.Entities.User.ApplicationUser", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("Brizco.Domain.Entities.Complex.Complex", b => modelBuilder.Entity("Brizco.Domain.Entities.Complex.Complex", b =>
{ {
b.Navigation("Roles"); b.Navigation("Roles");