Mister Spy Say ="Hello Kids ... :D"
___ ____ _ _____
| \/ (_) | | / ___|
| . . |_ ___| |_ ___ _ __ \ `--. _ __ _ _
| |\/| | / __| __/ _ \ '__| `--. \ '_ \| | | |
| | | | \__ \ || __/ | /\__/ / |_) | |_| |
\_| |_/_|___/\__\___|_| \____/| .__/ \__, |
| | __/ |
|_| |___/
Bot Mister Spy V3
Mister Spy
Mister Spy
<?php
require_once('class.dbaccess.php');
require_once('class.filter.php');
require_once('class.remate.php');
require_once('class.page.php');
class Remates extends DBAccess implements IFilterable
{
public function ParseFilter(array $filter)
{
$sql = '';
$sql.= " WHERE 1=1";
if (isset($filter['Nombre']) && $filter['Nombre'] != "")
{
$sql.= " AND Nombre LIKE '%" . DB::StringUnquoted($filter['Nombre']) . "%'";
}
if (isset($filter['Estado']) && $filter['Estado'] != "")
{
$sql.= " AND Estado = " . DB::Number($filter['Estado']);
}
if (isset($filter['IdRemate']) && $filter['IdRemate'] != "")
{
$sql.= " AND IdRemate = " . DB::Number($filter['IdRemate']);
}
return $sql;
}
public function GetPagesCount(Page $oPage, $filter = false)
{
$sql = "SELECT COUNT(1) / " . DB::Number($oPage->Size) . " AS Count";
$sql.= " FROM tblRemates";
if ($filter)
$sql.= " " . $this->ParseFilter($filter);
if (!($oRes = $this->GetQuery($sql)) )
return false;
if ( !($oRow = $oRes->GetRow()) )
return false;
$Count = $oRow['Count'];
return ceil($Count);
}
public function GetAll(array $filter = NULL, Page $oPage = NULL)
{
$sql = "SELECT *";
$sql.= " FROM tblRemates";
if ($filter)
$sql.= $this->ParseFilter($filter);
$sql.= " ORDER BY IdRemate DESC";
if ($oPage != NULL)
$sql.= " " . Pageable::ParsePage($oPage);
if (!($oRes = $this->GetQuery($sql)))
return false;
$arr = array();
while ($oRow = $oRes->GetRow())
{
$oRemate = new Remate();
$oRemate->ParseFromArray($oRow);
array_push($arr, $oRemate);
$oRes->MoveNext();
}
return $arr;
}
public function GetById($IdRemate)
{
$sql = "SELECT *";
$sql.= " FROM tblRemates";
$sql.= " WHERE IdRemate = " . DB::Number($IdRemate);
if (!($oRes = $this->GetQuery($sql)))
return false;
if (!($oRow = $oRes->GetRow()))
return false;
$oRemate = new Remate();
$oRemate->ParseFromArray($oRow);
return $oRemate;
}
public function GetCountRows(array $filter = NULL)
{
$sql = "SELECT *";
$sql.= " FROM tblRemates";
if ($filter)
$sql.= $this->ParseFilter($filter);
$sql.= " ORDER BY IdRemate DESC";
if (!($oRes = $this->GetQuery($sql)))
return false;
$CountRows = $oRes->NumRows();
return $CountRows;
}
public function Create(Remate $oRemate)
{
$arr = array
(
'Nombre' => DB::String($oRemate->Nombre),
'Lugar' => DB::String($oRemate->Lugar),
'Fecha' => DB::Date($oRemate->Fecha),
'HoraInicio' => DB::String($oRemate->HoraInicio),
'IdRaza' => DB::Number($oRemate->IdRaza),
'IdPais' => DB::Number($oRemate->IdPais),
'ImagenLogo' => DB::String($oRemate->ImagenLogo),
'NombreCarpeta' => DB::String($oRemate->NombreCarpeta),
'Estado' => DB::Number(1)
);
if (!$this->Insert('tblRemates', $arr))
return false;
$oRemate->IdRemate = $this->GetLastInsertId();
return $oRemate;
}
public function Update(Remate $oRemate)
{
$where = " IdRemate = " . DB::Number($oRemate->IdRemate);
$arr = array
(
'Nombre' => DB::String($oRemate->Nombre),
'Lugar' => DB::String($oRemate->Lugar),
'Fecha' => DB::Date($oRemate->Fecha),
'HoraInicio' => DB::String($oRemate->HoraInicio),
'IdRaza' => DB::Number($oRemate->IdRaza),
'IdPais' => DB::Number($oRemate->IdPais),
'ImagenLogo' => DB::String($oRemate->ImagenLogo),
'NombreCarpeta' => DB::String($oRemate->NombreCarpeta),
'Estado' => DB::Number(1)
);
if (!DBAccess::Update('tblRemates', $arr, $where))
return false;
return $oRemate;
}
public function Delete($IdRemate)
{
if (!DBAccess::$db->Begin())
return false;
$where = " IdRemate = " . DB::Number($IdRemate);
$arr = array
(
'Estado' => DB::Number(0)
);
if (!DBAccess::Update('tblRemates', $arr, $where))
{
DBAccess::$db->Rollback();
return false;
}
DBAccess::$db->Commit();
return true;
}
}
?>
Mr. DellatioNx196 GaLers xh3LL Backd00r 1.0, Coded By Mr. DellatioNx196 - Bogor BlackHat