/**
  * Metodo CheckUserSorteio
  *
  * @access public
  * @param integer $user_id
  * @param integer $sorteio_id
  * @return integer
  */
 public function CheckUserSorteio($user_id, $sorteio_id)
 {
     $session = new Session();
     $session->StartSession();
     $user = new User();
     if (!$user->CheckLogin($session->data)) {
         echo "<script>document.location.href='" . DIR_DOCS . "logout/'</script>";
     }
     $querys = new Querys();
     $sql = "SELECT \n                  *\n                FROM  \n                  " . $this->tabela . "\n                WHERE \n                  par_sorteios_id = '" . (int) $sorteio_id . "' AND\n                  par_accounts_id = '" . (int) $user_id . "'";
     $query = $querys->query($sql);
     return $query->num_rows;
 }
 /**
  * Metodo CheckGanhador
  *
  * @access public
  * @param integer $sorteio_id
  * @return integer
  */
 public function CheckGanhador($sorteio_id)
 {
     $session = new Session();
     $session->StartSession();
     $user = new User();
     if (!$user->CheckLogin($session->data)) {
         echo "<script>document.location.href='" . DIR_DOCS . "logout/'</script>";
     }
     $querys = new Querys();
     $sql = "SELECT \n                  g.*,\n                  a.act_account_nome,\n                  a.act_accounts_id,\n                  a.act_account_sobrenome\n                FROM  \n                  " . $this->tabela . " g\n                LEFT JOIN\n                  " . $this->tabela_accounts . " a ON (a.act_accounts_id = g.gan_accounts_id)\n                WHERE \n                 g.gan_sorteios_id = '" . (int) $sorteio_id . "'";
     $query = $querys->query($sql);
     if ($query->num_rows > 0) {
         return $query->row;
     } else {
         return $query->num_rows;
     }
 }
define('DIR_DOCS', DIR_BASE . 'docs/');
include 'Session.php';
include 'User.php';
include 'Querys.php';
include 'Sorteios.php';
include 'Participantes.php';
include 'Ganhadores.php';
include 'Checkout.php';
include 'Vendas.php';
include 'Cadastros.php';
include 'ProdutosInfo.php';
$querys = new Querys();
// Inicia Classe Querys
$session = new Session();
// Inicia Classe Session
$session->StartSession();
// Inicia SESSION
$user = new User();
// Inicia Classe User
$sorteios = new Sorteios();
$participantes = new Participantes();
$ganhadores = new Ganhadores();
$produtos_info = new ProdutosInfo();
$vendas = new Vendas();
if (!isset($session->data['user']['user_login']) and !isset($session->data['user']['user_cpf'])) {
    $session->Destroy('user');
} else {
    $user->CheckLogin($session->data);
    if ($user->isLoggedUser()) {
        if ($user->isConfirmed() == '0') {
            $S_NotConfirmed = true;
 /**
  * Metodo UpdateCredit
  *
  * @access public
  * @param int $act_accounts_id
  * @param int $cnt_credit
  * @return array
  */
 public function UpdateCredit($act_accounts_id, $cnt_credit)
 {
     $session = new Session();
     $session->StartSession();
     $querys = new Querys();
     $sql = "UPDATE \n                  " . $this->tabela_credit . " \n                SET \n                  act_account_credit = '" . (int) $cnt_credit . "'\n                WHERE \n                  act_accounts_id = '" . (int) $act_accounts_id . "'";
     $query = $querys->query($sql);
     return $query;
 }
 /**
  * Metodo ConfirmSorteio
  *
  * @access public
  * @param array $data
  * @return array
  */
 public function ConfirmSorteio($registro_id)
 {
     $session = new Session();
     $session->StartSession();
     $user = new User();
     if (!$user->CheckLogin($session->data)) {
         echo "<script>document.location.href='" . DIR_DOCS . "logout/'</script>";
     }
     $querys = new Querys();
     $sql = "UPDATE \n                  " . $this->tabela . " \n                SET \n                  sor_sorteio_status = '1'\n                WHERE \n                  sor_sorteios_id = '" . (int) $registro_id . "'";
     $query = $querys->query($sql);
     return $query;
 }
 /**
  * Metodo login logoutUser
  *
  * @access public
  * @return void
  */
 public function logoutUser()
 {
     $session = new Session();
     $session->StartSession();
     $session->Destroy('user');
     $this->act_accounts_id = '';
     $this->act_account_nome = '';
     $this->act_account_cpf = '';
     $this->act_account_email = '';
     session_destroy();
 }
 /**
  * Metodo UpdateEntregue
  *
  * @access public
  * @param string $vnd_transaction_id
  * @return array
  */
 public function UpdateEntregue($vnd_transaction_id)
 {
     $session = new Session();
     $session->StartSession();
     $user = new User();
     $querys = new Querys();
     $sql = "UPDATE \n                  " . $this->tabela . " \n                SET \n                  vnd_venda_entregue = '1'\n                WHERE \n                  vnd_transaction_id = '" . $vnd_transaction_id . "'";
     $query = $querys->query($sql);
     return $query;
 }