D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
idoso
/
adm
/
app
/
gre
/
Models
/
Filename :
GreApagarResid.php
back
Copy
<?php namespace App\gre\Models; if (!defined('URL')) { header("Location: /"); exit(); } /** * Description of GrsApagarResid * * @copyright (c) year, Carlos Marques - CM */ class GreApagarResid { private $DadosId; private $Resultado; private $Dados; private $DadosResidInferior; function getResultado() { return $this->Resultado; } public function apagarResidente($DadosId = null) { $this->DadosId = (int) $DadosId; $this->verfResidente(); if ($this->Resultado) { $apagarResidente = new \App\adms\Models\helper\AdmsDelete(); $apagarResidente->exeDelete("gre_residente", "WHERE id =:id", "id={$this->DadosId}"); if ($apagarResidente->getResultado()) { $_SESSION['msg'] = "<div class='alert alert-success' role='alert'> Residente apagado com sucesso! <button type='button' class='close' data-dismiss='alert' aria-label='Close'> <span aria-hidden='true'>×</span></button> </div>"; $this->Resultado = true; } else { $_SESSION['msg'] = "<div class='alert alert-danger' role='alert'> Residente não foi apagado! <button type='button' class='close' data-dismiss='alert' aria-label='Close'> <span aria-hidden='true'>×</span></button> </div>"; $this->Resultado = false; } } } private function verfResidente() { $verResidente = new \App\adms\Models\helper\AdmsRead(); $verResidente->fullRead("SELECT id FROM gre_residente WHERE id=:id and adms_sit_id <> 3 LIMIT :limit", "id=" . $this->DadosId . "&limit=2"); if ($verResidente->getResultado()) { $_SESSION['msg'] = "<div class='alert alert-danger' role='alert'> Erro: O Residente não pode ser apagado, Situação diferente de ANÁLISE! <button type='button' class='close' data-dismiss='alert' aria-label='Close'> <span aria-hidden='true'>×</span></button> </div>"; $this->Resultado = false; } else { $this->Resultado = true; } } }