using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Brizco.Common.Extensions;
using Brizco.Domain.Dtos.LargDtos;
using Brizco.Domain.Dtos.SmallDtos;
using Brizco.Domain.Entities.Complex;
using Brizco.Domain.Entities.Shift;
using Brizco.Domain.Entities.Task;
using Mapster.Models;
using Task = Brizco.Domain.Entities.Task.Task;

namespace Brizco.Domain.Mappers
{
    public static partial class TaskMapper
    {
        public static Task AdaptToTask(this TaskSDto p1)
        {
            return p1 == null ? null : new Task()
            {
                Type = p1.Type,
                Title = p1.Title,
                Description = p1.Description,
                IsDisposable = p1.IsDisposable,
                SetFor = Convert.ToDateTime(p1.SetFor),
                HasDisposed = p1.HasDisposed,
                ScheduleType = p1.ScheduleType,
                ComplexId = p1.ComplexId,
                Complex = new Complex() {Id = p1.ComplexId},
                Amount = p1.Amount,
                AmountType = p1.AmountType,
                Shifts = funcMain1(p1.Shifts),
                Routines = funcMain2(p1.Routines),
                Positions = funcMain3(p1.Positions),
                Id = p1.Id
            };
        }
        public static Task AdaptTo(this TaskSDto p5, Task p6)
        {
            if (p5 == null)
            {
                return null;
            }
            Task result = p6 ?? new Task();
            
            result.Type = p5.Type;
            result.Title = p5.Title;
            result.Description = p5.Description;
            result.IsDisposable = p5.IsDisposable;
            result.SetFor = Convert.ToDateTime(p5.SetFor);
            result.HasDisposed = p5.HasDisposed;
            result.ScheduleType = p5.ScheduleType;
            result.ComplexId = p5.ComplexId;
            result.Complex = funcMain4(new Never(), result.Complex, p5);
            result.Amount = p5.Amount;
            result.AmountType = p5.AmountType;
            result.Shifts = funcMain5(p5.Shifts, result.Shifts);
            result.Routines = funcMain6(p5.Routines, result.Routines);
            result.Positions = funcMain7(p5.Positions, result.Positions);
            result.Id = p5.Id;
            return result;
            
        }
        public static Expression<Func<TaskSDto, Task>> ProjectToTask => p15 => new Task()
        {
            Type = p15.Type,
            Title = p15.Title,
            Description = p15.Description,
            IsDisposable = p15.IsDisposable,
            SetFor = Convert.ToDateTime(p15.SetFor),
            HasDisposed = p15.HasDisposed,
            ScheduleType = p15.ScheduleType,
            ComplexId = p15.ComplexId,
            Complex = new Complex() {Id = p15.ComplexId},
            Amount = p15.Amount,
            AmountType = p15.AmountType,
            Shifts = p15.Shifts.Select<string, TaskShift>(p16 => (TaskShift)Convert.ChangeType((object)p16, typeof(TaskShift))).ToList<TaskShift>(),
            Routines = p15.Routines.Select<string, TaskRoutine>(p17 => (TaskRoutine)Convert.ChangeType((object)p17, typeof(TaskRoutine))).ToList<TaskRoutine>(),
            Positions = p15.Positions.Select<string, TaskPosition>(p18 => (TaskPosition)Convert.ChangeType((object)p18, typeof(TaskPosition))).ToList<TaskPosition>(),
            Id = p15.Id
        };
        public static TaskSDto AdaptToSDto(this Task p19)
        {
            return p19 == null ? null : new TaskSDto()
            {
                Type = p19.Type,
                Title = p19.Title,
                Description = p19.Description,
                IsDisposable = p19.IsDisposable,
                SetFor = DateTimeExtensions.DateTimeToUnixTimeStamp(p19.SetFor),
                HasDisposed = p19.HasDisposed,
                ComplexId = p19.ComplexId,
                ScheduleType = p19.ScheduleType,
                Shifts = funcMain8(p19.Shifts.Select<TaskShift, string>(funcMain9)),
                Routines = funcMain10(p19.Routines.Select<TaskRoutine, string>(funcMain11)),
                Positions = funcMain12(p19.Positions.Select<TaskPosition, string>(funcMain13)),
                Amount = p19.Amount,
                AmountType = p19.AmountType,
                Id = p19.Id
            };
        }
        public static TaskSDto AdaptTo(this Task p23, TaskSDto p24)
        {
            if (p23 == null)
            {
                return null;
            }
            TaskSDto result = p24 ?? new TaskSDto();
            
            result.Type = p23.Type;
            result.Title = p23.Title;
            result.Description = p23.Description;
            result.IsDisposable = p23.IsDisposable;
            result.SetFor = DateTimeExtensions.DateTimeToUnixTimeStamp(p23.SetFor);
            result.HasDisposed = p23.HasDisposed;
            result.ComplexId = p23.ComplexId;
            result.ScheduleType = p23.ScheduleType;
            result.Shifts = funcMain14(p23.Shifts.Select<TaskShift, string>(funcMain9), result.Shifts);
            result.Routines = funcMain15(p23.Routines.Select<TaskRoutine, string>(funcMain11), result.Routines);
            result.Positions = funcMain16(p23.Positions.Select<TaskPosition, string>(funcMain13), result.Positions);
            result.Amount = p23.Amount;
            result.AmountType = p23.AmountType;
            result.Id = p23.Id;
            return result;
            
        }
        public static Expression<Func<Task, TaskSDto>> ProjectToSDto => p31 => new TaskSDto()
        {
            Type = p31.Type,
            Title = p31.Title,
            Description = p31.Description,
            IsDisposable = p31.IsDisposable,
            SetFor = DateTimeExtensions.DateTimeToUnixTimeStamp(p31.SetFor),
            HasDisposed = p31.HasDisposed,
            ComplexId = p31.ComplexId,
            ScheduleType = p31.ScheduleType,
            Shifts = (List<string>)p31.Shifts.Select<TaskShift, string>(d => d.Shift != null ? d.Shift.Title : string.Empty),
            Routines = (List<string>)p31.Routines.Select<TaskRoutine, string>(d => d.Routine != null ? d.Routine.Name : string.Empty),
            Positions = (List<string>)p31.Positions.Select<TaskPosition, string>(d => d.Position != null ? d.Position.Name : string.Empty),
            Amount = p31.Amount,
            AmountType = p31.AmountType,
            Id = p31.Id
        };
        public static Task AdaptToTask(this TaskLDto p32)
        {
            return p32 == null ? null : new Task()
            {
                Type = p32.Type,
                Title = p32.Title,
                Description = p32.Description,
                IsDisposable = p32.IsDisposable,
                SetFor = Convert.ToDateTime(p32.SetFor),
                HasDisposed = p32.HasDisposed,
                ScheduleType = p32.ScheduleType,
                Amount = p32.Amount,
                AmountType = p32.AmountType,
                Shifts = funcMain17(p32.Shifts),
                Days = funcMain18(p32.Days),
                Routines = funcMain19(p32.Routines),
                Positions = funcMain20(p32.Positions),
                Id = p32.Id
            };
        }
        public static Task AdaptTo(this TaskLDto p37, Task p38)
        {
            if (p37 == null)
            {
                return null;
            }
            Task result = p38 ?? new Task();
            
            result.Type = p37.Type;
            result.Title = p37.Title;
            result.Description = p37.Description;
            result.IsDisposable = p37.IsDisposable;
            result.SetFor = Convert.ToDateTime(p37.SetFor);
            result.HasDisposed = p37.HasDisposed;
            result.ScheduleType = p37.ScheduleType;
            result.Amount = p37.Amount;
            result.AmountType = p37.AmountType;
            result.Shifts = funcMain21(p37.Shifts, result.Shifts);
            result.Days = funcMain22(p37.Days, result.Days);
            result.Routines = funcMain23(p37.Routines, result.Routines);
            result.Positions = funcMain24(p37.Positions, result.Positions);
            result.Id = p37.Id;
            return result;
            
        }
        public static TaskLDto AdaptToLDto(this Task p47)
        {
            return p47 == null ? null : new TaskLDto()
            {
                Type = p47.Type,
                Title = p47.Title,
                Description = p47.Description,
                IsDisposable = p47.IsDisposable,
                SetFor = DateTimeExtensions.DateTimeToUnixTimeStamp(p47.SetFor),
                HasDisposed = p47.HasDisposed,
                ScheduleType = p47.ScheduleType,
                Amount = p47.Amount,
                AmountType = p47.AmountType,
                Shifts = funcMain25(p47.Shifts),
                Positions = funcMain26(p47.Positions),
                Days = funcMain27(p47.Days),
                Routines = funcMain28(p47.Routines),
                Id = p47.Id
            };
        }
        public static TaskLDto AdaptTo(this Task p52, TaskLDto p53)
        {
            if (p52 == null)
            {
                return null;
            }
            TaskLDto result = p53 ?? new TaskLDto();
            
            result.Type = p52.Type;
            result.Title = p52.Title;
            result.Description = p52.Description;
            result.IsDisposable = p52.IsDisposable;
            result.SetFor = DateTimeExtensions.DateTimeToUnixTimeStamp(p52.SetFor);
            result.HasDisposed = p52.HasDisposed;
            result.ScheduleType = p52.ScheduleType;
            result.Amount = p52.Amount;
            result.AmountType = p52.AmountType;
            result.Shifts = funcMain29(p52.Shifts, result.Shifts);
            result.Positions = funcMain30(p52.Positions, result.Positions);
            result.Days = funcMain31(p52.Days, result.Days);
            result.Routines = funcMain32(p52.Routines, result.Routines);
            result.Id = p52.Id;
            return result;
            
        }
        public static Expression<Func<Task, TaskLDto>> ProjectToLDto => p62 => new TaskLDto()
        {
            Type = p62.Type,
            Title = p62.Title,
            Description = p62.Description,
            IsDisposable = p62.IsDisposable,
            SetFor = DateTimeExtensions.DateTimeToUnixTimeStamp(p62.SetFor),
            HasDisposed = p62.HasDisposed,
            ScheduleType = p62.ScheduleType,
            Amount = p62.Amount,
            AmountType = p62.AmountType,
            Shifts = p62.Shifts.Select<TaskShift, TaskShiftSDto>(p63 => new TaskShiftSDto()
            {
                ShiftId = p63.ShiftId,
                ShiftName = p63.Shift != null ? p63.Shift.Title : string.Empty,
                TaskId = p63.TaskId,
                TaskTitle = p63.Task != null ? p63.Task.Title : string.Empty,
                Id = p63.Id
            }).ToList<TaskShiftSDto>(),
            Positions = p62.Positions.Select<TaskPosition, TaskPositionSDto>(p64 => new TaskPositionSDto()
            {
                PositionId = p64.PositionId,
                PositionName = p64.Position != null ? p64.Position.Name : string.Empty,
                TaskId = p64.TaskId,
                Id = p64.Id
            }).ToList<TaskPositionSDto>(),
            Days = p62.Days.Select<TaskDay, TaskDaySDto>(p65 => new TaskDaySDto()
            {
                DayOfWeek = p65.DayOfWeek,
                TaskId = p65.TaskId,
                Id = p65.Id
            }).ToList<TaskDaySDto>(),
            Routines = p62.Routines.Select<TaskRoutine, TaskRoutineSDto>(p66 => new TaskRoutineSDto()
            {
                TaskId = p66.TaskId,
                RoutineId = p66.RoutineId,
                Id = p66.Id
            }).ToList<TaskRoutineSDto>(),
            Id = p62.Id
        };
        
