Beispiel #1
0
        /// <summary>
        /// Adds the standard header to the Receipt.
        /// </summary>
        /// <param name="receipt">The Receipt that is being formatted.</param>
        /// <param name="orderId">The OrderId from the Order being formatted.</param>
        private void CreateHeader(Receipt receipt, object orderId)
        {
            //var currentDateAndTime = DateTime.Today.ToString("G");

            receipt.AddLine("Katrines Kælder\nFinlandsgade 22\nDK-8200 Aarhus N\n\n");
            receipt.AddLine(string.Format(_formatProvider, "Dato: {0}\n", DateTime.Today));
            receipt.AddLine(string.Format(_formatProvider, "Ordre id: {0}\n\n", orderId));
            receipt.AddLine("-----\n");
        }
Beispiel #2
0
        public void Add_AddsAStringToTheReceipt_ContentContainsString()
        {
            var uut = new Receipt();

            uut.AddLine("Test");

            Assert.That(uut.Content, Contains.Item("Test"));
        }
Beispiel #3
0
        /// <summary>
        /// Formats a new Receipt from a Transaction.
        /// </summary>
        /// <param name="transaction">The Transaction to be formatted and printed.</param>
        public virtual void CreateReceipt(Transaction transaction)
        {
            var receipt = new Receipt(_formatProvider);

            receipt.AddLine(string.Format(_formatProvider, "{0}\nDate: {1}\nId: {2}\n{3}\n\b", transaction.PaymentType, transaction.Date, transaction.Id, transaction.Price));

            Print(receipt);
        }
Beispiel #4
0
        /// <summary>
        /// Formats a new Reciept from an order and prints the Reciept.
        /// </summary>
        /// <param name="order">The Order to be formatted and printed.</param>
        public virtual void CreateReceipt(SalesOrder order)
        {
            var receipt = new Receipt(_formatProvider);

            CreateHeader(receipt, order.Id);

            foreach (var p in order.Lines)
            {
                receipt.AddLine(string.Format(_formatProvider, "{0}x\t{1}\n", p.Quantity, p.Product.Name));
                receipt.AddLine("              ");
                receipt.AddLine(string.Format(_formatProvider, "{0}\n\n", p.UnitPrice));
            }

            receipt.AddLine(string.Format(_formatProvider, "Total: {0}\n\n", order.Total));

            CreateFooter(receipt);

            Print(receipt);
        }
Beispiel #5
0
        /// <summary>
        /// Formats a new Reciept from an order and prints the Reciept.
        /// </summary>
        /// <param name="order">The Order to be formatted and printed.</param>
        public virtual void CreateReceipt(SalesOrder order)
        {
            var receipt = new Receipt(_formatProvider);

            CreateHeader(receipt, order.Id);

            foreach (var p in order.Lines)
            {
                receipt.AddLine(string.Format(_formatProvider, "{0}x\t{1}\n", p.Quantity, p.Product.Name));
                receipt.AddLine("              ");
                receipt.AddLine(string.Format(_formatProvider, "{0}\n\n", p.UnitPrice));
            }

            receipt.AddLine(string.Format(_formatProvider, "Total: {0}\n\n", order.Total));

            CreateFooter(receipt);

            Print(receipt);
        }
Beispiel #6
0
        /// <summary>
        /// Formats a new Receipt from a Transaction.
        /// </summary>
        /// <param name="transaction">The Transaction to be formatted and printed.</param>
        public virtual void CreateReceipt(Transaction transaction)
        {
            var receipt = new Receipt(_formatProvider);

            receipt.AddLine(string.Format(_formatProvider, "{0}\nDate: {1}\nId: {2}\n{3}\n\b", transaction.PaymentType, transaction.Date, transaction.Id, transaction.Price));

            Print(receipt);
        }
Beispiel #7
0
        /// <summary>
        /// Adds the standard header to the Receipt.
        /// </summary>
        /// <param name="receipt">The Receipt that is being formatted.</param>
        /// <param name="orderId">The OrderId from the Order being formatted.</param>
        private void CreateHeader(Receipt receipt, object orderId)
        {
            //var currentDateAndTime = DateTime.Today.ToString("G");

            receipt.AddLine("Katrines Kælder\nFinlandsgade 22\nDK-8200 Aarhus N\n\n");
            receipt.AddLine(string.Format(_formatProvider ,"Dato: {0}\n", DateTime.Today));
            receipt.AddLine(string.Format(_formatProvider, "Ordre id: {0}\n\n", orderId));
            receipt.AddLine("-----\n");
        }
Beispiel #8
0
 /// <summary>
 /// Adds the standard footer to the Receipt.
 /// </summary>
 /// <param name="receipt">The Receipt that is being formatted.</param>
 private static void CreateFooter(Receipt receipt)
 {
     receipt.AddLine("-----\n");
     receipt.AddLine("På gensyn\n\n");
 }
Beispiel #9
0
 /// <summary>
 /// Adds the standard footer to the Receipt.
 /// </summary>
 /// <param name="receipt">The Receipt that is being formatted.</param>
 private static void CreateFooter(Receipt receipt)
 {
     receipt.AddLine("-----\n");
     receipt.AddLine("På gensyn\n\n");
 }