public static POChinoOutput MaptoOutput(this POO entity) { return(Mapper.Map <POChinoOutput>(entity)); }
ICollection <POSkusOutput> ITypeConverter <POO, ICollection <POSkusOutput> > .Convert(POO source, ICollection <POSkusOutput> destination, ResolutionContext context) { List <POSkusOutput> poSkus = new List <POSkusOutput>(); source.POSkus?.ToList().ForEach(x => { POProductOutput poProductOutput = new POProductOutput { Sku = x.POProduct.Sku, CountryOfOrigin = x.POProduct.CountryOfOrigin, ItemDescription = x.POProduct.SkuDesc, CasePackQty = x.POProduct.MasterPackQuantity.HasValue? x.POProduct.MasterPackQuantity.ToString() :"0", ClassCode = x.POProduct.Class, TariffCode = x.POProduct.HTSCode, VendorName = x.POProduct.SubVendor, VendorNumber = x.POProduct.VendorName, DepartmentName = x.POProduct.ClassDescription, ClassName = x.POProduct.ClassDescription, DepartmentCode = x.POProduct.Department }; poSkus.Add(new POSkusOutput { PONumber = x.PONumber.ToString(), ItemNumber = x.SKU, ItemQty = x.BuyQuantity.HasValue? x.BuyQuantity.ToString() : "0", ItemTotalQuantity = x.BuyQuantity.HasValue ? x.BuyQuantity.ToString() :"0", CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.Date.ToString("yyyyMMdd") : string.Empty, ModifiedDate = x.ModifiedDate.HasValue ? x.ModifiedDate.Value.Date.ToString("yyyyMMdd") : string.Empty, ApprovalLetter = x.ApprovalLetter.HasValue ? (x.ApprovalLetter.Value == true ? "Y" : "N") : "N", SamplesRequired = x.SamplesRequired.ToString(), EstimatedLandedCost = x.EstimatedLandedCost != null? Math.Round(x.EstimatedLandedCost.GetValueOrDefault(), 2).ToString() : "0", MasterPackCubicFeet = x.MasterPackCubicFeet.ToString(), DutyPctOfFOB = x.DutyPctOfFOB.ToString(), DutyCost = x.DutyCost.HasValue ? Math.Round(x.DutyCost.GetValueOrDefault(), 2).ToString() : "0", //POCreationDate UnitCost = x.FirstCost != null? Math.Round(x.FirstCost.GetValueOrDefault(), 2).ToString() :"0", POProduct = poProductOutput, }); }); return(poSkus); }
ICollection <POIntertekSKUOutput> ITypeConverter <POO, ICollection <POIntertekSKUOutput> > .Convert(POO source, ICollection <POIntertekSKUOutput> destination, ResolutionContext context) { List <POIntertekSKUOutput> poSkus = new List <POIntertekSKUOutput>(); POProductOutput poIntertekProduct = new POProductOutput(); source.POSkus?.ToList().ForEach(x => { POProductFlagsOutput productFlagsOutput = new POProductFlagsOutput { Sku = x.SKU, IntlSafetyTransitTestRequired = !string.IsNullOrEmpty((x.POProduct?.ProductFlags?.Find(y => y.FlagKey == ProductFlagSettings.IntlSafetyTransitTestRequired)?.FlagValue.ConvertToString())) ? x.POProduct.ProductFlags.Find(y => y.FlagKey == ProductFlagSettings.IntlSafetyTransitTestRequired).FlagValue.ConvertToString() : "N", IsChildClothCostume = !string.IsNullOrEmpty(x.POProduct?.ProductFlags?.Find(y => y.FlagKey == ProductFlagSettings.IsChildClothCostume)?.FlagValue.ConvertToString()) ? x.POProduct.ProductFlags.Find(y => y.FlagKey == ProductFlagSettings.IsChildClothCostume).FlagValue.ConvertToString() : "N", IsGlassDishAdultJewelry = !string.IsNullOrEmpty(x.POProduct?.ProductFlags?.Find(y => y.FlagKey == ProductFlagSettings.IsGlassDishAdultJewelry)?.FlagValue.ConvertToString()) ? x.POProduct.ProductFlags.Find(y => y.FlagKey == ProductFlagSettings.IsGlassDishAdultJewelry).FlagValue.ConvertToString() : "N", NonPaintTestingRequired = !string.IsNullOrEmpty(x.POProduct?.ProductFlags?.Find(y => y.FlagKey == ProductFlagSettings.NonPaintTestingRequired)?.FlagValue.ConvertToString()) ? x.POProduct.ProductFlags.Find(y => y.FlagKey == ProductFlagSettings.NonPaintTestingRequired).FlagValue.ConvertToString() : "N", RandomInspectionRequired = !string.IsNullOrEmpty(x.POProduct?.ProductFlags?.Find(y => y.FlagKey == ProductFlagSettings.RandomInspectionRequired)?.FlagValue.ConvertToString()) ? x.POProduct.ProductFlags.Find(y => y.FlagKey == ProductFlagSettings.RandomInspectionRequired).FlagValue.ConvertToString() : "N", CPSIATestingRequired = !string.IsNullOrEmpty(x.POProduct?.ProductFlags?.Find(y => y.FlagKey == ProductFlagSettings.CPSIATestingRequired)?.FlagValue.ConvertToString()) ? x.POProduct.ProductFlags.Find(y => y.FlagKey == ProductFlagSettings.CPSIATestingRequired).FlagValue.ConvertToString() : "N", }; if (x.POProduct != null) { poIntertekProduct = new POProductOutput { SKU = x.SKU, ClassCode = x.POProduct.Class, DepartmentName = x.POProduct.ClassDescription, ClassName = x.POProduct.ClassDescription, DepartmentCode = x.POProduct.Department, HTSCode = x.POProduct.HTSCode, MasterPackQuantity = x.POProduct.MasterPackQuantity.HasValue ? x.POProduct.MasterPackQuantity.Value.ToString() : "0", ClassShortDesc = x.POProduct.ClassShortDesc, SkuDesc = x.POProduct.SkuDesc, SubClass = x.POProduct.SubClass, SubclassDescription = x.POProduct.SubclassDescription, Country = x.POProduct.CountryOfOrigin, PrepackChildQuantity = (x.POProduct.ProductPrepack != null && x.POProduct.ProductPrepack.Count > 0) ? Convert.ToString(x.POProduct.ProductPrepack.Find(y => y.Prepack == x.PrepackId && y.Sku == x.SKU).Quantity) : string.Empty, PrepackTotalQuantity = (x.POProduct.ProductPrepack != null && x.POProduct.ProductPrepack.Count > 0) ? Convert.ToString(x.POProduct.ProductPrepack.Where(y => y.Prepack == x.PrepackId).Sum(y => y.Quantity)) : "0", ProductFlagsOutput = productFlagsOutput }; } poSkus.Add(new POIntertekSKUOutput { PONumber = x.PONumber.ToString(), BuyQuantity = x.BuyQuantity.HasValue ? x.BuyQuantity.Value.ToString() : "0", CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.Date.ToString("yyyyMMdd") : string.Empty, DutyCost = x.DutyCost.HasValue ? Math.Round(x.DutyCost.GetValueOrDefault(), 2).ToString() : "0", FirstCost = x.FirstCost.HasValue ? Math.Round(x.FirstCost.GetValueOrDefault(), 2).ToString() : "0", SKU = x.SKU, POProduct = poIntertekProduct, StatusCode = x.StatusCode, DutyPctOfFOB = x.DutyPctOfFOB.HasValue ? Math.Round(x.DutyPctOfFOB.GetValueOrDefault(), 2).ToString() : "0", EstimatedLandedCost = x.EstimatedLandedCost.HasValue ? Math.Round(x.EstimatedLandedCost.GetValueOrDefault(), 2).ToString() : "0", MasterPackCubicFeet = x.MasterPackCubicFeet.HasValue ? Math.Round(x.MasterPackCubicFeet.GetValueOrDefault(), 2).ToString() : "0", PrepackId = x.PrepackId, ApprovalLetter = x.ApprovalLetter.HasValue ? (x.ApprovalLetter.Value == true ? "Y" : "N") : "N" }); }); return(poSkus); }
IList <POContempoSkuOutput> ITypeConverter <POO, IList <POContempoSkuOutput> > .Convert(POO source, IList <POContempoSkuOutput> destination, ResolutionContext context) { List <POContempoSkuOutput> poSkus = new List <POContempoSkuOutput>(); source.POSkus?.ToList().ForEach(x => { if ((x.POProduct.Department == "JEP" || x.POProduct.Department == "JSF") && x.POProduct.SubClass != "JOSAC") { POContempoProductOutput poCntmpProductOutput = new POContempoProductOutput { APVendor = x.POProduct.APVendor, Class = x.POProduct.Class, ClassLevelDesc = x.POProduct.ClassDescription, SubClass = x.POProduct.SubClass, SubClassLevelDesc = x.POProduct.SubclassDescription, Size = x.POProduct.Size, CountryOfOrigin = x.POProduct.CountryOfOrigin, SkuDesc = x.POProduct.SkuDescShrt, VendorSKUCode = x.POProduct.VendorSkuCode, LabelType = x.POProduct?.LabelType, LabelDescription = x.POProduct?.LabelDescription, RetailPrice = x.GetRetailPrice() }; poSkus.Add(new POContempoSkuOutput { SKU = x.SKU, BuyQuanity = x.BuyQuantity != null ? Convert.ToInt32(x.BuyQuantity) : 0, POProduct = poCntmpProductOutput, //POSkus object is updated with CreateDate property. CreateDate = x.CreateDate != null ? x.CreateDate.Value : new DateTime?(), ModifiedDate = x.ModifiedDate != null ? x.ModifiedDate.Value : new DateTime?(), StatusCode = x.StatusCode, }); } }); return(poSkus); }
ICollection <POSkusOutput> ITypeConverter <POO, ICollection <POSkusOutput> > .Convert(POO source, ICollection <POSkusOutput> destination, ResolutionContext context) { List <POSkusOutput> poSkus = new List <POSkusOutput>(); source.POSkus?.ToList().ForEach(x => { poSkus.Add(new POSkusOutput { ItemName = x.SKU, OrderQty = x.BuyQuantity.ToString() }); }); return(poSkus); }
ICollection <POFineLineSkuOutput> ITypeConverter <POO, ICollection <POFineLineSkuOutput> > .Convert(POO source, ICollection <POFineLineSkuOutput> destination, ResolutionContext context) { List <POFineLineSkuOutput> poFLSkus = new List <POFineLineSkuOutput>(); source.POSkus?.ToList().ForEach(x => { POFineLineProductOutput poFlProduct = new POFineLineProductOutput { VendorNumber = x.POProduct.APVendor, SubVendorNumber = x.POProduct.SubVendor, SKUDescription = x.POProduct.SkuDescShrt, VendorStyleNumber = x.POProduct.VendorSkuCode, TicketType = x.POProduct.LabelType, TicketDescription = x.POProduct.LabelDescription, ClassID = x.POProduct.Class, ClassDescription = x.POProduct.ClassDescription, SubClassID = x.POProduct.SubClass, SubClassDescription = x.POProduct.SubclassDescription, Size = x.POProduct.Size, ISOCountryCode = x.POProduct.CountryOfOrigin, TicketRetail = x.GetRetailPrice() }; poFLSkus.Add(new POFineLineSkuOutput { SKUNumber = x.SKU, PurchaseOrderDate = x.CreateDate != null ? x.CreateDate.Value : new DateTime?(), PurchaseOrderReviseDate = x.ModifiedDate != null ? x.ModifiedDate.Value : new DateTime?(), OrderQuantity = x.BuyQuantity != null ? Convert.ToInt32(x.BuyQuantity) : 0, StatusCode = x.StatusCode, POProduct = poFlProduct }); }); return(poFLSkus); }