internal static MotorRecord BulidMotorRecord(Motor motor) { var result = new MotorRecord { MotorNumber = motor.MotorNumber, Description = motor.Description, Displacement = Convert.ToInt32(motor.Displacement), Feature = motor.Feature, MotorType = motor.MotorType }; return(result); }
internal static Motor BulidMotor(MotorRecord motor, IEnumerable <BOMItemRecord> bomItemRecords, IEnumerable <Part> parts) { if (motor == null) { return(null); } var newMotor = new Motor(motor.MotorNumber, motor.MotorType, Convert.ToUInt32(motor.Displacement), motor.Feature, motor.Description); foreach (var partItem in bomItemRecords) { var partToAdd = parts.First(p => p.PartNumber == partItem.PartItem.PartNumber); newMotor.AddPart(partToAdd, Convert.ToUInt32(partItem.PositionNumber), Convert.ToUInt32(partItem.Quantity)); } return(newMotor); }