        private static List<TaskShift> funcMain1(List<string> p2)
        {
            if (p2 == null)
            {
                return null;
            }
            List<TaskShift> result = new List<TaskShift>(p2.Count);
            
            int i = 0;
            int len = p2.Count;
            
            while (i < len)
            {
                string item = p2[i];
                result.Add(item == null ? null : (TaskShift)Convert.ChangeType((object)item, typeof(TaskShift)));
                i++;
            }
            return result;
            
        }
        
        private static List<TaskRoutine> funcMain2(List<string> p3)
        {
            if (p3 == null)
            {
                return null;
            }
            List<TaskRoutine> result = new List<TaskRoutine>(p3.Count);
            
            int i = 0;
            int len = p3.Count;
            
            while (i < len)
            {
                string item = p3[i];
                result.Add(item == null ? null : (TaskRoutine)Convert.ChangeType((object)item, typeof(TaskRoutine)));
                i++;
            }
            return result;
            
        }
        
        private static List<TaskPosition> funcMain3(List<string> p4)
        {
            if (p4 == null)
            {
                return null;
            }
            List<TaskPosition> result = new List<TaskPosition>(p4.Count);
            
            int i = 0;
            int len = p4.Count;
            
            while (i < len)
            {
                string item = p4[i];
                result.Add(item == null ? null : (TaskPosition)Convert.ChangeType((object)item, typeof(TaskPosition)));
                i++;
            }
            return result;
            
        }
        
