public PurchaseOrderItemAssignmentModel(WorkEffortPurchaseOrderItemAssignment assignment) { var purchaseOrderItem = assignment.PurchaseOrderItem; this.Name = purchaseOrderItem.Part?.Name ?? purchaseOrderItem.Description; this.Quantity = assignment.Quantity; this.UnitOfMeasure = purchaseOrderItem.Part?.UnitOfMeasure?.Abbreviation?.ToUpperInvariant() ?? purchaseOrderItem.Part?.UnitOfMeasure?.Name?.ToUpperInvariant() ?? "EA"; this.UnitSellingPrice = assignment.UnitSellingPrice; this.SellingPrice = Math.Round(assignment.Quantity * assignment.UnitSellingPrice, 2); }
public PurchaseOrderItemAssignmentModel(WorkEffortPurchaseOrderItemAssignment assignment) { var purchaseOrderItem = assignment.PurchaseOrderItem; this.Name = purchaseOrderItem.Part?.Name ?? purchaseOrderItem.Description; this.Quantity = assignment.Quantity; this.UnitOfMeasure = purchaseOrderItem.Part?.UnitOfMeasure?.Abbreviation?.ToUpperInvariant() ?? purchaseOrderItem.Part?.UnitOfMeasure?.Name?.ToUpperInvariant() ?? "EA"; this.UnitSellingPrice = Rounder.RoundDecimal(assignment.UnitSellingPrice, 2).ToString("N2", new CultureInfo("nl-BE")); this.SellingPrice = Rounder.RoundDecimal(assignment.Quantity * assignment.UnitSellingPrice, 2).ToString("N2", new CultureInfo("nl-BE")); }