public SerializableMove(InventoryShipmentOrder order) { Identifiable = new SerializableEmployeeIdentifiable(order); }
private SerializableLot(Lot lot) { HoldType = lot.Hold; HoldDescription = lot.HoldDescription; ReceivedPackagingKey = new PackagingProductKey(lot); ReceivedPkgID = lot.ReceivedPackaging.Product.ProductCode; var keyedAttributeDefects = lot.AttributeDefects.ToDictionary(d => new LotDefectKey(d), d => d); Attributes = (lot.Attributes ?? new LotAttribute[0]).Select(a => new Attribute { EmployeeKey = new EmployeeKey(a), TimeStamp = a.TimeStamp, NameKey = new AttributeNameKey(a), Value = a.AttributeValue, DateTested = a.AttributeDate, Computed = a.Computed }).ToList(); Defects = (lot.LotDefects ?? new LotDefect[0]).Select(d => new { defect = d, resolution = d.Resolution, attributeDefect = keyedAttributeDefects.Where(k => k.Key.Equals(d)).Select(k => k.Value).FirstOrDefault() }).Select(d => new Defect { AttributeDefect = d.attributeDefect == null ? null : new AttributeDefect { NameKey = new AttributeNameKey(d.attributeDefect), Value = d.attributeDefect.OriginalAttributeValue, Min = d.attributeDefect.OriginalAttributeMinLimit, Max = d.attributeDefect.OriginalAttributeMaxLimit }, DefectResolution = d.resolution == null ? null : new DefectResolution { ResolutionType = d.resolution.ResolutionType.ToString(), Description = d.resolution.Description, EmployeeKey = new EmployeeKey(d.resolution), TimeStamp = d.resolution.TimeStamp }, DefectType = d.defect.DefectType.ToString(), Description = d.defect.Description }).ToList(); LotIdentifiable = new SerializableEmployeeIdentifiable(lot); CustomerAllowances = (lot.CustomerAllowances ?? new List <LotCustomerAllowance>()) .Select(c => new CustomerAllowance { CompanyName = c.Customer.Company.Name }) .ToList(); ContractAllowances = (lot.ContractAllowances ?? new List <LotContractAllowance>()) .Where(c => c.Contract.ContractId != null) .Select(c => new ContractAllowance { ContractId = c.Contract.ContractId.Value }) .ToList(); CustomerOrderAllowances = (lot.SalesOrderAllowances ?? new List <LotSalesOrderAllowance>()) .Where(c => c.SalesOrder.InventoryShipmentOrder.MoveNum != null) .Select(c => new CustomerOrderAllowance { OrderNum = c.SalesOrder.InventoryShipmentOrder.MoveNum.Value }) .ToList(); }