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

class IndustryClass extends MasterBase {
	
	function __construct($db) {
		$this->db 			= $db ;
		$this->tbl 			= IndustryTable::C_TABLE ;
		$this->fldid 		= IndustryTable::C_ID ;
		$this->flddesc 		= IndustryTable::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 getIndustryIDByDesc($desc){
		$sql = "SELECT * FROM " . $this->tbl . " WHERE " . IndustryTable::C_DESC . " = '" . $desc . "'";
		
		$rows = $this->db->getTable($sql);

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