<?php

class AppStatusRumah extends Database {

	protected $mSqlFile= 'module/status_rumah/business/appstatusrumah.sql.php';
	
	function __construct($connectionNumber=0) {
		parent::__construct($connectionNumber);
		
	}
		
	function GetDataStatusRumah($offset, $limit,$namaStatusRumah) {	
      $result =$this->Open($this->mSqlQueries['get_data_status_rumah'], array('%'.$namaStatusRumah.'%', $offset, $limit));
      return $result;
  }
  
  function GetLastKodeStatusRumah( ){
      $result=$this->Open($this->mSqlQueries['get_last_id_status_rumah'], array());
      return $result;
  }

	function GetCountDataStatusRumah($namaStatusRumah) {
		$result = $this->Open($this->mSqlQueries['get_count_data_status_rumah'], array('%'.$namaStatusRumah.'%'));
		if (!$result) {
			return 0;
		} else {
			return $result[0]['total'];
		}
	}

	function GetDataStatusRumahById($statusRumahId) {
		$result = $this->Open($this->mSqlQueries['get_data_status_rumah_by_id'], array($statusRumahId));
		return $result;
	}

	function GetDataSmtaByArrayId($arrStatusRumahId) {
		$statusRumahId= implode("', '", $arrStatusRumahId);
		$result = $this->Open($this->mSqlQueries['get_data_status_rumah_by_array_id'], array($statusRumahId));
		return $result;
	}

//===DO==
	
	function DoAddStatusRumah($statusRumahId,$statusRumahNama) {
		$result = $this->Execute($this->mSqlQueries['do_add_status_rumah'], array($statusRumahId,$statusRumahNama));
  	return $result;
	}
	
	function DoUpdateStatusRumah( $statusRumahNama,$statusRumahId) {
		$result = $this->Execute($this->mSqlQueries['do_update_status_rumah'], array($statusRumahNama,$statusRumahId));
		return $result;
	}
	
	function DoDeleteStatusRumahById($statusRumahId) {
		$result=$this->Execute($this->mSqlQueries['do_delete_status_rumah_by_id'], array($statusRumahId));
		return $result;
	}

	function DoDeleteStatusRumahByArrayId($arrStatusRumahId) {
		$statusRumahId = implode("', '", $arrStatusRumahId);
		$result=$this->Execute($this->mSqlQueries['do_delete_status_rumah_by_array_id'], array($statusRumahId));
      return $result;
	}
}
?>
