public function doAddEmploymentAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $ajaxRes = array('success' => 0, 'info' => null);
     if ($this->getRequest()->isXmlHttpRequest()) {
         $params = $this->getRequest()->getParams();
         $companyName = null;
         $posotionHeld = 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'] == 'companyName') {
                     $companyName = $item['value'];
                 }
                 if ($item['name'] == 'posotionHeld') {
                     $posotionHeld = $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);
                 }
             }
             //echo "test:<pre>";print_r($Text);echo("</pre>") ;
             // echo "test:<pre>";print_r(count($Text["JobFucntion1"]));echo("</pre>") ;
             if (empty($companyName)) {
                 $errors['companyName'] = 1;
             }
             if (empty($posotionHeld)) {
                 $errors['posotionHeld'] = 1;
             }
             if (empty($startDate)) {
                 $errors['startDate'] = 1;
             }
             //if(empty($endDate)) $errors['endDate'] = 1;
             //if(empty($description)) $errors['description'] = 1;
             if (empty($errors)) {
                 $client = PR_Session::getSession(PR_Session::SESSION_USER);
                 $core = new PR_Api_Core_CandidateClass();
                 $Percentage = round($Percentage / 100, 2);
                 //$isSuccess = $core->addCandidateEmployment($client['UserID'],$companyName,$posotionHeld,$startDate,$endDate,$description);
                 // $isSuccess = $core->addCandidateEmploymentJob($client['UserID'],$companyName,$posotionHeld,$startDate,$endDate,$description,$JobFucntion,$Percentage);
                 $isSuccess = $core->addCandidateEmploymentJob($client['UserID'], $companyName, $posotionHeld, $startDate, $endDate, $description, $Text);
                 // $core->addjobfunction($empId,$JobFucntion,$Percentage);
                 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);
 }