Beispiel #1
0
 public function editar($conds = null)
 {
     $data = array('descricao' => $this->prato->getDescricao(), 'nome' => $this->prato->getNome(), 'tipo_prato_id' => $this->prato->getTipo_prato_id(), 'tamanho_prato_id' => $this->prato->getTamanho_prato_id(), 'preco' => $this->prato->getPreco(), 'imagem_prato_id' => $this->prato->getImagem_prato_id(), 'status_prato_id' => $this->prato->getStatus_prato_id());
     try {
         $this->database->update($this->tabela, $conds, $data);
         return true;
     } catch (\Simplon\Mysql\MysqlException $ex) {
         \Delivery\Utils\Utils::displayErrorMessage($ex->getMessage());
         return false;
     }
 }
Beispiel #2
0
 public function editar($conds)
 {
     $data = array('bairro' => $this->pessoa->getBairro(), 'cidade_id' => $this->pessoa->getCidade_id(), 'nome' => $this->pessoa->getNome(), 'idade' => $this->pessoa->getIdade(), 'data_nascimento' => $this->pessoa->getData_nascimento(), 'cpf' => $this->pessoa->getCpf(), 'rg' => $this->pessoa->getRg(), 'nome_mae' => $this->pessoa->getNome_mae(), 'sexo' => $this->pessoa->getSexo(), 'telefone' => $this->pessoa->getTelefone(), 'celular' => $this->pessoa->getCelular(), 'email' => $this->pessoa->getEmail(), 'endereco' => $this->pessoa->getEndereco());
     try {
         $this->database->update($this->tabela, $conds, $data);
         return true;
     } catch (\Simplon\Mysql\MysqlException $ex) {
         \Delivery\Utils\Utils::displayErrorMessage($ex->getMessage());
         return false;
     }
 }
Beispiel #3
0
 public function editar($conds = null)
 {
     $data = array('descricao' => $this->temperos->getDescricao());
     try {
         $this->database->update($this->tabela, $conds, $data);
         return true;
     } catch (\Simplon\Mysql\MysqlException $ex) {
         \Delivery\Utils\Utils::displayErrorMessage($ex->getMessage());
         return false;
     }
 }
 public function editar($conds = null)
 {
     $data = array('cardapio_id' => $this->cardapioPrato->getCardapio_id(), 'prato_id' => $this->cardapioPrato->getPrato_id());
     try {
         $this->database->update($this->tabela, $conds, $data);
         return true;
     } catch (\Simplon\Mysql\MysqlException $ex) {
         \Delivery\Utils\Utils::displayErrorMessage($ex->getMessage());
         return false;
     }
 }
Beispiel #5
0
 public function editar($conds = null)
 {
     $data = array('data' => $this->pedido->getData(), 'valor' => $this->pedido->getValor(), 'cliente_id' => $this->pedido->getCliente_id(), 'status_pedido_id' => $this->pedido->getStatus_pedido_id());
     try {
         $this->database->update($this->tabela, $conds, $data);
         return true;
     } catch (\Simplon\Mysql\MysqlException $ex) {
         \Delivery\Utils\Utils::displayErrorMessage($ex->getMessage());
         return false;
     }
 }
Beispiel #6
0
 public function editar($conds = null)
 {
     $data = array('senha' => $this->login->getSenha(), 'usuario' => $this->login->getUsuario(), 'funcionario_id' => $this->login->getFuncionario_id());
     try {
         $this->database->update($this->tabela, $conds, $data);
         return true;
     } catch (MysqlException $ex) {
         Utils::displayErrorMessage($ex->getMessage());
         return false;
     }
 }
Beispiel #7
0
 public function editar($conds = null)
 {
     $data = array('salario' => $this->funcionario->getSalario(), 'data_admissao' => $this->funcionario->getData_admissao(), 'data_desligamento' => $this->funcionario->getData_desligamento(), 'pessoa_id' => $this->funcionario->getPessoa_id());
     $dataLogin = array('usuario' => $this->login->getUsuario(), 'senha' => $this->login->getSenha(), 'funcionario_id' => $this->funcionario->getId());
     $condsLogin = array('funcionario_id' => $conds['id']);
     try {
         $this->database->update($this->tabela, $conds, $data);
         $this->database->update('login', $condsLogin, $dataLogin);
         return true;
     } catch (MysqlException $ex) {
         Utils::displayErrorMessage($ex->getMessage());
         return false;
     }
 }
