Altairis.Fakturoid.Client.DemoApp.Program.ShowInvoices C# (CSharp) Method

ShowInvoices() private static method

private static ShowInvoices ( ) : void
return void
        private static void ShowInvoices()
        {
            Console.Write("Creating new subject...");
            var subjectId = context.Subjects.Create(new JsonSubject {
                name = "ACME, s. r. o.",
                street = "Testovací 123",
                city = "Praha",
                zip = "11000",
                country = "CZ",
                registration_no = "12345678",
                vat_no = "CZ12345678",
                email = "[email protected]"
            });
            Console.WriteLine("OK, ID={0}", subjectId);

            Console.Write("Creating new invoice...");
            var newInvoice = new JsonInvoice {
                subject_id = subjectId,
                client_street = "Jiná ulice 123",
                lines = new List<JsonInvoiceLine>(),
            };
            newInvoice.lines.Add(new JsonInvoiceLine { name = "Položka 1", quantity = 1, unit_name = "ks", unit_price = 100, vat_rate = 21 });
            newInvoice.lines.Add(new JsonInvoiceLine { name = "Položka 2", quantity = 3, unit_name = "hod.", unit_price = 1234, vat_rate = 21 });
            var newInvoiceId = context.Invoices.Create(newInvoice);
            Console.WriteLine("OK, ID={0}", newInvoiceId);

            Console.Write("Reading back invoice information...");
            newInvoice = context.Invoices.SelectSingle(newInvoiceId);
            Console.WriteLine("OK");

            Console.Write("Sending invoice by e-mail...");
            context.Invoices.SendMessage(newInvoiceId, InvoiceMessageType.InvoiceMessage);
            Console.WriteLine("OK");

            Console.Write("Marking invoice as paid...");
            context.Invoices.SetPaymentStatus(newInvoiceId, InvoicePaymentStatus.Paid);
            Console.WriteLine("OK");

            Console.Write("Deleting invoice...");
            context.Invoices.Delete(newInvoiceId);
            Console.WriteLine("OK");

            Console.Write("Deleting subject...");
            context.Subjects.Delete(subjectId);
            Console.WriteLine("OK");
        }