using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using NetinaShop.Domain.Dtos.LargDtos; using NetinaShop.Domain.Dtos.SmallDtos; using NetinaShop.Domain.Entities.Orders; namespace NetinaShop.Domain.Mappers { public static partial class OrderMapper { public static Order AdaptToOrder(this OrderLDto p1) { return p1 == null ? null : new Order() { TotalProductsPrice = (double)p1.TotalProductsPrice, PackingPrice = (double)p1.PackingPrice, ServicePrice = (double)p1.ServicePrice, DeliveryPrice = (double)p1.DeliveryPrice, DiscountPrice = (double)p1.DiscountPrice, TaxesPrice = (double)p1.TaxesPrice, TotalPrice = (double)p1.TotalPrice, IsPayed = p1.IsPayed, OrderStatus = p1.OrderStatus, DoneAt = p1.DoneAt, OrderAt = p1.OrderAt, PreparingMinute = p1.PreparingMinute, DiscountCode = p1.DiscountCode, OrderProducts = funcMain1(p1.OrderProducts), OrderDeliveries = funcMain2(p1.OrderDeliveries), Id = p1.Id }; } public static Order AdaptTo(this OrderLDto p4, Order p5) { if (p4 == null) { return null; } Order result = p5 ?? new Order(); result.TotalProductsPrice = (double)p4.TotalProductsPrice; result.PackingPrice = (double)p4.PackingPrice; result.ServicePrice = (double)p4.ServicePrice; result.DeliveryPrice = (double)p4.DeliveryPrice; result.DiscountPrice = (double)p4.DiscountPrice; result.TaxesPrice = (double)p4.TaxesPrice; result.TotalPrice = (double)p4.TotalPrice; result.IsPayed = p4.IsPayed; result.OrderStatus = p4.OrderStatus; result.DoneAt = p4.DoneAt; result.OrderAt = p4.OrderAt; result.PreparingMinute = p4.PreparingMinute; result.DiscountCode = p4.DiscountCode; result.OrderProducts = funcMain3(p4.OrderProducts, result.OrderProducts); result.OrderDeliveries = funcMain4(p4.OrderDeliveries, result.OrderDeliveries); result.Id = p4.Id; return result; } public static Expression> ProjectToOrder => p10 => new Order() { TotalProductsPrice = (double)p10.TotalProductsPrice, PackingPrice = (double)p10.PackingPrice, ServicePrice = (double)p10.ServicePrice, DeliveryPrice = (double)p10.DeliveryPrice, DiscountPrice = (double)p10.DiscountPrice, TaxesPrice = (double)p10.TaxesPrice, TotalPrice = (double)p10.TotalPrice, IsPayed = p10.IsPayed, OrderStatus = p10.OrderStatus, DoneAt = p10.DoneAt, OrderAt = p10.OrderAt, PreparingMinute = p10.PreparingMinute, DiscountCode = p10.DiscountCode, OrderProducts = p10.OrderProducts.Select(p11 => new OrderProduct() { Count = p11.Count, ProductFee = (double)p11.ProductFee, ProductCost = (double)p11.ProductCost, OrderProductStatus = p11.OrderProductStatus, ProductId = p11.ProductId, OrderId = p11.OrderId, Id = p11.Id }).ToList(), OrderDeliveries = p10.OrderDeliveries.Select(p12 => new OrderDelivery() { Address = p12.Address, PostalCode = p12.PostalCode, ReceiverPhoneNumber = p12.ReceiverPhoneNumber, ReceiverFullName = p12.ReceiverFullName, ShippingId = p12.ShippingId, OrderId = p12.OrderId, Id = p12.Id }).ToList(), Id = p10.Id }; public static OrderLDto AdaptToLDto(this Order p13) { return p13 == null ? null : new OrderLDto() { TotalPrice = (long)p13.TotalPrice, DeliveryPrice = (long)p13.DeliveryPrice, TaxesPrice = (long)p13.TaxesPrice, ServicePrice = (long)p13.ServicePrice, PackingPrice = (long)p13.PackingPrice, TotalProductsPrice = (long)p13.TotalProductsPrice, DiscountPrice = (long)p13.DiscountPrice, IsPayed = p13.IsPayed, OrderStatus = p13.OrderStatus, DoneAt = p13.DoneAt, OrderAt = p13.OrderAt, PreparingMinute = p13.PreparingMinute, DiscountCode = p13.DiscountCode, OrderProducts = funcMain5(p13.OrderProducts), OrderDeliveries = funcMain6(p13.OrderDeliveries), Id = p13.Id }; } public static OrderLDto AdaptTo(this Order p16, OrderLDto p17) { if (p16 == null) { return null; } OrderLDto result = p17 ?? new OrderLDto(); result.TotalPrice = (long)p16.TotalPrice; result.DeliveryPrice = (long)p16.DeliveryPrice; result.TaxesPrice = (long)p16.TaxesPrice; result.ServicePrice = (long)p16.ServicePrice; result.PackingPrice = (long)p16.PackingPrice; result.TotalProductsPrice = (long)p16.TotalProductsPrice; result.DiscountPrice = (long)p16.DiscountPrice; result.IsPayed = p16.IsPayed; result.OrderStatus = p16.OrderStatus; result.DoneAt = p16.DoneAt; result.OrderAt = p16.OrderAt; result.PreparingMinute = p16.PreparingMinute; result.DiscountCode = p16.DiscountCode; result.OrderProducts = funcMain7(p16.OrderProducts, result.OrderProducts); result.OrderDeliveries = funcMain8(p16.OrderDeliveries, result.OrderDeliveries); result.Id = p16.Id; return result; } public static Expression> ProjectToLDto => p22 => new OrderLDto() { TotalPrice = (long)p22.TotalPrice, DeliveryPrice = (long)p22.DeliveryPrice, TaxesPrice = (long)p22.TaxesPrice, ServicePrice = (long)p22.ServicePrice, PackingPrice = (long)p22.PackingPrice, TotalProductsPrice = (long)p22.TotalProductsPrice, DiscountPrice = (long)p22.DiscountPrice, IsPayed = p22.IsPayed, OrderStatus = p22.OrderStatus, DoneAt = p22.DoneAt, OrderAt = p22.OrderAt, PreparingMinute = p22.PreparingMinute, DiscountCode = p22.DiscountCode, OrderProducts = p22.OrderProducts.Select(p23 => new OrderProductSDto() { Count = p23.Count, ProductFee = (float)p23.ProductFee, ProductCost = (float)p23.ProductCost, OrderProductStatus = p23.OrderProductStatus, ProductId = p23.ProductId, OrderId = p23.OrderId, Id = p23.Id }).ToList(), OrderDeliveries = p22.OrderDeliveries.Select(p24 => new OrderDeliverySDto() { Address = p24.Address, PostalCode = p24.PostalCode, ReceiverPhoneNumber = p24.ReceiverPhoneNumber, ReceiverFullName = p24.ReceiverFullName, OrderId = p24.OrderId, ShippingId = p24.ShippingId, Id = p24.Id }).ToList(), Id = p22.Id }; public static Order AdaptToOrder(this OrderSDto p25) { return p25 == null ? null : new Order() { TotalProductsPrice = (double)p25.TotalProductsPrice, PackingPrice = (double)p25.PackingPrice, ServicePrice = (double)p25.ServicePrice, DeliveryPrice = (double)p25.DeliveryPrice, DiscountPrice = (double)p25.DiscountPrice, TaxesPrice = (double)p25.TaxesPrice, TotalPrice = (double)p25.TotalPrice, IsPayed = p25.IsPayed, OrderStatus = p25.OrderStatus, DoneAt = p25.DoneAt, OrderAt = p25.OrderAt, PreparingMinute = p25.PreparingMinute, DiscountCode = p25.DiscountCode, Id = p25.Id }; } public static Order AdaptTo(this OrderSDto p26, Order p27) { if (p26 == null) { return null; } Order result = p27 ?? new Order(); result.TotalProductsPrice = (double)p26.TotalProductsPrice; result.PackingPrice = (double)p26.PackingPrice; result.ServicePrice = (double)p26.ServicePrice; result.DeliveryPrice = (double)p26.DeliveryPrice; result.DiscountPrice = (double)p26.DiscountPrice; result.TaxesPrice = (double)p26.TaxesPrice; result.TotalPrice = (double)p26.TotalPrice; result.IsPayed = p26.IsPayed; result.OrderStatus = p26.OrderStatus; result.DoneAt = p26.DoneAt; result.OrderAt = p26.OrderAt; result.PreparingMinute = p26.PreparingMinute; result.DiscountCode = p26.DiscountCode; result.Id = p26.Id; return result; } public static OrderSDto AdaptToSDto(this Order p28) { return p28 == null ? null : new OrderSDto() { TotalPrice = (long)p28.TotalPrice, DeliveryPrice = (long)p28.DeliveryPrice, TaxesPrice = (long)p28.TaxesPrice, ServicePrice = (long)p28.ServicePrice, PackingPrice = (long)p28.PackingPrice, TotalProductsPrice = (long)p28.TotalProductsPrice, DiscountPrice = (long)p28.DiscountPrice, IsPayed = p28.IsPayed, OrderStatus = p28.OrderStatus, DoneAt = p28.DoneAt, OrderAt = p28.OrderAt, PreparingMinute = p28.PreparingMinute, DiscountCode = p28.DiscountCode, Id = p28.Id }; } public static OrderSDto AdaptTo(this Order p29, OrderSDto p30) { if (p29 == null) { return null; } OrderSDto result = p30 ?? new OrderSDto(); result.TotalPrice = (long)p29.TotalPrice; result.DeliveryPrice = (long)p29.DeliveryPrice; result.TaxesPrice = (long)p29.TaxesPrice; result.ServicePrice = (long)p29.ServicePrice; result.PackingPrice = (long)p29.PackingPrice; result.TotalProductsPrice = (long)p29.TotalProductsPrice; result.DiscountPrice = (long)p29.DiscountPrice; result.IsPayed = p29.IsPayed; result.OrderStatus = p29.OrderStatus; result.DoneAt = p29.DoneAt; result.OrderAt = p29.OrderAt; result.PreparingMinute = p29.PreparingMinute; result.DiscountCode = p29.DiscountCode; result.Id = p29.Id; return result; } public static Expression> ProjectToSDto => p31 => new OrderSDto() { TotalPrice = (long)p31.TotalPrice, DeliveryPrice = (long)p31.DeliveryPrice, TaxesPrice = (long)p31.TaxesPrice, ServicePrice = (long)p31.ServicePrice, PackingPrice = (long)p31.PackingPrice, TotalProductsPrice = (long)p31.TotalProductsPrice, DiscountPrice = (long)p31.DiscountPrice, IsPayed = p31.IsPayed, OrderStatus = p31.OrderStatus, DoneAt = p31.DoneAt, OrderAt = p31.OrderAt, PreparingMinute = p31.PreparingMinute, DiscountCode = p31.DiscountCode, Id = p31.Id }; private static List funcMain1(List p2) { if (p2 == null) { return null; } List result = new List(p2.Count); int i = 0; int len = p2.Count; while (i < len) { OrderProductSDto item = p2[i]; result.Add(item == null ? null : new OrderProduct() { Count = item.Count, ProductFee = (double)item.ProductFee, ProductCost = (double)item.ProductCost, OrderProductStatus = item.OrderProductStatus, ProductId = item.ProductId, OrderId = item.OrderId, Id = item.Id }); i++; } return result; } private static List funcMain2(List p3) { if (p3 == null) { return null; } List result = new List(p3.Count); int i = 0; int len = p3.Count; while (i < len) { OrderDeliverySDto item = p3[i]; result.Add(item == null ? null : new OrderDelivery() { Address = item.Address, PostalCode = item.PostalCode, ReceiverPhoneNumber = item.ReceiverPhoneNumber, ReceiverFullName = item.ReceiverFullName, ShippingId = item.ShippingId, OrderId = item.OrderId, Id = item.Id }); i++; } return result; } private static List funcMain3(List p6, List p7) { if (p6 == null) { return null; } List result = new List(p6.Count); int i = 0; int len = p6.Count; while (i < len) { OrderProductSDto item = p6[i]; result.Add(item == null ? null : new OrderProduct() { Count = item.Count, ProductFee = (double)item.ProductFee, ProductCost = (double)item.ProductCost, OrderProductStatus = item.OrderProductStatus, ProductId = item.ProductId, OrderId = item.OrderId, Id = item.Id }); i++; } return result; } private static List funcMain4(List p8, List p9) { if (p8 == null) { return null; } List result = new List(p8.Count); int i = 0; int len = p8.Count; while (i < len) { OrderDeliverySDto item = p8[i]; result.Add(item == null ? null : new OrderDelivery() { Address = item.Address, PostalCode = item.PostalCode, ReceiverPhoneNumber = item.ReceiverPhoneNumber, ReceiverFullName = item.ReceiverFullName, ShippingId = item.ShippingId, OrderId = item.OrderId, Id = item.Id }); i++; } return result; } private static List funcMain5(List p14) { if (p14 == null) { return null; } List result = new List(p14.Count); int i = 0; int len = p14.Count; while (i < len) { OrderProduct item = p14[i]; result.Add(item == null ? null : new OrderProductSDto() { Count = item.Count, ProductFee = (float)item.ProductFee, ProductCost = (float)item.ProductCost, OrderProductStatus = item.OrderProductStatus, ProductId = item.ProductId, OrderId = item.OrderId, Id = item.Id }); i++; } return result; } private static List funcMain6(List p15) { if (p15 == null) { return null; } List result = new List(p15.Count); int i = 0; int len = p15.Count; while (i < len) { OrderDelivery item = p15[i]; result.Add(item == null ? null : new OrderDeliverySDto() { Address = item.Address, PostalCode = item.PostalCode, ReceiverPhoneNumber = item.ReceiverPhoneNumber, ReceiverFullName = item.ReceiverFullName, OrderId = item.OrderId, ShippingId = item.ShippingId, Id = item.Id }); i++; } return result; } private static List funcMain7(List p18, List p19) { if (p18 == null) { return null; } List result = new List(p18.Count); int i = 0; int len = p18.Count; while (i < len) { OrderProduct item = p18[i]; result.Add(item == null ? null : new OrderProductSDto() { Count = item.Count, ProductFee = (float)item.ProductFee, ProductCost = (float)item.ProductCost, OrderProductStatus = item.OrderProductStatus, ProductId = item.ProductId, OrderId = item.OrderId, Id = item.Id }); i++; } return result; } private static List funcMain8(List p20, List p21) { if (p20 == null) { return null; } List result = new List(p20.Count); int i = 0; int len = p20.Count; while (i < len) { OrderDelivery item = p20[i]; result.Add(item == null ? null : new OrderDeliverySDto() { Address = item.Address, PostalCode = item.PostalCode, ReceiverPhoneNumber = item.ReceiverPhoneNumber, ReceiverFullName = item.ReceiverFullName, OrderId = item.OrderId, ShippingId = item.ShippingId, Id = item.Id }); i++; } return result; } } }