Beispiel #8
0
 public function editar($cond)
 {
     $data = array('bairro' => $this->cliente->getBairro(), 'cidade_id' => $this->cliente->getCidade_id(), 'nome' => $this->cliente->getNome(), 'idade' => $this->cliente->getIdade(), 'data_nascimento' => $this->cliente->getData_nascimento(), 'cpf' => $this->cliente->getCpf(), 'rg' => $this->cliente->getRg(), 'nome_mae' => $this->cliente->getNome_mae(), 'sexo' => $this->cliente->getSexo(), 'telefone' => $this->cliente->getTelefone(), 'celular' => $this->cliente->getCelular(), 'email' => $this->cliente->getEmail(), 'endereco' => $this->cliente->getEndereco());
     try {
         if ($id = $this->database->update('pessoa', $cond, $data)) {
             $dadoscliente = array('pessoa_id' => $id, 'senha' => $this->cliente->getSenha());
             //                if ($idCliente = $this->database->update('cliente', $dadoscliente)) {
             //
             //                    return $idCliente;
             //                }
         }
         return true;
     } catch (\Simplon\Mysql\MysqlException $ex) {
         \Delivery\Utils\Utils::displayErrorMessage($ex->getMessage());
         return false;
     }
 }
Beispiel #9
0
 function salvarPessoa()
 {
     $pessoa = new Pessoa();
     $erro = '';
     if ($this->getPost('id')) {
         $pessoa->setId($this->getPost('id'));
     }
     $pessoa->setNome($this->getPost('nome'));
     $pessoa->setIdade($this->getPost('idade'));
     $sexo = $this->getPost('sexo') == 'Masculino' ? 'M' : 'F';
     $pessoa->setSexo($sexo);
     $pessoa->setData_nascimento($this->getPost('data_nascimento'));
     $pessoa->setNome_mae($this->getPost('nome_mae'));
     $cpf = $this->getPost('cpf');
     if (!\Delivery\Utils\Utils::validaCPF($cpf)) {
         $erro .= "CPF inválido.";
     } else {
         $pessoa->setCpf($cpf);
     }
     $pessoa->setRg($this->getPost('rg'));
     $email = $this->getPost('email');
     if (!$this->getPost('id') && $this->emailExist($email)) {
         $erro .= "E-mail {$resultado[0]['email']} já esta sendo utilizado.";
     } else {
         $pessoa->setEmail($email);
     }
     $pessoa->setCelular($this->getPost('celular'));
     $pessoa->setTelefone($this->getPost('telefone'));
     if ($this->getPost('cidade_id') == "0") {
         $erro .= "Cidade deve ser informada.";
     }
     $pessoa->setCidade_id($this->getPost('cidade_id'));
     $pessoa->setBairro($this->getPost('bairro'));
     $pessoa->setEndereco($this->getPost('endereco'));
     $pessoaS = serialize($pessoa);
     if (strlen($erro) > 0) {
         $this->redirect($this->UrlBuilder()->doAction('pessoa', array('errorMsg' => $erro, 'adicionar' => true, 'pessoaS' => $pessoaS)));
     }
     $pessoaDao = new PessoaDao('pessoa', $pessoa);
     if ($this->getPost('id')) {
         if ($pessoaDao->editar(array('id' => $this->getPost('id')))) {
             $successMsg = "Pessoa atualizada com sucesso!";
             $this->redirect($this->UrlBuilder()->doAction('pessoa', array('successMsg' => $successMsg)));
         } else {
             $errorMsg = "Pessoa não pode ser salva!";
             $this->redirect($this->UrlBuilder()->doAction('pessoa', array('adicionar' => true, 'errorMsg' => $pessoaDao->getErro(), 'pessoaS' => $pessoaS)));
         }
     } else {
         if ($pessoaDao->salvar()) {
             $successMsg = "Pessoa salva com sucesso!";
             $this->redirect($this->UrlBuilder()->doAction('pessoa', array('successMsg' => $successMsg)));
         } else {
             $errorMsg = "Pessoa não pode ser salva!";
             $this->redirect($this->UrlBuilder()->doAction('pessoa', array('errorMsg' => $pessoaDao->getErro())));
         }
     }
 }