Api/Brizco.Domain/Mappers/ShiftPlanMapper.g.cs

328 lines
11 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Brizco.Domain.Dtos.LargDtos;
using Brizco.Domain.Dtos.SmallDtos;
using Brizco.Domain.Entities.Routine;
using Brizco.Domain.Entities.Shift;
using Brizco.Domain.Entities.User;
using Mapster.Models;
namespace Brizco.Domain.Mappers
{
public static partial class ShiftPlanMapper
{
public static ShiftPlan AdaptToShiftPlan(this ShiftPlanSDto p1)
{
return p1 == null ? null : new ShiftPlan()
{
PlanFor = p1.PlanFor,
IsCompleted = p1.IsCompleted,
CompletePercent = p1.CompletePercent,
CompleteDescription = p1.CompleteDescription,
ShiftId = p1.ShiftId,
Id = p1.Id
};
}
public static ShiftPlan AdaptTo(this ShiftPlanSDto p2, ShiftPlan p3)
{
if (p2 == null)
{
return null;
}
ShiftPlan result = p3 ?? new ShiftPlan();
result.PlanFor = p2.PlanFor;
result.IsCompleted = p2.IsCompleted;
result.CompletePercent = p2.CompletePercent;
result.CompleteDescription = p2.CompleteDescription;
result.ShiftId = p2.ShiftId;
result.Id = p2.Id;
return result;
}
public static Expression<Func<ShiftPlanSDto, ShiftPlan>> ProjectToShiftPlan => p4 => new ShiftPlan()
{
PlanFor = p4.PlanFor,
IsCompleted = p4.IsCompleted,
CompletePercent = p4.CompletePercent,
CompleteDescription = p4.CompleteDescription,
ShiftId = p4.ShiftId,
Id = p4.Id
};
public static ShiftPlanSDto AdaptToSDto(this ShiftPlan p5)
{
return p5 == null ? null : new ShiftPlanSDto()
{
PlanFor = p5.PlanFor,
IsCompleted = p5.IsCompleted,
CompletePercent = p5.CompletePercent,
CompleteDescription = p5.CompleteDescription,
ShiftId = p5.ShiftId,
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
};
public static ShiftPlan AdaptToShiftPlan(this ShiftPlanLDto p9)
{
return p9 == null ? null : new ShiftPlan()
{
PlanFor = p9.PlanFor,
IsCompleted = p9.IsCompleted,
CompletePercent = p9.CompletePercent,
CompleteDescription = p9.CompleteDescription,
ShiftId = p9.ShiftId,
Shift = new Shift() {Id = p9.ShiftId},
RoutineId = p9.RoutineId,
Routine = new Routine() {Id = p9.RoutineId},
SupervisorId = p9.SupervisorId,
Supervisor = new ApplicationUser() {Id = p9.SupervisorId},
Users = funcMain1(p9.Users),
Id = p9.Id
};
}
public static ShiftPlan AdaptTo(this ShiftPlanLDto p11, ShiftPlan p12)
{
if (p11 == null)
{
return null;
}
ShiftPlan result = p12 ?? new ShiftPlan();
result.PlanFor = p11.PlanFor;
result.IsCompleted = p11.IsCompleted;
result.CompletePercent = p11.CompletePercent;
result.CompleteDescription = p11.CompleteDescription;
result.ShiftId = p11.ShiftId;
result.Shift = funcMain2(new Never(), result.Shift, p11);
result.RoutineId = p11.RoutineId;
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;
return result;
}
public static ShiftPlanLDto AdaptToLDto(this ShiftPlan p21)
{
return p21 == null ? null : new ShiftPlanLDto()
{
PlanFor = p21.PlanFor,
RoutineId = p21.RoutineId,
IsCompleted = p21.IsCompleted,
CompletePercent = p21.CompletePercent,
CompleteDescription = p21.CompleteDescription,
ShiftId = p21.ShiftId,
Users = funcMain6(p21.Users),
SupervisorId = p21.SupervisorId,
SupervisorFullName = p21.Supervisor != null ? p21.Supervisor.FirstName + " " + p21.Supervisor.LastName : string.Empty,
Id = p21.Id
};
}
public static ShiftPlanLDto AdaptTo(this ShiftPlan p23, ShiftPlanLDto p24)
{
if (p23 == null)
{
return null;
}
ShiftPlanLDto result = p24 ?? new ShiftPlanLDto();
result.PlanFor = p23.PlanFor;
result.RoutineId = p23.RoutineId;
result.IsCompleted = p23.IsCompleted;
result.CompletePercent = p23.CompletePercent;
result.CompleteDescription = p23.CompleteDescription;
result.ShiftId = p23.ShiftId;
result.Users = funcMain7(p23.Users, result.Users);
result.SupervisorId = p23.SupervisorId;
result.SupervisorFullName = p23.Supervisor != null ? p23.Supervisor.FirstName + " " + p23.Supervisor.LastName : string.Empty;
result.Id = p23.Id;
return result;
}
public static Expression<Func<ShiftPlan, ShiftPlanLDto>> ProjectToLDto => p27 => new ShiftPlanLDto()
{
PlanFor = p27.PlanFor,
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,
UserId = p28.UserId,
PositionId = p28.PositionId,
Id = p28.Id
}).ToList<ShiftPlanUserSDto>(),
SupervisorId = p27.SupervisorId,
SupervisorFullName = p27.Supervisor != null ? p27.Supervisor.FirstName + " " + p27.Supervisor.LastName : string.Empty,
Id = p27.Id
};
private static List<ShiftPlanUser> funcMain1(List<ShiftPlanUserSDto> p10)
{
if (p10 == null)
{
return null;
}
List<ShiftPlanUser> result = new List<ShiftPlanUser>(p10.Count);
int i = 0;
int len = p10.Count;
while (i < len)
{
ShiftPlanUserSDto 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()
{
ShiftPlanId = item.ShiftPlanId,
UserId = item.UserId,
PositionId = item.PositionId,
Id = item.Id
});
i++;
}
return result;
}
private static List<ShiftPlanUserSDto> funcMain7(List<ShiftPlanUser> p25, List<ShiftPlanUserSDto> p26)
{
if (p25 == null)
{
return null;
}
List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p25.Count);
int i = 0;
int len = p25.Count;
while (i < len)
{
ShiftPlanUser item = p25[i];
result.Add(item == null ? null : new ShiftPlanUserSDto()
{
ShiftPlanId = item.ShiftPlanId,
UserId = item.UserId,
PositionId = item.PositionId,
Id = item.Id
});
i++;
}
return result;
}
}
}