add version 0.4.7.7

master
Amir Hossein Khademi 2024-03-06 23:22:53 +03:30
parent cce4acaa00
commit 7b70ff62c8
14 changed files with 546 additions and 232 deletions

View File

@ -1 +1 @@
0.4.6.6 0.4.7.7

View File

@ -1,6 +1,6 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"PostgresServer": "User ID=postgres;Password=root;Host=localhost;Port=5432;Database=iGarsonDB;", "PostgresServer": "Host=185.220.227.160;port=5432;Username=postgres;Password=ub0J7sFFThkSBmkc0TzSKsCfheRnQpyu;Database=BrizcoDB",
"Postgres": "Host=pg-0,pg-1;Username=igarsonAgent;Password=xHTpBf4wC+bBeNg2pL6Ga7VEWKFJx7VPEUpqxwPFfOc2YYTVwFQuHfsiqoVeT9+6;Database=BrizcoDB;Load Balance Hosts=true;Target Session Attributes=primary;Application Name=iGLS" "Postgres": "Host=pg-0,pg-1;Username=igarsonAgent;Password=xHTpBf4wC+bBeNg2pL6Ga7VEWKFJx7VPEUpqxwPFfOc2YYTVwFQuHfsiqoVeT9+6;Database=BrizcoDB;Load Balance Hosts=true;Target Session Attributes=primary;Application Name=iGLS"
}, },
"Logging": { "Logging": {

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.4.6.6</AssemblyVersion> <AssemblyVersion>0.4.7.7</AssemblyVersion>
<FileVersion>0.4.6.6</FileVersion> <FileVersion>0.4.7.7</FileVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,4 +1,5 @@
using Brizco.Common.Models.Claims; using Brizco.Common.Models.Claims;
using Brizco.Domain.Enums;
namespace Brizco.Api.Controllers; namespace Brizco.Api.Controllers;
@ -50,7 +51,7 @@ public class ActivityController : ICarterModule
// GET:Get All Entity // GET:Get All Entity
public async Task<IResult> GetAllAsync([FromQuery] int page, [FromQuery] long? selectedDate, [FromQuery] Guid? selectedShift, ISender sender, CancellationToken cancellationToken) public async Task<IResult> GetAllAsync([FromQuery] int page, [FromQuery] DateQueryFilter? dateQueryFilter, [FromQuery] long? selectedDate, [FromQuery] Guid? selectedShift, ISender sender, CancellationToken cancellationToken)
=> TypedResults.Ok(await sender.Send(new GetActivitiesQuery(Page: page, SelectedDate: selectedDate ?? 0 , SelectedShift: selectedShift ?? default), cancellationToken)); => TypedResults.Ok(await sender.Send(new GetActivitiesQuery(Page: page, SelectedDate: selectedDate ?? 0 , SelectedShift: selectedShift ?? default), cancellationToken));
// GET:Get An Entity By Id // GET:Get An Entity By Id

View File

@ -1,6 +1,6 @@
namespace Brizco.Domain.CommandQueries.Queries; namespace Brizco.Domain.CommandQueries.Queries;
public sealed record GetActivitiesQuery(int Page = 0 , long SelectedDate = 0 , Guid SelectedShift = default) : public sealed record GetActivitiesQuery(int Page = 0 , long SelectedDate = 0 , Guid SelectedShift = default , DateQueryFilter? DateQueryFilter = null) :
IRequest<List<ActivitySDto>>; IRequest<List<ActivitySDto>>;
public sealed record GetActivityQuery(Guid Id) : public sealed record GetActivityQuery(Guid Id) :

View File

@ -14,4 +14,6 @@ public class ShiftPlanSDto : BaseDto<ShiftPlanSDto,ShiftPlan>
public string CompleteDescription { get; internal set; } = string.Empty; public string CompleteDescription { get; internal set; } = string.Empty;
public Guid ShiftId { get; set; } public Guid ShiftId { get; set; }
public string ShiftTitle { get; internal set; } = string.Empty; public string ShiftTitle { get; internal set; } = string.Empty;
public List<ShiftPlanUserSDto> Users { get; set; } = new();
} }

View File

@ -6,5 +6,7 @@ public class ShiftPlanUserSDto : BaseDto<ShiftPlanUserSDto,ShiftPlanUser>
{ {
public Guid ShiftPlanId { get; set; } public Guid ShiftPlanId { get; set; }
public Guid UserId { get; set; } public Guid UserId { get; set; }
public string UserFullName { get; set; } = string.Empty;
public Guid PositionId { get; set; } public Guid PositionId { get; set; }
public string PositionName { get; set; } = string.Empty;
} }

View File

@ -0,0 +1,8 @@
namespace Brizco.Domain.Enums;
public enum DateQueryFilter
{
Today = 0,
Tomorrow = 1,
ThisWeek = 2,
}

View File

@ -4,6 +4,7 @@ using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using Brizco.Domain.Dtos.LargDtos; using Brizco.Domain.Dtos.LargDtos;
using Brizco.Domain.Dtos.SmallDtos; using Brizco.Domain.Dtos.SmallDtos;
using Brizco.Domain.Entities.Complex;
using Brizco.Domain.Entities.Routine; using Brizco.Domain.Entities.Routine;
using Brizco.Domain.Entities.Shift; using Brizco.Domain.Entities.Shift;
using Brizco.Domain.Entities.User; using Brizco.Domain.Entities.User;
@ -22,274 +23,292 @@ namespace Brizco.Domain.Mappers
CompletePercent = p1.CompletePercent, CompletePercent = p1.CompletePercent,
CompleteDescription = p1.CompleteDescription, CompleteDescription = p1.CompleteDescription,
ShiftId = p1.ShiftId, ShiftId = p1.ShiftId,
Users = funcMain1(p1.Users),
Id = p1.Id Id = p1.Id
}; };
} }
public static ShiftPlan AdaptTo(this ShiftPlanSDto p2, ShiftPlan p3) public static ShiftPlan AdaptTo(this ShiftPlanSDto p3, ShiftPlan p4)
{ {
if (p2 == null) if (p3 == null)
{ {
return null; return null;
} }
ShiftPlan result = p3 ?? new ShiftPlan(); ShiftPlan result = p4 ?? new ShiftPlan();
result.PlanFor = p2.PlanFor; result.PlanFor = p3.PlanFor;
result.IsCompleted = p2.IsCompleted; result.IsCompleted = p3.IsCompleted;
result.CompletePercent = p2.CompletePercent; result.CompletePercent = p3.CompletePercent;
result.CompleteDescription = p2.CompleteDescription; result.CompleteDescription = p3.CompleteDescription;
result.ShiftId = p2.ShiftId; result.ShiftId = p3.ShiftId;
result.Id = p2.Id; result.Users = funcMain2(p3.Users, result.Users);
result.Id = p3.Id;
return result; return result;
} }
public static Expression<Func<ShiftPlanSDto, ShiftPlan>> ProjectToShiftPlan => p4 => new ShiftPlan() public static Expression<Func<ShiftPlanSDto, ShiftPlan>> ProjectToShiftPlan => p7 => new ShiftPlan()
{ {
PlanFor = p4.PlanFor, PlanFor = p7.PlanFor,
IsCompleted = p4.IsCompleted, IsCompleted = p7.IsCompleted,
CompletePercent = p4.CompletePercent, CompletePercent = p7.CompletePercent,
CompleteDescription = p4.CompleteDescription, CompleteDescription = p7.CompleteDescription,
ShiftId = p4.ShiftId, ShiftId = p7.ShiftId,
Id = p4.Id Users = p7.Users.Select<ShiftPlanUserSDto, ShiftPlanUser>(p8 => new ShiftPlanUser()
};
public static ShiftPlanSDto AdaptToSDto(this ShiftPlan p5)
{ {
return p5 == null ? null : new ShiftPlanSDto() ShiftPlanId = p8.ShiftPlanId,
ShiftPlan = new ShiftPlan() {Id = p8.ShiftPlanId},
PositionId = p8.PositionId,
Position = new Position()
{ {
PlanFor = p5.PlanFor, Name = p8.PositionName,
IsCompleted = p5.IsCompleted, Id = p8.PositionId
CompletePercent = p5.CompletePercent, },
CompleteDescription = p5.CompleteDescription, UserId = p8.UserId,
ShiftId = p5.ShiftId, User = new ApplicationUser() {Id = p8.UserId},
ShiftTitle = p5.Shift == null ? null : p5.Shift.Title,
Id = p5.Id
};
}
public static ShiftPlanSDto AdaptTo(this ShiftPlan p6, ShiftPlanSDto p7)
{
if (p6 == null)
{
return null;
}
ShiftPlanSDto result = p7 ?? new ShiftPlanSDto();
result.PlanFor = p6.PlanFor;
result.IsCompleted = p6.IsCompleted;
result.CompletePercent = p6.CompletePercent;
result.CompleteDescription = p6.CompleteDescription;
result.ShiftId = p6.ShiftId;
result.ShiftTitle = p6.Shift == null ? null : p6.Shift.Title;
result.Id = p6.Id;
return result;
}
public static Expression<Func<ShiftPlan, ShiftPlanSDto>> ProjectToSDto => p8 => new ShiftPlanSDto()
{
PlanFor = p8.PlanFor,
IsCompleted = p8.IsCompleted,
CompletePercent = p8.CompletePercent,
CompleteDescription = p8.CompleteDescription,
ShiftId = p8.ShiftId,
ShiftTitle = p8.Shift.Title,
Id = p8.Id Id = p8.Id
}).ToList<ShiftPlanUser>(),
Id = p7.Id
}; };
public static ShiftPlan AdaptToShiftPlan(this ShiftPlanLDto p9) public static ShiftPlanSDto AdaptToSDto(this ShiftPlan p9)
{ {
return p9 == null ? null : new ShiftPlan() return p9 == null ? null : new ShiftPlanSDto()
{ {
PlanFor = p9.PlanFor, PlanFor = p9.PlanFor,
IsCompleted = p9.IsCompleted, IsCompleted = p9.IsCompleted,
CompletePercent = p9.CompletePercent, CompletePercent = p9.CompletePercent,
CompleteDescription = p9.CompleteDescription, CompleteDescription = p9.CompleteDescription,
ShiftId = p9.ShiftId, ShiftId = p9.ShiftId,
Shift = new Shift() {Id = p9.ShiftId}, ShiftTitle = p9.Shift == null ? null : p9.Shift.Title,
RoutineId = p9.RoutineId, Users = funcMain3(p9.Users),
Routine = new Routine() {Id = p9.RoutineId},
SupervisorId = p9.SupervisorId,
Supervisor = new ApplicationUser() {Id = p9.SupervisorId},
Users = funcMain1(p9.Users),
Id = p9.Id Id = p9.Id
}; };
} }
public static ShiftPlan AdaptTo(this ShiftPlanLDto p11, ShiftPlan p12) public static ShiftPlanSDto AdaptTo(this ShiftPlan p11, ShiftPlanSDto p12)
{ {
if (p11 == null) if (p11 == null)
{ {
return null; return null;
} }
ShiftPlan result = p12 ?? new ShiftPlan(); ShiftPlanSDto result = p12 ?? new ShiftPlanSDto();
result.PlanFor = p11.PlanFor; result.PlanFor = p11.PlanFor;
result.IsCompleted = p11.IsCompleted; result.IsCompleted = p11.IsCompleted;
result.CompletePercent = p11.CompletePercent; result.CompletePercent = p11.CompletePercent;
result.CompleteDescription = p11.CompleteDescription; result.CompleteDescription = p11.CompleteDescription;
result.ShiftId = p11.ShiftId; result.ShiftId = p11.ShiftId;
result.Shift = funcMain2(new Never(), result.Shift, p11); result.ShiftTitle = p11.Shift == null ? null : p11.Shift.Title;
result.RoutineId = p11.RoutineId; result.Users = funcMain4(p11.Users, result.Users);
result.Routine = funcMain3(new Never(), result.Routine, p11);
result.SupervisorId = p11.SupervisorId;
result.Supervisor = funcMain4(new Never(), result.Supervisor, p11);
result.Users = funcMain5(p11.Users, result.Users);
result.Id = p11.Id; result.Id = p11.Id;
return result; return result;
} }
public static ShiftPlanLDto AdaptToLDto(this ShiftPlan p21) public static Expression<Func<ShiftPlan, ShiftPlanSDto>> ProjectToSDto => p15 => new ShiftPlanSDto()
{ {
return p21 == null ? null : new ShiftPlanLDto() PlanFor = p15.PlanFor,
IsCompleted = p15.IsCompleted,
CompletePercent = p15.CompletePercent,
CompleteDescription = p15.CompleteDescription,
ShiftId = p15.ShiftId,
ShiftTitle = p15.Shift.Title,
Users = p15.Users.Select<ShiftPlanUser, ShiftPlanUserSDto>(p16 => new ShiftPlanUserSDto()
{ {
PlanFor = p21.PlanFor, ShiftPlanId = p16.ShiftPlanId,
RoutineId = p21.RoutineId, UserId = p16.UserId,
IsCompleted = p21.IsCompleted, UserFullName = p16.User != null ? p16.User.FirstName + " " + p16.User.LastName : string.Empty,
CompletePercent = p21.CompletePercent, PositionId = p16.PositionId,
CompleteDescription = p21.CompleteDescription, PositionName = p16.Position != null ? p16.Position.Name : string.Empty,
ShiftId = p21.ShiftId, Id = p16.Id
Users = funcMain6(p21.Users), }).ToList<ShiftPlanUserSDto>(),
SupervisorId = p21.SupervisorId, Id = p15.Id
SupervisorFullName = p21.Supervisor != null ? p21.Supervisor.FirstName + " " + p21.Supervisor.LastName : string.Empty, };
Id = p21.Id public static ShiftPlan AdaptToShiftPlan(this ShiftPlanLDto p17)
{
return p17 == null ? null : new ShiftPlan()
{
PlanFor = p17.PlanFor,
IsCompleted = p17.IsCompleted,
CompletePercent = p17.CompletePercent,
CompleteDescription = p17.CompleteDescription,
ShiftId = p17.ShiftId,
Shift = new Shift() {Id = p17.ShiftId},
RoutineId = p17.RoutineId,
Routine = new Routine() {Id = p17.RoutineId},
SupervisorId = p17.SupervisorId,
Supervisor = new ApplicationUser() {Id = p17.SupervisorId},
Users = funcMain5(p17.Users),
Id = p17.Id
}; };
} }
public static ShiftPlanLDto AdaptTo(this ShiftPlan p23, ShiftPlanLDto p24) public static ShiftPlan AdaptTo(this ShiftPlanLDto p19, ShiftPlan p20)
{ {
if (p23 == null) if (p19 == null)
{ {
return null; return null;
} }
ShiftPlanLDto result = p24 ?? new ShiftPlanLDto(); ShiftPlan result = p20 ?? new ShiftPlan();
result.PlanFor = p23.PlanFor; result.PlanFor = p19.PlanFor;
result.RoutineId = p23.RoutineId; result.IsCompleted = p19.IsCompleted;
result.IsCompleted = p23.IsCompleted; result.CompletePercent = p19.CompletePercent;
result.CompletePercent = p23.CompletePercent; result.CompleteDescription = p19.CompleteDescription;
result.CompleteDescription = p23.CompleteDescription; result.ShiftId = p19.ShiftId;
result.ShiftId = p23.ShiftId; result.Shift = funcMain6(new Never(), result.Shift, p19);
result.Users = funcMain7(p23.Users, result.Users); result.RoutineId = p19.RoutineId;
result.SupervisorId = p23.SupervisorId; result.Routine = funcMain7(new Never(), result.Routine, p19);
result.SupervisorFullName = p23.Supervisor != null ? p23.Supervisor.FirstName + " " + p23.Supervisor.LastName : string.Empty; result.SupervisorId = p19.SupervisorId;
result.Id = p23.Id; result.Supervisor = funcMain8(new Never(), result.Supervisor, p19);
result.Users = funcMain9(p19.Users, result.Users);
result.Id = p19.Id;
return result; return result;
} }
public static Expression<Func<ShiftPlan, ShiftPlanLDto>> ProjectToLDto => p27 => new ShiftPlanLDto() public static ShiftPlanLDto AdaptToLDto(this ShiftPlan p29)
{ {
PlanFor = p27.PlanFor, return p29 == null ? null : new ShiftPlanLDto()
RoutineId = p27.RoutineId,
IsCompleted = p27.IsCompleted,
CompletePercent = p27.CompletePercent,
CompleteDescription = p27.CompleteDescription,
ShiftId = p27.ShiftId,
Users = p27.Users.Select<ShiftPlanUser, ShiftPlanUserSDto>(p28 => new ShiftPlanUserSDto()
{ {
ShiftPlanId = p28.ShiftPlanId, PlanFor = p29.PlanFor,
UserId = p28.UserId, RoutineId = p29.RoutineId,
PositionId = p28.PositionId, IsCompleted = p29.IsCompleted,
Id = p28.Id CompletePercent = p29.CompletePercent,
CompleteDescription = p29.CompleteDescription,
ShiftId = p29.ShiftId,
Users = funcMain10(p29.Users),
SupervisorId = p29.SupervisorId,
SupervisorFullName = p29.Supervisor != null ? p29.Supervisor.FirstName + " " + p29.Supervisor.LastName : string.Empty,
Id = p29.Id
};
}
public static ShiftPlanLDto AdaptTo(this ShiftPlan p31, ShiftPlanLDto p32)
{
if (p31 == null)
{
return null;
}
ShiftPlanLDto result = p32 ?? new ShiftPlanLDto();
result.PlanFor = p31.PlanFor;
result.RoutineId = p31.RoutineId;
result.IsCompleted = p31.IsCompleted;
result.CompletePercent = p31.CompletePercent;
result.CompleteDescription = p31.CompleteDescription;
result.ShiftId = p31.ShiftId;
result.Users = funcMain11(p31.Users, result.Users);
result.SupervisorId = p31.SupervisorId;
result.SupervisorFullName = p31.Supervisor != null ? p31.Supervisor.FirstName + " " + p31.Supervisor.LastName : string.Empty;
result.Id = p31.Id;
return result;
}
public static Expression<Func<ShiftPlan, ShiftPlanLDto>> ProjectToLDto => p35 => new ShiftPlanLDto()
{
PlanFor = p35.PlanFor,
RoutineId = p35.RoutineId,
IsCompleted = p35.IsCompleted,
CompletePercent = p35.CompletePercent,
CompleteDescription = p35.CompleteDescription,
ShiftId = p35.ShiftId,
Users = p35.Users.Select<ShiftPlanUser, ShiftPlanUserSDto>(p36 => new ShiftPlanUserSDto()
{
ShiftPlanId = p36.ShiftPlanId,
UserId = p36.UserId,
UserFullName = p36.User != null ? p36.User.FirstName + " " + p36.User.LastName : string.Empty,
PositionId = p36.PositionId,
PositionName = p36.Position != null ? p36.Position.Name : string.Empty,
Id = p36.Id
}).ToList<ShiftPlanUserSDto>(), }).ToList<ShiftPlanUserSDto>(),
SupervisorId = p27.SupervisorId, SupervisorId = p35.SupervisorId,
SupervisorFullName = p27.Supervisor != null ? p27.Supervisor.FirstName + " " + p27.Supervisor.LastName : string.Empty, SupervisorFullName = p35.Supervisor != null ? p35.Supervisor.FirstName + " " + p35.Supervisor.LastName : string.Empty,
Id = p27.Id Id = p35.Id
}; };
private static List<ShiftPlanUser> funcMain1(List<ShiftPlanUserSDto> p10) private static List<ShiftPlanUser> funcMain1(List<ShiftPlanUserSDto> p2)
{
if (p2 == null)
{
return null;
}
List<ShiftPlanUser> result = new List<ShiftPlanUser>(p2.Count);
int i = 0;
int len = p2.Count;
while (i < len)
{
ShiftPlanUserSDto item = p2[i];
result.Add(item == null ? null : new ShiftPlanUser()
{
ShiftPlanId = item.ShiftPlanId,
ShiftPlan = new ShiftPlan() {Id = item.ShiftPlanId},
PositionId = item.PositionId,
Position = new Position()
{
Name = item.PositionName,
Id = item.PositionId
},
UserId = item.UserId,
User = new ApplicationUser() {Id = item.UserId},
Id = item.Id
});
i++;
}
return result;
}
private static List<ShiftPlanUser> funcMain2(List<ShiftPlanUserSDto> p5, List<ShiftPlanUser> p6)
{
if (p5 == null)
{
return null;
}
List<ShiftPlanUser> result = new List<ShiftPlanUser>(p5.Count);
int i = 0;
int len = p5.Count;
while (i < len)
{
ShiftPlanUserSDto item = p5[i];
result.Add(item == null ? null : new ShiftPlanUser()
{
ShiftPlanId = item.ShiftPlanId,
ShiftPlan = new ShiftPlan() {Id = item.ShiftPlanId},
PositionId = item.PositionId,
Position = new Position()
{
Name = item.PositionName,
Id = item.PositionId
},
UserId = item.UserId,
User = new ApplicationUser() {Id = item.UserId},
Id = item.Id
});
i++;
}
return result;
}
private static List<ShiftPlanUserSDto> funcMain3(List<ShiftPlanUser> p10)
{ {
if (p10 == null) if (p10 == null)
{ {
return null; return null;
} }
List<ShiftPlanUser> result = new List<ShiftPlanUser>(p10.Count); List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p10.Count);
int i = 0; int i = 0;
int len = p10.Count; int len = p10.Count;
while (i < len) while (i < len)
{ {
ShiftPlanUserSDto item = p10[i]; ShiftPlanUser item = p10[i];
result.Add(item == null ? null : new ShiftPlanUser()
{
ShiftPlanId = item.ShiftPlanId,
PositionId = item.PositionId,
UserId = item.UserId,
Id = item.Id
});
i++;
}
return result;
}
private static Shift funcMain2(Never p13, Shift p14, ShiftPlanLDto p11)
{
Shift result = p14 ?? new Shift();
result.Id = p11.ShiftId;
return result;
}
private static Routine funcMain3(Never p15, Routine p16, ShiftPlanLDto p11)
{
Routine result = p16 ?? new Routine();
result.Id = p11.RoutineId;
return result;
}
private static ApplicationUser funcMain4(Never p17, ApplicationUser p18, ShiftPlanLDto p11)
{
ApplicationUser result = p18 ?? new ApplicationUser();
result.Id = p11.SupervisorId;
return result;
}
private static List<ShiftPlanUser> funcMain5(List<ShiftPlanUserSDto> p19, List<ShiftPlanUser> p20)
{
if (p19 == null)
{
return null;
}
List<ShiftPlanUser> result = new List<ShiftPlanUser>(p19.Count);
int i = 0;
int len = p19.Count;
while (i < len)
{
ShiftPlanUserSDto item = p19[i];
result.Add(item == null ? null : new ShiftPlanUser()
{
ShiftPlanId = item.ShiftPlanId,
PositionId = item.PositionId,
UserId = item.UserId,
Id = item.Id
});
i++;
}
return result;
}
private static List<ShiftPlanUserSDto> funcMain6(List<ShiftPlanUser> p22)
{
if (p22 == null)
{
return null;
}
List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p22.Count);
int i = 0;
int len = p22.Count;
while (i < len)
{
ShiftPlanUser item = p22[i];
result.Add(item == null ? null : new ShiftPlanUserSDto() result.Add(item == null ? null : new ShiftPlanUserSDto()
{ {
ShiftPlanId = item.ShiftPlanId, ShiftPlanId = item.ShiftPlanId,
UserId = item.UserId, UserId = item.UserId,
UserFullName = item.User != null ? item.User.FirstName + " " + item.User.LastName : string.Empty,
PositionId = item.PositionId, PositionId = item.PositionId,
PositionName = item.Position != null ? item.Position.Name : string.Empty,
Id = item.Id Id = item.Id
}); });
i++; i++;
@ -298,25 +317,180 @@ namespace Brizco.Domain.Mappers
} }
private static List<ShiftPlanUserSDto> funcMain7(List<ShiftPlanUser> p25, List<ShiftPlanUserSDto> p26) private static List<ShiftPlanUserSDto> funcMain4(List<ShiftPlanUser> p13, List<ShiftPlanUserSDto> p14)
{ {
if (p25 == null) if (p13 == null)
{ {
return null; return null;
} }
List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p25.Count); List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p13.Count);
int i = 0; int i = 0;
int len = p25.Count; int len = p13.Count;
while (i < len) while (i < len)
{ {
ShiftPlanUser item = p25[i]; ShiftPlanUser item = p13[i];
result.Add(item == null ? null : new ShiftPlanUserSDto() result.Add(item == null ? null : new ShiftPlanUserSDto()
{ {
ShiftPlanId = item.ShiftPlanId, ShiftPlanId = item.ShiftPlanId,
UserId = item.UserId, UserId = item.UserId,
UserFullName = item.User != null ? item.User.FirstName + " " + item.User.LastName : string.Empty,
PositionId = item.PositionId, PositionId = item.PositionId,
PositionName = item.Position != null ? item.Position.Name : string.Empty,
Id = item.Id
});
i++;
}
return result;
}
private static List<ShiftPlanUser> funcMain5(List<ShiftPlanUserSDto> p18)
{
if (p18 == null)
{
return null;
}
List<ShiftPlanUser> result = new List<ShiftPlanUser>(p18.Count);
int i = 0;
int len = p18.Count;
while (i < len)
{
ShiftPlanUserSDto item = p18[i];
result.Add(item == null ? null : new ShiftPlanUser()
{
ShiftPlanId = item.ShiftPlanId,
ShiftPlan = new ShiftPlan() {Id = item.ShiftPlanId},
PositionId = item.PositionId,
Position = new Position()
{
Name = item.PositionName,
Id = item.PositionId
},
UserId = item.UserId,
User = new ApplicationUser() {Id = item.UserId},
Id = item.Id
});
i++;
}
return result;
}
private static Shift funcMain6(Never p21, Shift p22, ShiftPlanLDto p19)
{
Shift result = p22 ?? new Shift();
result.Id = p19.ShiftId;
return result;
}
private static Routine funcMain7(Never p23, Routine p24, ShiftPlanLDto p19)
{
Routine result = p24 ?? new Routine();
result.Id = p19.RoutineId;
return result;
}
private static ApplicationUser funcMain8(Never p25, ApplicationUser p26, ShiftPlanLDto p19)
{
ApplicationUser result = p26 ?? new ApplicationUser();
result.Id = p19.SupervisorId;
return result;
}
private static List<ShiftPlanUser> funcMain9(List<ShiftPlanUserSDto> p27, List<ShiftPlanUser> p28)
{
if (p27 == null)
{
return null;
}
List<ShiftPlanUser> result = new List<ShiftPlanUser>(p27.Count);
int i = 0;
int len = p27.Count;
while (i < len)
{
ShiftPlanUserSDto item = p27[i];
result.Add(item == null ? null : new ShiftPlanUser()
{
ShiftPlanId = item.ShiftPlanId,
ShiftPlan = new ShiftPlan() {Id = item.ShiftPlanId},
PositionId = item.PositionId,
Position = new Position()
{
Name = item.PositionName,
Id = item.PositionId
},
UserId = item.UserId,
User = new ApplicationUser() {Id = item.UserId},
Id = item.Id
});
i++;
}
return result;
}
private static List<ShiftPlanUserSDto> funcMain10(List<ShiftPlanUser> p30)
{
if (p30 == null)
{
return null;
}
List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p30.Count);
int i = 0;
int len = p30.Count;
while (i < len)
{
ShiftPlanUser item = p30[i];
result.Add(item == null ? null : new ShiftPlanUserSDto()
{
ShiftPlanId = item.ShiftPlanId,
UserId = item.UserId,
UserFullName = item.User != null ? item.User.FirstName + " " + item.User.LastName : string.Empty,
PositionId = item.PositionId,
PositionName = item.Position != null ? item.Position.Name : string.Empty,
Id = item.Id
});
i++;
}
return result;
}
private static List<ShiftPlanUserSDto> funcMain11(List<ShiftPlanUser> p33, List<ShiftPlanUserSDto> p34)
{
if (p33 == null)
{
return null;
}
List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p33.Count);
int i = 0;
int len = p33.Count;
while (i < len)
{
ShiftPlanUser item = p33[i];
result.Add(item == null ? null : new ShiftPlanUserSDto()
{
ShiftPlanId = item.ShiftPlanId,
UserId = item.UserId,
UserFullName = item.User != null ? item.User.FirstName + " " + item.User.LastName : string.Empty,
PositionId = item.PositionId,
PositionName = item.Position != null ? item.Position.Name : string.Empty,
Id = item.Id Id = item.Id
}); });
i++; i++;

