Mister Spy Say ="Hello Kids ... :D"
___ ____ _ _____
| \/ (_) | | / ___|
| . . |_ ___| |_ ___ _ __ \ `--. _ __ _ _
| |\/| | / __| __/ _ \ '__| `--. \ '_ \| | | |
| | | | \__ \ || __/ | /\__/ / |_) | |_| |
\_| |_/_|___/\__\___|_| \____/| .__/ \__, |
| | __/ |
|_| |___/
Bot Mister Spy V3
Mister Spy
Mister Spy
<?php
require_once('class.dbaccess.php');
require_once('class.eventoaudio.php');
require_once('class.filter.php');
require_once('class.page.php');
class EventoAudios extends DBAccess implements IFilterable
{
public function ParseFilter(array $filter)
{
$sql = ' WHERE 1';
if ((isset($filter['Nombre'])) && ($filter['Nombre'] != ''))
$sql.= " AND Nombre LIKE '%" . DB::StringUnquoted($filter['Nombre']) . "%'";
if ((isset($filter['IdEvento'])) && ($filter['IdEvento'] != ''))
$sql.= " AND IdEvento = " . DB::Number($filter['IdEvento']);
return $sql;
}
public function GetAll(array $filter = NULL, Page $oPage = NULL)
{
$sql = "SELECT *";
$sql.= " FROM tblEventoAudios";
$sql.= ($filter) ? $this->ParseFilter($filter) : "";
$sql.= " ORDER BY Nombre";
$sql.= ($oPage) ? Pageable::ParsePage($oPage) : "";
if (!($oRes = $this->GetQuery($sql)))
return false;
$arr = array();
while ($oRow = $oRes->GetRow())
{
$oEventoAudio = new EventoAudio();
$oEventoAudio->ParseFromArray($oRow);
array_push($arr, $oEventoAudio);
$oRes->MoveNext();
}
return $arr;
}
public function GetById($IdEventoAudio)
{
$sql = "SELECT *";
$sql.= " FROM tblEventoAudios";
$sql.= " WHERE IdEventoAudio = " . DB::Number($IdEventoAudio);
if (!($oRes = $this->GetQuery($sql)))
return false;
if (!($oRow = $oRes->GetRow()))
return false;
$oEventoAudio = new EventoAudio();
$oEventoAudio->ParseFromArray($oRow);
return $oEventoAudio;
}
public function GetCountRows(array $filter = NULL)
{
$sql = "SELECT *";
$sql.= " FROM tblEventoAudios";
$sql.= ($filter) ? $this->ParseFilter($filter) : "";
$sql.= " ORDER BY Nombre";
if (!($oRes = $this->GetQuery($sql)))
return false;
$CountRows = $oRes->NumRows();
return $CountRows;
}
public function GetAllByEvento(Evento $oEvento)
{
$sql = "SELECT *";
$sql.= " FROM tblEventoAudios";
$sql.= " WHERE IdEvento = " . DB::Number($oEvento->IdEvento);
$sql.= " ORDER BY Nombre";
if (!($oRes = $this->GetQuery($sql)))
return false;
$arr = array();
while ($oRow = $oRes->GetRow())
{
$oEventoAudio = new EventoAudio();
$oEventoAudio->ParseFromArray($oRow);
array_push($arr, $oEventoAudio);
$oRes->MoveNext();
}
return $arr;
}
public function Create(EventoAudio $oEventoAudio)
{
$arr = array
(
'IdEvento' => DB::Number($oEventoAudio->IdEvento),
'Nombre' => DB::String($oEventoAudio->Nombre),
'Audio' => DB::String($oEventoAudio->Audio)
);
if (!$this->Insert('tblEventoAudios', $arr))
return false;
return $oEventoAudio;
}
public function Update(EventoAudio $oEventoAudio)
{
$where = " IdEventoAudio = " . DB::Number($oEventoAudio->IdEventoAudio);
$arr = array
(
'IdEvento' => DB::Number($oEventoAudio->IdEvento),
'Nombre' => DB::String($oEventoAudio->Nombre),
'Audio' => DB::String($oEventoAudio->Audio)
);
if (!DBAccess::UpdateEntidad('tblEventoAudios', $arr, $where))
return false;
return $oEventoAudio;
}
public function Delete($IdEventoAudio)
{
if (!DBAccess::$db->Begin())
return false;
$where = " IdEventoAudio = " . DB::Number($IdEventoAudio);
if (!DBAccess::DeleteEntidad('tblEventoAudios', $where))
{
DBAccess::$db->Rollback();
return false;
}
DBAccess::$db->Commit();
return true;
}
public function DeleteByEvento(Evento $oEvento)
{
if (!DBAccess::$db->Begin())
return false;
$oEventoAudios = new EventoAudios();
$oEventoAudios = $oEventoAudios->GetAllByEvento($oEvento);
if ($oEventoAudios)
foreach ($oEventoAudios as $oEventoAudio)
Up::DeleteFile(Evento::PathListen, $oEventoAudio->Audio);
$where = " IdEvento = " . DB::Number($oEvento->IdEvento);
if (!DBAccess::DeleteEntidad('tblEventoAudios', $where))
{
DBAccess::$db->Rollback();
return false;
}
DBAccess::$db->Commit();
return true;
}
}
?>
Mr. DellatioNx196 GaLers xh3LL Backd00r 1.0, Coded By Mr. DellatioNx196 - Bogor BlackHat