feat : add version 0.5.8.9 , edit roles and permissions , fix issues
parent
34e9e73d3c
commit
5b67533eee
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"ConnectionStrings": {
|
||||
"PostgresServer": "Host=185.220.227.160;port=5432;Username=postgres;Password=ub0J7sFFThkSBmkc0TzSKsCfheRnQpyu;Database=BrizcoDB",
|
||||
"PostgresServer": "Host=185.220.227.123;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"
|
||||
},
|
||||
"Logging": {
|
||||
|
|
|
@ -6,42 +6,42 @@
|
|||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
|
||||
<AssemblyVersion>0.4.8.8</AssemblyVersion>
|
||||
<FileVersion>0.4.8.8</FileVersion>
|
||||
<AssemblyVersion>0.5.8.9</AssemblyVersion>
|
||||
<FileVersion>0.5.8.9</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Asp.Versioning.Http" Version="8.0.0" />
|
||||
<PackageReference Include="Asp.Versioning.Http" Version="8.1.0" />
|
||||
<PackageReference Include="Ben.BlockingDetector" Version="0.0.4" />
|
||||
<PackageReference Include="Carter" Version="8.0.0" />
|
||||
<PackageReference Include="FluentValidation" Version="11.9.0" />
|
||||
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.9.0" />
|
||||
<PackageReference Include="FluentValidation" Version="11.9.1" />
|
||||
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.9.1" />
|
||||
<PackageReference Include="MediatR.Extensions.Autofac.DependencyInjection" Version="12.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.2">
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.2">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Autofac" Version="8.0.0" />
|
||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="9.0.0" />
|
||||
<PackageReference Include="Elmah.Io.AspNetCore.Serilog" Version="5.0.17" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.20.1" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.1" />
|
||||
<PackageReference Include="Sentry.Serilog" Version="4.1.1" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.2" />
|
||||
<PackageReference Include="Sentry.Serilog" Version="4.4.0" />
|
||||
<PackageReference Include="Serilog" Version="3.1.1" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
|
||||
<PackageReference Include="Serilog.Sinks.PostgreSQL" Version="2.3.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Seq" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Seq" Version="7.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.ElmahIo" Version="5.0.38" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="10.2.0" />
|
||||
|
@ -51,7 +51,7 @@
|
|||
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="8.0.1" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="8.0.2" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="8.0.4" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Using Include="Autofac" />
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
"ASPNETCORE_URLS": "http://+:80"
|
||||
},
|
||||
"publishAllPorts": true,
|
||||
"DockerfileRunArguments": " --network=mother -p 32769:80"
|
||||
"DockerfileRunArguments": " --network=mother -p 32767:80"
|
||||
}
|
||||
},
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<!--<PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<LangVersion>10</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
|
@ -11,10 +11,10 @@
|
|||
<PackageReference Include="MD.PersianDateTime.Standard" Version="2.5.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.3.1" />
|
||||
</ItemGroup>-->
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.5.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<!--<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<LangVersion>10</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
|
@ -25,7 +25,7 @@
|
|||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.0.3" />
|
||||
</ItemGroup>
|
||||
</ItemGroup>-->
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="MD.PersianDateTime.Standard" />
|
||||
|
|
|
@ -97,6 +97,13 @@ public static class ApplicationClaims
|
|||
Title = "مشاهده فعالیت ها",
|
||||
Detail = "دسترسی به مشاهده فعالیت ها فروشگاه شما"
|
||||
};
|
||||
public static ClaimDto ViewMineActivities { get; } = new ClaimDto
|
||||
{
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewMineActivities,
|
||||
Title = "مشاهده فعالیت ها من",
|
||||
Detail = "دسترسی به مشاهده فعالیت ها فروشگاه شما"
|
||||
};
|
||||
|
||||
|
||||
public static ClaimDto ManageRoutines { get; } = new ClaimDto
|
||||
|
@ -217,6 +224,7 @@ public static class ApplicationClaims
|
|||
ManageComplexes,
|
||||
|
||||
ViewActivities,
|
||||
ViewMineActivities,
|
||||
|
||||
ManageRoutines,
|
||||
ViewRoutines,
|
||||
|
@ -257,6 +265,7 @@ public static class ApplicationClaims
|
|||
ManageActivities.GetClaim,
|
||||
ViewActivities.GetClaim,
|
||||
ChangeActivityStatus.GetClaim,
|
||||
ViewMineActivities.GetClaim,
|
||||
|
||||
ManageRoutines.GetClaim,
|
||||
ViewRoutines.GetClaim,
|
||||
|
@ -339,7 +348,7 @@ public static class ApplicationClaims
|
|||
{
|
||||
ManageActivities.GetClaim,
|
||||
ChangeActivityStatus.GetClaim,
|
||||
ViewActivities.GetClaim,
|
||||
ViewMineActivities.GetClaim,
|
||||
ManageReports.GetClaim,
|
||||
|
||||
ViewTasks.GetClaim,
|
||||
|
@ -351,13 +360,17 @@ public static class ApplicationClaims
|
|||
ViewShifts.GetClaim,
|
||||
ManageShifts.GetClaim,
|
||||
|
||||
ViewDashboard.GetClaim
|
||||
ViewDashboard.GetClaim,
|
||||
|
||||
ViewRoutines.GetClaim,
|
||||
ViewPositions.GetClaim,
|
||||
ViewUsers.GetClaim,
|
||||
};
|
||||
|
||||
public static List<Claim> StaffClaims = new List<Claim>
|
||||
{
|
||||
ChangeActivityStatus.GetClaim,
|
||||
ViewActivities.GetClaim,
|
||||
ViewMineActivities.GetClaim,
|
||||
|
||||
ViewTasks.GetClaim,
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ public static class ApplicationPermission
|
|||
public const string ManageActivities = nameof(ManageActivities);
|
||||
public const string ChangeActivityStatus = nameof(ChangeActivityStatus);
|
||||
public const string ViewActivities = nameof(ViewActivities);
|
||||
public const string ViewMineActivities = nameof(ViewActivities);
|
||||
|
||||
public const string ManageRoutines = nameof(ManageRoutines);
|
||||
public const string ViewRoutines = nameof(ViewRoutines);
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
namespace Brizco.Common.Models.Claims;
|
||||
|
||||
public static class ApplicationRoles
|
||||
{
|
||||
public const string Manager = nameof(Manager);
|
||||
public const string ViewerOwner = nameof(ViewerOwner);
|
||||
public const string SuperVisor = nameof(SuperVisor);
|
||||
public const string Staff = nameof(Staff);
|
||||
}
|
|
@ -10,9 +10,9 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="AspNetCoreRateLimit" Version="5.0.0" />
|
||||
<PackageReference Include="AspNetCoreRateLimit.Redis" Version="2.0.0" />
|
||||
<PackageReference Include="Autofac.Extras.Quartz" Version="9.0.0" />
|
||||
<PackageReference Include="Autofac.Extras.Quartz" Version="10.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
|
||||
<PackageReference Include="NPOI" Version="2.6.2" />
|
||||
<PackageReference Include="NPOI" Version="2.7.0" />
|
||||
<PackageReference Include="Quartz" Version="3.8.1" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -25,22 +25,32 @@ public class PageService : IPageService
|
|||
{
|
||||
if (_currentUserService.UserId == null)
|
||||
throw new AppException("User id is null ");
|
||||
if (Guid.TryParse(_currentUserService.UserId, out Guid userId)!)
|
||||
if (!Guid.TryParse(_currentUserService.UserId, out Guid userId))
|
||||
throw new AppException("User id is wrong");
|
||||
if (Guid.TryParse(_currentUserService.ComplexId, out Guid complexId)!)
|
||||
if (!Guid.TryParse(_currentUserService.ComplexId, out Guid complexId))
|
||||
throw new AppException("Complex id is wrong");
|
||||
|
||||
var todayTasks = await _repositoryWrapper.SetRepository<Activity>()
|
||||
.TableNoTracking
|
||||
.Where(a => a.UserId == userId)
|
||||
.ToListAsync(cancellationToken);
|
||||
var todayShiftPlans = await _repositoryWrapper.SetRepository<ShiftPlan>()
|
||||
.TableNoTracking
|
||||
.Where(a => a.PlanFor.Date == DateTime.Today.Date)
|
||||
.Select(ShiftPlanMapper.ProjectToSDto)
|
||||
.ToListAsync(cancellationToken);
|
||||
var names = new List<string>();
|
||||
names.AddRange(todayShiftPlans.SelectMany(sp => sp.Users).Select(s => s.UserFullName).ToList());
|
||||
var page = new AppDashboardPageDto
|
||||
{
|
||||
DoneActivitiesToday = todayTasks.Count(t => t.IsDone),
|
||||
TotalActivitiesToday = todayTasks.Count,
|
||||
UnDoneActivitiesToday = todayTasks.Count(t => t.IsDone!)
|
||||
UnDoneActivitiesToday = todayTasks.Count(t => t.IsDone!),
|
||||
TotalShiftToday = todayShiftPlans.Count,
|
||||
TodayStaffNames = names,
|
||||
TotalStaffToday = todayShiftPlans.SelectMany(sp => sp.Users).Count()
|
||||
};
|
||||
|
||||
|
||||
if (_currentUserService.Permissions != null)
|
||||
{
|
||||
int totalStepCount = 0;
|
||||
|
|
|
@ -24,10 +24,10 @@ public class ComplexService : IComplexService
|
|||
var managerRole = new ApplicationRole
|
||||
{
|
||||
ComplexId = complex.Id,
|
||||
EnglishName = "Manager",
|
||||
EnglishName = ApplicationRoles.Manager,
|
||||
PersianName = "مدیریت",
|
||||
Description = "مدیریت مجموعه",
|
||||
Name = $"Manager_{complex.Id.ToString()}"
|
||||
Name = $"{ApplicationRoles.Manager}_{complex.Id.ToString()}"
|
||||
};
|
||||
var createRoleResult = await _roleManager.CreateAsync(managerRole);
|
||||
if (!createRoleResult.Succeeded)
|
||||
|
@ -41,10 +41,10 @@ public class ComplexService : IComplexService
|
|||
var viewOwnerRole = new ApplicationRole
|
||||
{
|
||||
ComplexId = complex.Id,
|
||||
EnglishName = "ViewerOwner",
|
||||
EnglishName = ApplicationRoles.ViewerOwner,
|
||||
PersianName = "ناظر",
|
||||
Description = "ناظر مجموعه",
|
||||
Name = $"ViewerOwner_{complex.Id.ToString()}"
|
||||
Name = $"{ApplicationRoles.ViewerOwner}_{complex.Id.ToString()}"
|
||||
};
|
||||
var createViewerResult = await _roleManager.CreateAsync(viewOwnerRole);
|
||||
if (!createViewerResult.Succeeded)
|
||||
|
@ -56,10 +56,10 @@ public class ComplexService : IComplexService
|
|||
var superVisorRole = new ApplicationRole
|
||||
{
|
||||
ComplexId = complex.Id,
|
||||
EnglishName = "SuperVisor",
|
||||
EnglishName = ApplicationRoles.SuperVisor,
|
||||
PersianName = "سوپروایزر",
|
||||
Description = "انجام فعالیت مدیریت کارکنان و وظیفه ها",
|
||||
Name = $"SuperVisor_{complex.Id.ToString()}"
|
||||
Name = $"{ApplicationRoles.SuperVisor}_{complex.Id.ToString()}"
|
||||
};
|
||||
var superVisorRoleResult = await _roleManager.CreateAsync(superVisorRole);
|
||||
if (!superVisorRoleResult.Succeeded)
|
||||
|
@ -72,10 +72,10 @@ public class ComplexService : IComplexService
|
|||
var staffRole = new ApplicationRole
|
||||
{
|
||||
ComplexId = complex.Id,
|
||||
EnglishName = "Staff",
|
||||
EnglishName = ApplicationRoles.Staff,
|
||||
PersianName = "کارمند",
|
||||
Description = "انجام فعالیت ها و وظیفه ها",
|
||||
Name = $"Staff_{complex.Id.ToString()}"
|
||||
Name = $"{ApplicationRoles.Staff}_{complex.Id.ToString()}"
|
||||
};
|
||||
var staffRoleResult = await _roleManager.CreateAsync(staffRole);
|
||||
if (!staffRoleResult.Succeeded)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<!--<PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
@ -11,12 +11,12 @@
|
|||
<PackageReference Include="Mapster" Version="7.4.0" />
|
||||
<PackageReference Include="Mapster.Core" Version="1.2.1" />
|
||||
<PackageReference Include="MediatR" Version="12.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="8.0.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="8.0.4" />
|
||||
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" />
|
||||
</ItemGroup>-->
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<PropertyGroup>
|
||||
<!--<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<LangVersion>10</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
|
@ -32,7 +32,7 @@
|
|||
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.0" />
|
||||
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" />
|
||||
</ItemGroup>
|
||||
</ItemGroup>-->
|
||||
|
||||
|
||||
<Target Name="Mapster">
|
||||
|
|
|
@ -5,7 +5,9 @@ public class AppDashboardPageDto
|
|||
public int UnDoneActivitiesToday { get; set; }
|
||||
public int DoneActivitiesToday { get; set; }
|
||||
public int TotalActivitiesToday { get; set; }
|
||||
public int TotalShiftToday { get; set; }
|
||||
public int TotalStaffToday { get; set; }
|
||||
public List<string> TodayStaffNames { get; set; } = new();
|
||||
|
||||
public string CurrentSignUpStep { get; set; } = string.Empty;
|
||||
public int SignUpCompletePercent { get; set; }
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
using Brizco.Domain.Entities.Shift;
|
||||
|
||||
namespace Brizco.Domain.Dtos.SmallDtos;
|
||||
namespace Brizco.Domain.Dtos.SmallDtos;
|
||||
|
||||
public class ShiftPlanSDto : BaseDto<ShiftPlanSDto,ShiftPlan>
|
||||
{
|
||||
public DateTime PlanFor { get; internal set; }
|
||||
public bool IsCompleted { get; internal set; }
|
||||
public DateTime PlanFor { get; set; }
|
||||
public bool IsCompleted { get; set; }
|
||||
public int UndoneActivitiesCount { get; set; }
|
||||
public int DoneActivitiesCount { get; set; }
|
||||
public int TotalActivitiesCount { get; set; }
|
||||
public int StaffCount { get; set; }
|
||||
public int CompletePercent { get; internal set; }
|
||||
public string CompleteDescription { get; internal set; } = string.Empty;
|
||||
public int CompletePercent { get; set; }
|
||||
public string SupervisorFullName { get; set; } = string.Empty;
|
||||
public string CompleteDescription { get; set; } = string.Empty;
|
||||
public Guid ShiftId { get; set; }
|
||||
public string ShiftTitle { get; internal set; } = string.Empty;
|
||||
public string ShiftTitle { get; set; } = string.Empty;
|
||||
|
||||
public List<ShiftPlanUserSDto> Users { get; set; } = new();
|
||||
}
|
|
@ -23,6 +23,11 @@ namespace Brizco.Domain.Mappers
|
|||
CompletePercent = p1.CompletePercent,
|
||||
CompleteDescription = p1.CompleteDescription,
|
||||
ShiftId = p1.ShiftId,
|
||||
Shift = new Shift()
|
||||
{
|
||||
Title = p1.ShiftTitle,
|
||||
Id = p1.ShiftId
|
||||
},
|
||||
Users = funcMain1(p1.Users),
|
||||
Id = p1.Id
|
||||
};
|
||||
|
@ -40,184 +45,193 @@ namespace Brizco.Domain.Mappers
|
|||
result.CompletePercent = p3.CompletePercent;
|
||||
result.CompleteDescription = p3.CompleteDescription;
|
||||
result.ShiftId = p3.ShiftId;
|
||||
result.Users = funcMain2(p3.Users, result.Users);
|
||||
result.Shift = funcMain2(new Never(), result.Shift, p3);
|
||||
result.Users = funcMain3(p3.Users, result.Users);
|
||||
result.Id = p3.Id;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<ShiftPlanSDto, ShiftPlan>> ProjectToShiftPlan => p7 => new ShiftPlan()
|
||||
public static Expression<Func<ShiftPlanSDto, ShiftPlan>> ProjectToShiftPlan => p9 => new ShiftPlan()
|
||||
{
|
||||
PlanFor = p7.PlanFor,
|
||||
IsCompleted = p7.IsCompleted,
|
||||
CompletePercent = p7.CompletePercent,
|
||||
CompleteDescription = p7.CompleteDescription,
|
||||
ShiftId = p7.ShiftId,
|
||||
Users = p7.Users.Select<ShiftPlanUserSDto, ShiftPlanUser>(p8 => new ShiftPlanUser()
|
||||
PlanFor = p9.PlanFor,
|
||||
IsCompleted = p9.IsCompleted,
|
||||
CompletePercent = p9.CompletePercent,
|
||||
CompleteDescription = p9.CompleteDescription,
|
||||
ShiftId = p9.ShiftId,
|
||||
Shift = new Shift()
|
||||
{
|
||||
ShiftPlanId = p8.ShiftPlanId,
|
||||
ShiftPlan = new ShiftPlan() {Id = p8.ShiftPlanId},
|
||||
PositionId = p8.PositionId,
|
||||
Title = p9.ShiftTitle,
|
||||
Id = p9.ShiftId
|
||||
},
|
||||
Users = p9.Users.Select<ShiftPlanUserSDto, ShiftPlanUser>(p10 => new ShiftPlanUser()
|
||||
{
|
||||
ShiftPlanId = p10.ShiftPlanId,
|
||||
ShiftPlan = new ShiftPlan() {Id = p10.ShiftPlanId},
|
||||
PositionId = p10.PositionId,
|
||||
Position = new Position()
|
||||
{
|
||||
Name = p8.PositionName,
|
||||
Id = p8.PositionId
|
||||
Name = p10.PositionName,
|
||||
Id = p10.PositionId
|
||||
},
|
||||
UserId = p8.UserId,
|
||||
User = new ApplicationUser() {Id = p8.UserId},
|
||||
Id = p8.Id
|
||||
UserId = p10.UserId,
|
||||
User = new ApplicationUser() {Id = p10.UserId},
|
||||
Id = p10.Id
|
||||
}).ToList<ShiftPlanUser>(),
|
||||
Id = p7.Id
|
||||
Id = p9.Id
|
||||
};
|
||||
public static ShiftPlanSDto AdaptToSDto(this ShiftPlan p9)
|
||||
public static ShiftPlanSDto AdaptToSDto(this ShiftPlan p11)
|
||||
{
|
||||
return p9 == null ? null : new ShiftPlanSDto()
|
||||
return p11 == null ? null : new ShiftPlanSDto()
|
||||
{
|
||||
PlanFor = p9.PlanFor,
|
||||
IsCompleted = p9.IsCompleted,
|
||||
CompletePercent = p9.CompletePercent,
|
||||
CompleteDescription = p9.CompleteDescription,
|
||||
ShiftId = p9.ShiftId,
|
||||
ShiftTitle = p9.Shift == null ? null : p9.Shift.Title,
|
||||
Users = funcMain3(p9.Users),
|
||||
Id = p9.Id
|
||||
PlanFor = p11.PlanFor,
|
||||
IsCompleted = p11.IsCompleted,
|
||||
CompletePercent = p11.CompletePercent,
|
||||
SupervisorFullName = p11.Supervisor != null ? p11.Supervisor.FirstName + " " + p11.Supervisor.LastName : string.Empty,
|
||||
CompleteDescription = p11.CompleteDescription,
|
||||
ShiftId = p11.ShiftId,
|
||||
ShiftTitle = p11.Shift == null ? null : p11.Shift.Title,
|
||||
Users = funcMain4(p11.Users),
|
||||
Id = p11.Id
|
||||
};
|
||||
}
|
||||
public static ShiftPlanSDto AdaptTo(this ShiftPlan p11, ShiftPlanSDto p12)
|
||||
public static ShiftPlanSDto AdaptTo(this ShiftPlan p13, ShiftPlanSDto p14)
|
||||
{
|
||||
if (p11 == null)
|
||||
if (p13 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ShiftPlanSDto result = p12 ?? new ShiftPlanSDto();
|
||||
ShiftPlanSDto result = p14 ?? new ShiftPlanSDto();
|
||||
|
||||
result.PlanFor = p11.PlanFor;
|
||||
result.IsCompleted = p11.IsCompleted;
|
||||
result.CompletePercent = p11.CompletePercent;
|
||||
result.CompleteDescription = p11.CompleteDescription;
|
||||
result.ShiftId = p11.ShiftId;
|
||||
result.ShiftTitle = p11.Shift == null ? null : p11.Shift.Title;
|
||||
result.Users = funcMain4(p11.Users, result.Users);
|
||||
result.Id = p11.Id;
|
||||
result.PlanFor = p13.PlanFor;
|
||||
result.IsCompleted = p13.IsCompleted;
|
||||
result.CompletePercent = p13.CompletePercent;
|
||||
result.SupervisorFullName = p13.Supervisor != null ? p13.Supervisor.FirstName + " " + p13.Supervisor.LastName : string.Empty;
|
||||
result.CompleteDescription = p13.CompleteDescription;
|
||||
result.ShiftId = p13.ShiftId;
|
||||
result.ShiftTitle = p13.Shift == null ? null : p13.Shift.Title;
|
||||
result.Users = funcMain5(p13.Users, result.Users);
|
||||
result.Id = p13.Id;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<ShiftPlan, ShiftPlanSDto>> ProjectToSDto => p15 => new ShiftPlanSDto()
|
||||
public static Expression<Func<ShiftPlan, ShiftPlanSDto>> ProjectToSDto => p17 => new ShiftPlanSDto()
|
||||
{
|
||||
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 = p17.PlanFor,
|
||||
IsCompleted = p17.IsCompleted,
|
||||
CompletePercent = p17.CompletePercent,
|
||||
SupervisorFullName = p17.Supervisor != null ? p17.Supervisor.FirstName + " " + p17.Supervisor.LastName : string.Empty,
|
||||
CompleteDescription = p17.CompleteDescription,
|
||||
ShiftId = p17.ShiftId,
|
||||
ShiftTitle = p17.Shift.Title,
|
||||
Users = p17.Users.Select<ShiftPlanUser, ShiftPlanUserSDto>(p18 => new ShiftPlanUserSDto()
|
||||
{
|
||||
ShiftPlanId = p16.ShiftPlanId,
|
||||
UserId = p16.UserId,
|
||||
UserFullName = p16.User != null ? p16.User.FirstName + " " + p16.User.LastName : string.Empty,
|
||||
PositionId = p16.PositionId,
|
||||
PositionName = p16.Position != null ? p16.Position.Name : string.Empty,
|
||||
Id = p16.Id
|
||||
ShiftPlanId = p18.ShiftPlanId,
|
||||
UserId = p18.UserId,
|
||||
UserFullName = p18.User != null ? p18.User.FirstName + " " + p18.User.LastName : string.Empty,
|
||||
PositionId = p18.PositionId,
|
||||
PositionName = p18.Position != null ? p18.Position.Name : string.Empty,
|
||||
Id = p18.Id
|
||||
}).ToList<ShiftPlanUserSDto>(),
|
||||
Id = p15.Id
|
||||
Id = p17.Id
|
||||
};
|
||||
public static ShiftPlan AdaptToShiftPlan(this ShiftPlanLDto p17)
|
||||
public static ShiftPlan AdaptToShiftPlan(this ShiftPlanLDto p19)
|
||||
{
|
||||
return p17 == null ? null : new ShiftPlan()
|
||||
return p19 == 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
|
||||
PlanFor = p19.PlanFor,
|
||||
IsCompleted = p19.IsCompleted,
|
||||
CompletePercent = p19.CompletePercent,
|
||||
CompleteDescription = p19.CompleteDescription,
|
||||
ShiftId = p19.ShiftId,
|
||||
Shift = new Shift() {Id = p19.ShiftId},
|
||||
RoutineId = p19.RoutineId,
|
||||
Routine = new Routine() {Id = p19.RoutineId},
|
||||
SupervisorId = p19.SupervisorId,
|
||||
Supervisor = new ApplicationUser() {Id = p19.SupervisorId},
|
||||
Users = funcMain6(p19.Users),
|
||||
Id = p19.Id
|
||||
};
|
||||
}
|
||||
public static ShiftPlan AdaptTo(this ShiftPlanLDto p19, ShiftPlan p20)
|
||||
public static ShiftPlan AdaptTo(this ShiftPlanLDto p21, ShiftPlan p22)
|
||||
{
|
||||
if (p19 == null)
|
||||
if (p21 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ShiftPlan result = p20 ?? new ShiftPlan();
|
||||
ShiftPlan result = p22 ?? new ShiftPlan();
|
||||
|
||||
result.PlanFor = p19.PlanFor;
|
||||
result.IsCompleted = p19.IsCompleted;
|
||||
result.CompletePercent = p19.CompletePercent;
|
||||
result.CompleteDescription = p19.CompleteDescription;
|
||||
result.ShiftId = p19.ShiftId;
|
||||
result.Shift = funcMain6(new Never(), result.Shift, p19);
|
||||
result.RoutineId = p19.RoutineId;
|
||||
result.Routine = funcMain7(new Never(), result.Routine, p19);
|
||||
result.SupervisorId = p19.SupervisorId;
|
||||
result.Supervisor = funcMain8(new Never(), result.Supervisor, p19);
|
||||
result.Users = funcMain9(p19.Users, result.Users);
|
||||
result.Id = p19.Id;
|
||||
result.PlanFor = p21.PlanFor;
|
||||
result.IsCompleted = p21.IsCompleted;
|
||||
result.CompletePercent = p21.CompletePercent;
|
||||
result.CompleteDescription = p21.CompleteDescription;
|
||||
result.ShiftId = p21.ShiftId;
|
||||
result.Shift = funcMain7(new Never(), result.Shift, p21);
|
||||
result.RoutineId = p21.RoutineId;
|
||||
result.Routine = funcMain8(new Never(), result.Routine, p21);
|
||||
result.SupervisorId = p21.SupervisorId;
|
||||
result.Supervisor = funcMain9(new Never(), result.Supervisor, p21);
|
||||
result.Users = funcMain10(p21.Users, result.Users);
|
||||
result.Id = p21.Id;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static ShiftPlanLDto AdaptToLDto(this ShiftPlan p29)
|
||||
public static ShiftPlanLDto AdaptToLDto(this ShiftPlan p31)
|
||||
{
|
||||
return p29 == null ? null : new ShiftPlanLDto()
|
||||
return p31 == null ? null : new ShiftPlanLDto()
|
||||
{
|
||||
PlanFor = p29.PlanFor,
|
||||
RoutineId = p29.RoutineId,
|
||||
IsCompleted = p29.IsCompleted,
|
||||
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
|
||||
PlanFor = p31.PlanFor,
|
||||
RoutineId = p31.RoutineId,
|
||||
IsCompleted = p31.IsCompleted,
|
||||
CompletePercent = p31.CompletePercent,
|
||||
CompleteDescription = p31.CompleteDescription,
|
||||
ShiftId = p31.ShiftId,
|
||||
Users = funcMain11(p31.Users),
|
||||
SupervisorId = p31.SupervisorId,
|
||||
SupervisorFullName = p31.Supervisor != null ? p31.Supervisor.FirstName + " " + p31.Supervisor.LastName : string.Empty,
|
||||
Id = p31.Id
|
||||
};
|
||||
}
|
||||
public static ShiftPlanLDto AdaptTo(this ShiftPlan p31, ShiftPlanLDto p32)
|
||||
public static ShiftPlanLDto AdaptTo(this ShiftPlan p33, ShiftPlanLDto p34)
|
||||
{
|
||||
if (p31 == null)
|
||||
if (p33 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ShiftPlanLDto result = p32 ?? new ShiftPlanLDto();
|
||||
ShiftPlanLDto result = p34 ?? 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;
|
||||
result.PlanFor = p33.PlanFor;
|
||||
result.RoutineId = p33.RoutineId;
|
||||
result.IsCompleted = p33.IsCompleted;
|
||||
result.CompletePercent = p33.CompletePercent;
|
||||
result.CompleteDescription = p33.CompleteDescription;
|
||||
result.ShiftId = p33.ShiftId;
|
||||
result.Users = funcMain12(p33.Users, result.Users);
|
||||
result.SupervisorId = p33.SupervisorId;
|
||||
result.SupervisorFullName = p33.Supervisor != null ? p33.Supervisor.FirstName + " " + p33.Supervisor.LastName : string.Empty;
|
||||
result.Id = p33.Id;
|
||||
return result;
|
||||
|
||||
}
|
||||
public static Expression<Func<ShiftPlan, ShiftPlanLDto>> ProjectToLDto => p35 => new ShiftPlanLDto()
|
||||
public static Expression<Func<ShiftPlan, ShiftPlanLDto>> ProjectToLDto => p37 => 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()
|
||||
PlanFor = p37.PlanFor,
|
||||
RoutineId = p37.RoutineId,
|
||||
IsCompleted = p37.IsCompleted,
|
||||
CompletePercent = p37.CompletePercent,
|
||||
CompleteDescription = p37.CompleteDescription,
|
||||
ShiftId = p37.ShiftId,
|
||||
Users = p37.Users.Select<ShiftPlanUser, ShiftPlanUserSDto>(p38 => 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
|
||||
ShiftPlanId = p38.ShiftPlanId,
|
||||
UserId = p38.UserId,
|
||||
UserFullName = p38.User != null ? p38.User.FirstName + " " + p38.User.LastName : string.Empty,
|
||||
PositionId = p38.PositionId,
|
||||
PositionName = p38.Position != null ? p38.Position.Name : string.Empty,
|
||||
Id = p38.Id
|
||||
}).ToList<ShiftPlanUserSDto>(),
|
||||
SupervisorId = p35.SupervisorId,
|
||||
SupervisorFullName = p35.Supervisor != null ? p35.Supervisor.FirstName + " " + p35.Supervisor.LastName : string.Empty,
|
||||
Id = p35.Id
|
||||
SupervisorId = p37.SupervisorId,
|
||||
SupervisorFullName = p37.Supervisor != null ? p37.Supervisor.FirstName + " " + p37.Supervisor.LastName : string.Empty,
|
||||
Id = p37.Id
|
||||
};
|
||||
|
||||
private static List<ShiftPlanUser> funcMain1(List<ShiftPlanUserSDto> p2)
|
||||
|
@ -254,20 +268,30 @@ namespace Brizco.Domain.Mappers
|
|||
|
||||
}
|
||||
|
||||
private static List<ShiftPlanUser> funcMain2(List<ShiftPlanUserSDto> p5, List<ShiftPlanUser> p6)
|
||||
private static Shift funcMain2(Never p5, Shift p6, ShiftPlanSDto p3)
|
||||
{
|
||||
if (p5 == null)
|
||||
Shift result = p6 ?? new Shift();
|
||||
|
||||
result.Title = p3.ShiftTitle;
|
||||
result.Id = p3.ShiftId;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static List<ShiftPlanUser> funcMain3(List<ShiftPlanUserSDto> p7, List<ShiftPlanUser> p8)
|
||||
{
|
||||
if (p7 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<ShiftPlanUser> result = new List<ShiftPlanUser>(p5.Count);
|
||||
List<ShiftPlanUser> result = new List<ShiftPlanUser>(p7.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p5.Count;
|
||||
int len = p7.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
ShiftPlanUserSDto item = p5[i];
|
||||
ShiftPlanUserSDto item = p7[i];
|
||||
result.Add(item == null ? null : new ShiftPlanUser()
|
||||
{
|
||||
ShiftPlanId = item.ShiftPlanId,
|
||||
|
@ -288,20 +312,20 @@ namespace Brizco.Domain.Mappers
|
|||
|
||||
}
|
||||
|
||||
private static List<ShiftPlanUserSDto> funcMain3(List<ShiftPlanUser> p10)
|
||||
private static List<ShiftPlanUserSDto> funcMain4(List<ShiftPlanUser> p12)
|
||||
{
|
||||
if (p10 == null)
|
||||
if (p12 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p10.Count);
|
||||
List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p12.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p10.Count;
|
||||
int len = p12.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
ShiftPlanUser item = p10[i];
|
||||
ShiftPlanUser item = p12[i];
|
||||
result.Add(item == null ? null : new ShiftPlanUserSDto()
|
||||
{
|
||||
ShiftPlanId = item.ShiftPlanId,
|
||||
|
@ -317,20 +341,20 @@ namespace Brizco.Domain.Mappers
|
|||
|
||||
}
|
||||
|
||||
private static List<ShiftPlanUserSDto> funcMain4(List<ShiftPlanUser> p13, List<ShiftPlanUserSDto> p14)
|
||||
private static List<ShiftPlanUserSDto> funcMain5(List<ShiftPlanUser> p15, List<ShiftPlanUserSDto> p16)
|
||||
{
|
||||
if (p13 == null)
|
||||
if (p15 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p13.Count);
|
||||
List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p15.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p13.Count;
|
||||
int len = p15.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
ShiftPlanUser item = p13[i];
|
||||
ShiftPlanUser item = p15[i];
|
||||
result.Add(item == null ? null : new ShiftPlanUserSDto()
|
||||
{
|
||||
ShiftPlanId = item.ShiftPlanId,
|
||||
|
@ -346,20 +370,20 @@ namespace Brizco.Domain.Mappers
|
|||
|
||||
}
|
||||
|
||||
private static List<ShiftPlanUser> funcMain5(List<ShiftPlanUserSDto> p18)
|
||||
private static List<ShiftPlanUser> funcMain6(List<ShiftPlanUserSDto> p20)
|
||||
{
|
||||
if (p18 == null)
|
||||
if (p20 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<ShiftPlanUser> result = new List<ShiftPlanUser>(p18.Count);
|
||||
List<ShiftPlanUser> result = new List<ShiftPlanUser>(p20.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p18.Count;
|
||||
int len = p20.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
ShiftPlanUserSDto item = p18[i];
|
||||
ShiftPlanUserSDto item = p20[i];
|
||||
result.Add(item == null ? null : new ShiftPlanUser()
|
||||
{
|
||||
ShiftPlanId = item.ShiftPlanId,
|
||||
|
@ -380,47 +404,47 @@ namespace Brizco.Domain.Mappers
|
|||
|
||||
}
|
||||
|
||||
private static Shift funcMain6(Never p21, Shift p22, ShiftPlanLDto p19)
|
||||
private static Shift funcMain7(Never p23, Shift p24, ShiftPlanLDto p21)
|
||||
{
|
||||
Shift result = p22 ?? new Shift();
|
||||
Shift result = p24 ?? new Shift();
|
||||
|
||||
result.Id = p19.ShiftId;
|
||||
result.Id = p21.ShiftId;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static Routine funcMain7(Never p23, Routine p24, ShiftPlanLDto p19)
|
||||
private static Routine funcMain8(Never p25, Routine p26, ShiftPlanLDto p21)
|
||||
{
|
||||
Routine result = p24 ?? new Routine();
|
||||
Routine result = p26 ?? new Routine();
|
||||
|
||||
result.Id = p19.RoutineId;
|
||||
result.Id = p21.RoutineId;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static ApplicationUser funcMain8(Never p25, ApplicationUser p26, ShiftPlanLDto p19)
|
||||
private static ApplicationUser funcMain9(Never p27, ApplicationUser p28, ShiftPlanLDto p21)
|
||||
{
|
||||
ApplicationUser result = p26 ?? new ApplicationUser();
|
||||
ApplicationUser result = p28 ?? new ApplicationUser();
|
||||
|
||||
result.Id = p19.SupervisorId;
|
||||
result.Id = p21.SupervisorId;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static List<ShiftPlanUser> funcMain9(List<ShiftPlanUserSDto> p27, List<ShiftPlanUser> p28)
|
||||
private static List<ShiftPlanUser> funcMain10(List<ShiftPlanUserSDto> p29, List<ShiftPlanUser> p30)
|
||||
{
|
||||
if (p27 == null)
|
||||
if (p29 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<ShiftPlanUser> result = new List<ShiftPlanUser>(p27.Count);
|
||||
List<ShiftPlanUser> result = new List<ShiftPlanUser>(p29.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p27.Count;
|
||||
int len = p29.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
ShiftPlanUserSDto item = p27[i];
|
||||
ShiftPlanUserSDto item = p29[i];
|
||||
result.Add(item == null ? null : new ShiftPlanUser()
|
||||
{
|
||||
ShiftPlanId = item.ShiftPlanId,
|
||||
|
@ -441,20 +465,20 @@ namespace Brizco.Domain.Mappers
|
|||
|
||||
}
|
||||
|
||||
private static List<ShiftPlanUserSDto> funcMain10(List<ShiftPlanUser> p30)
|
||||
private static List<ShiftPlanUserSDto> funcMain11(List<ShiftPlanUser> p32)
|
||||
{
|
||||
if (p30 == null)
|
||||
if (p32 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p30.Count);
|
||||
List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p32.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p30.Count;
|
||||
int len = p32.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
ShiftPlanUser item = p30[i];
|
||||
ShiftPlanUser item = p32[i];
|
||||
result.Add(item == null ? null : new ShiftPlanUserSDto()
|
||||
{
|
||||
ShiftPlanId = item.ShiftPlanId,
|
||||
|
@ -470,20 +494,20 @@ namespace Brizco.Domain.Mappers
|
|||
|
||||
}
|
||||
|
||||
private static List<ShiftPlanUserSDto> funcMain11(List<ShiftPlanUser> p33, List<ShiftPlanUserSDto> p34)
|
||||
private static List<ShiftPlanUserSDto> funcMain12(List<ShiftPlanUser> p35, List<ShiftPlanUserSDto> p36)
|
||||
{
|
||||
if (p33 == null)
|
||||
if (p35 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p33.Count);
|
||||
List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p35.Count);
|
||||
|
||||
int i = 0;
|
||||
int len = p33.Count;
|
||||
int len = p35.Count;
|
||||
|
||||
while (i < len)
|
||||
{
|
||||
ShiftPlanUser item = p33[i];
|
||||
ShiftPlanUser item = p35[i];
|
||||
result.Add(item == null ? null : new ShiftPlanUserSDto()
|
||||
{
|
||||
ShiftPlanId = item.ShiftPlanId,
|
||||
|
|
|
@ -44,6 +44,10 @@ public class MapsterRegister : IRegister
|
|||
.Map("SupervisorFullName", o => o.Supervisor != null ? o.Supervisor.FirstName + " " + o.Supervisor.LastName : string.Empty)
|
||||
.TwoWays();
|
||||
|
||||
config.NewConfig<ShiftPlan, ShiftPlanSDto>()
|
||||
.Map("SupervisorFullName", o => o.Supervisor != null ? o.Supervisor.FirstName + " " + o.Supervisor.LastName : string.Empty)
|
||||
.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)
|
||||
|
|
|
@ -8,21 +8,21 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MediatR" Version="12.2.0" />
|
||||
<PackageReference Include="FluentValidation" Version="11.9.0" />
|
||||
<PackageReference Include="FluentValidation" Version="11.9.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.2">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.2">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Pluralize.NET" Version="1.0.2" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.2" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.7.17" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.4" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.7.33" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.Core" Version="10.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -25,6 +25,11 @@ public class GetActivitiesQueryHandler : IRequestHandler<GetActivitiesQuery, Lis
|
|||
|
||||
IQueryable<Domain.Entities.Task.Activity> activities = _repositoryWrapper.SetRepository<Domain.Entities.Task.Activity>().TableNoTracking
|
||||
.Where(a=>a.IsActivity);
|
||||
if (_currentUserService.Permissions != null)
|
||||
{
|
||||
if (_currentUserService.Permissions.Contains(ApplicationPermission.ViewMineActivities))
|
||||
activities = activities.Where(a => a.UserId == userId);
|
||||
}
|
||||
|
||||
if (request.DateQueryFilter != null)
|
||||
{
|
||||
|
@ -53,9 +58,6 @@ public class GetActivitiesQueryHandler : IRequestHandler<GetActivitiesQuery, Lis
|
|||
if (request.SelectedShift != default)
|
||||
activities = activities.Where(a => a.ComplexId == complexId && a.ShiftId == request.SelectedShift);
|
||||
|
||||
if (request.SelectedDate == 0 && request.SelectedShift == default)
|
||||
activities = activities.Where(a => a.UserId == userId);
|
||||
|
||||
|
||||
|
||||
return await activities.OrderBy(s => s.ScheduleType)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using Brizco.Domain.Entities.Shift;
|
||||
using Guid = System.Guid;
|
||||
|
||||
namespace Brizco.Repository.Handlers.Shift;
|
||||
|
||||
|
@ -18,15 +19,15 @@ public class GetShiftPlansQueryHandler : IRequestHandler<GetShiftsQuery, List<Sh
|
|||
throw new AppException("ComplexId is null", ApiResultStatusCode.NotFound);
|
||||
if (!Guid.TryParse(_currentUserService.ComplexId, out Guid complexId))
|
||||
throw new AppException("ComplexId is wrong", ApiResultStatusCode.NotFound);
|
||||
List<ShiftSDto> shifts = new List<ShiftSDto>();
|
||||
List<ShiftSDto> shifts;
|
||||
if (request.SelectedDate > 0)
|
||||
{
|
||||
var selectedDate = DateTimeExtensions.UnixTimeStampToDateTime(request.SelectedDate);
|
||||
|
||||
var originalShifts = from shiftDay in _repositoryWrapper.SetRepository<ShiftDay>().Entities
|
||||
join shift in _repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>().Entities on shiftDay .ShiftId equals shift.Id
|
||||
where shiftDay.DayOfWeek == selectedDate.DayOfWeek && shift.ComplexId == complexId
|
||||
select shift;
|
||||
join shift in _repositoryWrapper.SetRepository<Domain.Entities.Shift.Shift>().Entities on shiftDay.ShiftId equals shift.Id
|
||||
where shiftDay.DayOfWeek == selectedDate.DayOfWeek && shift.ComplexId == complexId
|
||||
select shift;
|
||||
|
||||
shifts = await originalShifts.AsNoTracking().Select(ShiftMapper.ProjectToSDto).ToListAsync(cancellationToken);
|
||||
foreach (var shift in shifts)
|
||||
|
@ -44,12 +45,33 @@ public class GetShiftPlansQueryHandler : IRequestHandler<GetShiftsQuery, List<Sh
|
|||
shift.DoneActivitiesCount = doneActivitiesCount;
|
||||
shift.TotalActivitiesCount = activitiesCount;
|
||||
|
||||
var existedShiftPlan = await _repositoryWrapper.SetRepository<Domain.Entities.Shift.ShiftPlan>()
|
||||
.TableNoTracking
|
||||
.FirstOrDefaultAsync(s => s.ShiftId == shift.Id && s.PlanFor.Date == selectedDate.Date, cancellationToken);
|
||||
shift.IsCompleted = existedShiftPlan?.IsCompleted ?? false;
|
||||
shift.CurrentShiftPlanId = existedShiftPlan?.Id ?? default;
|
||||
shift.HasCurrentShiftPlan = existedShiftPlan != null;
|
||||
switch (_currentUserService.RoleName)
|
||||
{
|
||||
case null:
|
||||
continue;
|
||||
case ApplicationRoles.SuperVisor:
|
||||
{
|
||||
if (!Guid.TryParse(_currentUserService.UserId, out Guid userId))
|
||||
throw new AppException("User id is wrong");
|
||||
var existedShiftPlan = await _repositoryWrapper.SetRepository<Domain.Entities.Shift.ShiftPlan>()
|
||||
.TableNoTracking
|
||||
.FirstOrDefaultAsync(s => s.ShiftId == shift.Id && s.PlanFor.Date == selectedDate.Date && s.SupervisorId == userId, cancellationToken);
|
||||
shift.IsCompleted = existedShiftPlan?.IsCompleted ?? false;
|
||||
shift.CurrentShiftPlanId = existedShiftPlan?.Id ?? default;
|
||||
shift.HasCurrentShiftPlan = existedShiftPlan != null;
|
||||
break;
|
||||
}
|
||||
case ApplicationRoles.Manager:
|
||||
{
|
||||
var existedShiftPlan = await _repositoryWrapper.SetRepository<Domain.Entities.Shift.ShiftPlan>()
|
||||
.TableNoTracking
|
||||
.FirstOrDefaultAsync(s => s.ShiftId == shift.Id && s.PlanFor.Date == selectedDate.Date, cancellationToken);
|
||||
shift.IsCompleted = existedShiftPlan?.IsCompleted ?? false;
|
||||
shift.CurrentShiftPlanId = existedShiftPlan?.Id ?? default;
|
||||
shift.HasCurrentShiftPlan = existedShiftPlan != null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -61,18 +83,20 @@ public class GetShiftPlansQueryHandler : IRequestHandler<GetShiftsQuery, List<Sh
|
|||
.Skip(request.Page * 15).Take(15)
|
||||
.Select(ShiftMapper.ProjectToSDto)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
foreach (var shift in shifts)
|
||||
{
|
||||
var shiftDays = new List<DayOfWeek>();
|
||||
shift.Days.OrderBy(d=>d).ToList().ForEach(d =>
|
||||
shift.Days.OrderBy(d => d).ToList().ForEach(d =>
|
||||
{
|
||||
if(d==DayOfWeek.Saturday)
|
||||
shiftDays.Insert(0,d);
|
||||
else{
|
||||
shiftDays.Add(d);}
|
||||
if (d == DayOfWeek.Saturday)
|
||||
shiftDays.Insert(0, d);
|
||||
else
|
||||
{
|
||||
shiftDays.Add(d);
|
||||
}
|
||||
|
||||
});
|
||||
shift.Days = shiftDays;
|
||||
|
|
|
@ -14,6 +14,7 @@ public static class RepositoryConfig
|
|||
{
|
||||
identityDbInitialize.Initialize();
|
||||
await identityDbInitialize.SeedDate();
|
||||
await identityDbInitialize.Refactor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,4 +8,5 @@ public interface IDbInitializerService : IScopedDependency
|
|||
void Initialize();
|
||||
Task SeedDate(bool force = false);
|
||||
Task SeedRoles();
|
||||
Task Refactor();
|
||||
}
|
|
@ -89,54 +89,44 @@ public class DbInitializerService : IDbInitializerService
|
|||
foreach (var claim in ApplicationClaims.AllClaims)
|
||||
await _roleManager.AddClaimAsync(managerRole, claim);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task Refactor()
|
||||
{
|
||||
//var roles = await _roleManager.Roles.ToListAsync();
|
||||
//foreach (var role in roles)
|
||||
//{
|
||||
// if (role.EnglishName == "Manager")
|
||||
// if (role.EnglishName == ApplicationRoles.Manager)
|
||||
// {
|
||||
// var claims = await _roleManager.GetClaimsAsync(role);
|
||||
|
||||
// foreach (var claim in claims)
|
||||
// await _roleManager.RemoveClaimAsync(role,claim);
|
||||
// foreach (var claim in ApplicationClaims.ManagerClaims)
|
||||
// {
|
||||
// if(!claims.Contains(claim))
|
||||
// await _roleManager.AddClaimAsync(role, claim);
|
||||
// }
|
||||
// }
|
||||
// else if (role.EnglishName == "ViewerOwner")
|
||||
// if (role.EnglishName == ApplicationRoles.ViewerOwner)
|
||||
// {
|
||||
|
||||
// var claims = await _roleManager.GetClaimsAsync(role);
|
||||
|
||||
// foreach (var claim in claims)
|
||||
// await _roleManager.RemoveClaimAsync(role, claim);
|
||||
// foreach (var claim in ApplicationClaims.ViewerOwnerClaims)
|
||||
// {
|
||||
// if (!claims.Contains(claim))
|
||||
// await _roleManager.AddClaimAsync(role, claim);
|
||||
// }
|
||||
// await _roleManager.AddClaimAsync(role, claim);
|
||||
// }
|
||||
// else if (role.EnglishName == "SuperVisor")
|
||||
// if (role.EnglishName == ApplicationRoles.SuperVisor)
|
||||
// {
|
||||
|
||||
|
||||
// var claims = await _roleManager.GetClaimsAsync(role);
|
||||
|
||||
// foreach (var claim in claims)
|
||||
// await _roleManager.RemoveClaimAsync(role, claim);
|
||||
// foreach (var claim in ApplicationClaims.SuperVisorClaims)
|
||||
// {
|
||||
// if (!claims.Contains(claim))
|
||||
// await _roleManager.AddClaimAsync(role, claim);
|
||||
// }
|
||||
// await _roleManager.AddClaimAsync(role, claim);
|
||||
// }
|
||||
// else if (role.EnglishName == "Staff")
|
||||
// if (role.EnglishName == ApplicationRoles.Staff)
|
||||
// {
|
||||
|
||||
|
||||
// var claims = await _roleManager.GetClaimsAsync(role);
|
||||
|
||||
// foreach (var claim in claims)
|
||||
// await _roleManager.RemoveClaimAsync(role, claim);
|
||||
// foreach (var claim in ApplicationClaims.StaffClaims)
|
||||
// {
|
||||
// if (!claims.Contains(claim))
|
||||
// await _roleManager.AddClaimAsync(role, claim);
|
||||
// }
|
||||
// await _roleManager.AddClaimAsync(role, claim);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue