Advertisement
Guest User

przyklad

a guest
Nov 20th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.67 KB | None | 0 0
  1. //It stores the information of a participant to be printed on his badge.
  2. public class Badge {
  3.     String pid;  //participant ID
  4.     String engName; //participant's full name in English
  5.     String chiName; //participant's full name in Chinese
  6.     String engOrgName; //name of the participant's organization in English
  7.     String chiOrgName; //name of the participant's organization in Chinese
  8.     String engCountry; //the organization's country in English
  9.     String chiCountry; //the organization's country in Chinese
  10.     //***********************
  11.     //constructor.
  12.     //The participant ID is provided. It then loads all the info from the DB.
  13.     //***********************
  14.     Badge(String pid) {
  15.         this.pid = pid;
  16.         //***********************
  17.         //get the participant's full names.
  18.         //***********************
  19.         ParticipantsInDB partsInDB = ParticipantsInDB.getInstance();
  20.         Participant part = partsInDB.locateParticipant(pid);
  21.         if (part != null) {
  22.             //get the participant's full name in English.
  23.             engName = part.getELastName() + ", " + part.getEFirstName();
  24.             //get the participant's full name in Chinese.
  25.             chiName = part.getCLastName() + part.getCFirstName();
  26.             //***********************
  27.             //get the organization's name and country.
  28.             //***********************
  29.             OrganizationsInDB orgsInDB = OrganizationsInDB.getInstance();
  30.             //find the ID of the organization employing this participant.
  31.             String oid = orgsInDB.getOrganization(pid);
  32.             if (oid != null) {
  33.                 Organization org = orgsInDB.locateOrganization(oid);
  34.                 engOrgName = org.getEName();
  35.                 chiOrgName = org.getCName();
  36.                 engCountry = org.getEAddress().getCountry();
  37.                 chiCountry = org.getCAddress().getCountry();
  38.             }
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement