Created
May 29, 2012 03:15
-
-
Save jinweijie/2822328 to your computer and use it in GitHub Desktop.
code_bad
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Constructor | |
*/ | |
public ControllerStudentOCLevel(){ | |
//1. validate input | |
this.CurrentStudentId = ApexPages.currentPage().getParameters().get('studentId'); | |
if( this.CurrentStudentId == null || this.CurrentStudentId.trim() == '') | |
throw new InvalidParameterValueException('studentId','Missing parameter studentId.'); | |
//2. create model | |
this.MStudentOCLevel = new ModelStudentOCLevel(); | |
Contact currentStudent = ServiceStudent.getStudentByContactId(this.CurrentStudentId); | |
if( currentStudent == null ) | |
throw new ExEtownStudentNotExistException('Cannot find student with id:' + this.CurrentStudentId); | |
this.MStudentOCLevel.CurrentStudent = currentStudent; | |
intialOCLevelList(); | |
convertHIMATestLevel(currentStudent.EtownMemberId__c); | |
} | |
/** | |
* Convert HIMA Test Level for MINI. | |
*/ | |
private void convertHIMATestLevel(decimal etownMemberId){ | |
system.debug('[EXEC] convertHIMATestLevel, etownmemberId=' + etownmemberId); | |
this.HIMATestLevel = ServiceStudent.getStudentHIMATest(etownMemberId); | |
if (this.HIMATestLevel == Constants.LEVEL_0A){ | |
this.HIMATestLevel = Constants.LEVEL_ONE; | |
} | |
else if (this.HIMATestLevel == Constants.LEVEL_0B){ | |
this.HIMATestLevel = Constants.LEVEL_TWO; | |
} | |
else{ | |
this.HIMATestLevel = String.valueOf(integer.valueOf( this.HIMATestLevel) + 2); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment