866 lines
38 KiB
C#
866 lines
38 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Linq.Expressions;
|
|
using Mapster.Models;
|
|
using Netina.Domain.Dtos.LargDtos;
|
|
using Netina.Domain.Dtos.SmallDtos;
|
|
using Netina.Domain.Entities.Accounting;
|
|
using Netina.Domain.Entities.Orders;
|
|
using Netina.Domain.Entities.Products;
|
|
using Netina.Domain.Entities.Users;
|
|
using Netina.Domain.Entities.Warehouses;
|
|
|
|
namespace Netina.Domain.Mappers
|
|
{
|
|
public static partial class OrderMapper
|
|
{
|
|
public static Order AdaptToOrder(this OrderLDto p1)
|
|
{
|
|
return p1 == null ? null : new Order()
|
|
{
|
|
FactorCode = p1.FactorCode,
|
|
TotalProductsPrice = (double)p1.TotalProductsPrice,
|
|
PackingPrice = (double)p1.PackingPrice,
|
|
ServicePrice = (double)p1.ServicePrice,
|
|
DeliveryPrice = (double)p1.DeliveryPrice,
|
|
DiscountPrice = (double)p1.DiscountPrice,
|
|
DiscountCodePrice = p1.DiscountCodePrice,
|
|
ProductDiscountPrice = p1.ProductDiscountPrice,
|
|
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,
|
|
CustomerId = p1.CustomerId,
|
|
Customer = new Customer() {Id = p1.CustomerId},
|
|
OrderDelivery = p1.OrderDelivery == null ? null : new OrderDelivery()
|
|
{
|
|
AddressId = p1.OrderDelivery.AddressId,
|
|
Address = p1.OrderDelivery.Address == null ? null : (UserAddress)Convert.ChangeType((object)p1.OrderDelivery.Address, typeof(UserAddress)),
|
|
DeliveryCost = p1.OrderDelivery.DeliveryCost,
|
|
TrackingCode = p1.OrderDelivery.TrackingCode,
|
|
ShippingId = p1.OrderDelivery.ShippingId,
|
|
Shipping = new Shipping() {Id = p1.OrderDelivery.ShippingId},
|
|
OrderId = p1.OrderDelivery.OrderId,
|
|
Order = new Order() {Id = p1.OrderDelivery.OrderId},
|
|
Id = p1.OrderDelivery.Id,
|
|
CreatedAt = p1.OrderDelivery.CreatedAt
|
|
},
|
|
OrderProducts = funcMain1(p1.OrderProducts),
|
|
Payments = funcMain2(p1.Payments),
|
|
Id = p1.Id,
|
|
CreatedAt = p1.CreatedAt
|
|
};
|
|
}
|
|
public static Order AdaptTo(this OrderLDto p4, Order p5)
|
|
{
|
|
if (p4 == null)
|
|
{
|
|
return null;
|
|
}
|
|
Order result = p5 ?? new Order();
|
|
|
|
result.FactorCode = p4.FactorCode;
|
|
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.DiscountCodePrice = p4.DiscountCodePrice;
|
|
result.ProductDiscountPrice = p4.ProductDiscountPrice;
|
|
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.CustomerId = p4.CustomerId;
|
|
result.Customer = funcMain3(new Never(), result.Customer, p4);
|
|
result.OrderDelivery = funcMain4(p4.OrderDelivery, result.OrderDelivery);
|
|
result.OrderProducts = funcMain7(p4.OrderProducts, result.OrderProducts);
|
|
result.Payments = funcMain8(p4.Payments, result.Payments);
|
|
result.Id = p4.Id;
|
|
result.CreatedAt = p4.CreatedAt;
|
|
return result;
|
|
|
|
}
|
|
public static Expression<Func<OrderLDto, Order>> ProjectToOrder => p18 => new Order()
|
|
{
|
|
FactorCode = p18.FactorCode,
|
|
TotalProductsPrice = (double)p18.TotalProductsPrice,
|
|
PackingPrice = (double)p18.PackingPrice,
|
|
ServicePrice = (double)p18.ServicePrice,
|
|
DeliveryPrice = (double)p18.DeliveryPrice,
|
|
DiscountPrice = (double)p18.DiscountPrice,
|
|
DiscountCodePrice = p18.DiscountCodePrice,
|
|
ProductDiscountPrice = p18.ProductDiscountPrice,
|
|
TaxesPrice = (double)p18.TaxesPrice,
|
|
TotalPrice = (double)p18.TotalPrice,
|
|
IsPayed = p18.IsPayed,
|
|
OrderStatus = p18.OrderStatus,
|
|
DoneAt = p18.DoneAt,
|
|
OrderAt = p18.OrderAt,
|
|
PreparingMinute = p18.PreparingMinute,
|
|
DiscountCode = p18.DiscountCode,
|
|
CustomerId = p18.CustomerId,
|
|
Customer = new Customer() {Id = p18.CustomerId},
|
|
OrderDelivery = p18.OrderDelivery == null ? null : new OrderDelivery()
|
|
{
|
|
AddressId = p18.OrderDelivery.AddressId,
|
|
Address = p18.OrderDelivery.Address == null ? null : (UserAddress)Convert.ChangeType((object)p18.OrderDelivery.Address, typeof(UserAddress)),
|
|
DeliveryCost = p18.OrderDelivery.DeliveryCost,
|
|
TrackingCode = p18.OrderDelivery.TrackingCode,
|
|
ShippingId = p18.OrderDelivery.ShippingId,
|
|
Shipping = new Shipping() {Id = p18.OrderDelivery.ShippingId},
|
|
OrderId = p18.OrderDelivery.OrderId,
|
|
Order = new Order() {Id = p18.OrderDelivery.OrderId},
|
|
Id = p18.OrderDelivery.Id,
|
|
CreatedAt = p18.OrderDelivery.CreatedAt
|
|
},
|
|
OrderProducts = p18.OrderProducts.Select<OrderProductSDto, OrderProduct>(p19 => new OrderProduct()
|
|
{
|
|
Count = p19.Count,
|
|
ProductFee = p19.ProductFee,
|
|
ProductFeeWithDiscount = p19.ProductFeeWithDiscount,
|
|
HasDiscount = p19.HasDiscount,
|
|
ProductCost = p19.ProductCost,
|
|
PackingFee = p19.PackingFee,
|
|
PackingCost = p19.PackingCost,
|
|
OrderProductStatus = p19.OrderProductStatus,
|
|
ProductId = p19.ProductId,
|
|
Product = new Product()
|
|
{
|
|
Cost = p19.ProductCost,
|
|
Id = p19.ProductId
|
|
},
|
|
OrderId = p19.OrderId,
|
|
Order = new Order() {Id = p19.OrderId},
|
|
Id = p19.Id,
|
|
CreatedAt = p19.CreatedAt
|
|
}).ToList<OrderProduct>(),
|
|
Payments = p18.Payments.Select<PaymentSDto, Payment>(p20 => new Payment()
|
|
{
|
|
FactorNumber = p20.FactorNumber,
|
|
Amount = p20.Amount,
|
|
Description = p20.Description,
|
|
TransactionCode = p20.TransactionCode,
|
|
CardPan = p20.CardPan,
|
|
Authority = p20.Authority,
|
|
Type = p20.Type,
|
|
Status = p20.Status,
|
|
OrderId = p20.OrderId,
|
|
Order = new Order() {Id = p20.OrderId},
|
|
CustomerId = p20.CustomerId,
|
|
Customer = new Customer() {Id = p20.CustomerId},
|
|
Id = p20.Id,
|
|
CreatedAt = p20.CreatedAt
|
|
}).ToList<Payment>(),
|
|
Id = p18.Id,
|
|
CreatedAt = p18.CreatedAt
|
|
};
|
|
public static OrderLDto AdaptToLDto(this Order p21)
|
|
{
|
|
return p21 == null ? null : new OrderLDto()
|
|
{
|
|
FactorCode = p21.FactorCode,
|
|
TotalPrice = (long)p21.TotalPrice,
|
|
DeliveryPrice = (long)p21.DeliveryPrice,
|
|
TaxesPrice = (long)p21.TaxesPrice,
|
|
ServicePrice = (long)p21.ServicePrice,
|
|
PackingPrice = (long)p21.PackingPrice,
|
|
TotalProductsPrice = (long)p21.TotalProductsPrice,
|
|
DiscountCodePrice = p21.DiscountCodePrice,
|
|
ProductDiscountPrice = p21.ProductDiscountPrice,
|
|
DiscountPrice = (long)p21.DiscountPrice,
|
|
IsPayed = p21.IsPayed,
|
|
OrderStatus = p21.OrderStatus,
|
|
DoneAt = p21.DoneAt,
|
|
OrderAt = p21.OrderAt,
|
|
PreparingMinute = p21.PreparingMinute,
|
|
DiscountCode = p21.DiscountCode,
|
|
CustomerId = p21.CustomerId,
|
|
CustomerFullName = p21.Customer != null && p21.Customer.User != null ? p21.Customer.User.FirstName + " " + p21.Customer.User.LastName : string.Empty,
|
|
CustomerPhoneNumber = p21.Customer != null && p21.Customer.User != null ? p21.Customer.User.PhoneNumber : string.Empty,
|
|
OrderProducts = funcMain9(p21.OrderProducts),
|
|
Payments = funcMain10(p21.Payments),
|
|
OrderDelivery = p21.OrderDelivery == null ? null : new OrderDeliverySDto()
|
|
{
|
|
Province = p21.OrderDelivery.Address != null ? p21.OrderDelivery.Address.Province : string.Empty,
|
|
City = p21.OrderDelivery.Address != null ? p21.OrderDelivery.Address.City : string.Empty,
|
|
Plaque = p21.OrderDelivery.Address != null ? p21.OrderDelivery.Address.Plaque : string.Empty,
|
|
LocationLat = p21.OrderDelivery.Address != null ? p21.OrderDelivery.Address.LocationLat : 0f,
|
|
LocationLong = p21.OrderDelivery.Address != null ? p21.OrderDelivery.Address.LocationLong : 0f,
|
|
Address = p21.OrderDelivery.Address != null ? p21.OrderDelivery.Address.Address : string.Empty,
|
|
PostalCode = p21.OrderDelivery.Address != null ? p21.OrderDelivery.Address.PostalCode : string.Empty,
|
|
TrackingCode = p21.OrderDelivery.TrackingCode,
|
|
ReceiverPhoneNumber = p21.OrderDelivery.Address != null ? p21.OrderDelivery.Address.ReceiverPhoneNumber : string.Empty,
|
|
ReceiverFullName = p21.OrderDelivery.Address != null ? p21.OrderDelivery.Address.ReceiverFullName : string.Empty,
|
|
ShippingMethod = p21.OrderDelivery.Shipping != null ? p21.OrderDelivery.Shipping.Name : string.Empty,
|
|
DeliveryCost = p21.OrderDelivery.DeliveryCost,
|
|
AddressId = p21.OrderDelivery.AddressId,
|
|
OrderId = p21.OrderDelivery.OrderId,
|
|
ShippingId = p21.OrderDelivery.ShippingId,
|
|
Id = p21.OrderDelivery.Id,
|
|
CreatedAt = p21.OrderDelivery.CreatedAt
|
|
},
|
|
Id = p21.Id,
|
|
CreatedAt = p21.CreatedAt
|
|
};
|
|
}
|
|
public static OrderLDto AdaptTo(this Order p24, OrderLDto p25)
|
|
{
|
|
if (p24 == null)
|
|
{
|
|
return null;
|
|
}
|
|
OrderLDto result = p25 ?? new OrderLDto();
|
|
|
|
result.FactorCode = p24.FactorCode;
|
|
result.TotalPrice = (long)p24.TotalPrice;
|
|
result.DeliveryPrice = (long)p24.DeliveryPrice;
|
|
result.TaxesPrice = (long)p24.TaxesPrice;
|
|
result.ServicePrice = (long)p24.ServicePrice;
|
|
result.PackingPrice = (long)p24.PackingPrice;
|
|
result.TotalProductsPrice = (long)p24.TotalProductsPrice;
|
|
result.DiscountCodePrice = p24.DiscountCodePrice;
|
|
result.ProductDiscountPrice = p24.ProductDiscountPrice;
|
|
result.DiscountPrice = (long)p24.DiscountPrice;
|
|
result.IsPayed = p24.IsPayed;
|
|
result.OrderStatus = p24.OrderStatus;
|
|
result.DoneAt = p24.DoneAt;
|
|
result.OrderAt = p24.OrderAt;
|
|
result.PreparingMinute = p24.PreparingMinute;
|
|
result.DiscountCode = p24.DiscountCode;
|
|
result.CustomerId = p24.CustomerId;
|
|
result.CustomerFullName = p24.Customer != null && p24.Customer.User != null ? p24.Customer.User.FirstName + " " + p24.Customer.User.LastName : string.Empty;
|
|
result.CustomerPhoneNumber = p24.Customer != null && p24.Customer.User != null ? p24.Customer.User.PhoneNumber : string.Empty;
|
|
result.OrderProducts = funcMain11(p24.OrderProducts, result.OrderProducts);
|
|
result.Payments = funcMain12(p24.Payments, result.Payments);
|
|
result.OrderDelivery = funcMain13(p24.OrderDelivery, result.OrderDelivery);
|
|
result.Id = p24.Id;
|
|
result.CreatedAt = p24.CreatedAt;
|
|
return result;
|
|
|
|
}
|
|
public static Expression<Func<Order, OrderLDto>> ProjectToLDto => p32 => new OrderLDto()
|
|
{
|
|
FactorCode = p32.FactorCode,
|
|
TotalPrice = (long)p32.TotalPrice,
|
|
DeliveryPrice = (long)p32.DeliveryPrice,
|
|
TaxesPrice = (long)p32.TaxesPrice,
|
|
ServicePrice = (long)p32.ServicePrice,
|
|
PackingPrice = (long)p32.PackingPrice,
|
|
TotalProductsPrice = (long)p32.TotalProductsPrice,
|
|
DiscountCodePrice = p32.DiscountCodePrice,
|
|
ProductDiscountPrice = p32.ProductDiscountPrice,
|
|
DiscountPrice = (long)p32.DiscountPrice,
|
|
IsPayed = p32.IsPayed,
|
|
OrderStatus = p32.OrderStatus,
|
|
DoneAt = p32.DoneAt,
|
|
OrderAt = p32.OrderAt,
|
|
PreparingMinute = p32.PreparingMinute,
|
|
DiscountCode = p32.DiscountCode,
|
|
CustomerId = p32.CustomerId,
|
|
CustomerFullName = p32.Customer != null && p32.Customer.User != null ? p32.Customer.User.FirstName + " " + p32.Customer.User.LastName : string.Empty,
|
|
CustomerPhoneNumber = p32.Customer != null && p32.Customer.User != null ? p32.Customer.User.PhoneNumber : string.Empty,
|
|
OrderProducts = p32.OrderProducts.Select<OrderProduct, OrderProductSDto>(p33 => new OrderProductSDto()
|
|
{
|
|
Count = p33.Count,
|
|
ProductFee = p33.ProductFee,
|
|
ProductFeeWithDiscount = p33.ProductFeeWithDiscount,
|
|
HasDiscount = p33.HasDiscount,
|
|
ProductCost = p33.ProductCost,
|
|
PackingFee = p33.PackingFee,
|
|
PackingCost = p33.PackingCost,
|
|
OrderProductStatus = p33.OrderProductStatus,
|
|
ProductId = p33.ProductId,
|
|
ProductName = p33.Product != null ? p33.Product.PersianName : string.Empty,
|
|
OrderId = p33.OrderId,
|
|
Id = p33.Id,
|
|
CreatedAt = p33.CreatedAt
|
|
}).ToList<OrderProductSDto>(),
|
|
Payments = p32.Payments.Select<Payment, PaymentSDto>(p34 => new PaymentSDto()
|
|
{
|
|
FactorNumber = p34.FactorNumber,
|
|
Amount = p34.Amount,
|
|
Description = p34.Description,
|
|
TransactionCode = p34.TransactionCode,
|
|
CardPan = p34.CardPan,
|
|
Authority = p34.Authority,
|
|
Type = p34.Type,
|
|
Status = p34.Status,
|
|
OrderId = p34.OrderId,
|
|
CustomerId = p34.CustomerId,
|
|
CustomerFullName = p34.Customer != null && p34.Customer.User != null ? p34.Customer.User.FirstName + " " + p34.Customer.User.LastName : string.Empty,
|
|
CustomerPhoneNumber = p34.Customer != null && p34.Customer.User != null ? p34.Customer.User.PhoneNumber : string.Empty,
|
|
Id = p34.Id,
|
|
CreatedAt = p34.CreatedAt
|
|
}).ToList<PaymentSDto>(),
|
|
OrderDelivery = p32.OrderDelivery == null ? null : new OrderDeliverySDto()
|
|
{
|
|
Province = p32.OrderDelivery.Address != null ? p32.OrderDelivery.Address.Province : string.Empty,
|
|
City = p32.OrderDelivery.Address != null ? p32.OrderDelivery.Address.City : string.Empty,
|
|
Plaque = p32.OrderDelivery.Address != null ? p32.OrderDelivery.Address.Plaque : string.Empty,
|
|
LocationLat = p32.OrderDelivery.Address != null ? p32.OrderDelivery.Address.LocationLat : 0f,
|
|
LocationLong = p32.OrderDelivery.Address != null ? p32.OrderDelivery.Address.LocationLong : 0f,
|
|
Address = p32.OrderDelivery.Address != null ? p32.OrderDelivery.Address.Address : string.Empty,
|
|
PostalCode = p32.OrderDelivery.Address != null ? p32.OrderDelivery.Address.PostalCode : string.Empty,
|
|
TrackingCode = p32.OrderDelivery.TrackingCode,
|
|
ReceiverPhoneNumber = p32.OrderDelivery.Address != null ? p32.OrderDelivery.Address.ReceiverPhoneNumber : string.Empty,
|
|
ReceiverFullName = p32.OrderDelivery.Address != null ? p32.OrderDelivery.Address.ReceiverFullName : string.Empty,
|
|
ShippingMethod = p32.OrderDelivery.Shipping != null ? p32.OrderDelivery.Shipping.Name : string.Empty,
|
|
DeliveryCost = p32.OrderDelivery.DeliveryCost,
|
|
AddressId = p32.OrderDelivery.AddressId,
|
|
OrderId = p32.OrderDelivery.OrderId,
|
|
ShippingId = p32.OrderDelivery.ShippingId,
|
|
Id = p32.OrderDelivery.Id,
|
|
CreatedAt = p32.OrderDelivery.CreatedAt
|
|
},
|
|
Id = p32.Id,
|
|
CreatedAt = p32.CreatedAt
|
|
};
|
|
public static Order AdaptToOrder(this OrderSDto p35)
|
|
{
|
|
return p35 == null ? null : new Order()
|
|
{
|
|
FactorCode = p35.FactorCode,
|
|
TotalProductsPrice = p35.TotalProductsPrice,
|
|
PackingPrice = p35.PackingPrice,
|
|
ServicePrice = p35.ServicePrice,
|
|
DeliveryPrice = p35.DeliveryPrice,
|
|
DiscountPrice = p35.DiscountPrice,
|
|
DiscountCodePrice = p35.DiscountCodePrice,
|
|
ProductDiscountPrice = p35.ProductDiscountPrice,
|
|
TaxesPrice = p35.TaxesPrice,
|
|
TotalPrice = p35.TotalPrice,
|
|
IsPayed = p35.IsPayed,
|
|
OrderStatus = p35.OrderStatus,
|
|
DoneAt = p35.DoneAt,
|
|
OrderAt = p35.OrderAt,
|
|
PayedAt = p35.PayedAt,
|
|
PreparingMinute = p35.PreparingMinute,
|
|
DiscountCode = p35.DiscountCode,
|
|
CustomerId = p35.CustomerId,
|
|
Customer = new Customer() {Id = p35.CustomerId},
|
|
Id = p35.Id,
|
|
CreatedAt = p35.CreatedAt
|
|
};
|
|
}
|
|
public static Order AdaptTo(this OrderSDto p36, Order p37)
|
|
{
|
|
if (p36 == null)
|
|
{
|
|
return null;
|
|
}
|
|
Order result = p37 ?? new Order();
|
|
|
|
result.FactorCode = p36.FactorCode;
|
|
result.TotalProductsPrice = p36.TotalProductsPrice;
|
|
result.PackingPrice = p36.PackingPrice;
|
|
result.ServicePrice = p36.ServicePrice;
|
|
result.DeliveryPrice = p36.DeliveryPrice;
|
|
result.DiscountPrice = p36.DiscountPrice;
|
|
result.DiscountCodePrice = p36.DiscountCodePrice;
|
|
result.ProductDiscountPrice = p36.ProductDiscountPrice;
|
|
result.TaxesPrice = p36.TaxesPrice;
|
|
result.TotalPrice = p36.TotalPrice;
|
|
result.IsPayed = p36.IsPayed;
|
|
result.OrderStatus = p36.OrderStatus;
|
|
result.DoneAt = p36.DoneAt;
|
|
result.OrderAt = p36.OrderAt;
|
|
result.PayedAt = p36.PayedAt;
|
|
result.PreparingMinute = p36.PreparingMinute;
|
|
result.DiscountCode = p36.DiscountCode;
|
|
result.CustomerId = p36.CustomerId;
|
|
result.Customer = funcMain14(new Never(), result.Customer, p36);
|
|
result.Id = p36.Id;
|
|
result.CreatedAt = p36.CreatedAt;
|
|
return result;
|
|
|
|
}
|
|
public static OrderSDto AdaptToSDto(this Order p40)
|
|
{
|
|
return p40 == null ? null : new OrderSDto()
|
|
{
|
|
TotalPrice = p40.TotalPrice,
|
|
FactorCode = p40.FactorCode,
|
|
DeliveryPrice = p40.DeliveryPrice,
|
|
TaxesPrice = p40.TaxesPrice,
|
|
ServicePrice = p40.ServicePrice,
|
|
PackingPrice = p40.PackingPrice,
|
|
TotalProductsPrice = p40.TotalProductsPrice,
|
|
DiscountPrice = p40.DiscountPrice,
|
|
DiscountCodePrice = p40.DiscountCodePrice,
|
|
ProductDiscountPrice = p40.ProductDiscountPrice,
|
|
IsPayed = p40.IsPayed,
|
|
OrderStatus = p40.OrderStatus,
|
|
PayedAt = p40.PayedAt,
|
|
DoneAt = p40.DoneAt,
|
|
OrderAt = p40.OrderAt,
|
|
PreparingMinute = p40.PreparingMinute,
|
|
DiscountCode = p40.DiscountCode,
|
|
CustomerFullName = p40.Customer != null && p40.Customer.User != null ? p40.Customer.User.FirstName + " " + p40.Customer.User.LastName : string.Empty,
|
|
CustomerPhoneNumber = p40.Customer != null && p40.Customer.User != null ? p40.Customer.User.PhoneNumber : string.Empty,
|
|
CustomerId = p40.CustomerId,
|
|
DeliveryTrackingCode = p40.OrderDelivery != null ? p40.OrderDelivery.TrackingCode : string.Empty,
|
|
Id = p40.Id,
|
|
CreatedAt = p40.CreatedAt
|
|
};
|
|
}
|
|
public static OrderSDto AdaptTo(this Order p41, OrderSDto p42)
|
|
{
|
|
if (p41 == null)
|
|
{
|
|
return null;
|
|
}
|
|
OrderSDto result = p42 ?? new OrderSDto();
|
|
|
|
result.TotalPrice = p41.TotalPrice;
|
|
result.FactorCode = p41.FactorCode;
|
|
result.DeliveryPrice = p41.DeliveryPrice;
|
|
result.TaxesPrice = p41.TaxesPrice;
|
|
result.ServicePrice = p41.ServicePrice;
|
|
result.PackingPrice = p41.PackingPrice;
|
|
result.TotalProductsPrice = p41.TotalProductsPrice;
|
|
result.DiscountPrice = p41.DiscountPrice;
|
|
result.DiscountCodePrice = p41.DiscountCodePrice;
|
|
result.ProductDiscountPrice = p41.ProductDiscountPrice;
|
|
result.IsPayed = p41.IsPayed;
|
|
result.OrderStatus = p41.OrderStatus;
|
|
result.PayedAt = p41.PayedAt;
|
|
result.DoneAt = p41.DoneAt;
|
|
result.OrderAt = p41.OrderAt;
|
|
result.PreparingMinute = p41.PreparingMinute;
|
|
result.DiscountCode = p41.DiscountCode;
|
|
result.CustomerFullName = p41.Customer != null && p41.Customer.User != null ? p41.Customer.User.FirstName + " " + p41.Customer.User.LastName : string.Empty;
|
|
result.CustomerPhoneNumber = p41.Customer != null && p41.Customer.User != null ? p41.Customer.User.PhoneNumber : string.Empty;
|
|
result.CustomerId = p41.CustomerId;
|
|
result.DeliveryTrackingCode = p41.OrderDelivery != null ? p41.OrderDelivery.TrackingCode : string.Empty;
|
|
result.Id = p41.Id;
|
|
result.CreatedAt = p41.CreatedAt;
|
|
return result;
|
|
|
|
}
|
|
public static Expression<Func<Order, OrderSDto>> ProjectToSDto => p43 => new OrderSDto()
|
|
{
|
|
TotalPrice = p43.TotalPrice,
|
|
FactorCode = p43.FactorCode,
|
|
DeliveryPrice = p43.DeliveryPrice,
|
|
TaxesPrice = p43.TaxesPrice,
|
|
ServicePrice = p43.ServicePrice,
|
|
PackingPrice = p43.PackingPrice,
|
|
TotalProductsPrice = p43.TotalProductsPrice,
|
|
DiscountPrice = p43.DiscountPrice,
|
|
DiscountCodePrice = p43.DiscountCodePrice,
|
|
ProductDiscountPrice = p43.ProductDiscountPrice,
|
|
IsPayed = p43.IsPayed,
|
|
OrderStatus = p43.OrderStatus,
|
|
PayedAt = p43.PayedAt,
|
|
DoneAt = p43.DoneAt,
|
|
OrderAt = p43.OrderAt,
|
|
PreparingMinute = p43.PreparingMinute,
|
|
DiscountCode = p43.DiscountCode,
|
|
CustomerFullName = p43.Customer != null && p43.Customer.User != null ? p43.Customer.User.FirstName + " " + p43.Customer.User.LastName : string.Empty,
|
|
CustomerPhoneNumber = p43.Customer != null && p43.Customer.User != null ? p43.Customer.User.PhoneNumber : string.Empty,
|
|
CustomerId = p43.CustomerId,
|
|
DeliveryTrackingCode = p43.OrderDelivery != null ? p43.OrderDelivery.TrackingCode : string.Empty,
|
|
Id = p43.Id,
|
|
CreatedAt = p43.CreatedAt
|
|
};
|
|
|
|
private static List<OrderProduct> funcMain1(List<OrderProductSDto> p2)
|
|
{
|
|
if (p2 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<OrderProduct> result = new List<OrderProduct>(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 = item.ProductFee,
|
|
ProductFeeWithDiscount = item.ProductFeeWithDiscount,
|
|
HasDiscount = item.HasDiscount,
|
|
ProductCost = item.ProductCost,
|
|
PackingFee = item.PackingFee,
|
|
PackingCost = item.PackingCost,
|
|
OrderProductStatus = item.OrderProductStatus,
|
|
ProductId = item.ProductId,
|
|
Product = new Product()
|
|
{
|
|
Cost = item.ProductCost,
|
|
Id = item.ProductId
|
|
},
|
|
OrderId = item.OrderId,
|
|
Order = new Order() {Id = item.OrderId},
|
|
Id = item.Id,
|
|
CreatedAt = item.CreatedAt
|
|
});
|
|
i++;
|
|
}
|
|
return result;
|
|
|
|
}
|
|
|
|
private static List<Payment> funcMain2(List<PaymentSDto> p3)
|
|
{
|
|
if (p3 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<Payment> result = new List<Payment>(p3.Count);
|
|
|
|
int i = 0;
|
|
int len = p3.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
PaymentSDto item = p3[i];
|
|
result.Add(item == null ? null : new Payment()
|
|
{
|
|
FactorNumber = item.FactorNumber,
|
|
Amount = item.Amount,
|
|
Description = item.Description,
|
|
TransactionCode = item.TransactionCode,
|
|
CardPan = item.CardPan,
|
|
Authority = item.Authority,
|
|
Type = item.Type,
|
|
Status = item.Status,
|
|
OrderId = item.OrderId,
|
|
Order = new Order() {Id = item.OrderId},
|
|
CustomerId = item.CustomerId,
|
|
Customer = new Customer() {Id = item.CustomerId},
|
|
Id = item.Id,
|
|
CreatedAt = item.CreatedAt
|
|
});
|
|
i++;
|
|
}
|
|
return result;
|
|
|
|
}
|
|
|
|
private static Customer funcMain3(Never p6, Customer p7, OrderLDto p4)
|
|
{
|
|
Customer result = p7 ?? new Customer();
|
|
|
|
result.Id = p4.CustomerId;
|
|
return result;
|
|
|
|
}
|
|
|
|
private static OrderDelivery funcMain4(OrderDeliverySDto p8, OrderDelivery p9)
|
|
{
|
|
if (p8 == null)
|
|
{
|
|
return null;
|
|
}
|
|
OrderDelivery result = p9 ?? new OrderDelivery();
|
|
|
|
result.AddressId = p8.AddressId;
|
|
result.Address = p8.Address == null ? null : (UserAddress)Convert.ChangeType((object)p8.Address, typeof(UserAddress));
|
|
result.DeliveryCost = p8.DeliveryCost;
|
|
result.TrackingCode = p8.TrackingCode;
|
|
result.ShippingId = p8.ShippingId;
|
|
result.Shipping = funcMain5(new Never(), result.Shipping, p8);
|
|
result.OrderId = p8.OrderId;
|
|
result.Order = funcMain6(new Never(), result.Order, p8);
|
|
result.Id = p8.Id;
|
|
result.CreatedAt = p8.CreatedAt;
|
|
return result;
|
|
|
|
}
|
|
|
|
private static List<OrderProduct> funcMain7(List<OrderProductSDto> p14, List<OrderProduct> p15)
|
|
{
|
|
if (p14 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<OrderProduct> result = new List<OrderProduct>(p14.Count);
|
|
|
|
int i = 0;
|
|
int len = p14.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
OrderProductSDto item = p14[i];
|
|
result.Add(item == null ? null : new OrderProduct()
|
|
{
|
|
Count = item.Count,
|
|
ProductFee = item.ProductFee,
|
|
ProductFeeWithDiscount = item.ProductFeeWithDiscount,
|
|
HasDiscount = item.HasDiscount,
|
|
ProductCost = item.ProductCost,
|
|
PackingFee = item.PackingFee,
|
|
PackingCost = item.PackingCost,
|
|
OrderProductStatus = item.OrderProductStatus,
|
|
ProductId = item.ProductId,
|
|
Product = new Product()
|
|
{
|
|
Cost = item.ProductCost,
|
|
Id = item.ProductId
|
|
},
|
|
OrderId = item.OrderId,
|
|
Order = new Order() {Id = item.OrderId},
|
|
Id = item.Id,
|
|
CreatedAt = item.CreatedAt
|
|
});
|
|
i++;
|
|
}
|
|
return result;
|
|
|
|
}
|
|
|
|
private static List<Payment> funcMain8(List<PaymentSDto> p16, List<Payment> p17)
|
|
{
|
|
if (p16 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<Payment> result = new List<Payment>(p16.Count);
|
|
|
|
int i = 0;
|
|
int len = p16.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
PaymentSDto item = p16[i];
|
|
result.Add(item == null ? null : new Payment()
|
|
{
|
|
FactorNumber = item.FactorNumber,
|
|
Amount = item.Amount,
|
|
Description = item.Description,
|
|
TransactionCode = item.TransactionCode,
|
|
CardPan = item.CardPan,
|
|
Authority = item.Authority,
|
|
Type = item.Type,
|
|
Status = item.Status,
|
|
OrderId = item.OrderId,
|
|
Order = new Order() {Id = item.OrderId},
|
|
CustomerId = item.CustomerId,
|
|
Customer = new Customer() {Id = item.CustomerId},
|
|
Id = item.Id,
|
|
CreatedAt = item.CreatedAt
|
|
});
|
|
i++;
|
|
}
|
|
return result;
|
|
|
|
}
|
|
|
|
private static List<OrderProductSDto> funcMain9(List<OrderProduct> p22)
|
|
{
|
|
if (p22 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<OrderProductSDto> result = new List<OrderProductSDto>(p22.Count);
|
|
|
|
int i = 0;
|
|
int len = p22.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
OrderProduct item = p22[i];
|
|
result.Add(item == null ? null : new OrderProductSDto()
|
|
{
|
|
Count = item.Count,
|
|
ProductFee = item.ProductFee,
|
|
ProductFeeWithDiscount = item.ProductFeeWithDiscount,
|
|
HasDiscount = item.HasDiscount,
|
|
ProductCost = item.ProductCost,
|
|
PackingFee = item.PackingFee,
|
|
PackingCost = item.PackingCost,
|
|
OrderProductStatus = item.OrderProductStatus,
|
|
ProductId = item.ProductId,
|
|
ProductName = item.Product != null ? item.Product.PersianName : string.Empty,
|
|
OrderId = item.OrderId,
|
|
Id = item.Id,
|
|
CreatedAt = item.CreatedAt
|
|
});
|
|
i++;
|
|
}
|
|
return result;
|
|
|
|
}
|
|
|
|
private static List<PaymentSDto> funcMain10(List<Payment> p23)
|
|
{
|
|
if (p23 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<PaymentSDto> result = new List<PaymentSDto>(p23.Count);
|
|
|
|
int i = 0;
|
|
int len = p23.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
Payment item = p23[i];
|
|
result.Add(item == null ? null : new PaymentSDto()
|
|
{
|
|
FactorNumber = item.FactorNumber,
|
|
Amount = item.Amount,
|
|
Description = item.Description,
|
|
TransactionCode = item.TransactionCode,
|
|
CardPan = item.CardPan,
|
|
Authority = item.Authority,
|
|
Type = item.Type,
|
|
Status = item.Status,
|
|
OrderId = item.OrderId,
|
|
CustomerId = item.CustomerId,
|
|
CustomerFullName = item.Customer != null && item.Customer.User != null ? item.Customer.User.FirstName + " " + item.Customer.User.LastName : string.Empty,
|
|
CustomerPhoneNumber = item.Customer != null && item.Customer.User != null ? item.Customer.User.PhoneNumber : string.Empty,
|
|
Id = item.Id,
|
|
CreatedAt = item.CreatedAt
|
|
});
|
|
i++;
|
|
}
|
|
return result;
|
|
|
|
}
|
|
|
|
private static List<OrderProductSDto> funcMain11(List<OrderProduct> p26, List<OrderProductSDto> p27)
|
|
{
|
|
if (p26 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<OrderProductSDto> result = new List<OrderProductSDto>(p26.Count);
|
|
|
|
int i = 0;
|
|
int len = p26.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
OrderProduct item = p26[i];
|
|
result.Add(item == null ? null : new OrderProductSDto()
|
|
{
|
|
Count = item.Count,
|
|
ProductFee = item.ProductFee,
|
|
ProductFeeWithDiscount = item.ProductFeeWithDiscount,
|
|
HasDiscount = item.HasDiscount,
|
|
ProductCost = item.ProductCost,
|
|
PackingFee = item.PackingFee,
|
|
PackingCost = item.PackingCost,
|
|
OrderProductStatus = item.OrderProductStatus,
|
|
ProductId = item.ProductId,
|
|
ProductName = item.Product != null ? item.Product.PersianName : string.Empty,
|
|
OrderId = item.OrderId,
|
|
Id = item.Id,
|
|
CreatedAt = item.CreatedAt
|
|
});
|
|
i++;
|
|
}
|
|
return result;
|
|
|
|
}
|
|
|
|
private static List<PaymentSDto> funcMain12(List<Payment> p28, List<PaymentSDto> p29)
|
|
{
|
|
if (p28 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<PaymentSDto> result = new List<PaymentSDto>(p28.Count);
|
|
|
|
int i = 0;
|
|
int len = p28.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
Payment item = p28[i];
|
|
result.Add(item == null ? null : new PaymentSDto()
|
|
{
|
|
FactorNumber = item.FactorNumber,
|
|
Amount = item.Amount,
|
|
Description = item.Description,
|
|
TransactionCode = item.TransactionCode,
|
|
CardPan = item.CardPan,
|
|
Authority = item.Authority,
|
|
Type = item.Type,
|
|
Status = item.Status,
|
|
OrderId = item.OrderId,
|
|
CustomerId = item.CustomerId,
|
|
CustomerFullName = item.Customer != null && item.Customer.User != null ? item.Customer.User.FirstName + " " + item.Customer.User.LastName : string.Empty,
|
|
CustomerPhoneNumber = item.Customer != null && item.Customer.User != null ? item.Customer.User.PhoneNumber : string.Empty,
|
|
Id = item.Id,
|
|
CreatedAt = item.CreatedAt
|
|
});
|
|
i++;
|
|
}
|
|
return result;
|
|
|
|
}
|
|
|
|
private static OrderDeliverySDto funcMain13(OrderDelivery p30, OrderDeliverySDto p31)
|
|
{
|
|
if (p30 == null)
|
|
{
|
|
return null;
|
|
}
|
|
OrderDeliverySDto result = p31 ?? new OrderDeliverySDto();
|
|
|
|
result.Province = p30.Address != null ? p30.Address.Province : string.Empty;
|
|
result.City = p30.Address != null ? p30.Address.City : string.Empty;
|
|
result.Plaque = p30.Address != null ? p30.Address.Plaque : string.Empty;
|
|
result.LocationLat = p30.Address != null ? p30.Address.LocationLat : 0f;
|
|
result.LocationLong = p30.Address != null ? p30.Address.LocationLong : 0f;
|
|
result.Address = p30.Address != null ? p30.Address.Address : string.Empty;
|
|
result.PostalCode = p30.Address != null ? p30.Address.PostalCode : string.Empty;
|
|
result.TrackingCode = p30.TrackingCode;
|
|
result.ReceiverPhoneNumber = p30.Address != null ? p30.Address.ReceiverPhoneNumber : string.Empty;
|
|
result.ReceiverFullName = p30.Address != null ? p30.Address.ReceiverFullName : string.Empty;
|
|
result.ShippingMethod = p30.Shipping != null ? p30.Shipping.Name : string.Empty;
|
|
result.DeliveryCost = p30.DeliveryCost;
|
|
result.AddressId = p30.AddressId;
|
|
result.OrderId = p30.OrderId;
|
|
result.ShippingId = p30.ShippingId;
|
|
result.Id = p30.Id;
|
|
result.CreatedAt = p30.CreatedAt;
|
|
return result;
|
|
|
|
}
|
|
|
|
private static Customer funcMain14(Never p38, Customer p39, OrderSDto p36)
|
|
{
|
|
Customer result = p39 ?? new Customer();
|
|
|
|
result.Id = p36.CustomerId;
|
|
return result;
|
|
|
|
}
|
|
|
|
private static Shipping funcMain5(Never p10, Shipping p11, OrderDeliverySDto p8)
|
|
{
|
|
Shipping result = p11 ?? new Shipping();
|
|
|
|
result.Id = p8.ShippingId;
|
|
return result;
|
|
|
|
}
|
|
|
|
private static Order funcMain6(Never p12, Order p13, OrderDeliverySDto p8)
|
|
{
|
|
Order result = p13 ?? new Order();
|
|
|
|
result.Id = p8.OrderId;
|
|
return result;
|
|
|
|
}
|
|
}
|
|
} |