View File

@ -1,7 +1,10 @@
using System; using System;
using System.Linq.Expressions; using System.Linq.Expressions;
using Brizco.Domain.Dtos.SmallDtos; using Brizco.Domain.Dtos.SmallDtos;
using Brizco.Domain.Entities.Complex;
using Brizco.Domain.Entities.Shift; using Brizco.Domain.Entities.Shift;
using Brizco.Domain.Entities.User;
using Mapster.Models;
namespace Brizco.Domain.Mappers namespace Brizco.Domain.Mappers
{ {
@ -12,8 +15,15 @@ namespace Brizco.Domain.Mappers
return p1 == null ? null : new ShiftPlanUser() return p1 == null ? null : new ShiftPlanUser()
{ {
ShiftPlanId = p1.ShiftPlanId, ShiftPlanId = p1.ShiftPlanId,
ShiftPlan = new ShiftPlan() {Id = p1.ShiftPlanId},
PositionId = p1.PositionId, PositionId = p1.PositionId,
Position = new Position()
{
Name = p1.PositionName,
Id = p1.PositionId
},
UserId = p1.UserId, UserId = p1.UserId,
User = new ApplicationUser() {Id = p1.UserId},
Id = p1.Id Id = p1.Id
}; };
} }
@ -26,50 +36,94 @@ namespace Brizco.Domain.Mappers
ShiftPlanUser result = p3 ?? new ShiftPlanUser(); ShiftPlanUser result = p3 ?? new ShiftPlanUser();
result.ShiftPlanId = p2.ShiftPlanId; result.ShiftPlanId = p2.ShiftPlanId;
result.ShiftPlan = funcMain1(new Never(), result.ShiftPlan, p2);
result.PositionId = p2.PositionId; result.PositionId = p2.PositionId;
result.Position = funcMain2(new Never(), result.Position, p2);
result.UserId = p2.UserId; result.UserId = p2.UserId;
result.User = funcMain3(new Never(), result.User, p2);
result.Id = p2.Id; result.Id = p2.Id;
return result; return result;
} }
public static Expression<Func<ShiftPlanUserSDto, ShiftPlanUser>> ProjectToShiftPlanUser => p4 => new ShiftPlanUser() public static Expression<Func<ShiftPlanUserSDto, ShiftPlanUser>> ProjectToShiftPlanUser => p10 => new ShiftPlanUser()
{ {
ShiftPlanId = p4.ShiftPlanId, ShiftPlanId = p10.ShiftPlanId,
PositionId = p4.PositionId, ShiftPlan = new ShiftPlan() {Id = p10.ShiftPlanId},
UserId = p4.UserId, PositionId = p10.PositionId,
Id = p4.Id Position = new Position()
{
Name = p10.PositionName,
Id = p10.PositionId
},
UserId = p10.UserId,
User = new ApplicationUser() {Id = p10.UserId},
Id = p10.Id
}; };
public static ShiftPlanUserSDto AdaptToSDto(this ShiftPlanUser p5) public static ShiftPlanUserSDto AdaptToSDto(this ShiftPlanUser p11)
{ {
return p5 == null ? null : new ShiftPlanUserSDto() return p11 == null ? null : new ShiftPlanUserSDto()
{ {
ShiftPlanId = p5.ShiftPlanId, ShiftPlanId = p11.ShiftPlanId,
UserId = p5.UserId, UserId = p11.UserId,
PositionId = p5.PositionId, UserFullName = p11.User != null ? p11.User.FirstName + " " + p11.User.LastName : string.Empty,
Id = p5.Id PositionId = p11.PositionId,
PositionName = p11.Position != null ? p11.Position.Name : string.Empty,
Id = p11.Id
}; };
} }
public static ShiftPlanUserSDto AdaptTo(this ShiftPlanUser p6, ShiftPlanUserSDto p7) public static ShiftPlanUserSDto AdaptTo(this ShiftPlanUser p12, ShiftPlanUserSDto p13)
{ {
if (p6 == null) if (p12 == null)
{ {
return null; return null;
} }
ShiftPlanUserSDto result = p7 ?? new ShiftPlanUserSDto(); ShiftPlanUserSDto result = p13 ?? new ShiftPlanUserSDto();
result.ShiftPlanId = p6.ShiftPlanId; result.ShiftPlanId = p12.ShiftPlanId;
result.UserId = p6.UserId; result.UserId = p12.UserId;
result.PositionId = p6.PositionId; result.UserFullName = p12.User != null ? p12.User.FirstName + " " + p12.User.LastName : string.Empty;
result.Id = p6.Id; result.PositionId = p12.PositionId;
result.PositionName = p12.Position != null ? p12.Position.Name : string.Empty;
result.Id = p12.Id;
return result; return result;
} }
public static Expression<Func<ShiftPlanUser, ShiftPlanUserSDto>> ProjectToSDto => p8 => new ShiftPlanUserSDto() public static Expression<Func<ShiftPlanUser, ShiftPlanUserSDto>> ProjectToSDto => p14 => new ShiftPlanUserSDto()
{ {
ShiftPlanId = p8.ShiftPlanId, ShiftPlanId = p14.ShiftPlanId,
UserId = p8.UserId, UserId = p14.UserId,
PositionId = p8.PositionId, UserFullName = p14.User != null ? p14.User.FirstName + " " + p14.User.LastName : string.Empty,
Id = p8.Id PositionId = p14.PositionId,
PositionName = p14.Position != null ? p14.Position.Name : string.Empty,
Id = p14.Id
}; };
private static ShiftPlan funcMain1(Never p4, ShiftPlan p5, ShiftPlanUserSDto p2)
{
ShiftPlan result = p5 ?? new ShiftPlan();
result.Id = p2.ShiftPlanId;
return result;
}
private static Position funcMain2(Never p6, Position p7, ShiftPlanUserSDto p2)
{
Position result = p7 ?? new Position();
result.Name = p2.PositionName;
result.Id = p2.PositionId;
return result;
}
private static ApplicationUser funcMain3(Never p8, ApplicationUser p9, ShiftPlanUserSDto p2)
{
ApplicationUser result = p9 ?? new ApplicationUser();
result.Id = p2.UserId;
return result;
}
} }
} }

View File

@ -44,6 +44,11 @@ public class MapsterRegister : IRegister
.Map("SupervisorFullName", o => o.Supervisor != null ? o.Supervisor.FirstName + " " + o.Supervisor.LastName : string.Empty) .Map("SupervisorFullName", o => o.Supervisor != null ? o.Supervisor.FirstName + " " + o.Supervisor.LastName : string.Empty)
.TwoWays(); .TwoWays();
config.NewConfig<ShiftPlanUser, ShiftPlanUserSDto>()
.Map("UserFullName", o => o.User != null ? o.User.FirstName + " " + o.User.LastName : string.Empty)
.Map("PositionName", o => o.Position != null ? o.Position.Name : string.Empty)
.TwoWays();
config.NewConfig<ComplexUserRole, ComplexUserRoleSDto>() config.NewConfig<ComplexUserRole, ComplexUserRoleSDto>()
.Map("RoleName", org => org.Role!.PersianName) .Map("RoleName", org => org.Role!.PersianName)
.TwoWays(); .TwoWays();

View File

@ -26,6 +26,23 @@ public class GetActivitiesQueryHandler : IRequestHandler<GetActivitiesQuery, Lis
IQueryable<Domain.Entities.Task.Activity> activities = _repositoryWrapper.SetRepository<Domain.Entities.Task.Activity>().TableNoTracking IQueryable<Domain.Entities.Task.Activity> activities = _repositoryWrapper.SetRepository<Domain.Entities.Task.Activity>().TableNoTracking
.Where(a=>a.IsActivity); .Where(a=>a.IsActivity);
if (request.DateQueryFilter != null)
{
switch (request.DateQueryFilter)
{
case DateQueryFilter.Today:
activities = activities.Where(a => a.SetFor.Date == DateTime.Today.Date);
break;
case DateQueryFilter.Tomorrow:
activities = activities.Where(a => a.SetFor.Date == DateTime.Today.AddDays(1).Date);
break;
case DateQueryFilter.ThisWeek:
activities = activities.Where(a => a.SetFor.Date >= DateTime.Today.AddDays(-1).Date && a.SetFor.Date <= DateTime.Today.AddDays(+6).Date);
break;
default:
throw new ArgumentOutOfRangeException();
}
}
if (request.SelectedDate > 0) if (request.SelectedDate > 0)
{ {

View File

@ -117,6 +117,7 @@ public class GetShiftPlansQueryHandler : IRequestHandler<GetShiftPlansQuery, Lis
shiftPlan.StaffCount = await _repositoryWrapper.SetRepository<ShiftPlanUser>() shiftPlan.StaffCount = await _repositoryWrapper.SetRepository<ShiftPlanUser>()
.TableNoTracking .TableNoTracking
.CountAsync(spu => spu.ShiftPlanId == shiftPlan.Id, cancellationToken); .CountAsync(spu => spu.ShiftPlanId == shiftPlan.Id, cancellationToken);
} }
return shiftPlans; return shiftPlans;

