<?php
/*
	@ClassName : Lantai
	@Copyright : PT Gamatechno Indonesia
	@Analyzed By : Nanang Ruswianto <nanang@gamatechno.com>
	@Author By : Dyan Galih <galih@gamatechno.com>
	@Version : 0.1
	@StartDate : 2010-02-02
	@LastUpdate : 2010-02-02
	@Description : 
*/

class Lantai extends Database
{
	protected $mSqlFile;

	function __construct ($connectionNumber=0)
	{
		$this->mSqlFile = 'module/gedung/business/lantai.sql.php';
		parent::__construct($connectionNumber);
	}
	
	public function GetListLantai($gedungId,$start,$limit){
		$result = $this->Open($this->mSqlQueries['list_lantai'], array($gedungId,$start,$limit));
		return $result;
	}
	
	public function GetLantaiById($id){
		$result = $this->Open($this->mSqlQueries['get_lantai_by_id'], array($id));
		return $result['0'];
	}
	
	public function GetCountLantai($gedungId){
		$result = $this->Open($this->mSqlQueries['count_lantai'], array($gedungId));
		return $result['0']['jumlah'];
	}
	
	public function GetGedungById($id){
		$result = $this->Open($this->mSqlQueries['get_gedung_by_id'], array($id));
		return $result[0];
	}
	
	public function AddLantai($gedungId, $lantaiKode, $lantaiName){
		$this->Execute($this->mSqlQueries['add_lantai'], array($gedungId, $lantaiKode, $lantaiName));
		return $this->AffectedRows();
	}
	
	public function UpdateLantai($gedungId,$lantaiKode, $lantaiName, $lantaiId){
		$result = $this->Execute($this->mSqlQueries['update_lantai'], array($gedungId,$lantaiKode, $lantaiName, $lantaiId));
		return $this->AffectedRows();
	}
	
	public function DeleteLantai($idDelete, $gId){
		$result = $this->Execute($this->mSqlQueries['delete_lantai'], array($idDelete, $gId));
		return $this->AffectedRows();
	}
	
}
?>
