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

569 lines
21 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Brizco.Domain.Dtos.LargeDtos;
using Brizco.Domain.Dtos.SmallDtos;
using Brizco.Domain.Entities.Complexes;
using Brizco.Domain.Entities.Routines;
using Brizco.Domain.Entities.ShiftPlans;
using Brizco.Domain.Entities.Shifts;
using Brizco.Domain.Entities.Users;
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,
Shift = new Shift()
{
Title = p1.ShiftTitle,
Id = p1.ShiftId
},
ComplexId = p1.ComplexId,
Complex = new Complex() {Id = p1.ComplexId},
SupervisorId = p1.SupervisorId,
Supervisor = new ApplicationUser() {Id = p1.SupervisorId},
Users = funcMain1(p1.Users),
Id = p1.Id
};
}
public static ShiftPlan AdaptTo(this ShiftPlanSDto p3, ShiftPlan p4)
{
if (p3 == null)
{
return null;
}
ShiftPlan result = p4 ?? new ShiftPlan();
result.PlanFor = p3.PlanFor;
result.IsCompleted = p3.IsCompleted;
result.CompletePercent = p3.CompletePercent;
result.CompleteDescription = p3.CompleteDescription;
result.ShiftId = p3.ShiftId;
result.Shift = funcMain2(new Never(), result.Shift, p3);
result.ComplexId = p3.ComplexId;
result.Complex = funcMain3(new Never(), result.Complex, p3);
result.SupervisorId = p3.SupervisorId;
result.Supervisor = funcMain4(new Never(), result.Supervisor, p3);
result.Users = funcMain5(p3.Users, result.Users);
result.Id = p3.Id;
return result;
}
public static Expression<Func<ShiftPlanSDto, ShiftPlan>> ProjectToShiftPlan => p13 => new ShiftPlan()
{
PlanFor = p13.PlanFor,
IsCompleted = p13.IsCompleted,
CompletePercent = p13.CompletePercent,
CompleteDescription = p13.CompleteDescription,
ShiftId = p13.ShiftId,
Shift = new Shift()
{
Title = p13.ShiftTitle,
Id = p13.ShiftId
},
ComplexId = p13.ComplexId,
Complex = new Complex() {Id = p13.ComplexId},
SupervisorId = p13.SupervisorId,
Supervisor = new ApplicationUser() {Id = p13.SupervisorId},
Users = p13.Users.Select<ShiftPlanUserSDto, ShiftPlanUser>(p14 => new ShiftPlanUser()
{
ShiftPlanId = p14.ShiftPlanId,
ShiftPlan = new ShiftPlan() {Id = p14.ShiftPlanId},
PositionId = p14.PositionId,
Position = new Position()
{
Name = p14.PositionName,
Id = p14.PositionId
},
UserId = p14.UserId,
User = new ApplicationUser() {Id = p14.UserId},
Id = p14.Id
}).ToList<ShiftPlanUser>(),
Id = p13.Id
};
public static ShiftPlanSDto AdaptToSDto(this ShiftPlan p15)
{
return p15 == null ? null : new ShiftPlanSDto()
{
PlanFor = p15.PlanFor,
IsCompleted = p15.IsCompleted,
CompletePercent = p15.CompletePercent,
SupervisorFullName = p15.Supervisor != null ? p15.Supervisor.FirstName + " " + p15.Supervisor.LastName : string.Empty,
CompleteDescription = p15.CompleteDescription,
ComplexId = p15.ComplexId,
ShiftId = p15.ShiftId,
ShiftTitle = p15.Shift == null ? null : p15.Shift.Title,
StartAt = p15.Shift != null ? p15.Shift.StartAt : TimeSpan.MinValue,
EndAt = p15.Shift != null ? p15.Shift.EndAt : TimeSpan.MinValue,
SupervisorId = p15.SupervisorId,
Users = funcMain6(p15.Users),
Id = p15.Id
};
}
public static ShiftPlanSDto AdaptTo(this ShiftPlan p17, ShiftPlanSDto p18)
{
if (p17 == null)
{
return null;
}
ShiftPlanSDto result = p18 ?? new ShiftPlanSDto();
result.PlanFor = p17.PlanFor;
result.IsCompleted = p17.IsCompleted;
result.CompletePercent = p17.CompletePercent;
result.SupervisorFullName = p17.Supervisor != null ? p17.Supervisor.FirstName + " " + p17.Supervisor.LastName : string.Empty;
result.CompleteDescription = p17.CompleteDescription;
result.ComplexId = p17.ComplexId;
result.ShiftId = p17.ShiftId;
result.ShiftTitle = p17.Shift == null ? null : p17.Shift.Title;
result.StartAt = p17.Shift != null ? p17.Shift.StartAt : TimeSpan.MinValue;
result.EndAt = p17.Shift != null ? p17.Shift.EndAt : TimeSpan.MinValue;
result.SupervisorId = p17.SupervisorId;
result.Users = funcMain7(p17.Users, result.Users);
result.Id = p17.Id;
return result;
}
public static Expression<Func<ShiftPlan, ShiftPlanSDto>> ProjectToSDto => p21 => new ShiftPlanSDto()
{
PlanFor = p21.PlanFor,
IsCompleted = p21.IsCompleted,
CompletePercent = p21.CompletePercent,
SupervisorFullName = p21.Supervisor != null ? p21.Supervisor.FirstName + " " + p21.Supervisor.LastName : string.Empty,
CompleteDescription = p21.CompleteDescription,
ComplexId = p21.ComplexId,
ShiftId = p21.ShiftId,
ShiftTitle = p21.Shift.Title,
StartAt = p21.Shift != null ? p21.Shift.StartAt : TimeSpan.MinValue,
EndAt = p21.Shift != null ? p21.Shift.EndAt : TimeSpan.MinValue,
SupervisorId = p21.SupervisorId,
Users = p21.Users.Select<ShiftPlanUser, ShiftPlanUserSDto>(p22 => new ShiftPlanUserSDto()
{
ShiftPlanId = p22.ShiftPlanId,
UserId = p22.UserId,
UserFullName = p22.User != null ? p22.User.FirstName + " " + p22.User.LastName : string.Empty,
PositionId = p22.PositionId,
PositionName = p22.Position != null ? p22.Position.Name : string.Empty,
Id = p22.Id
}).ToList<ShiftPlanUserSDto>(),
Id = p21.Id
};
public static ShiftPlan AdaptToShiftPlan(this ShiftPlanLDto p23)
{
return p23 == null ? null : new ShiftPlan()
{
PlanFor = p23.PlanFor,
IsCompleted = p23.IsCompleted,
CompletePercent = p23.CompletePercent,
CompleteDescription = p23.CompleteDescription,
ShiftId = p23.ShiftId,
Shift = new Shift() {Id = p23.ShiftId},
RoutineId = p23.RoutineId,
Routine = new Routine() {Id = p23.RoutineId},
SupervisorId = p23.SupervisorId,
Supervisor = new ApplicationUser() {Id = p23.SupervisorId},
Users = funcMain8(p23.Users),
Id = p23.Id
};
}
public static ShiftPlan AdaptTo(this ShiftPlanLDto p25, ShiftPlan p26)
{
if (p25 == null)
{
return null;
}
ShiftPlan result = p26 ?? new ShiftPlan();
result.PlanFor = p25.PlanFor;
result.IsCompleted = p25.IsCompleted;
result.CompletePercent = p25.CompletePercent;
result.CompleteDescription = p25.CompleteDescription;
result.ShiftId = p25.ShiftId;
result.Shift = funcMain9(new Never(), result.Shift, p25);
result.RoutineId = p25.RoutineId;
result.Routine = funcMain10(new Never(), result.Routine, p25);
result.SupervisorId = p25.SupervisorId;
result.Supervisor = funcMain11(new Never(), result.Supervisor, p25);
result.Users = funcMain12(p25.Users, result.Users);
result.Id = p25.Id;
return result;
}
public static ShiftPlanLDto AdaptToLDto(this ShiftPlan p35)
{
return p35 == null ? null : new ShiftPlanLDto()
{
PlanFor = p35.PlanFor,
RoutineId = p35.RoutineId,
IsCompleted = p35.IsCompleted,
CompletePercent = p35.CompletePercent,
CompleteDescription = p35.CompleteDescription,
ShiftId = p35.ShiftId,
Users = funcMain13(p35.Users),
SupervisorId = p35.SupervisorId,
SupervisorFullName = p35.Supervisor != null ? p35.Supervisor.FirstName + " " + p35.Supervisor.LastName : string.Empty,
Id = p35.Id
};
}
public static ShiftPlanLDto AdaptTo(this ShiftPlan p37, ShiftPlanLDto p38)
{
if (p37 == null)
{
return null;
}
ShiftPlanLDto result = p38 ?? new ShiftPlanLDto();
result.PlanFor = p37.PlanFor;
result.RoutineId = p37.RoutineId;
result.IsCompleted = p37.IsCompleted;
result.CompletePercent = p37.CompletePercent;
result.CompleteDescription = p37.CompleteDescription;
result.ShiftId = p37.ShiftId;
result.Users = funcMain14(p37.Users, result.Users);
result.SupervisorId = p37.SupervisorId;
result.SupervisorFullName = p37.Supervisor != null ? p37.Supervisor.FirstName + " " + p37.Supervisor.LastName : string.Empty;
result.Id = p37.Id;
return result;
}
public static Expression<Func<ShiftPlan, ShiftPlanLDto>> ProjectToLDto => p41 => new ShiftPlanLDto()
{
PlanFor = p41.PlanFor,
RoutineId = p41.RoutineId,
IsCompleted = p41.IsCompleted,
CompletePercent = p41.CompletePercent,
CompleteDescription = p41.CompleteDescription,
ShiftId = p41.ShiftId,
Users = p41.Users.Select<ShiftPlanUser, ShiftPlanUserSDto>(p42 => new ShiftPlanUserSDto()
{
ShiftPlanId = p42.ShiftPlanId,
UserId = p42.UserId,
UserFullName = p42.User != null ? p42.User.FirstName + " " + p42.User.LastName : string.Empty,
PositionId = p42.PositionId,
PositionName = p42.Position != null ? p42.Position.Name : string.Empty,
Id = p42.Id
}).ToList<ShiftPlanUserSDto>(),
SupervisorId = p41.SupervisorId,
SupervisorFullName = p41.Supervisor != null ? p41.Supervisor.FirstName + " " + p41.Supervisor.LastName : string.Empty,
Id = p41.Id
};
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 Shift funcMain2(Never p5, Shift p6, ShiftPlanSDto p3)
{
Shift result = p6 ?? new Shift();
result.Title = p3.ShiftTitle;
result.Id = p3.ShiftId;
return result;
}
private static Complex funcMain3(Never p7, Complex p8, ShiftPlanSDto p3)
{
Complex result = p8 ?? new Complex();
result.Id = p3.ComplexId;
return result;
}
private static ApplicationUser funcMain4(Never p9, ApplicationUser p10, ShiftPlanSDto p3)
{
ApplicationUser result = p10 ?? new ApplicationUser();
result.Id = p3.SupervisorId;
return result;
}
private static List<ShiftPlanUser> funcMain5(List<ShiftPlanUserSDto> p11, List<ShiftPlanUser> p12)
{
if (p11 == null)
{
return null;
}
List<ShiftPlanUser> result = new List<ShiftPlanUser>(p11.Count);
int i = 0;
int len = p11.Count;
while (i < len)
{
ShiftPlanUserSDto item = p11[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> funcMain6(List<ShiftPlanUser> p16)
{
if (p16 == null)
{
return null;
}
List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p16.Count);
int i = 0;
int len = p16.Count;
while (i < len)
{
ShiftPlanUser item = p16[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> funcMain7(List<ShiftPlanUser> p19, List<ShiftPlanUserSDto> p20)
{
if (p19 == null)
{
return null;
}
List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p19.Count);
int i = 0;
int len = p19.Count;
while (i < len)
{
ShiftPlanUser item = p19[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<ShiftPlanUser> funcMain8(List<ShiftPlanUserSDto> p24)
{
if (p24 == null)
{
return null;
}
List<ShiftPlanUser> result = new List<ShiftPlanUser>(p24.Count);
int i = 0;
int len = p24.Count;
while (i < len)
{
ShiftPlanUserSDto item = p24[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 funcMain9(Never p27, Shift p28, ShiftPlanLDto p25)
{
Shift result = p28 ?? new Shift();
result.Id = p25.ShiftId;
return result;
}
private static Routine funcMain10(Never p29, Routine p30, ShiftPlanLDto p25)
{
Routine result = p30 ?? new Routine();
result.Id = p25.RoutineId;
return result;
}
private static ApplicationUser funcMain11(Never p31, ApplicationUser p32, ShiftPlanLDto p25)
{
ApplicationUser result = p32 ?? new ApplicationUser();
result.Id = p25.SupervisorId;
return result;
}
private static List<ShiftPlanUser> funcMain12(List<ShiftPlanUserSDto> p33, List<ShiftPlanUser> p34)
{
if (p33 == null)
{
return null;
}
List<ShiftPlanUser> result = new List<ShiftPlanUser>(p33.Count);
int i = 0;
int len = p33.Count;
while (i < len)
{
ShiftPlanUserSDto item = p33[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> funcMain13(List<ShiftPlanUser> p36)
{
if (p36 == null)
{
return null;
}
List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p36.Count);
int i = 0;
int len = p36.Count;
while (i < len)
{
ShiftPlanUser item = p36[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> funcMain14(List<ShiftPlanUser> p39, List<ShiftPlanUserSDto> p40)
{
if (p39 == null)
{
return null;
}
List<ShiftPlanUserSDto> result = new List<ShiftPlanUserSDto>(p39.Count);
int i = 0;
int len = p39.Count;
while (i < len)
{
ShiftPlanUser item = p39[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;
}
}
}