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

class CompanyLocationClass extends MasterBase {
	function __construct($db) {
		$this->db = $db ;
		$this->tbl = CompanyLocationTable::C_TABLE ;
		$this->fldid = CompanyLocationTable::C_ID ;
		$this->flddesc = CompanyLocationTable::C_DESC ;
	}
	function __destruct() {
	}
	
	
	function deleteCompanyLocation($id){
		$sql = "DELETE FROM " . CompanyLocationTable::C_TABLE . 
                " WHERE " . CompanyLocationTable::C_COY_ID . " = " . $id. "";
        
        try{
            $this->db->executeSql($sql);
        } catch (Exception $e){
            Log::write("[CompanyLocationClass]" . $e->getMessage());
        }
	}

	function getCompanyLocation($id){
		$sql = "SELECT * ". 
                " FROM " . CompanyLocationTable::C_TABLE . "  " .
                " WHERE " . CompanyLocationTable::C_COY_ID . " = " . $id . " " .
                " ORDER BY " . CompanyLocationTable::C_DESC . " ";
        
        $result = null;
        try{
            $result = $this->db->getTable($sql);
        } catch (Exception $e){
            Log::write("[CompanyLocationClass]" . $e->getMessage());
        }
        
        return $result;
        
	}	
}
?>