Skip to content

Commit

Permalink
🔨 APP #270 update controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
bjverde committed Sep 28, 2022
1 parent 09f5e20 commit 31c2364
Show file tree
Hide file tree
Showing 26 changed files with 592 additions and 70 deletions.
19 changes: 15 additions & 4 deletions appexemplo_v2.5/controllers/Acesso_menu.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* Download SysGen: https://github.com/bjverde/sysgen
* Download Formdin Framework: https://github.com/bjverde/formDin
*
* SysGen Version: 1.9.0-alpha
* FormDin Version: 4.7.5
* SysGen Version: 1.12.0
* FormDin Version: 4.19.0
*
* System appev2 created in: 2019-09-10 09:04:46
* System appev2 created in: 2022-09-28 00:42:11
*/
class Acesso_menu
{
Expand Down Expand Up @@ -38,7 +38,7 @@ public function selectMenuByLogin( $login )
{
$result = $this->dao->selectMenuByLogin( $login );
return $result;
}
}
//--------------------------------------------------------------------------------
public function selectCount( $where=null )
{
Expand All @@ -58,10 +58,20 @@ public function selectAll( $orderBy=null, $where=null )
return $result;
}
//--------------------------------------------------------------------------------
private function validatePkNotExist( $id )
{
$where=array('IDMENU'=>$id);
$qtd = $this->selectCount($where);
if( empty($qtd) ){
throw new DomainException(Message::GENERIC_ID_NOT_EXIST);
}
}
//--------------------------------------------------------------------------------
public function save( Acesso_menuVO $objVo )
{
$result = null;
if( $objVo->getIdmenu() ) {
$this->validatePkNotExist( $objVo->getIdmenu() );
$result = $this->dao->update( $objVo );
} else {
$result = $this->dao->insert( $objVo );
Expand All @@ -71,6 +81,7 @@ public function save( Acesso_menuVO $objVo )
//--------------------------------------------------------------------------------
public function delete( $id )
{
$this->validatePkNotExist( $id );
$result = $this->dao->delete( $id );
return $result;
}
Expand Down
32 changes: 28 additions & 4 deletions appexemplo_v2.5/controllers/Acesso_perfil.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* Download SysGen: https://github.com/bjverde/sysgen
* Download Formdin Framework: https://github.com/bjverde/formDin
*
* SysGen Version: 1.9.0-alpha
* FormDin Version: 4.7.5
* SysGen Version: 1.12.0
* FormDin Version: 4.19.0
*
* System appev2 created in: 2019-09-10 09:04:46
* System appev2 created in: 2022-09-28 00:42:11
*/
class Acesso_perfil
{
Expand Down Expand Up @@ -52,10 +52,34 @@ public function selectAll( $orderBy=null, $where=null )
return $result;
}
//--------------------------------------------------------------------------------
public function validarNomePerfilJaExiste( Acesso_perfilVO $objVo )
{
$where=array('NOM_PERFIL'=>$objVo->getNom_perfil());
$qtd = $this->selectCount($where);
if($qtd >= 1){
throw new DomainException('Já existe um perfil com o mesmo nome!');
}
}
public function validar( Acesso_perfilVO $objVo )
{
$this->validarNomePerfilJaExiste($objVo);
}
//--------------------------------------------------------------------------------
private function validatePkNotExist( $id )
{
$where=array('IDPERFIL'=>$id);
$qtd = $this->selectCount($where);
if( empty($qtd) ){
throw new DomainException(Message::GENERIC_ID_NOT_EXIST);
}
}
//--------------------------------------------------------------------------------
public function save( Acesso_perfilVO $objVo )
{
$result = null;
$this->validar($objVo);
if( $objVo->getIdperfil() ) {
$this->validatePkNotExist( $objVo->getIdperfil() );
$result = $this->dao->update( $objVo );
} else {
$result = $this->dao->insert( $objVo );
Expand All @@ -65,6 +89,7 @@ public function save( Acesso_perfilVO $objVo )
//--------------------------------------------------------------------------------
public function delete( $id )
{
$this->validatePkNotExist( $id );
$result = $this->dao->delete( $id );
return $result;
}
Expand All @@ -74,6 +99,5 @@ public function getVoById( $id )
$result = $this->dao->getVoById( $id );
return $result;
}

}
?>
17 changes: 14 additions & 3 deletions appexemplo_v2.5/controllers/Acesso_perfil_menu.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* Download SysGen: https://github.com/bjverde/sysgen
* Download Formdin Framework: https://github.com/bjverde/formDin
*
* SysGen Version: 1.9.0-alpha
* FormDin Version: 4.7.5
* SysGen Version: 1.12.0
* FormDin Version: 4.19.0
*
* System appev2 created in: 2019-09-10 09:04:46
* System appev2 created in: 2022-09-28 00:42:12
*/
class Acesso_perfil_menu
{
Expand Down Expand Up @@ -52,10 +52,20 @@ public function selectAll( $orderBy=null, $where=null )
return $result;
}
//--------------------------------------------------------------------------------
private function validatePkNotExist( $id )
{
$where=array('IDPERFILMENU'=>$id);
$qtd = $this->selectCount($where);
if( empty($qtd) ){
throw new DomainException(Message::GENERIC_ID_NOT_EXIST);
}
}
//--------------------------------------------------------------------------------
public function save( Acesso_perfil_menuVO $objVo )
{
$result = null;
if( $objVo->getIdperfilmenu() ) {
$this->validatePkNotExist( $objVo->getIdperfilmenu() );
$result = $this->dao->update( $objVo );
} else {
$result = $this->dao->insert( $objVo );
Expand All @@ -65,6 +75,7 @@ public function save( Acesso_perfil_menuVO $objVo )
//--------------------------------------------------------------------------------
public function delete( $id )
{
$this->validatePkNotExist( $id );
$result = $this->dao->delete( $id );
return $result;
}
Expand Down
21 changes: 16 additions & 5 deletions appexemplo_v2.5/controllers/Acesso_perfil_user.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* Download SysGen: https://github.com/bjverde/sysgen
* Download Formdin Framework: https://github.com/bjverde/formDin
*
* SysGen Version: 1.9.0-alpha
* FormDin Version: 4.7.5
* SysGen Version: 1.12.0
* FormDin Version: 4.19.0
*
* System appev2 created in: 2019-09-10 09:04:46
* System appev2 created in: 2022-09-28 00:42:12
*/
class Acesso_perfil_user
{
Expand Down Expand Up @@ -39,7 +39,7 @@ public function selectByIdUser( $idUser )
$where = array ('IDUSER'=>$idUser);
$result = $this->dao->selectAll( null, $where );
return $result;
}
}
//--------------------------------------------------------------------------------
public function selectCount( $where=null )
{
Expand All @@ -59,11 +59,21 @@ public function selectAll( $orderBy=null, $where=null )
return $result;
}
//--------------------------------------------------------------------------------
private function validatePkNotExist( $id )
{
$where=array('IDPERFILUSER'=>$id);
$qtd = $this->selectCount($where);
if( empty($qtd) ){
throw new DomainException(Message::GENERIC_ID_NOT_EXIST);
}
}
//--------------------------------------------------------------------------------
public function save( Acesso_perfil_userVO $objVo )
{
$result = null;
$objVo->setSit_ativo('S');
if( $objVo->getIdperfiluser() ) {
$this->validatePkNotExist( $objVo->getIdperfiluser() );
$result = $this->dao->update( $objVo );
} else {
$result = $this->dao->insert( $objVo );
Expand All @@ -73,6 +83,7 @@ public function save( Acesso_perfil_userVO $objVo )
//--------------------------------------------------------------------------------
public function delete( $id )
{
$this->validatePkNotExist( $id );
$result = $this->dao->delete( $id );
return $result;
}
Expand All @@ -81,7 +92,7 @@ public function deleteByIdUser( $id )
{
$result = $this->dao->deleteByIdUser( $id );
return $result;
}
}
//--------------------------------------------------------------------------------
public function getVoById( $id )
{
Expand Down
19 changes: 15 additions & 4 deletions appexemplo_v2.5/controllers/Acesso_user.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* Download SysGen: https://github.com/bjverde/sysgen
* Download Formdin Framework: https://github.com/bjverde/formDin
*
* SysGen Version: 1.9.0-alpha
* FormDin Version: 4.7.5
* SysGen Version: 1.12.0
* FormDin Version: 4.19.0
*
* System appev2 created in: 2019-09-10 09:04:46
* System appev2 created in: 2022-09-28 00:42:12
*/
class Acesso_user
{
Expand Down Expand Up @@ -37,7 +37,7 @@ public function selectByLogin( $login )
{
$result = $this->dao->selectByLogin($login);
return $result;
}
}
//--------------------------------------------------------------------------------
public function selectCount( $where=null )
{
Expand All @@ -57,10 +57,20 @@ public function selectAll( $orderBy=null, $where=null )
return $result;
}
//--------------------------------------------------------------------------------
private function validatePkNotExist( $id )
{
$where=array('IDUSER'=>$id);
$qtd = $this->selectCount($where);
if( empty($qtd) ){
throw new DomainException(Message::GENERIC_ID_NOT_EXIST);
}
}
//--------------------------------------------------------------------------------
public function save( Acesso_userVO $objVo )
{
$result = null;
if( $objVo->getIduser() ) {
$this->validatePkNotExist( $objVo->getIduser() );
$result = $this->dao->update( $objVo );
} else {
$result = $this->dao->insert( $objVo );
Expand All @@ -70,6 +80,7 @@ public function save( Acesso_userVO $objVo )
//--------------------------------------------------------------------------------
public function delete( $id )
{
$this->validatePkNotExist( $id );
$result = $this->dao->delete( $id );
return $result;
}
Expand Down
17 changes: 14 additions & 3 deletions appexemplo_v2.5/controllers/Autoridade.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* Download SysGen: https://github.com/bjverde/sysgen
* Download Formdin Framework: https://github.com/bjverde/formDin
*
* SysGen Version: 1.9.0-alpha
* FormDin Version: 4.7.5
* SysGen Version: 1.12.0
* FormDin Version: 4.19.0
*
* System appev2 created in: 2019-09-10 09:04:46
* System appev2 created in: 2022-09-28 00:42:12
*/
class Autoridade
{
Expand Down Expand Up @@ -67,11 +67,21 @@ public function validar( AutoridadeVO $objVo) {
}
}
//--------------------------------------------------------------------------------
private function validatePkNotExist( $id )
{
$where=array('IDAUTORIDADE'=>$id);
$qtd = $this->selectCount($where);
if( empty($qtd) ){
throw new DomainException(Message::GENERIC_ID_NOT_EXIST);
}
}
//--------------------------------------------------------------------------------
public function save( AutoridadeVO $objVo )
{
$result = null;
$this->validar($objVo);
if( $objVo->getIdautoridade() ) {
$this->validatePkNotExist( $objVo->getIdautoridade() );
$result = $this->dao->update( $objVo );
} else {
$result = $this->dao->insert( $objVo );
Expand All @@ -81,6 +91,7 @@ public function save( AutoridadeVO $objVo )
//--------------------------------------------------------------------------------
public function delete( $id )
{
$this->validatePkNotExist( $id );
$result = $this->dao->delete( $id );
return $result;
}
Expand Down
2 changes: 1 addition & 1 deletion appexemplo_v2.5/controllers/Database.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public function rollBack()
$msg = 'Depois do include';
$this->showMsgQtds($msg, $tpdo, $objUser, $objUserPerfil);

throw new Exception('Gerenic Exception!!!!');
throw new Exception('Generic Exception!!!!');
//----------------
//$objUserPerfil->deleteByIdUser($idUser);
//$objUser->delete($idUser);
Expand Down
17 changes: 14 additions & 3 deletions appexemplo_v2.5/controllers/Endereco.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* Download SysGen: https://github.com/bjverde/sysgen
* Download Formdin Framework: https://github.com/bjverde/formDin
*
* SysGen Version: 1.9.0-alpha
* FormDin Version: 4.7.5
* SysGen Version: 1.12.0
* FormDin Version: 4.19.0
*
* System appev2 created in: 2019-09-10 09:04:46
* System appev2 created in: 2022-09-28 00:42:12
*/
class Endereco
{
Expand Down Expand Up @@ -52,10 +52,20 @@ public function selectAll( $orderBy=null, $where=null )
return $result;
}
//--------------------------------------------------------------------------------
private function validatePkNotExist( $id )
{
$where=array('IDENDERECO'=>$id);
$qtd = $this->selectCount($where);
if( empty($qtd) ){
throw new DomainException(Message::GENERIC_ID_NOT_EXIST);
}
}
//--------------------------------------------------------------------------------
public function save( EnderecoVO $objVo )
{
$result = null;
if( $objVo->getIdendereco() ) {
$this->validatePkNotExist( $objVo->getIdendereco() );
$result = $this->dao->update( $objVo );
} else {
$result = $this->dao->insert( $objVo );
Expand All @@ -65,6 +75,7 @@ public function save( EnderecoVO $objVo )
//--------------------------------------------------------------------------------
public function delete( $id )
{
$this->validatePkNotExist( $id );
$result = $this->dao->delete( $id );
return $result;
}
Expand Down
Loading

0 comments on commit 31c2364

Please sign in to comment.