Exemplo n.º 1
0
 /// <summary>
 /// Creates new license object with given properties. See lmBoxAPI JavaDoc for details:
 /// http://lmbox.labs64.com/javadoc/index.html?com/labs64/lmbox/core/service/LicenseService.html
 /// </summary>
 public static License create(Context context, String licenseeNumber, String licenseTemplateNumber, String transactionNumber, License newLicense)
 {
     newLicense.licenseeNumber = licenseeNumber;
     newLicense.licenseTemplateNumber = licenseTemplateNumber;
     newLicense.licenseProperties.Add(Constants.Transaction.TRANSACTION_NUMBER, transactionNumber);
     lmbox output = LmBoxAPI.request(context, LmBoxAPI.Method.POST, Constants.License.endPoint, newLicense.ToDictionary());
     return new License(output.items[0]);
 }
        /// <summary>
        /// Returns all product modules of a vendor. See lmBoxAPI JavaDoc for details:
        /// http://lmbox.labs64.com/javadoc/index.html?com/labs64/lmbox/core/service/ProductModuleService.html
        /// </summary>
        public static List<ProductModule> list(Context context, String filter)
        {
            lmbox output = LmBoxAPI.request(context, LmBoxAPI.Method.GET, Constants.ProductModule.ENDPOINT_PATH, null);

            List<ProductModule> productModules = new List<ProductModule>();
            foreach (item i in output.items)
            {
                productModules.Add(new ProductModule(i));
            }
            return productModules;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Returns all licensees of a vendor. See lmBoxAPI JavaDoc for details:
        /// http://lmbox.labs64.com/javadoc/index.html?com/labs64/lmbox/core/service/LicenseeService.html
        /// </summary>
        public static List<Licensee> list(Context context)
        {
            lmbox output = LmBoxAPI.request(context, LmBoxAPI.Method.GET, Constants.Licensee.ENDPOINT_PATH, null);

            List<Licensee> licensees = new List<Licensee>();
            foreach (item i in output.items)
            {
                licensees.Add(new Licensee(i));
            }
            return licensees;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Returns all products of a vendor. See lmBoxAPI JavaDoc for details:
        /// http://lmbox.labs64.com/javadoc/index.html?com/labs64/lmbox/core/service/ProductService.html
        /// </summary>
        public static List<Product> list(Context context)
        {
            lmbox output = LmBoxAPI.request(context, LmBoxAPI.Method.GET, "/product", null);

            List<Product> products = new List<Product>();
            foreach (item i in output.items)
            {
               products.Add(new Product(i));
            }
            return products;
        }
        /// <summary>
        /// Returns all license templates of a vendor. See lmBoxAPI JavaDoc for details:
        /// http://lmbox.labs64.com/javadoc/index.html?com/labs64/lmbox/core/service/LicenseTemplateService.html
        /// </summary>
        public static List<LicenseTemplate> list(Context context, String filter)
        {
            lmbox output = LmBoxAPI.request(context, LmBoxAPI.Method.GET, "/licensetemplate", null);

            List<LicenseTemplate> licenseTemplates = new List<LicenseTemplate>();
            foreach (item i in output.items)
            {
                licenseTemplates.Add(new LicenseTemplate(i));
            }
            return licenseTemplates;
        }
Exemplo n.º 6
0
 /// <summary>
 /// Creates new licensee object with given properties. See lmBoxAPI JavaDoc for details:
 /// http://lmbox.labs64.com/javadoc/index.html?com/labs64/lmbox/core/service/LicenseeService.html
 /// </summary>
 public static Licensee create(Context context, String productNumber, Licensee newLicensee)
 {
     newLicensee.productNumber = productNumber;
     lmbox output = LmBoxAPI.request(context, LmBoxAPI.Method.POST, Constants.Licensee.ENDPOINT_PATH, newLicensee.ToDictionary());
     return new Licensee(output.items[0]);
 }
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            try
            {
                Context context = new Context();
                context.baseUrl = "http://lmbox.labs64.com/core/rest";
                //context.baseUrl = "http://10.0.2.2:28080";
                context.username = "******";
                context.password = "******";

             //               String vendor = "VDEMO";
                String product = "P014";
                String licensee = "I011";
                String productModule = "M001";
                String licenseTemplate = "E001";

                #region ****************** Product

                ProductService.delete(context, product, true);

                Product defaultProduct = new Product();
                defaultProduct.number = product;
                defaultProduct.name = "Default product";
                Product addedDProduct = ProductService.create(context, defaultProduct);
                Console.WriteLine("Added default product:");
                Console.WriteLine(addedDProduct.ToString());
                Console.WriteLine("");

                Product gotProduct = ProductService.get(context, product);
                Console.WriteLine("Got default product: ");
                Console.WriteLine(gotProduct.ToString());
                Console.WriteLine("");

                Product updateProduct = new Product();
                updateProduct.productProperties.Add("Updated property name", "Updated value");
                Product upProduct = ProductService.update(context, product, updateProduct);
                Console.WriteLine("Updated default product: ");
                Console.WriteLine(upProduct.ToString());
                Console.WriteLine("");

                ProductService.delete(context, product, true);
                Console.WriteLine("Deleted default Product!");
                Console.WriteLine("");

                List<Product> products = ProductService.list(context);
                Console.WriteLine("Got the following Products:");
                foreach (Product prod in products)
                {
                    Console.WriteLine(prod.ToString());
                }
                Console.WriteLine("");
                #endregion

                #region ****************** Licensee
                LicenseeService.delete(context, licensee, false);

                Licensee defaultLicensee = new Licensee();
                defaultLicensee.number = licensee;
                Licensee addedDLicensee = LicenseeService.create(context, "P015", defaultLicensee);
                Console.WriteLine("Added default licensee:");
                Console.WriteLine(addedDLicensee.ToString());
                Console.WriteLine("");

                Licensee gotLicensee = LicenseeService.get(context, licensee);
                Console.WriteLine("Got default licensee: ");
                Console.WriteLine(gotLicensee.ToString());
                Console.WriteLine("");

                Licensee updateLicensee = new Licensee();
                updateLicensee.licenseeProperties.Add("Updated property name", "Updated value");
                Licensee upLicensee = LicenseeService.update(context, licensee, updateLicensee);
                Console.WriteLine("Updated default licensee: ");
                Console.WriteLine(upLicensee.ToString());
                Console.WriteLine("");

                LicenseeService.delete(context, licensee, false);
                Console.WriteLine("Deleted default licensee!");
                Console.WriteLine("");

                List<Licensee> licensees = LicenseeService.list(context);
                Console.WriteLine("Got the following licensees:");
                foreach (Licensee licenz in licensees)
                {
                    Console.WriteLine(licenz.ToString());
                }
                Console.WriteLine("");

                Licensee addedLicensee = new Licensee();
                addedLicensee.number = licensee;
                Licensee addedNewLicensee = LicenseeService.create(context, "P015", addedLicensee);
                Console.WriteLine("Added new licensee:");
                Console.WriteLine(addedNewLicensee.ToString());
                Console.WriteLine("");

                licensees = LicenseeService.list(context);
                Console.WriteLine("Got the following licensees after add:");
                foreach (Licensee licenz in licensees)
                {
                    Console.WriteLine(licenz.ToString());
                }
                Console.WriteLine("");

                #endregion

                #region ****************** License
                License defaultLicense = new License();
                defaultLicense.number = "L011";
                License addedDLicense = LicenseService.create(context, licensee, "E011", null, defaultLicense);
                Console.WriteLine("Added default license:");
                Console.WriteLine(addedDLicense.ToString());
                Console.WriteLine("");

                License gotLicense = LicenseService.get(context, "L011");
                Console.WriteLine("Got default license: ");
                Console.WriteLine(gotLicense.ToString());
                Console.WriteLine("");

                License updateLicense = new License();
                updateLicense.licenseProperties.Add("Updated property name", "Updated value");
                License upLicense = LicenseService.update(context, "L011", null, updateLicense);
                Console.WriteLine("Updated default license: ");
                Console.WriteLine(upLicense.ToString());
                Console.WriteLine("");

                List<License> licenses = LicenseService.list(context);
                Console.WriteLine("Got the following licenses:");
                foreach (License license in licenses)
                {
                    Console.WriteLine(license.ToString());
                }
                Console.WriteLine("");

                licenses = LicenseService.list(context);
                Console.WriteLine("Got the following licenses after add:");
                foreach (License license in licenses)
                {
                    Console.WriteLine(license.ToString());
                }
                Console.WriteLine("");

                LicenseService.delete(context, "L011");
                Console.WriteLine("Deleted default license!");
                Console.WriteLine("");
                #endregion

                #region ****************** ProductModule
                List<ProductModule> productModules = ProductModuleService.list(context, null);
                Console.WriteLine("Got the following ProductModules:");
                foreach (ProductModule prodMod in productModules)
                {
                    Console.WriteLine(prodMod.ToString());
                }
                Console.WriteLine("");

                ProductModule gotProductModule = ProductModuleService.get(context, productModule);
                Console.WriteLine("Got default product module: ");
                Console.WriteLine(gotProductModule.ToString());
                Console.WriteLine("");

                ProductModuleService.delete(context, productModule, true);
                Console.WriteLine("Deleted default ProductModule!");
                Console.WriteLine("");

                ProductService.create(context, defaultProduct);

                ProductModule defaultProductModule = new ProductModule();
                defaultProductModule.number = productModule;
                defaultProductModule.name = "Default product module";
                defaultProductModule.licensingModel = "TimeEvaluation";
                ProductModule addedDProductModule = ProductModuleService.create(context, product, defaultProductModule);
                Console.WriteLine("Added default product module:");
                Console.WriteLine(addedDProductModule.ToString());
                Console.WriteLine("");

                ProductModule updateProductModule = new ProductModule();
                addedDProductModule.productModuleProperties.Add("Updated property name", "Updated property value");
                ProductModule upProductModule = ProductModuleService.update(context, productModule, addedDProductModule);
                Console.WriteLine("Updated default product module: ");
                Console.WriteLine(upProductModule.ToString());
                Console.WriteLine("");
                #endregion

                #region ************** LicenseTemplate
                List<LicenseTemplate> licenseTemplates = LicenseTemplateService.list(context, null);
                Console.WriteLine("Got the following license templates:");
                foreach (LicenseTemplate lTemplate in licenseTemplates)
                {
                    Console.WriteLine(lTemplate.ToString());
                }
                Console.WriteLine("");

                LicenseTemplate defaultLicenseTemplate = new LicenseTemplate();
                defaultLicenseTemplate.number = licenseTemplate;
                defaultLicenseTemplate.name = "Default license template";
                defaultLicenseTemplate.licenseType = "FEATURE";
                LicenseTemplate addedDLicenseTemplate = LicenseTemplateService.create(context, productModule, defaultLicenseTemplate);
                Console.WriteLine("Added default license template:");
                Console.WriteLine(addedDLicenseTemplate.ToString());
                Console.WriteLine("");

                LicenseTemplate gotLicenseTemplate = LicenseTemplateService.get(context, licenseTemplate);
                Console.WriteLine("Got default license template:");
                Console.WriteLine(gotLicenseTemplate.ToString());
                Console.WriteLine("");

                defaultLicenseTemplate.licenseTemplateProperties.Add("Updated property name", "Updated property value");
                LicenseTemplate updateLicenseTemplate = LicenseTemplateService.update(context, licenseTemplate, defaultLicenseTemplate);
                Console.WriteLine("Updated default license template:");
                Console.WriteLine(updateLicenseTemplate.ToString());
                Console.WriteLine("");

                LicenseTemplateService.delete(context, licenseTemplate, false);
                Console.WriteLine("Deleted default license template!");
                Console.WriteLine("");
                #endregion

                #region ****************** Validate
                ValidationResult validationResult = LicenseeService.validate(context, licensee);
                Console.WriteLine("Validation result for created licensee:");
                Console.WriteLine(validationResult.ToString());
                #endregion

                LicenseeService.delete(context, licensee, false);

            }
            catch (LmBoxException e)
            {
                Console.WriteLine("Got lmBox exception:");
                Console.WriteLine(e);
            }
            catch (Exception e)
            {
                Console.WriteLine("Got exception:");
                Console.WriteLine(e);
            }

            Console.WriteLine("Press <Enter> to exit...");
            Console.ReadLine();
        }
 /// <summary>
 /// Updates product module properties. See lmBoxAPI JavaDoc for details:
 /// http://lmbox.labs64.com/javadoc/index.html?com/labs64/lmbox/core/service/ProductModuleService.html
 /// </summary>
 public static ProductModule update(Context context, String number, ProductModule updateProductModule)
 {
     updateProductModule.number = number;
     lmbox output = LmBoxAPI.request(context, LmBoxAPI.Method.POST, Constants.ProductModule.ENDPOINT_PATH + "/" + number, updateProductModule.ToDictionary());
     return new ProductModule(output.items[0]);
 }
 /// <summary>
 /// Creates new ProductModel object with given properties. See lmBoxAPI JavaDoc for details:
 /// http://lmbox.labs64.com/javadoc/index.html?com/labs64/lmbox/core/service/ProductModuleService.html
 /// </summary>
 public static ProductModule create(Context context, String productNumber, ProductModule newProductModule)
 {
     newProductModule.productNumber = productNumber;
     lmbox output = LmBoxAPI.request(context, LmBoxAPI.Method.POST, "/productmodule", newProductModule.ToDictionary());
     return new ProductModule(output.items[0]);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Deletes product. See lmBoxAPI JavaDoc for details:
 /// http://lmbox.labs64.com/javadoc/index.html?com/labs64/lmbox/core/service/ProductService.html
 /// </summary>
 public static void delete(Context context, String number, bool forceCascade)
 {
     String strCascade = Convert.ToString(forceCascade).ToLower();
     lmbox output = LmBoxAPI.request(context, LmBoxAPI.Method.DELETE, "/product/" + number + "?" + Constants.CASCADE + "=" + strCascade, null);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Validates active licenses of the licensee. See lmBoxAPI JavaDoc for details:
 /// http://lmbox.labs64.com/javadoc/index.html?com/labs64/lmbox/core/service/LicenseeService.html
 /// </summary>
 public static ValidationResult validate(Context context, String number)
 {
     lmbox output = LmBoxAPI.request(context, LmBoxAPI.Method.GET, Constants.Licensee.ENDPOINT_PATH + "/" + number + "/validate", null);
     return new ValidationResult(output);
 }
Exemplo n.º 12
0
 /// <summary>
 /// Deletes licensee. See lmBoxAPI JavaDoc for details:
 /// http://lmbox.labs64.com/javadoc/index.html?com/labs64/lmbox/core/service/LicenseeService.html
 /// </summary>
 public static void delete(Context context, String number, Boolean forceCascade)
 {
     lmbox output = LmBoxAPI.request(context, LmBoxAPI.Method.DELETE, Constants.Licensee.ENDPOINT_PATH + "/" + number, Utilities.forceCascadeToDict(forceCascade));
 }
Exemplo n.º 13
0
 /// <summary>
 /// Gets product by its number. See lmBoxAPI JavaDoc for details:
 /// http://lmbox.labs64.com/javadoc/index.html?com/labs64/lmbox/core/service/ProductService.html
 /// </summary>
 public static Product get(Context context, String number)
 {
     lmbox output = LmBoxAPI.request(context, LmBoxAPI.Method.GET, Constants.Product.ENDPOINT_PATH + "/" + number, null);
     return new Product(output.items[0]);
 }
Exemplo n.º 14
0
 /// <summary>
 /// Creates new product object with given properties. See lmBoxAPI JavaDoc for details:
 /// http://lmbox.labs64.com/javadoc/index.html?com/labs64/lmbox/core/service/ProductService.html
 /// </summary>
 public static Product create(Context context, Product newProduct)
 {
     lmbox output = LmBoxAPI.request(context, LmBoxAPI.Method.POST, Constants.Product.ENDPOINT_PATH, newProduct.ToDictionary());
     return new Product(output.items[0]);
 }
 /// <summary>
 /// Updates license template properties. See lmBoxAPI JavaDoc for details:
 /// http://lmbox.labs64.com/javadoc/index.html?com/labs64/lmbox/core/service/LicenseTemplateService.html
 /// </summary>
 public static LicenseTemplate update(Context context, String number, LicenseTemplate updateLicenseTemplate)
 {
     lmbox output = LmBoxAPI.request(context, LmBoxAPI.Method.POST, "/licensetemplate/" + number, updateLicenseTemplate.ToDictionary());
     return new LicenseTemplate(output.items[0]);
 }
 /// <summary>
 /// Gets license template by its number. See lmBoxAPI JavaDoc for details:
 /// http://lmbox.labs64.com/javadoc/index.html?com/labs64/lmbox/core/service/LicenseTemplateService.html
 /// </summary>
 public static LicenseTemplate get(Context context, String number)
 {
     lmbox output = LmBoxAPI.request(context, LmBoxAPI.Method.GET, "/licensetemplate/" + number, null);
     return new LicenseTemplate(output.items[0]);
 }
 /// <summary>
 /// Creates new license template object with given properties. See lmBoxAPI JavaDoc for details:
 /// http://lmbox.labs64.com/javadoc/index.html?com/labs64/lmbox/core/service/LicenseTemplateService.html
 /// </summary>
 public static LicenseTemplate create(Context context, String productModuleNumber, LicenseTemplate newLicenseTemplate)
 {
     newLicenseTemplate.productModuleNumber = productModuleNumber;
     lmbox output = LmBoxAPI.request(context, LmBoxAPI.Method.POST, "/licensetemplate", newLicenseTemplate.ToDictionary());
     return new LicenseTemplate(output.items[0]);
 }
Exemplo n.º 18
0
 /// <summary>
 /// Gets licensee by its number. See lmBoxAPI JavaDoc for details:
 /// http://lmbox.labs64.com/javadoc/index.html?com/labs64/lmbox/core/service/LicenseeService.html
 /// </summary>
 public static Licensee get(Context context, String number)
 {
     lmbox output = LmBoxAPI.request(context, LmBoxAPI.Method.GET, Constants.Licensee.ENDPOINT_PATH + "/" + number, null);
     return new Licensee(output.items[0]);
 }
Exemplo n.º 19
0
 /// <summary>
 /// Deletes license. See lmBoxAPI JavaDoc for details:
 /// http://lmbox.labs64.com/javadoc/index.html?com/labs64/lmbox/core/service/LicenseService.html
 /// </summary>
 public static void delete(Context context, String number)
 {
     lmbox output = LmBoxAPI.request(context, LmBoxAPI.Method.DELETE, Constants.License.endPoint + number, null);
 }
Exemplo n.º 20
0
 /// <summary>
 /// Updates licensee properties. See lmBoxAPI JavaDoc for details:
 /// http://lmbox.labs64.com/javadoc/index.html?com/labs64/lmbox/core/service/LicenseeService.html
 /// </summary>
 public static Licensee update(Context context, String number, Licensee updateLicensee)
 {
     updateLicensee.number = number;
     lmbox output = LmBoxAPI.request(context, LmBoxAPI.Method.POST, Constants.Licensee.ENDPOINT_PATH + "/" + number, updateLicensee.ToDictionary());
     return new Licensee(output.items[0]);
 }
Exemplo n.º 21
0
 /// <summary>
 /// Gets license by its number. See lmBoxAPI JavaDoc for details:
 /// http://lmbox.labs64.com/javadoc/index.html?com/labs64/lmbox/core/service/LicenseService.html
 /// </summary>
 public static License get(Context context, String number)
 {
     lmbox output = LmBoxAPI.request(context, LmBoxAPI.Method.GET, Constants.License.endPoint + number, null);
     return new License(output.items[0]);
 }
Exemplo n.º 22
0
 /// <summary>
 /// Creates new product object with given properties. See lmBoxAPI JavaDoc for details:
 /// http://lmbox.labs64.com/javadoc/index.html?com/labs64/lmbox/core/service/ProductService.html
 /// </summary>
 public static Product create(Context context, Product newProduct)
 {
     lmbox output = LmBoxAPI.request(context, LmBoxAPI.Method.POST, "/product", newProduct.ToDictionary());
     return new Product(output.items[0]);
 }
Exemplo n.º 23
0
 /// <summary>
 /// Updates license properties. See lmBoxAPI JavaDoc for details:
 /// http://lmbox.labs64.com/javadoc/index.html?com/labs64/lmbox/core/service/LicenseService.html
 /// </summary>
 public static License update(Context context, String number, String transactionNumber, License updateLicense)
 {
     lmbox output = LmBoxAPI.request(context, LmBoxAPI.Method.POST, Constants.License.endPoint + number, updateLicense.ToDictionary());
     return new License(output.items[0]);
 }
Exemplo n.º 24
0
 /// <summary>
 /// Gets product by its number. See lmBoxAPI JavaDoc for details:
 /// http://lmbox.labs64.com/javadoc/index.html?com/labs64/lmbox/core/service/ProductService.html
 /// </summary>
 public static Product get(Context context, String number)
 {
     lmbox output = LmBoxAPI.request(context, LmBoxAPI.Method.GET, "/product/" + number, null);
     return new Product(output.items[0]);
 }
 /// <summary>
 /// Deletes product module. See lmBoxAPI JavaDoc for details:
 /// http://lmbox.labs64.com/javadoc/index.html?com/labs64/lmbox/core/service/ProductModuleService.html
 /// </summary>
 public static void delete(Context context, String number, bool forceCascade)
 {
     String strCascade = Convert.ToString(forceCascade).ToLower();
     lmbox output = LmBoxAPI.request(context, LmBoxAPI.Method.DELETE, Constants.ProductModule.ENDPOINT_PATH + "/" + number, Utilities.forceCascadeToDict(forceCascade));
 }
Exemplo n.º 26
0
 /// <summary>
 /// Updates product properties. See lmBoxAPI JavaDoc for details:
 /// http://lmbox.labs64.com/javadoc/index.html?com/labs64/lmbox/core/service/ProductService.html
 /// </summary>
 public static Product update(Context context, String number, Product updateProduct)
 {
     updateProduct.number = number;
     lmbox output = LmBoxAPI.request(context, LmBoxAPI.Method.POST, "/product/" + number, updateProduct.ToDictionary());
     return new Product(output.items[0]);
 }
Exemplo n.º 27
0
        static void Main(string[] args)
        {
            ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; // Trust the self-signed certificate at lmbox.labs64.com.
            Context context = new Context();
            context.baseUrl = "https://lmbox.labs64.com";
            context.username = "******";
            context.password = "******";

            String demoProductNumber = "P001demo";
            String demoProductModuleNumber = "M001demo";
            String demoLicensingModel = "TimeEvaluation";

            String demoLicenseTemplate1_Number = "E001demo";
            String demoLicenseTemplate1_Name = "Demo Evaluation Period";
            String demoLicenseTemplate1_Type = "TIMEVOLUME";
            Decimal demoLicenseTemplate1_Price = 12.50M;
            String demoLicenseTemplate1_Currency = "EUR";
            String demoLicenseTemplate1_TimeVolume = "5"; // days
            Boolean demoLicenseTemplate1_Automatic = true;

            String demoLicenseeNumber = "I001demo";

            try
            {
                #region ****************** Product

                Product newProduct = new Product();
                newProduct.number = demoProductNumber;
                newProduct.name = "Demo product";
                Product product = ProductService.create(context, newProduct);
                ConsoleWriter.WriteEntity("Added product:", product);

                product = ProductService.get(context, demoProductNumber);
                ConsoleWriter.WriteEntity("Got product:", product);

                List<Product> products = ProductService.list(context);
                ConsoleWriter.WriteList("Got the following products:", products);

                Product updateProduct = new Product();
                updateProduct.productProperties.Add("Updated property name", "Updated value");
                product = ProductService.update(context, demoProductNumber, updateProduct);
                ConsoleWriter.WriteEntity("Updated product:", product);

                ProductService.delete(context, demoProductNumber, true);
                ConsoleWriter.WriteMsg("Deleted Product!");

                products = ProductService.list(context);
                ConsoleWriter.WriteList("Got the following Products:", products);

                product = ProductService.create(context, newProduct);
                ConsoleWriter.WriteEntity("Added product again:", product);

                products = ProductService.list(context);
                ConsoleWriter.WriteList("Got the following Products:", products);

                #endregion

                #region ****************** ProductModule

                ProductModule newProductModule = new ProductModule();
                newProductModule.number = demoProductModuleNumber;
                newProductModule.name = "Demo product module";
                newProductModule.licensingModel = demoLicensingModel;
                ProductModule productModule = ProductModuleService.create(context, demoProductNumber, newProductModule);
                ConsoleWriter.WriteEntity("Added product module:", productModule);

                productModule = ProductModuleService.get(context, demoProductModuleNumber);
                ConsoleWriter.WriteEntity("Got product module:", productModule);

                List<ProductModule> productModules = ProductModuleService.list(context, null);
                ConsoleWriter.WriteList("Got the following ProductModules:", productModules);

                ProductModule updateProductModule = new ProductModule();
                updateProductModule.productModuleProperties.Add("Updated property name", "Updated property value");
                productModule = ProductModuleService.update(context, demoProductModuleNumber, updateProductModule);
                ConsoleWriter.WriteEntity("Updated product module:", productModule);

                ProductModuleService.delete(context, demoProductModuleNumber, true);
                ConsoleWriter.WriteMsg("Deleted ProductModule!");

                productModules = ProductModuleService.list(context, null);
                ConsoleWriter.WriteList("Got the following ProductModules:", productModules);

                productModule = ProductModuleService.create(context, demoProductNumber, newProductModule);
                ConsoleWriter.WriteEntity("Added product module again:", productModule);

                productModules = ProductModuleService.list(context, null);
                ConsoleWriter.WriteList("Got the following ProductModules:", productModules);

                #endregion

                #region ****************** LicenseTemplate
                LicenseTemplate newLicenseTemplate = new LicenseTemplate();
                newLicenseTemplate.number = demoLicenseTemplate1_Number;
                newLicenseTemplate.name = demoLicenseTemplate1_Name;
                newLicenseTemplate.licenseType = demoLicenseTemplate1_Type;
                newLicenseTemplate.price = demoLicenseTemplate1_Price;
                newLicenseTemplate.currency = demoLicenseTemplate1_Currency;
                newLicenseTemplate.licenseTemplateProperties[Constants.License.PROP_TIME_VOLUME] = demoLicenseTemplate1_TimeVolume;
                newLicenseTemplate.automatic = demoLicenseTemplate1_Automatic;
                ConsoleWriter.WriteEntity("Adding license template:", newLicenseTemplate);
                LicenseTemplate licenseTemplate = LicenseTemplateService.create(context, demoProductModuleNumber, newLicenseTemplate);
                ConsoleWriter.WriteEntity("Added license template:", licenseTemplate);

                licenseTemplate = LicenseTemplateService.get(context, demoLicenseTemplate1_Number);
                ConsoleWriter.WriteEntity("Got licenseTemplate:", licenseTemplate);

                List<LicenseTemplate> licenseTemplates = LicenseTemplateService.list(context, null);
                ConsoleWriter.WriteList("Got the following license templates:", licenseTemplates);

                LicenseTemplate updateLicenseTemplate = new LicenseTemplate();
                updateLicenseTemplate.active = true;
                updateLicenseTemplate.automatic = true; // workaround: at the moment not specified booleans treated as "false"
                licenseTemplate = LicenseTemplateService.update(context, demoLicenseTemplate1_Number, updateLicenseTemplate);
                ConsoleWriter.WriteEntity("Updated license template:", licenseTemplate);

                // TODO: delete

                #endregion

                /*
                #region ****************** Licensee

                Licensee newLicensee = new Licensee();
                newLicensee.number = demoLicenseeNumber;
                Licensee licensee = LicenseeService.create(context, demoProductNumber, newLicensee);
                ConsoleWriter.WriteEntity("Added licensee:", licensee);

                List<Licensee> licensees = LicenseeService.list(context);
                ConsoleWriter.WriteList("Got the following licensees:", licensees);

                LicenseeService.delete(context, demoLicenseeNumber, true);
                ConsoleWriter.WriteMsg("Deleted licensee!");

                licensees = LicenseeService.list(context);
                ConsoleWriter.WriteList("Got the following licensees:", licensees);

                licensee = LicenseeService.create(context, demoProductNumber, newLicensee);
                ConsoleWriter.WriteEntity("Added licensee again:", licensee);

                licensee = LicenseeService.get(context, demoLicenseeNumber);
                ConsoleWriter.WriteEntity("Got licensee:", licensee);

                Licensee updateLicensee = new Licensee();
                updateLicensee.licenseeProperties.Add("Updated property name", "Updated value");
                licensee = LicenseeService.update(context, demoLicenseeNumber, updateLicensee);
                ConsoleWriter.WriteEntity("Updated licensee:", licensee);

                licensees = LicenseeService.list(context);
                ConsoleWriter.WriteList("Got the following licensees:", licensees);

                #endregion

                #region ****************** License
                License defaultLicense = new License();
                defaultLicense.number = "L011";
                License addedDLicense = LicenseService.create(context, demoLicenseeNumber, demoLicenseTemplate1_Number, null, defaultLicense);
                ConsoleWriter.WriteEntity("Added default license:", addedDLicense);

                License gotLicense = LicenseService.get(context, "L011");
                ConsoleWriter.WriteEntity("Got default license:", gotLicense);

                License updateLicense = new License();
                updateLicense.licenseProperties.Add("Updated property name", "Updated value");
                License upLicense = LicenseService.update(context, "L011", null, updateLicense);
                ConsoleWriter.WriteEntity("Updated default license:", upLicense);

                List<License> licenses = LicenseService.list(context);
                Console.WriteLine("Got the following licenses:");
                foreach (License license in licenses)
                {
                    Console.WriteLine(license.ToString());
                }
                Console.WriteLine("");

                licenses = LicenseService.list(context);
                Console.WriteLine("Got the following licenses after add:");
                foreach (License license in licenses)
                {
                    Console.WriteLine(license.ToString());
                }
                Console.WriteLine("");

                LicenseService.delete(context, "L011");
                Console.WriteLine("Deleted default license!");
                Console.WriteLine("");
                #endregion

                #region ****************** Validate
                ValidationResult validationResult = LicenseeService.validate(context, demoLicenseeNumber);
                ConsoleWriter.WriteEntity("Validation result for created licensee:", validationResult);
                #endregion
                */

            }
            catch (LmBoxException e)
            {
                Console.WriteLine("Got lmBox exception:");
                Console.WriteLine(e);
            }
            catch (Exception e)
            {
                Console.WriteLine("Got exception:");
                Console.WriteLine(e);
            }
            finally
            {
                try
                {
                    // Cleanup - delete test product with all its related items
                    ProductService.delete(context, demoProductNumber, true);
                }
                catch (LmBoxException e)
                {
                    Console.WriteLine("Got lmBox exception during cleanup:");
                    Console.WriteLine(e);
                }
                catch (Exception e)
                {
                    Console.WriteLine("Got exception during cleanup:");
                    Console.WriteLine(e);
                }
            }

            Console.WriteLine("Press <Enter> to exit...");
            Console.ReadLine();
        }