        private static Complex funcMain4(Never p7, Complex p8, TaskSDto p5)
        {
            Complex result = p8 ?? new Complex();
            
            result.Id = p5.ComplexId;
            return result;
            
        }
        
        private static List<TaskShift> funcMain5(List<string> p9, List<TaskShift> p10)
        {
            if (p9 == null)
            {
                return null;
            }
            List<TaskShift> result = new List<TaskShift>(p9.Count);
            
            int i = 0;
            int len = p9.Count;
            
            while (i < len)
            {
                string item = p9[i];
                result.Add(item == null ? null : (TaskShift)Convert.ChangeType((object)item, typeof(TaskShift)));
                i++;
            }
            return result;
            
        }
        
        private static List<TaskRoutine> funcMain6(List<string> p11, List<TaskRoutine> p12)
        {
            if (p11 == null)
            {
                return null;
            }
            List<TaskRoutine> result = new List<TaskRoutine>(p11.Count);
            
            int i = 0;
            int len = p11.Count;
            
            while (i < len)
            {
                string item = p11[i];
                result.Add(item == null ? null : (TaskRoutine)Convert.ChangeType((object)item, typeof(TaskRoutine)));
                i++;
            }
            return result;
            
        }
        
        private static List<TaskPosition> funcMain7(List<string> p13, List<TaskPosition> p14)
        {
            if (p13 == null)
            {
                return null;
            }
            List<TaskPosition> result = new List<TaskPosition>(p13.Count);
            
            int i = 0;
            int len = p13.Count;
            
            while (i < len)
            {
                string item = p13[i];
                result.Add(item == null ? null : (TaskPosition)Convert.ChangeType((object)item, typeof(TaskPosition)));
                i++;
            }
            return result;
            
        }
        
        private static List<string> funcMain8(IEnumerable<string> p20)
        {
            if (p20 == null)
            {
                return null;
            }
            List<string> result = new List<string>();
            
            IEnumerator<string> enumerator = p20.GetEnumerator();
            
            while (enumerator.MoveNext())
            {
                string item = enumerator.Current;
                result.Add(item);
            }
            return result;
            
        }
        
        private static string funcMain9(TaskShift d)
        {
            return d.Shift != null ? d.Shift.Title : string.Empty;
        }
        
        private static List<string> funcMain10(IEnumerable<string> p21)
        {
            if (p21 == null)
            {
                return null;
            }
            List<string> result = new List<string>();
            
            IEnumerator<string> enumerator = p21.GetEnumerator();
            
            while (enumerator.MoveNext())
            {
                string item = enumerator.Current;
                result.Add(item);
            }
            return result;
            
        }
        
        private static string funcMain11(TaskRoutine d)
        {
            return d.Routine != null ? d.Routine.Name : string.Empty;
        }
        
        private static List<string> funcMain12(IEnumerable<string> p22)
        {
            if (p22 == null)
            {
                return null;
            }
            List<string> result = new List<string>();
            
            IEnumerator<string> enumerator = p22.GetEnumerator();
            
            while (enumerator.MoveNext())
            {
                string item = enumerator.Current;
                result.Add(item);
            }
            return result;
            
        }
        
