<?php   
    require "commonincludefiles.php";
	
	$objDesignationMgmt = new DesignationMgmt();
	$objEmployeeMgmt = new EmployeeMgmt();
	     
	if ($_SESSION['cCompany_id']!="" && isset($_SESSION['cCompany_id'])) {
		$objEmployeeMgmt->designation_id 	=	$_REQUEST["designation_id"];
		$objDesignationMgmt->designation_id 	=	$_REQUEST["designation_id"];
		$objDesignationMgmt->designation_name 	=	$_REQUEST['designation_name'];	
				
		if($_REQUEST["designation_id"] > 0 && isset($_REQUEST["designation_id"])){
			if($_REQUEST["mode"] =="delete"){
				$objDesignationMgmt -> delete();
				$objEmployeeMgmt -> delete();
			} else{
				$objDesignationMgmt -> edit();
			}
			echo '{"success":"true","msg":""}';
		} else{	
			$objDesignationMgmt->add();
			if(	$objDesignationMgmt->designation_id	>0) {
				echo '{"success":"true","msg":""}';			
			} else{
				echo '{"success":"false","msg":""}';	
			}
		}
   	} else {
		echo '{"success":"false","msg":"session expiry"}';
	}	
 ?>