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