        private static string funcMain13(TaskPosition d)
        {
            return d.Position != null ? d.Position.Name : string.Empty;
        }
        
        private static List<string> funcMain14(IEnumerable<string> p25, List<string> p26)
        {
            if (p25 == null)
            {
                return null;
            }
            List<string> result = new List<string>();
            
            IEnumerator<string> enumerator = p25.GetEnumerator();
            
            while (enumerator.MoveNext())
            {
                string item = enumerator.Current;
                result.Add(item);
            }
            return result;
            
        }
        
        private static List<string> funcMain15(IEnumerable<string> p27, List<string> p28)
        {
            if (p27 == null)
            {
                return null;
            }
            List<string> result = new List<string>();
            
            IEnumerator<string> enumerator = p27.GetEnumerator();
            
            while (enumerator.MoveNext())
            {
                string item = enumerator.Current;
                result.Add(item);
            }
            return result;
            
        }
        
        private static List<string> funcMain16(IEnumerable<string> p29, List<string> p30)
        {
            if (p29 == null)
            {
                return null;
            }
            List<string> result = new List<string>();
            
            IEnumerator<string> enumerator = p29.GetEnumerator();
            
            while (enumerator.MoveNext())
            {
                string item = enumerator.Current;
                result.Add(item);
            }
            return result;
            
        }
        
        private static List<TaskShift> funcMain17(List<TaskShiftSDto> p33)
        {
            if (p33 == null)
            {
                return null;
            }
            List<TaskShift> result = new List<TaskShift>(p33.Count);
            
            int i = 0;
            int len = p33.Count;
            
            while (i < len)
            {
                TaskShiftSDto item = p33[i];
                result.Add(item == null ? null : new TaskShift()
                {
                    TaskId = item.TaskId,
                    Task = new Task()
                    {
                        Title = item.TaskTitle,
                        Id = item.TaskId
                    },
                    ShiftId = item.ShiftId,
                    Shift = new Shift() {Id = item.ShiftId},
                    Id = item.Id
                });
                i++;
            }
            return result;
            
        }
        
        private static List<TaskDay> funcMain18(List<TaskDaySDto> p34)
        {
            if (p34 == null)
            {
                return null;
            }
            List<TaskDay> result = new List<TaskDay>(p34.Count);
            
            int i = 0;
            int len = p34.Count;
            
            while (i < len)
            {
                TaskDaySDto item = p34[i];
                result.Add(item == null ? null : new TaskDay()
                {
                    DayOfWeek = item.DayOfWeek,
                    TaskId = item.TaskId,
                    Id = item.Id
                });
                i++;
            }
            return result;
            
        }
        
        private static List<TaskRoutine> funcMain19(List<TaskRoutineSDto> p35)
        {
            if (p35 == null)
            {
                return null;
            }
            List<TaskRoutine> result = new List<TaskRoutine>(p35.Count);
            
            int i = 0;
            int len = p35.Count;
            
            while (i < len)
            {
                TaskRoutineSDto item = p35[i];
                result.Add(item == null ? null : new TaskRoutine()
                {
                    TaskId = item.TaskId,
                    RoutineId = item.RoutineId,
                    Id = item.Id
                });
                i++;
            }
            return result;
            
        }
        
        private static List<TaskPosition> funcMain20(List<TaskPositionSDto> p36)
        {
            if (p36 == null)
            {
                return null;
            }
            List<TaskPosition> result = new List<TaskPosition>(p36.Count);
            
            int i = 0;
            int len = p36.Count;
            
            while (i < len)
            {
                TaskPositionSDto item = p36[i];
                result.Add(item == null ? null : new TaskPosition()
                {
                    PositionId = item.PositionId,
                    Position = new Position()
                    {
                        Name = item.PositionName,
                        Id = item.PositionId
                    },
                    TaskId = item.TaskId,
                    Task = new Task() {Id = item.TaskId},
                    Id = item.Id
                });
                i++;
            }
            return result;
            
        }
        
