public function doUpdateEmploymentAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $ajaxRes = array('success' => 0, 'info' => null);
     if ($this->getRequest()->isXmlHttpRequest()) {
         $params = $this->getRequest()->getParams();
         $empId = null;
         $companyName = null;
         $positionHeld = null;
         $startDate = null;
         $endDate = null;
         $description = null;
         $errors = array();
         if (!empty($params['data']) && sizeof($params['data'])) {
             $Text = array("JobFucntion1" => "", "Percentage1" => "");
             foreach ($params['data'] as $key => $item) {
                 if ($item['name'] == 'empId') {
                     $empId = $item['value'];
                 }
                 if ($item['name'] == 'companyName') {
                     $companyName = $item['value'];
                 }
                 if ($item['name'] == 'posotionHeld') {
                     $positionHeld = $item['value'];
                 }
                 if ($item['name'] == 'startDate') {
                     $startDate = $item['value'];
                 }
                 if ($item['name'] == 'endDate') {
                     $endDate = $item['value'];
                 }
                 if ($item['name'] == 'description') {
                     $description = $item['value'];
                 }
                 if ($item['name'] == 'JobID') {
                     $jobid = $item['value'];
                 }
                 if ($item['name'] == 'JobFunctionID') {
                     $JobFunctionID = $item['value'];
                 }
                 if ($item['name'] == 'JobFucntion') {
                     $JobFucntion = $item['value'];
                 }
                 if ($item['name'] == 'Percentage') {
                     $Percentage = $item['value'];
                 }
                 if ($item['name'] == 'JobFucntion1[]') {
                     $Text["JobFucntion1"][] = $item['value'];
                 }
                 if ($item['name'] == 'Percentage1[]') {
                     $Text["Percentage1"][] = $Percentage = round($item['value'] / 100, 2);
                 }
             }
             if (empty($empId)) {
                 $errors['empId'] = 1;
             }
             if (empty($companyName)) {
                 $errors['companyName'] = 1;
             }
             if (empty($positionHeld)) {
                 $errors['posotionHeld'] = 1;
             }
             if (empty($startDate)) {
                 $errors['startDate'] = 1;
             }
             //if(empty($endDate)) $errors['endDate'] = 1;
             //if(empty($description)) $errors['description'] = 1;
             // die();
             if (empty($errors)) {
                 //$client = PR_Session::getSession(PR_Session::SESSION_USER);
                 $core = new PR_Api_Core_CandidateClass();
                 $isSuccess = $core->updateCandidateEmployment($empId, $companyName, $positionHeld, $startDate, $endDate, $description);
                 $Percentage = round($Percentage / 100, 2);
                 if (isset($jobid) && !empty($jobid)) {
                     // $core->updateJobFunction($JobFucntion,$empId,$Percentage,$jobid);
                     $core->deleteJobFunction($jobid);
                 }
                 // else{
                 //      $core->addjobfunction($empId,$Text);
                 //  }
                 if (!empty($Text["JobFucntion1"]) && !empty($Text["Percentage1"])) {
                     $core->addjobfunction($empId, $Text);
                 }
                 //if($isSuccess)
                 $ajaxRes['success'] = 1;
             } else {
                 $ajaxRes['info'] = $errors;
             }
         }
     }
     $response = $this->getResponse();
     $response->clearAllHeaders()->clearBody();
     $ajaxRes = json_encode($ajaxRes);
     $response->setHeader('Content-type', 'application/json');
     $response->setHeader('Content-Length', strlen($ajaxRes), true)->setBody($ajaxRes);
 }