Mister Spy Say ="Hello Kids ... :D"
___ ____ _ _____
| \/ (_) | | / ___|
| . . |_ ___| |_ ___ _ __ \ `--. _ __ _ _
| |\/| | / __| __/ _ \ '__| `--. \ '_ \| | | |
| | | | \__ \ || __/ | /\__/ / |_) | |_| |
\_| |_/_|___/\__\___|_| \____/| .__/ \__, |
| | __/ |
|_| |___/
Bot Mister Spy V3
Mister Spy
Mister Spy
<?php
require_once('class.dbaccess.php');
require_once('class.asoc.php');
require_once('class.filter.php');
require_once('class.page.php');
class Asocs extends DBAccess implements IFilterable
{
public function ParseFilter(array $filter)
{
$sql = '';
if (isset($filter['IdDepartamento']) && $filter['IdDepartamento'] != "")
{
$sql.= " AND pa.IdDepartamento = " . DB::Number($filter['IdDepartamento']);
}
return $sql;
}
public function GetPagesCount(Page $oPage, $filter = false)
{
$sql = "SELECT COUNT(1) / " . DB::Number($oPage->Size) . " AS Count";
$sql.= " FROM tblAsoc pr";
$sql.= " WHERE 1 ";
if ($filter)
$sql.= " " . $this->ParseFilter($filter);
if (!($oRes = $this->GetQuery($sql)) )
return false;
if ( !($oRow = $oRes->GetRow()) )
return false;
$Count = $oRow['Count'];
$Count = ceil($Count);
return $Count;
}
public function GetAll(array $filter = NULL, Page $oPage = NULL)
{
$sql = "SELECT * ";
$sql.= " FROM tblAsoc ";
$sql.= " WHERE 1 ";
if ($filter)
$sql.= $this->ParseFilter($filter);
if ($oPage != NULL)
$sql.= " " . Pageable::ParsePage($oPage);
if (!($oRes = $this->GetQuery($sql)))
return false;
$arr = array();
while ($oRow = $oRes->GetRow())
{
$oAsoc = new Asoc();
$oAsoc->ParseFromArray($oRow);
array_push($arr, $oAsoc);
$oRes->MoveNext();
}
return $arr;
}
public function GetNombreById($IdAsoc)
{
$sql = "SELECT * ";
$sql.= " FROM tblAsoc ";
$sql.= " WHERE IdAsoc = " . DB::Number($IdAsoc);
if (!($oRes = $this->GetQuery($sql)))
return false;
if (!($oRow = $oRes->GetRow()))
return false;
$oAsoc = new Asoc();
$oAsoc->ParseFromArray($oRow);
return $oAsoc->Nombre;
}
public function GetByASOC($Asoc)
{
$sql = "SELECT * ";
$sql.= " FROM tblAsoc ";
$sql.= " WHERE ASOC = " . DB::Number($Asoc);
if (!($oRes = $this->GetQuery($sql)))
return false;
if (!($oRow = $oRes->GetRow()))
return false;
$oAsoc = new Asoc();
$oAsoc->ParseFromArray($oRow);
return $oAsoc;
}
public function GetByNombre($Nombre, $IdAsoc)
{
$sql = " SELECT * ";
$sql.= " FROM tblAsoc ";
$sql.= " WHERE WHERE 1 ";
if (!($oRes = $this->GetQuery($sql)))
return false;
if (!($oRow = $oRes->GetRow()))
return false;
$oAsoc = new Asoc();
$oAsoc->ParseFromArray($oRow);
return $oAsoc;
}
public function GetCountRows(array $filter = NULL)
{
$sql = "SELECT * ";
$sql.= " FROM tblAsoc ";
$sql.= " WHERE 1";
if ($filter)
$sql.= $this->ParseFilter($filter);
$sql.= " ORDER BY DepartamentoNombre, Nombre ASC";
if (!($oRes = $this->GetQuery($sql)))
return false;
$CountRows = $oRes->NumRows();
return $CountRows;
}
public function Create(Asoc $oAsoc)
{
$arr = array
(
'IdAsoc'=> DB::Number($oAsoc->IdAsoc),
'ASOC' => DB::String($oAsoc->ASOC),
'NOMB' => DB::String($oAsoc->NOMB),
'NOM1' => DB::String($oAsoc->NOM1),
'LEYS' => DB::String($oAsoc->LEYS),
'DIRE' => DB::String($oAsoc->DIRE),
'DIR1' => DB::String($oAsoc->DIR1),
'TELE' => DB::String($oAsoc->TELE),
'TELX' => DB::String($oAsoc->TELX),
'NFAX' => DB::String($oAsoc->NFAX),
'PAIS' => DB::String($oAsoc->PAIS),
'REFE' => DB::String($oAsoc->REFE),
'REF1' => DB::String($oAsoc->REF1),
'SIGL' => DB::String($oAsoc->SIGL),
'NROS' => DB::String($oAsoc->NROS)
);
if (!$this->Insert('tblAsoc', $arr))
return false;
return $oAsoc;
}
public function Update(Asoc $oAsoc)
{
$where = " IdAsoc = " . DB::Number($oAsoc->IdAsoc);
$arr = array
(
'IdAsoc'=> DB::Number($oAsoc->IdAsoc),
'ASOC' => DB::String($oAsoc->ASOC),
'NOMB' => DB::String($oAsoc->NOMB),
'NOM1' => DB::String($oAsoc->NOM1),
'LEYS' => DB::String($oAsoc->LEYS),
'DIRE' => DB::String($oAsoc->DIRE),
'DIR1' => DB::String($oAsoc->DIR1),
'TELE' => DB::String($oAsoc->TELE),
'TELX' => DB::String($oAsoc->TELX),
'NFAX' => DB::String($oAsoc->NFAX),
'PAIS' => DB::String($oAsoc->PAIS),
'REFE' => DB::String($oAsoc->REFE),
'REF1' => DB::String($oAsoc->REF1),
'SIGL' => DB::String($oAsoc->SIGL),
'NROS' => DB::String($oAsoc->NROS)
);
if (!DBAccess::Update('tblAsoc', $arr, $where))
return false;
return $oAsoc;
}
public function Delete($IdAsoc)
{
if (!DBAccess::$db->Begin())
return false;
$where = " IdAsoc = " . DB::Number($IdAsoc);
if (!DBAccess::Delete('tblAsoc', $where))
{
DBAccess::$db->Rollback();
return false;
}
DBAccess::$db->Commit();
return true;
}
}
?>
Mr. DellatioNx196 GaLers xh3LL Backd00r 1.0, Coded By Mr. DellatioNx196 - Bogor BlackHat