Ejemplo n.º 1
0
        public void Print(bool terminalErrorsOnly = true)
        {

            Console.WriteLine($"Account: {Account}\nDocument Number:{DocumentNumber}\nDate: {TaxDate}\nOrder Number: {OrderNumber}\nDate: {OrderDate}");
            Console.WriteLine($"IsValid: {IsValid}\nTerminal Errors:{TerminalErrorCount}\nWarning Errors: {WarningErrorCount}");
            Console.WriteLine($"Shredding Time (ms) was {TimeToShred}");

            foreach (var item in LineItems)
            {
                Console.WriteLine($"{item.ItemDescription}\t{item.LineQuantity}\t{item.UnitPrice}\t{item.VATCode}\t{item.NetAmount}\t{item.CalculatedLineQuantity}");
            }
            Console.WriteLine();
            Console.WriteLine("Errors:");
            IEnumerable<DocumentError> errorsToPrint;
            if (terminalErrorsOnly)
            {
                errorsToPrint = Errors.Where(e => e.ErrorSeverity == DocumentErrorSeverity.Terminal);
            }
            else
            {
                errorsToPrint = Errors.AsEnumerable<DocumentError>();
            }
            if (errorsToPrint.Count() != 0)
            {
                foreach (var item in errorsToPrint)
                {
                    Console.WriteLine($"{item.ErrorCode}\t{item.ErrorMessage}\t{item.ErrorSeverity}");
                }
            }
            else
            {
                Console.WriteLine($"No errors. terminalErrorsOnlyFlag={terminalErrorsOnly}");
            }
        }