public static ComponentModel ConvertToComponentModel(this AccessoryDescriptionDTO componentModelDto) { var componentModel = new ComponentModel { ItemId = componentModelDto.ItemId, IsDeleted = componentModelDto.IsDeleted, Updated = componentModelDto.Updated, CorrectorId = componentModelDto.CorrectorId, Name = componentModelDto.Model, PartNumber = componentModelDto.PartNumber, AltPartNumber = componentModelDto.AltPartNumber, ATAChapter = componentModelDto.ATAChapter?.Convert(), Description = componentModelDto.Description, Standart = componentModelDto.GoodStandart?.Convert(), Manufacturer = componentModelDto.Manufacturer, CostNew = componentModelDto.CostNew ?? default(double), CostOverhaul = componentModelDto.CostOverhaul ?? default(double), CostServiceable = componentModelDto.CostServiceable ?? default(double), Measure = componentModelDto.Measure.HasValue ? Measure.Items.GetItemById(componentModelDto.Measure.Value) : Measure.Unknown, Remarks = componentModelDto.Remarks, ManufactureReg = componentModelDto.ModelingObjectSubTypeId.HasValue ? ManufactureRegion.Items.GetItemById(componentModelDto.ModelingObjectSubTypeId.Value) : ManufactureRegion.Unknown, Series = componentModelDto.SubModel, FullName = componentModelDto.FullName, ShortName = componentModelDto.ShortName, Designer = componentModelDto.Designer, Code = componentModelDto.Code, GoodsClass = componentModelDto.ComponentClass.HasValue ? GoodsClass.Items.GetItemById(componentModelDto.ComponentClass.Value) : GoodsClass.Unknown, IsDangerous = componentModelDto.IsDangerous, IsEffectivity = componentModelDto.IsEffectivity, IsForbidden = componentModelDto.IsForbidden, DescRus = componentModelDto.DescRus, HTS = componentModelDto.HTS, EngineRef = componentModelDto.EngineRef }; if (componentModelDto.SupplierRelations != null) { componentModel.SupplierRelations.AddRange(componentModelDto.SupplierRelations.Select(i => i.Convert())); } return(componentModel); }
public static Product ConvertToProduct(this AccessoryDescriptionDTO productDto) { var product = new Product { ItemId = productDto.ItemId, IsDeleted = productDto.IsDeleted, Updated = productDto.Updated, CorrectorId = productDto.CorrectorId, Name = productDto.Model, PartNumber = productDto.PartNumber, AltPartNumber = productDto.AltPartNumber, ATAChapter = productDto.ATAChapter?.Convert(), Description = productDto.Description, Standart = productDto.GoodStandart?.Convert(), Manufacturer = productDto.Manufacturer, CostNew = productDto.CostNew ?? default(double), CostOverhaul = productDto.CostOverhaul ?? default(double), CostServiceable = productDto.CostServiceable ?? default(double), Measure = productDto.Measure.HasValue ? Measure.Items.GetItemById(productDto.Measure.Value) : Measure.Unknown, Remarks = productDto.Remarks, Code = productDto.Code, GoodsClass = productDto.ComponentClass.HasValue ? GoodsClass.Items.GetItemById(productDto.ComponentClass.Value) : GoodsClass.Unknown, IsDangerous = productDto.IsDangerous, DescRus = productDto.DescRus, HTS = productDto.HTS, Reference = productDto.Reference, IsEffectivity = productDto.IsEffectivity, IsForbidden = productDto.IsForbidden, EngineRef = productDto.EngineRef, ProductType = productDto.ModelingObjectTypeId == -1 ? ProductType.EquipmentandMaterial: ProductType.ComponentModel }; if (productDto.SupplierRelations != null) { product.SupplierRelations.AddRange(productDto.SupplierRelations.Select(i => i.Convert())); } return(product); }
public static AircraftModel ConvertToAircraftModel(this AccessoryDescriptionDTO aircraftModelDto) { var value = new AircraftModel { ItemId = aircraftModelDto.ItemId, IsDeleted = aircraftModelDto.IsDeleted, Updated = aircraftModelDto.Updated, CorrectorId = aircraftModelDto.CorrectorId, Name = aircraftModelDto.Model, PartNumber = aircraftModelDto.PartNumber, AltPartNumber = aircraftModelDto.AltPartNumber, ATAChapter = aircraftModelDto.ATAChapter?.Convert(), Description = aircraftModelDto.Description, Standart = aircraftModelDto.GoodStandart?.Convert(), Manufacturer = aircraftModelDto.Manufacturer, CostNew = aircraftModelDto.CostNew ?? default(double), CostOverhaul = aircraftModelDto.CostOverhaul ?? default(double), CostServiceable = aircraftModelDto.CostServiceable ?? default(double), Measure = aircraftModelDto.Measure.HasValue ? Measure.Items.GetItemById(aircraftModelDto.Measure.Value) : Measure.Unknown, Remarks = aircraftModelDto.Remarks, ManufactureReg = aircraftModelDto.ModelingObjectSubTypeId.HasValue ? ManufactureRegion.Items.GetItemById(aircraftModelDto.ModelingObjectSubTypeId.Value) : ManufactureRegion.Unknown, Series = aircraftModelDto.SubModel, FullName = aircraftModelDto.FullName, ShortName = aircraftModelDto.ShortName, Designer = aircraftModelDto.Designer, Code = aircraftModelDto.Code, GoodsClass = aircraftModelDto.ComponentClass.HasValue ? GoodsClass.Items.GetItemById(aircraftModelDto.ComponentClass.Value) : GoodsClass.Unknown, IsDangerous = aircraftModelDto.IsDangerous }; if (aircraftModelDto.SupplierRelations != null) { value.SupplierRelations.AddRange(aircraftModelDto.SupplierRelations.Select(i => i.Convert())); } return(value); }