Altairis.Fakturoid.Client.DemoApp.Program.ShowSubjects C# (CSharp) Метод

ShowSubjects() приватный статический Метод

private static ShowSubjects ( ) : void
Результат void
        private static void ShowSubjects()
        {
            Console.Write("Creating new subject...");
            var subject = new JsonSubject {
                name = "Altairis, s. r. o.",
                street = "Bořivojova 35",
                city = "Praha",
                zip = "17000",
                country = "CZ",
                registration_no = "27560911",
                vat_no = "CZ27560911",
            };
            var newId = context.Subjects.Create(subject);
            Console.WriteLine("OK, ID={0}", newId);

            Console.Write("Getting information about newly created subject...");
            subject = context.Subjects.SelectSingle(newId);
            Console.WriteLine("OK, listing properties:");
            subject.DumpProperties(Console.Out, "\t");

            Console.Write("Updating subject...");
            subject.custom_id = "MY_CUSTOM_ID";
            subject = context.Subjects.Update(subject);
            Console.WriteLine("OK, listing properties:");
            subject.DumpProperties(Console.Out, "\t");

            try {
                Console.Write("Causing intentional error...");
                context.Subjects.Create(subject);
                Console.WriteLine("OK (that's unexpected!)");
            }
            catch (FakturoidException fex) {
                Console.WriteLine("Failed! (that's expected)");
                Console.WriteLine(fex.Message);
                foreach (var item in fex.Errors) {
                    Console.WriteLine("\tProperty '{0}': {1}", item.Key, item.Value);
                }
            }

            Console.Write("Deleting newly created contact...");
            context.Subjects.Delete(newId);
            Console.WriteLine("OK");

            Console.WriteLine();
        }