View File

@ -89,5 +89,55 @@ public class DbInitializerService : IDbInitializerService
foreach (var claim in ApplicationClaims.AllClaims) foreach (var claim in ApplicationClaims.AllClaims)
await _roleManager.AddClaimAsync(managerRole, claim); await _roleManager.AddClaimAsync(managerRole, claim);
} }
//var roles = await _roleManager.Roles.ToListAsync();
//foreach (var role in roles)
//{
// if (role.EnglishName == "Manager")
// {
// var claims = await _roleManager.GetClaimsAsync(role);
// foreach (var claim in ApplicationClaims.ManagerClaims)
// {
// if(!claims.Contains(claim))
// await _roleManager.AddClaimAsync(role, claim);
// }
// }
// else if (role.EnglishName == "ViewerOwner")
// {
// var claims = await _roleManager.GetClaimsAsync(role);
// foreach (var claim in ApplicationClaims.ViewerOwnerClaims)
// {
// if (!claims.Contains(claim))
// await _roleManager.AddClaimAsync(role, claim);
// }
// }
// else if (role.EnglishName == "SuperVisor")
// {
// var claims = await _roleManager.GetClaimsAsync(role);
// foreach (var claim in ApplicationClaims.SuperVisorClaims)
// {
// if (!claims.Contains(claim))
// await _roleManager.AddClaimAsync(role, claim);
// }
// }
// else if (role.EnglishName == "Staff")
// {
// var claims = await _roleManager.GetClaimsAsync(role);
// foreach (var claim in ApplicationClaims.StaffClaims)
// {
// if (!claims.Contains(claim))
// await _roleManager.AddClaimAsync(role, claim);
// }
// }
//}
} }
} }