public static function addCategory5($application, $category5, $schoolIds, $yArray, $dArray, $guardianNic)
 {
     $db = Connection::getInstance();
     $mysqli = $db->getConnection();
     $mysqli->autocommit(FALSE);
     $applicantResult = DBApplicationController::addApplication($application);
     if ($applicantResult) {
         $resultSchoolSet = true;
         $isApplicanthasCSS = DBSchoolController::isApplicanthasCSS($application->getApplicant_id());
         if ($isApplicanthasCSS) {
             //do not need add school set
         } else {
             // return $schoolIds[1];
             $resultSchoolSet = DBSchoolController::addCloseSchoolSet($application->getApplicant_id(), $schoolIds);
         }
         if ($resultSchoolSet) {
             $resultEL = true;
             $isGuardianHasEL = DBGuardianController::isGuardianHasEL($guardianNic);
             if ($isGuardianHasEL) {
             } else {
                 $resultEL = DBElectrocalListController::addElectrocalListDetail($dArray, $yArray, $guardianNic);
             }
             if ($resultEL) {
                 $resultC = true;
                 $resultCD = DBGuardianController::hasCategory5Detail($guardianNic);
                 if ($resultCD == false) {
                     $resultC = DBCategory5Controller::addCategory5($category5);
                 }
                 if ($resultC) {
                     $mysqli->commit();
                     return true;
                 } else {
                     $mysqli->rollback();
                     $mysqli->commit();
                     return false;
                 }
             } else {
                 $mysqli->rollback();
                 $mysqli->commit();
                 return FALSE;
             }
         } else {
             $mysqli->rollback();
             $mysqli->commit();
             return FALSE;
         }
     } else {
         $mysqli->rollback();
         $mysqli->commit();
         return FALSE;
     }
 }
 public function postEditcategory5()
 {
     $nic = Input::get('nic');
     $dateOfTransferReceived = Input::get("dateOfTransferReceived");
     $beforeWorkedPlace = Input::get("beforeWorkedPlace");
     $afterWorkedPlace = Input::get("afterWorkedPlace");
     $distanceOfTransfer = Input::get("distanceOfTransfer");
     $year1RemLeave = Input::get("year1RemLeave");
     $year2RemLeave = Input::get("year2RemLeave");
     $year3RemLeave = Input::get("year3RemLeave");
     $year4RemLeave = Input::get("year4RemLeave");
     $servicePeriod = Input::get("servicePeriod");
     $category5 = new OfficerOnTransfer();
     $category5->setNic($nic);
     $category5->setDateOfTransferReceived($dateOfTransferReceived);
     $category5->setBeforeWorkedPlace($beforeWorkedPlace);
     $category5->setAfterWorkedPlace($afterWorkedPlace);
     $category5->setDistanceOfTransfer($distanceOfTransfer);
     $category5->setYear1RemLeave($year1RemLeave);
     $category5->setYear2RemLeave($year2RemLeave);
     $category5->setYear3RemLeave($year3RemLeave);
     $category5->setYear4RemLeave($year4RemLeave);
     $category5->setServicePeriod($servicePeriod);
     $result = DBCategory5Controller::editCategory5($category5);
     if ($result) {
         return "category 5 editted well";
     } else {
         return "category 5 not editted well";
     }
 }
 public function postVerifytype5()
 {
     $application_id = Input::get('type');
     $schoolid = Input::get('school_id');
     $school = DBSchoolController::getSchool($schoolid);
     $application = DBApplicationController::getApplication($application_id);
     $applicant_id = $application->getApplicant_id();
     $applicant = DBStudentApplicantController::getApplicantById($applicant_id);
     $NIC = $applicant->getGuardianNIC();
     $guardian = DBGuardianController::getGuardianByNic($NIC);
     $category = DBCategory5Controller::getCategory5($NIC);
     return View::make('G1SAS/verifycategoryset/VerifyCategory5')->with('application_id', $application_id)->with('guardian', $guardian)->with('school', $school)->with('application', $application)->with('applicant', $applicant)->with('category', $category);
 }