874 lines
34 KiB
C#
874 lines
34 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,
|
|
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,
|
|
User = new ApplicationUser() {PhoneNumber = p1.UserPhoneNumber},
|
|
OrderProducts = funcMain1(p1.OrderProducts),
|
|
OrderDeliveries = funcMain2(p1.OrderDeliveries),
|
|
Payments = funcMain3(p1.Payments),
|
|
Id = p1.Id,
|
|
CreatedAt = p1.CreatedAt
|
|
};
|
|
}
|
|
public static Order AdaptTo(this OrderLDto p5, Order p6)
|
|
{
|
|
if (p5 == null)
|
|
{
|
|
return null;
|
|
}
|
|
Order result = p6 ?? new Order();
|
|
|
|
result.FactorCode = p5.FactorCode;
|
|
result.TotalProductsPrice = (double)p5.TotalProductsPrice;
|
|
result.PackingPrice = (double)p5.PackingPrice;
|
|
result.ServicePrice = (double)p5.ServicePrice;
|
|
result.DeliveryPrice = (double)p5.DeliveryPrice;
|
|
result.DiscountPrice = (double)p5.DiscountPrice;
|
|
result.TaxesPrice = (double)p5.TaxesPrice;
|
|
result.TotalPrice = (double)p5.TotalPrice;
|
|
result.IsPayed = p5.IsPayed;
|
|
result.OrderStatus = p5.OrderStatus;
|
|
result.DoneAt = p5.DoneAt;
|
|
result.OrderAt = p5.OrderAt;
|
|
result.PreparingMinute = p5.PreparingMinute;
|
|
result.DiscountCode = p5.DiscountCode;
|
|
result.User = funcMain4(new Never(), result.User, p5);
|
|
result.OrderProducts = funcMain5(p5.OrderProducts, result.OrderProducts);
|
|
result.OrderDeliveries = funcMain6(p5.OrderDeliveries, result.OrderDeliveries);
|
|
result.Payments = funcMain7(p5.Payments, result.Payments);
|
|
result.Id = p5.Id;
|
|
result.CreatedAt = p5.CreatedAt;
|
|
return result;
|
|
|
|
}
|
|
public static Expression<Func<OrderLDto, Order>> ProjectToOrder => p15 => new Order()
|
|
{
|
|
FactorCode = p15.FactorCode,
|
|
TotalProductsPrice = (double)p15.TotalProductsPrice,
|
|
PackingPrice = (double)p15.PackingPrice,
|
|
ServicePrice = (double)p15.ServicePrice,
|
|
DeliveryPrice = (double)p15.DeliveryPrice,
|
|
DiscountPrice = (double)p15.DiscountPrice,
|
|
TaxesPrice = (double)p15.TaxesPrice,
|
|
TotalPrice = (double)p15.TotalPrice,
|
|
IsPayed = p15.IsPayed,
|
|
OrderStatus = p15.OrderStatus,
|
|
DoneAt = p15.DoneAt,
|
|
OrderAt = p15.OrderAt,
|
|
PreparingMinute = p15.PreparingMinute,
|
|
DiscountCode = p15.DiscountCode,
|
|
User = new ApplicationUser() {PhoneNumber = p15.UserPhoneNumber},
|
|
OrderProducts = p15.OrderProducts.Select<OrderProductSDto, OrderProduct>(p16 => new OrderProduct()
|
|
{
|
|
Count = p16.Count,
|
|
ProductFee = p16.ProductFee,
|
|
ProductFeeWithDiscount = p16.ProductFeeWithDiscount,
|
|
HasDiscount = p16.HasDiscount,
|
|
ProductCost = p16.ProductCost,
|
|
PackingFee = p16.PackingFee,
|
|
PackingCost = p16.PackingCost,
|
|
OrderProductStatus = p16.OrderProductStatus,
|
|
ProductId = p16.ProductId,
|
|
Product = new Product()
|
|
{
|
|
Cost = p16.ProductCost,
|
|
Id = p16.ProductId
|
|
},
|
|
OrderId = p16.OrderId,
|
|
Order = new Order() {Id = p16.OrderId},
|
|
Id = p16.Id,
|
|
CreatedAt = p16.CreatedAt
|
|
}).ToList<OrderProduct>(),
|
|
OrderDeliveries = p15.OrderDeliveries.Select<OrderDeliverySDto, OrderDelivery>(p17 => new OrderDelivery()
|
|
{
|
|
Address = p17.Address,
|
|
PostalCode = p17.PostalCode,
|
|
ReceiverPhoneNumber = p17.ReceiverPhoneNumber,
|
|
ReceiverFullName = p17.ReceiverFullName,
|
|
ShippingId = p17.ShippingId,
|
|
Shipping = new Shipping() {Id = p17.ShippingId},
|
|
OrderId = p17.OrderId,
|
|
Order = new Order() {Id = p17.OrderId},
|
|
Id = p17.Id,
|
|
CreatedAt = p17.CreatedAt
|
|
}).ToList<OrderDelivery>(),
|
|
Payments = p15.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},
|
|
UserId = p18.UserId,
|
|
User = new ApplicationUser()
|
|
{
|
|
Id = p18.UserId,
|
|
PhoneNumber = p18.UserPhoneNumber
|
|
},
|
|
Id = p18.Id,
|
|
CreatedAt = p18.CreatedAt
|
|
}).ToList<Payment>(),
|
|
Id = p15.Id,
|
|
CreatedAt = p15.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,
|
|
DiscountPrice = (long)p19.DiscountPrice,
|
|
IsPayed = p19.IsPayed,
|
|
OrderStatus = p19.OrderStatus,
|
|
DoneAt = p19.DoneAt,
|
|
OrderAt = p19.OrderAt,
|
|
PreparingMinute = p19.PreparingMinute,
|
|
DiscountCode = p19.DiscountCode,
|
|
UserFullName = p19.User != null ? p19.User.FirstName + " " + p19.User.LastName : string.Empty,
|
|
UserPhoneNumber = p19.User != null ? p19.User.PhoneNumber : string.Empty,
|
|
OrderProducts = funcMain8(p19.OrderProducts),
|
|
OrderDeliveries = funcMain9(p19.OrderDeliveries),
|
|
Payments = funcMain10(p19.Payments),
|
|
Id = p19.Id,
|
|
CreatedAt = p19.CreatedAt
|
|
};
|
|
}
|
|
public static OrderLDto AdaptTo(this Order p23, OrderLDto p24)
|
|
{
|
|
if (p23 == null)
|
|
{
|
|
return null;
|
|
}
|
|
OrderLDto result = p24 ?? new OrderLDto();
|
|
|
|
result.FactorCode = p23.FactorCode;
|
|
result.TotalPrice = (long)p23.TotalPrice;
|
|
result.DeliveryPrice = (long)p23.DeliveryPrice;
|
|
result.TaxesPrice = (long)p23.TaxesPrice;
|
|
result.ServicePrice = (long)p23.ServicePrice;
|
|
result.PackingPrice = (long)p23.PackingPrice;
|
|
result.TotalProductsPrice = (long)p23.TotalProductsPrice;
|
|
result.DiscountPrice = (long)p23.DiscountPrice;
|
|
result.IsPayed = p23.IsPayed;
|
|
result.OrderStatus = p23.OrderStatus;
|
|
result.DoneAt = p23.DoneAt;
|
|
result.OrderAt = p23.OrderAt;
|
|
result.PreparingMinute = p23.PreparingMinute;
|
|
result.DiscountCode = p23.DiscountCode;
|
|
result.UserFullName = p23.User != null ? p23.User.FirstName + " " + p23.User.LastName : string.Empty;
|
|
result.UserPhoneNumber = p23.User != null ? p23.User.PhoneNumber : string.Empty;
|
|
result.OrderProducts = funcMain11(p23.OrderProducts, result.OrderProducts);
|
|
result.OrderDeliveries = funcMain12(p23.OrderDeliveries, result.OrderDeliveries);
|
|
result.Payments = funcMain13(p23.Payments, result.Payments);
|
|
result.Id = p23.Id;
|
|
result.CreatedAt = p23.CreatedAt;
|
|
return result;
|
|
|
|
}
|
|
public static Expression<Func<Order, OrderLDto>> ProjectToLDto => p31 => new OrderLDto()
|
|
{
|
|
FactorCode = p31.FactorCode,
|
|
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,
|
|
UserFullName = p31.User != null ? p31.User.FirstName + " " + p31.User.LastName : string.Empty,
|
|
UserPhoneNumber = p31.User != null ? p31.User.PhoneNumber : string.Empty,
|
|
OrderProducts = p31.OrderProducts.Select<OrderProduct, OrderProductSDto>(p32 => new OrderProductSDto()
|
|
{
|
|
Count = p32.Count,
|
|
ProductFee = p32.ProductFee,
|
|
ProductFeeWithDiscount = p32.ProductFeeWithDiscount,
|
|
HasDiscount = p32.HasDiscount,
|
|
ProductCost = p32.ProductCost,
|
|
PackingFee = p32.PackingFee,
|
|
PackingCost = p32.PackingCost,
|
|
OrderProductStatus = p32.OrderProductStatus,
|
|
ProductId = p32.ProductId,
|
|
ProductName = p32.Product != null ? p32.Product.PersianName : string.Empty,
|
|
OrderId = p32.OrderId,
|
|
Id = p32.Id,
|
|
CreatedAt = p32.CreatedAt
|
|
}).ToList<OrderProductSDto>(),
|
|
OrderDeliveries = p31.OrderDeliveries.Select<OrderDelivery, OrderDeliverySDto>(p33 => new OrderDeliverySDto()
|
|
{
|
|
Address = p33.Address,
|
|
PostalCode = p33.PostalCode,
|
|
ReceiverPhoneNumber = p33.ReceiverPhoneNumber,
|
|
ReceiverFullName = p33.ReceiverFullName,
|
|
ShippingMethod = p33.Shipping != null ? p33.Shipping.Name : string.Empty,
|
|
OrderId = p33.OrderId,
|
|
ShippingId = p33.ShippingId,
|
|
Id = p33.Id,
|
|
CreatedAt = p33.CreatedAt
|
|
}).ToList<OrderDeliverySDto>(),
|
|
Payments = p31.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,
|
|
UserId = p34.UserId,
|
|
UserFullName = p34.User != null ? p34.User.FirstName + " " + p34.User.LastName : string.Empty,
|
|
UserPhoneNumber = p34.User != null ? p34.User.PhoneNumber : string.Empty,
|
|
Id = p34.Id,
|
|
CreatedAt = p34.CreatedAt
|
|
}).ToList<PaymentSDto>(),
|
|
Id = p31.Id,
|
|
CreatedAt = p31.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,
|
|
TaxesPrice = p35.TaxesPrice,
|
|
TotalPrice = p35.TotalPrice,
|
|
IsPayed = p35.IsPayed,
|
|
PayedAt = p35.PayedAt,
|
|
OrderStatus = p35.OrderStatus,
|
|
DoneAt = p35.DoneAt,
|
|
OrderAt = p35.OrderAt,
|
|
PreparingMinute = p35.PreparingMinute,
|
|
DiscountCode = p35.DiscountCode,
|
|
UserId = p35.UserId,
|
|
User = new ApplicationUser()
|
|
{
|
|
Id = p35.UserId,
|
|
PhoneNumber = p35.UserPhoneNumber
|
|
},
|
|
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.TaxesPrice = p36.TaxesPrice;
|
|
result.TotalPrice = p36.TotalPrice;
|
|
result.IsPayed = p36.IsPayed;
|
|
result.PayedAt = p36.PayedAt;
|
|
result.OrderStatus = p36.OrderStatus;
|
|
result.DoneAt = p36.DoneAt;
|
|
result.OrderAt = p36.OrderAt;
|
|
result.PreparingMinute = p36.PreparingMinute;
|
|
result.DiscountCode = p36.DiscountCode;
|
|
result.UserId = p36.UserId;
|
|
result.User = funcMain14(new Never(), result.User, 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,
|
|
IsPayed = p40.IsPayed,
|
|
OrderStatus = p40.OrderStatus,
|
|
PayedAt = p40.PayedAt,
|
|
DoneAt = p40.DoneAt,
|
|
OrderAt = p40.OrderAt,
|
|
PreparingMinute = p40.PreparingMinute,
|
|
DiscountCode = p40.DiscountCode,
|
|
UserFullName = p40.User != null ? p40.User.FirstName + " " + p40.User.LastName : string.Empty,
|
|
UserPhoneNumber = p40.User != null ? p40.User.PhoneNumber : string.Empty,
|
|
UserId = p40.UserId,
|
|
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.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.UserFullName = p41.User != null ? p41.User.FirstName + " " + p41.User.LastName : string.Empty;
|
|
result.UserPhoneNumber = p41.User != null ? p41.User.PhoneNumber : string.Empty;
|
|
result.UserId = p41.UserId;
|
|
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,
|
|
IsPayed = p43.IsPayed,
|
|
OrderStatus = p43.OrderStatus,
|
|
PayedAt = p43.PayedAt,
|
|
DoneAt = p43.DoneAt,
|
|
OrderAt = p43.OrderAt,
|
|
PreparingMinute = p43.PreparingMinute,
|
|
DiscountCode = p43.DiscountCode,
|
|
UserFullName = p43.User != null ? p43.User.FirstName + " " + p43.User.LastName : string.Empty,
|
|
UserPhoneNumber = p43.User != null ? p43.User.PhoneNumber : string.Empty,
|
|
UserId = p43.UserId,
|
|
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<OrderDelivery> funcMain2(List<OrderDeliverySDto> p3)
|
|
{
|
|
if (p3 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<OrderDelivery> result = new List<OrderDelivery>(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,
|
|
Shipping = new Shipping() {Id = item.ShippingId},
|
|
OrderId = item.OrderId,
|
|
Order = new Order() {Id = item.OrderId},
|
|
Id = item.Id,
|
|
CreatedAt = item.CreatedAt
|
|
});
|
|
i++;
|
|
}
|
|
return result;
|
|
|
|
}
|
|
|
|
private static List<Payment> funcMain3(List<PaymentSDto> p4)
|
|
{
|
|
if (p4 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<Payment> result = new List<Payment>(p4.Count);
|
|
|
|
int i = 0;
|
|
int len = p4.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
PaymentSDto item = p4[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},
|
|
UserId = item.UserId,
|
|
User = new ApplicationUser()
|
|
{
|
|
Id = item.UserId,
|
|
PhoneNumber = item.UserPhoneNumber
|
|
},
|
|
Id = item.Id,
|
|
CreatedAt = item.CreatedAt
|
|
});
|
|
i++;
|
|
}
|
|
return result;
|
|
|
|
}
|
|
|
|
private static ApplicationUser funcMain4(Never p7, ApplicationUser p8, OrderLDto p5)
|
|
{
|
|
ApplicationUser result = p8 ?? new ApplicationUser();
|
|
|
|
result.PhoneNumber = p5.UserPhoneNumber;
|
|
return result;
|
|
|
|
}
|
|
|
|
private static List<OrderProduct> funcMain5(List<OrderProductSDto> p9, List<OrderProduct> p10)
|
|
{
|
|
if (p9 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<OrderProduct> result = new List<OrderProduct>(p9.Count);
|
|
|
|
int i = 0;
|
|
int len = p9.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
OrderProductSDto item = p9[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<OrderDelivery> funcMain6(List<OrderDeliverySDto> p11, List<OrderDelivery> p12)
|
|
{
|
|
if (p11 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<OrderDelivery> result = new List<OrderDelivery>(p11.Count);
|
|
|
|
int i = 0;
|
|
int len = p11.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
OrderDeliverySDto item = p11[i];
|
|
result.Add(item == null ? null : new OrderDelivery()
|
|
{
|
|
Address = item.Address,
|
|
PostalCode = item.PostalCode,
|
|
ReceiverPhoneNumber = item.ReceiverPhoneNumber,
|
|
ReceiverFullName = item.ReceiverFullName,
|
|
ShippingId = item.ShippingId,
|
|
Shipping = new Shipping() {Id = item.ShippingId},
|
|
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> p13, List<Payment> p14)
|
|
{
|
|
if (p13 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<Payment> result = new List<Payment>(p13.Count);
|
|
|
|
int i = 0;
|
|
int len = p13.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
PaymentSDto item = p13[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},
|
|
UserId = item.UserId,
|
|
User = new ApplicationUser()
|
|
{
|
|
Id = item.UserId,
|
|
PhoneNumber = item.UserPhoneNumber
|
|
},
|
|
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<OrderDeliverySDto> funcMain9(List<OrderDelivery> p21)
|
|
{
|
|
if (p21 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<OrderDeliverySDto> result = new List<OrderDeliverySDto>(p21.Count);
|
|
|
|
int i = 0;
|
|
int len = p21.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
OrderDelivery item = p21[i];
|
|
result.Add(item == null ? null : new OrderDeliverySDto()
|
|
{
|
|
Address = item.Address,
|
|
PostalCode = item.PostalCode,
|
|
ReceiverPhoneNumber = item.ReceiverPhoneNumber,
|
|
ReceiverFullName = item.ReceiverFullName,
|
|
ShippingMethod = item.Shipping != null ? item.Shipping.Name : string.Empty,
|
|
OrderId = item.OrderId,
|
|
ShippingId = item.ShippingId,
|
|
Id = item.Id,
|
|
CreatedAt = item.CreatedAt
|
|
});
|
|
i++;
|
|
}
|
|
return result;
|
|
|
|
}
|
|
|
|
private static List<PaymentSDto> funcMain10(List<Payment> p22)
|
|
{
|
|
if (p22 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<PaymentSDto> result = new List<PaymentSDto>(p22.Count);
|
|
|
|
int i = 0;
|
|
int len = p22.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
Payment item = p22[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,
|
|
UserId = item.UserId,
|
|
UserFullName = item.User != null ? item.User.FirstName + " " + item.User.LastName : string.Empty,
|
|
UserPhoneNumber = item.User != null ? item.User.PhoneNumber : string.Empty,
|
|
Id = item.Id,
|
|
CreatedAt = item.CreatedAt
|
|
});
|
|
i++;
|
|
}
|
|
return result;
|
|
|
|
}
|
|
|
|
private static List<OrderProductSDto> funcMain11(List<OrderProduct> p25, List<OrderProductSDto> p26)
|
|
{
|
|
if (p25 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<OrderProductSDto> result = new List<OrderProductSDto>(p25.Count);
|
|
|
|
int i = 0;
|
|
int len = p25.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
OrderProduct item = p25[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<OrderDeliverySDto> funcMain12(List<OrderDelivery> p27, List<OrderDeliverySDto> p28)
|
|
{
|
|
if (p27 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<OrderDeliverySDto> result = new List<OrderDeliverySDto>(p27.Count);
|
|
|
|
int i = 0;
|
|
int len = p27.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
OrderDelivery item = p27[i];
|
|
result.Add(item == null ? null : new OrderDeliverySDto()
|
|
{
|
|
Address = item.Address,
|
|
PostalCode = item.PostalCode,
|
|
ReceiverPhoneNumber = item.ReceiverPhoneNumber,
|
|
ReceiverFullName = item.ReceiverFullName,
|
|
ShippingMethod = item.Shipping != null ? item.Shipping.Name : string.Empty,
|
|
OrderId = item.OrderId,
|
|
ShippingId = item.ShippingId,
|
|
Id = item.Id,
|
|
CreatedAt = item.CreatedAt
|
|
});
|
|
i++;
|
|
}
|
|
return result;
|
|
|
|
}
|
|
|
|
private static List<PaymentSDto> funcMain13(List<Payment> p29, List<PaymentSDto> p30)
|
|
{
|
|
if (p29 == null)
|
|
{
|
|
return null;
|
|
}
|
|
List<PaymentSDto> result = new List<PaymentSDto>(p29.Count);
|
|
|
|
int i = 0;
|
|
int len = p29.Count;
|
|
|
|
while (i < len)
|
|
{
|
|
Payment item = p29[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,
|
|
UserId = item.UserId,
|
|
UserFullName = item.User != null ? item.User.FirstName + " " + item.User.LastName : string.Empty,
|
|
UserPhoneNumber = item.User != null ? item.User.PhoneNumber : string.Empty,
|
|
Id = item.Id,
|
|
CreatedAt = item.CreatedAt
|
|
});
|
|
i++;
|
|
}
|
|
return result;
|
|
|
|
}
|
|
|
|
private static ApplicationUser funcMain14(Never p38, ApplicationUser p39, OrderSDto p36)
|
|
{
|
|
ApplicationUser result = p39 ?? new ApplicationUser();
|
|
|
|
result.Id = p36.UserId;
|
|
result.PhoneNumber = p36.UserPhoneNumber;
|
|
return result;
|
|
|
|
}
|
|
}
|
|
} |