Console Application Lab
Objective
Develop a console application that retrieves and displays the friendly name associated with a given Account ID and Person ID. The lab will guide users through the necessary steps to implement this functionality.
Credentials
- User ID: Test
- Password: P@$$w0rd
Steps
-
Start the 20331B-NYC-DC-05 virtual machine. Wait for the virtual machine to display the Desktop.
-
On your Desktop, Right-click Workflow Studio (WFS), and then click Run as administrator.
-
Wait for WFS to start and enter your credentials.
-
In Solution Explorer, right-click on the Developer Packages folder, create a new folder called DemoLabs, and click the Ok button.
-
Add New Folder dialog box will appear from it; select the following options:
- Console Applications
- And click the Ok button.
-
Expand the Developer Packages folder, find the DemoLabs folder, expand it under the DemoLabs folder, right-click on the Console Applications folder.
-
Wait for Console Application to be loaded.
-
Click on the Save icon to save your Console Application and give it a name CAGetPersonByID.
-
Click on the Save button.
-
Once you are back to console application designer code. Close the tab.
-
In the left navigation pane, open the to Demo Labs folder and double- click on the console application and it will then open in the Visual Studio.
In the Solution Explorer (typically on the right side of Visual Studio), you will notice that the project includes references to various EmpowerID assemblies. These assemblies contain the necessary code for interacting with the EmpowerID platform, including the components.
- In the Solution Explorer, double-click the Program.cs file. This will open the class that contains the Main method.
Observe the default namespace using directives at the top of the file. You will likely see namespaces related to EmpowerID, including components
- Write below code in the main method.
//TODO: Implementation code goes here
int personID = 0545654;
int accountID = 0987;
C.Person person = C.Person.GetByPersonID(personID);
Console.WriteLine("Friendly Name: " + person.FriendlyName);
var acc = C.Account.GetByAccountID(accountID);
Console.WriteLine("Friendly Name: " + acc.FriendlyName);
Console.ReadLine();
Ensure that you pass the correct person IDs to the methods listed above to obtain the expected results.
- Run the Console Application and you will see the results in the window.