コード例 #1
0
        private string PrintReceiptItem(ReceiptItem item)
        {
            string totalPrice = PrintPrice(item.TotalPrice);
            string name       = item.Product.Name;
            string line       = FormatLineWithWhitespace(name, totalPrice);

            if (item.Quantity != 1)
            {
                line += "  " + PrintPrice(item.Price) + " * " + PrintQuantity(item) + "\n";
            }

            return(line);
        }
コード例 #2
0
 private static string PresentQuantity(ReceiptItem item)
 {
     return(ProductUnit.Each == item.Product.Unit
         ? ((int)item.Quantity).ToString()
         : item.Quantity.ToString("N3", Culture));
 }