        private static List<TaskShift> funcMain21(List<TaskShiftSDto> p39, List<TaskShift> p40)
        {
            if (p39 == null)
            {
                return null;
            }
            List<TaskShift> result = new List<TaskShift>(p39.Count);
            
            int i = 0;
            int len = p39.Count;
            
            while (i < len)
            {
                TaskShiftSDto item = p39[i];
                result.Add(item == null ? null : new TaskShift()
                {
                    TaskId = item.TaskId,
                    Task = new Task()
                    {
                        Title = item.TaskTitle,
                        Id = item.TaskId
                    },
                    ShiftId = item.ShiftId,
                    Shift = new Shift() {Id = item.ShiftId},
                    Id = item.Id
                });
                i++;
            }
            return result;
            
        }
        
        private static List<TaskDay> funcMain22(List<TaskDaySDto> p41, List<TaskDay> p42)
        {
            if (p41 == null)
            {
                return null;
            }
            List<TaskDay> result = new List<TaskDay>(p41.Count);
            
            int i = 0;
            int len = p41.Count;
            
            while (i < len)
            {
                TaskDaySDto item = p41[i];
                result.Add(item == null ? null : new TaskDay()
                {
                    DayOfWeek = item.DayOfWeek,
                    TaskId = item.TaskId,
                    Id = item.Id
                });
                i++;
            }
            return result;
            
        }
        
        private static List<TaskRoutine> funcMain23(List<TaskRoutineSDto> p43, List<TaskRoutine> p44)
        {
            if (p43 == null)
            {
                return null;
            }
            List<TaskRoutine> result = new List<TaskRoutine>(p43.Count);
            
            int i = 0;
            int len = p43.Count;
            
            while (i < len)
            {
                TaskRoutineSDto item = p43[i];
                result.Add(item == null ? null : new TaskRoutine()
                {
                    TaskId = item.TaskId,
                    RoutineId = item.RoutineId,
                    Id = item.Id
                });
                i++;
            }
            return result;
            
        }
        
        private static List<TaskPosition> funcMain24(List<TaskPositionSDto> p45, List<TaskPosition> p46)
        {
            if (p45 == null)
            {
                return null;
            }
            List<TaskPosition> result = new List<TaskPosition>(p45.Count);
            
            int i = 0;
            int len = p45.Count;
            
            while (i < len)
            {
                TaskPositionSDto item = p45[i];
                result.Add(item == null ? null : new TaskPosition()
                {
                    PositionId = item.PositionId,
                    Position = new Position()
                    {
                        Name = item.PositionName,
                        Id = item.PositionId
                    },
                    TaskId = item.TaskId,
                    Task = new Task() {Id = item.TaskId},
                    Id = item.Id
                });
                i++;
            }
            return result;
            
        }
        
        private static List<TaskShiftSDto> funcMain25(List<TaskShift> p48)
        {
            if (p48 == null)
            {
                return null;
            }
            List<TaskShiftSDto> result = new List<TaskShiftSDto>(p48.Count);
            
            int i = 0;
            int len = p48.Count;
            
            while (i < len)
            {
                TaskShift item = p48[i];
                result.Add(item == null ? null : new TaskShiftSDto()
                {
                    ShiftId = item.ShiftId,
                    ShiftName = item.Shift != null ? item.Shift.Title : string.Empty,
                    TaskId = item.TaskId,
                    TaskTitle = item.Task != null ? item.Task.Title : string.Empty,
                    Id = item.Id
                });
                i++;
            }
            return result;
            
        }
        
        private static List<TaskPositionSDto> funcMain26(List<TaskPosition> p49)
        {
            if (p49 == null)
            {
                return null;
            }
            List<TaskPositionSDto> result = new List<TaskPositionSDto>(p49.Count);
            
            int i = 0;
            int len = p49.Count;
            
            while (i < len)
            {
                TaskPosition item = p49[i];
                result.Add(item == null ? null : new TaskPositionSDto()
                {
                    PositionId = item.PositionId,
                    PositionName = item.Position != null ? item.Position.Name : string.Empty,
                    TaskId = item.TaskId,
                    Id = item.Id
                });
                i++;
            }
            return result;
            
        }
        
