<?php
require_once (PATH_TABLES . "admin/BusinessSectorTable.php") ;
require_once (PATH_MODELS . "base/MasterBase.php") ;

class BusinessSectorClass extends MasterBase {
	
	function __construct($db) {
		$this->db 			= $db ;
		$this->tbl 			= BusinessSectorTable::C_TABLE ;
		$this->fldid 		= BusinessSectorTable::C_ID ;
		$this->flddesc 		= BusinessSectorTable::C_DESC ;
	}
	function __destruct() {
	}

	function isNameFound($name) {
		$filter = $this->db->fieldParam($this->flddesc);
		$params = array() ;
		$params[] = $this->db->valueParam($this->flddesc,$name) ;
		if ($this->db->getRowsCount($this->tbl,$filter,$params) > 0 )
			return true ;
		else
			return false ;
	}

	function deleteSettingRecord($ids){
		$sql = "delete from ". $this->tbl ." where ". $this->fldid ." in ( ".$ids.") ";
		$this->db->executeSql($sql);
	}

	function getBusinessIDByDesc($desc){
		$sql = "SELECT * FROM " . $this->tbl . " WHERE " . BusinessSectorTable::C_DESC . " = '" . $desc . "'";
		
		$rows = $this->db->getTable($sql);

		if(!is_null($rows) && count($rows) > 0){
			return $rows[0][BusinessSectorTable::C_ID];
		}
		return null;
	}
}
?>