| | | 1 | | using System; |
| | | 2 | | using SVETA.Api.Data.DTO.DepartmentDTO; |
| | | 3 | | using System.Collections.Generic; |
| | | 4 | | using System.Linq; |
| | | 5 | | using System.Threading.Tasks; |
| | | 6 | | using System.ComponentModel.DataAnnotations; |
| | | 7 | | using WinSolutions.Sveta.Server.Data.DataModel.Entities; |
| | | 8 | | using WinSolutions.Sveta.Server.Data.DataModel.Extensions; |
| | | 9 | | |
| | | 10 | | namespace SVETA.Api.Data.DTO.Prices.PriceTrend |
| | | 11 | | { |
| | | 12 | | public class PriceTrendResponseDTO |
| | | 13 | | { |
| | 0 | 14 | | public PriceTrendResponseDTO() { } |
| | 0 | 15 | | public PriceTrendResponseDTO(WinSolutions.Sveta.Server.Data.DataModel.Entities.PriceTrend data) |
| | 0 | 16 | | { |
| | 0 | 17 | | Id = data.Id; |
| | 0 | 18 | | SupplierDepartment = new DepartmentShortDTO(data.SupplierDepartment); |
| | 0 | 19 | | BeginDate = data.BeginDate; |
| | | 20 | | /*PriceTrendDetails = new List<PriceTrendGoodsDTO>(); |
| | | 21 | | PriceTrendDetails.AddRange(data.PriceTrendDetails.Select(x => new PriceTrendGoodsDTO(x)));*/ |
| | 0 | 22 | | } |
| | 0 | 23 | | public long Id { get; set; } |
| | 0 | 24 | | public DepartmentShortDTO SupplierDepartment { get; set; } |
| | 0 | 25 | | public DateTime BeginDate { get; set; } |
| | 0 | 26 | | public BaseResponseDTO<PriceTrendGoodsDTO> PriceTrendDetails { get; set; } |
| | | 27 | | //public List<PriceTrendGoodsDTO> PriceTrendDetails { get; set; } |
| | | 28 | | } |
| | | 29 | | |
| | | 30 | | public class PriceTrendGoodsDTO |
| | | 31 | | { |
| | | 32 | | public PriceTrendGoodsDTO() { } |
| | | 33 | | public PriceTrendGoodsDTO(PriceTrendDetail data) |
| | | 34 | | { |
| | | 35 | | Id = data.Id; |
| | | 36 | | GoodId = data.GoodId; |
| | | 37 | | VendorCode = data.Good.GetActualVendorCode(data.PriceTrend.SupplierDepartmentId); |
| | | 38 | | Name = data.Good.Name; |
| | | 39 | | PriceNew = data.PriceNew; |
| | | 40 | | PriceOld = data.PriceOld ?? 0; |
| | | 41 | | Photo = (PhotoPrevDto)data.Good.Photos.FirstOrDefault(); |
| | | 42 | | UniqueCode = data.Good.UniqueCode; |
| | | 43 | | BarCode = data.Good.GetActualBarCode(); |
| | | 44 | | } |
| | | 45 | | public long Id { get; set; } |
| | | 46 | | public long GoodId { get; set; } |
| | | 47 | | public string VendorCode { get; set; } |
| | | 48 | | public string Name { get; set; } |
| | | 49 | | public decimal PriceNew { get; set; } |
| | | 50 | | public decimal PriceOld { get; set; } |
| | | 51 | | public decimal PriceCurrent { get; set; } |
| | | 52 | | public PhotoPrevDto Photo { get; set; } |
| | | 53 | | public string UniqueCode { get; set; } |
| | | 54 | | public string BarCode { get; set; } |
| | | 55 | | } |
| | | 56 | | |
| | | 57 | | public class PriceTrendsResponseDTO |
| | | 58 | | { |
| | | 59 | | public PriceTrendsResponseDTO() { } |
| | | 60 | | public PriceTrendsResponseDTO(WinSolutions.Sveta.Server.Data.DataModel.Entities.PriceTrend data) |
| | | 61 | | { |
| | | 62 | | Id = data.Id; |
| | | 63 | | DocNumber = data.DocNumber; |
| | | 64 | | CreationDate = data.CreationDateTime; |
| | | 65 | | BeginDate = data.BeginDate; |
| | | 66 | | SupplierDepartment = new DepartmentShortDTO(data.SupplierDepartment); |
| | | 67 | | GoodsCount = data.PriceTrendDetails?.Count(x=>!x.IsDeleted && !x.Good.IsDeleted) ?? 0; |
| | | 68 | | } |
| | | 69 | | public long Id { get; set; } |
| | | 70 | | public string DocNumber { get; set; } |
| | | 71 | | public DateTime CreationDate { get; set; } |
| | | 72 | | public DepartmentShortDTO SupplierDepartment { get; set; } |
| | | 73 | | public DateTime BeginDate { get; set; } |
| | | 74 | | public int? GoodsCount { get; set; } |
| | | 75 | | } |
| | | 76 | | |
| | | 77 | | public class PriceTrendsSourceGoodsResponseDTO |
| | | 78 | | { |
| | | 79 | | public long Id { get; set; } |
| | | 80 | | public string VendorCode { get; set; } |
| | | 81 | | public string Name { get; set; } |
| | | 82 | | public bool IsInTrend { get; set; } |
| | | 83 | | public long? TrendDetailId { get; set; } |
| | | 84 | | |
| | | 85 | | public string UniqueCode { get; set; } |
| | | 86 | | } |
| | | 87 | | } |