/// <summary> /// This is is very simple demo of how to create a payroll import. /// </summary> public static void PayrollImportDemo() { // Set up authorization settings var authorizationSettings = new AuthorizationSettings { ApplicationKey = "<You Application Key Here>", ClientKey = "<PowerOffice Go Client Key Here>", TokenStore = new BasicTokenStore(@"my.tokenstore") }; // Initialize the PowerOffice Go API and request authorization var api = new Go(authorizationSettings); // Create the import object and upload it to the server var import = CreateAndSaveImport(api); // List un-posted imports ImportList.ListUnpostedImports(); // The user can post the journal manually from the PowerOffice GO user interface, // or the journal can be posted by code. PostImport(api, import); Console.WriteLine("Demo finished! Press any key to exit..."); Console.ReadKey(); }
/// <summary> /// This is is very simple demo of how to create a payroll import. /// </summary> public static async Task PayrollImportDemo() { // Set up authorization settings var authorizationSettings = new AuthorizationSettings { ApplicationKey = "<You Application Key Here>", ClientKey = "<PowerOffice Go Client Key Here>", TokenStore = new BasicTokenStore(@"my.tokenstore"), EndPointHost = Settings.EndPointMode.Production //For authorization against the demo environment - Change this to Settings.EndPointMode.Demo }; // Initialize the PowerOffice Go API and request authorization var api = await Go.CreateAsync(authorizationSettings); // Create the import object and upload it to the server var import = CreateAndSaveImport(api); // List un-posted imports ImportList.ListUnpostedImports(); // The user can post the journal manually from the PowerOffice GO user interface, // or the journal can be posted by code. PostImport(api, import); Console.WriteLine("Demo finished! Press any key to exit..."); Console.ReadKey(); }
//// Main method for C# 7.0 and below. Be careful with Wait, you can get deadlocks. It is highly recommended to update to C# 7.1 for console applications. //// To change the C# version, open the project properties, go to Build, then click the Advanced button in the bottom right, and select your C# version. //// If you can't find an appropriate C# version you may need to update your Visual Studio. //public static void Main(string[] args) //{ // RunDemo().Wait(); //} /// <summary> /// The purpose of this demo is to demonstrate how to import various journal types /// See each import class for details regarding the various import types. /// </summary> /// <remarks> /// FOR VERSION 2.6.0 AND ABOVE: /// The newly created Voucher endpoint is a prefered way of creating vouchers in PowerOffice Go. /// Take a look at VoucherDemo before thinking about using this demo. /// </remarks> private static async Task RunDemo() { try { // Run the payroll import demo await PayrollImport.PayrollImportDemo(); await CustomerInvoicesImport.CustomerInvoicesImportDemo(); await ImportList.ListUnpostedImports(); await SalesOrderImport.SalesOrderImportDemo(); } catch (ApiException e) { Console.WriteLine("Error: " + e.Message); } // Wait for user input Console.WriteLine("\n\nPress any key..."); Console.ReadKey(); }