Example #1
0
        private ReceiptFormatter GetNormalFormatter()
        {
            ReceiptFormatter formatter = new ReceiptFormatter();

            formatter.HeaderFormats.Add("Order Receipt for " + ReceiptPieces.Company + Environment.NewLine);
            formatter.LineFormats.Add("\t" + ReceiptPieces.LineQuantity + " x " + ReceiptPieces.BikeBrand + " "
                                      + ReceiptPieces.BikeModel + " = " + ReceiptPieces.LinePrice + Environment.NewLine);
            formatter.TailFormats.Add("Sub-Total: " + ReceiptPieces.SubTotal + Environment.NewLine);
            formatter.TailFormats.Add("Tax: " + ReceiptPieces.Tax + Environment.NewLine);
            formatter.TailFormats.Add("Total: " + ReceiptPieces.Total);
            return(formatter);
        }
Example #2
0
        private ReceiptFormatter GetHtmlFormatter()
        {
            ReceiptFormatter formatter = new ReceiptFormatter();

            formatter.HeaderFormats.Add(string.Format("<html><body><h1>Order Receipt for {0}</h1>", ReceiptPieces.Company));
            formatter.HeaderFormats.Add("<ul>");

            formatter.LineFormats.Add(string.Format("<li>{0} x {1} {2} = {3}</li>", ReceiptPieces.LineQuantity,
                                                    ReceiptPieces.BikeBrand, ReceiptPieces.BikeModel, ReceiptPieces.LinePrice));

            formatter.TailFormats.Add("</ul>");
            formatter.TailFormats.Add(string.Format("<h3>Sub-Total: {0}</h3>", ReceiptPieces.SubTotal));
            formatter.TailFormats.Add(string.Format("<h3>Tax: {0}</h3>", ReceiptPieces.Tax));
            formatter.TailFormats.Add(string.Format("<h2>Total: {0}</h2>", ReceiptPieces.Total));
            formatter.TailFormats.Add("</body></html>");
            return(formatter);
        }