        private static List<TaskDaySDto> funcMain27(List<TaskDay> p50)
        {
            if (p50 == null)
            {
                return null;
            }
            List<TaskDaySDto> result = new List<TaskDaySDto>(p50.Count);
            
            int i = 0;
            int len = p50.Count;
            
            while (i < len)
            {
                TaskDay item = p50[i];
                result.Add(item == null ? null : new TaskDaySDto()
                {
                    DayOfWeek = item.DayOfWeek,
                    TaskId = item.TaskId,
                    Id = item.Id
                });
                i++;
            }
            return result;
            
        }
        
        private static List<TaskRoutineSDto> funcMain28(List<TaskRoutine> p51)
        {
            if (p51 == null)
            {
                return null;
            }
            List<TaskRoutineSDto> result = new List<TaskRoutineSDto>(p51.Count);
            
            int i = 0;
            int len = p51.Count;
            
            while (i < len)
            {
                TaskRoutine item = p51[i];
                result.Add(item == null ? null : new TaskRoutineSDto()
                {
                    TaskId = item.TaskId,
                    RoutineId = item.RoutineId,
                    Id = item.Id
                });
                i++;
            }
            return result;
            
        }
        
        private static List<TaskShiftSDto> funcMain29(List<TaskShift> p54, List<TaskShiftSDto> p55)
        {
            if (p54 == null)
            {
                return null;
            }
            List<TaskShiftSDto> result = new List<TaskShiftSDto>(p54.Count);
            
            int i = 0;
            int len = p54.Count;
            
            while (i < len)
            {
                TaskShift item = p54[i];
                result.Add(item == null ? null : new TaskShiftSDto()
                {
                    ShiftId = item.ShiftId,
                    ShiftName = item.Shift != null ? item.Shift.Title : string.Empty,
                    TaskId = item.TaskId,
                    TaskTitle = item.Task != null ? item.Task.Title : string.Empty,
                    Id = item.Id
                });
                i++;
            }
            return result;
            
        }
        
        private static List<TaskPositionSDto> funcMain30(List<TaskPosition> p56, List<TaskPositionSDto> p57)
        {
            if (p56 == null)
            {
                return null;
            }
            List<TaskPositionSDto> result = new List<TaskPositionSDto>(p56.Count);
            
            int i = 0;
            int len = p56.Count;
            
            while (i < len)
            {
                TaskPosition item = p56[i];
                result.Add(item == null ? null : new TaskPositionSDto()
                {
                    PositionId = item.PositionId,
                    PositionName = item.Position != null ? item.Position.Name : string.Empty,
                    TaskId = item.TaskId,
                    Id = item.Id
                });
                i++;
            }
            return result;
            
        }
        
        private static List<TaskDaySDto> funcMain31(List<TaskDay> p58, List<TaskDaySDto> p59)
        {
            if (p58 == null)
            {
                return null;
            }
            List<TaskDaySDto> result = new List<TaskDaySDto>(p58.Count);
            
            int i = 0;
            int len = p58.Count;
            
            while (i < len)
            {
                TaskDay item = p58[i];
                result.Add(item == null ? null : new TaskDaySDto()
                {
                    DayOfWeek = item.DayOfWeek,
                    TaskId = item.TaskId,
                    Id = item.Id
                });
                i++;
            }
            return result;
            
        }
        
        private static List<TaskRoutineSDto> funcMain32(List<TaskRoutine> p60, List<TaskRoutineSDto> p61)
        {
            if (p60 == null)
            {
                return null;
            }
            List<TaskRoutineSDto> result = new List<TaskRoutineSDto>(p60.Count);
            
            int i = 0;
            int len = p60.Count;
            
            while (i < len)
            {
                TaskRoutine item = p60[i];
                result.Add(item == null ? null : new TaskRoutineSDto()
                {
                    TaskId = item.TaskId,
                    RoutineId = item.RoutineId,
                    Id = item.Id
                });
                i++;
            }
            return result;
            
        }
    }
}