Ejemplo n.º 1
0
        private void PrintReceipt(Order order)
        {
            string customerEmail = order.CustomerEmail;

            if (!string.IsNullOrEmpty(customerEmail))
            {
                var receipt = new Receipt
                {
                    Title = "Receipt for your order placed on " + DateTime.Now,
                    Body  = "Your order details: \n "
                };
                foreach (var orderItem in order.Items)
                {
                    receipt.Body += orderItem.Quantity + " of item " + orderItem.ItemId;
                }

                try
                {
                    printer.Print(receipt);
                }
                catch (Exception ex)
                {
                    Logger.Error("Problem sending notification email", ex);
                }
            }
        }
Ejemplo n.º 2
0
        public void PrintReceipt(Order order)
        {
            var receipt = new Receipt
            {
                Title = "Receipt for your order placed on " + DateTime.Now,
                Body  = "Your order details: \n "
            };

            foreach (var orderItem in order.Items)
            {
                receipt.Body += orderItem.Quantity + " of item " + orderItem.ItemId;
            }

            try
            {
                printer.Print(receipt);
            }
            catch (Exception ex)
            {
                Logger.Error("Problem sending to printer", ex);
            }
        }