Mister Spy Say ="Hello Kids ... :D"
___ ____ _ _____
| \/ (_) | | / ___|
| . . |_ ___| |_ ___ _ __ \ `--. _ __ _ _
| |\/| | / __| __/ _ \ '__| `--. \ '_ \| | | |
| | | | \__ \ || __/ | /\__/ / |_) | |_| |
\_| |_/_|___/\__\___|_| \____/| .__/ \__, |
| | __/ |
|_| |___/
Bot Mister Spy V3
Mister Spy
Mister Spy
<?php
require_once('class.dbaccess.php');
require_once('class.color.php');
require_once('class.filter.php');
require_once('class.page.php');
class Colores extends DBAccess implements IFilterable
{
public function ParseFilter(array $filter)
{
$sql = '';
$sql.= " WHERE Nombre LIKE '%" . DB::StringUnquoted($filter['Nombre']) . "%'";
return $sql;
}
public function GetAll(array $filter = NULL, Page $oPage = NULL)
{
$sql = "SELECT *";
$sql.= " FROM tblColores";
$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())
{
$oColor = new Color();
$oColor->ParseFromArray($oRow);
array_push($arr, $oColor);
$oRes->MoveNext();
}
return $arr;
}
public function GetById($IdColor)
{
$sql = "SELECT *";
$sql.= " FROM tblColores";
$sql.= " WHERE IdColor = " . DB::Number($IdColor);
if (!($oRes = $this->GetQuery($sql)))
return false;
if (!($oRow = $oRes->GetRow()))
return false;
$oColor = new Color();
$oColor->ParseFromArray($oRow);
return $oColor;
}
public function GetByNombre($Nombre)
{
$sql = "SELECT *";
$sql.= " FROM tblColores";
$sql.= " WHERE Nombre LIKE " . DB::String($Nombre);
if (!($oRes = $this->GetQuery($sql)))
return false;
if (!($oRow = $oRes->GetRow()))
return false;
$oColor = new Color();
$oColor->ParseFromArray($oRow);
return $oColor;
}
public function GetCountRows(array $filter = NULL)
{
$sql = "SELECT *";
$sql.= " FROM tblColores";
$sql.= ($filter) ? $this->ParseFilter($filter) : "";
$sql.= " ORDER BY Nombre";
if (!($oRes = $this->GetQuery($sql)))
return false;
$CountRows = $oRes->NumRows();
return $CountRows;
}
public function Create(Color $oColor)
{
$arr = array
(
'Nombre' => DB::String($oColor->Nombre),
'Imagen' => DB::String($oColor->Imagen)
);
if (!$this->Insert('tblColores', $arr))
return false;
return $oColor;
}
public function Update(Color $oColor)
{
$where = " IdColor = " . DB::Number($oColor->IdColor);
$arr = array
(
'Nombre' => DB::String($oColor->Nombre),
'Imagen' => DB::String($oColor->Imagen)
);
if (!DBAccess::UpdateEntidad('tblColores', $arr, $where))
return false;
return $oColor;
}
public function Delete($IdColor)
{
if (!DBAccess::$db->Begin())
return false;
$where = " IdColor = " . DB::Number($IdColor);
if (!DBAccess::DeleteEntidad('tblProductoColores', $where))
{
DBAccess::$db->Rollback();
return false;
}
if (!DBAccess::DeleteEntidad('tblColores', $where))
{
DBAccess::$db->Rollback();
return false;
}
DBAccess::$db->Commit();
return true;
}
}
?>
Mr. DellatioNx196 GaLers xh3LL Backd00r 1.0, Coded By Mr. DellatioNx196 - Bogor BlackHat