/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreateClient() { $hU = new HttpUtils(); if ($hU->isAjaxRequest() == false) { Response::error("not allowed ;)"); } if (isset($_POST["clientName"]) == false || isset($_POST["clientEmail"]) == false) { Response::ok(CJSON::encode(array("resultado" => Constants::RESULTADO_OPERACION_FALLA, "detalle" => "Faltan parámetros obligatorios"))); } $cl = Cliente::model()->findAll("email=:email", array(':email' => $_POST["clientEmail"])); if (sizeof($cl) > 0) { Response::ok(CJSON::encode(array("resultado" => Constants::RESULTADO_OPERACION_FALLA, "detalle" => "Cliente {$_POST["clientEmail"]} ya registrado en el sistema"))); } $cl = new Cliente(); $cl->surname = ""; $cl->comments = ""; $cl->streetaddress = ""; $cl->name = $_POST["clientName"]; $cl->email = $_POST["clientEmail"]; if ($cl->save()) { Response::ok(CJSON::encode(array("resultado" => Constants::RESULTADO_OPERACION_EXITO, "detalle" => "Cliente {$cl->email} registrado con éxito"))); } else { Response::ok(CJSON::encode(array("resultado" => Constants::RESULTADO_OPERACION_FALLA, "detalle" => "Error registrando cliente {$cl->email} en el sistema"))); } }
function guardarCliente(Cliente $cliente) { $nombre = $cliente->getNombre(); $email = $cliente->getEmail(); $arrayRuta = $cliente->getRutaImagen(); $imagen = $arrayRuta['name']; $tmp = $arrayRuta['tmp_name']; if ($imagen != "") { $destino = "../imagenes/" . $imagen; if (copy($tmp, $destino)) { if (empty($nombre) || empty($email)) { return "No hay datos que guardar"; } else { $sql = "insert into cliente2 values(0,'{$nombre}','{$email}','{$destino}')"; if ($this->conexion->conexion->query($sql)) { $myId = $this->conexion->conexion->insert_id; return $myId; $this->conexion->conexion->close(); } else { return "Error al guardar el usuario"; } $this->conexion->conexion->close(); } } else { return "Error al subir Imagen"; } } else { return "Error en el nombre de la imagen"; } }
function mantclientes() { $_SESSION['Autenticado'] = true; $cliente = new Cliente(); $data['Cliente'] = $cliente->listadoClientes(); $this->view->show("cliente/listar.phtml", $data); }
/** * Restituisce la lista dei metodi di pagamento (carte di credito) * di uno specifico cliente * @param Cliente $cliente * @return array una lista di metodi pagamenti */ public function &getListaPagamentiPerCliente(Cliente $cliente) { $pagamenti = array(); $query = "select \n pagamenti.id, \n pagamenti.saldo, \n pagamenti.num_carta, \n pagamenti.cod_carta, \n pagamenti.scadenza_carta, \n pagamenti.titolare_carta, \n pagamenti.tipo_carta\n from \n clienti_pagamenti join pagamenti\n on \n clienti_pagamenti.pagamenti_id = pagamenti.id\n where \n clienti_pagamenti.clienti_id = ?"; $mysqli = Db::getInstance()->connectDb(); if (!isset($mysqli)) { error_log("[caricaPagamentoPerId] impossibile inizializzare il database"); $mysqli->close(); return null; } $stmt = $mysqli->stmt_init(); $stmt->prepare($query); if (!$stmt) { error_log("[getListaPagamentiPerCliente] impossibile" . " inizializzare il prepared statement"); $mysqli->close(); return null; } if (!$stmt->bind_param('i', $cliente->getId())) { error_log("[getListaPagamentiPerCliente] impossibile" . " effettuare il binding in input"); $mysqli->close(); return null; } $pagamenti = self::caricaPagamentiDaStmt($stmt, 2); $mysqli->close(); return $pagamenti; }
/** * Verifica o login do cliente no sistema */ public function login() { /** * Cria a sessão para a navegação segura do cliente, * incluindo a sessão atual de 'visitante' */ $cliente = new Cliente(); $cliente->setEmail($_REQUEST['email']); $cliente->setSenha($_REQUEST['senha']); $this->modelo('ClienteDAO'); $objCliente = $this->ClienteDAO->login($cliente); $_SESSION['cliente'] = serialize($objCliente); if (isset($_REQUEST['finalizar_compra'])) { $carrinho = new Carrinho(); $carrinho->setSession($_SESSION['visitante']); /** * Carrega os dados do modelo */ $this->modelo('CarrinhoDAO'); $objCarrinho = array(); $objCarrinho = $this->CarrinhoDAO->show($carrinho); $this->visao->bind('objCarrinho', $objCarrinho); $this->visao->render('finalizar_compra/index'); } else { $this->visao->render('pedido/index'); } }
public function cadastro($created) { /** * criar uma pessoa */ $modelPessoa = new Pessoa(); $pessoasId = $modelPessoa->genericInsert(array('tipo_pessoa' => 1, 'created' => $created)); /** * criar uma pessoa fisica */ $ModelPF = new Fisica(); $ModelPF->genericInsert(array('pessoas_id' => $pessoasId, 'cpf' => '00000000000', 'nome' => $this->getNome())); /** * criar um contato */ $modelContato = new Contato(); $contatoId = $modelContato->genericInsert(array('telefone' => Utils::returnNumeric($this->getPhone()), 'tipo' => 1)); $modelContato->inserirContato($pessoasId, $contatoId); /** * criar um email */ $modelEmail = new Email(); $modelEmail->inserirEmailPessoa($pessoasId, $this->getEmail()); /** * criar um usuario */ $modelUsuario = new Usuario(); $usuarioId = $modelUsuario->genericInsert(array('roles_id' => 1, 'pessoas_id' => $pessoasId, 'status' => 1, 'perfil_teste' => 0, 'created' => $created, 'email' => $this->getEmail(), 'login' => $this->getEmail(), 'senha' => Authentication::password($this->getPhone()), 'chave' => Authentication::uuid(), 'facebook_id' => $this->getFacebookId())); $modelCliente = new Cliente(); $modelCliente->genericInsert(array('pessoas_id' => $pessoasId, 'status' => 1, 'sexo' => 0)); return $modelCliente->recuperaCliente($this->getNome(), $this->getPhone()); }
function clientezona() { $dataClienteZona = new ClienteZona(); $opciones = new general(); $zona = new Zona(); $cliente = new Cliente(); $url = "/" . $_REQUEST['url']; $id = $_REQUEST['id'] != '' ? $_REQUEST['id'] : 1; $data['Opcion'] = $opciones->buscaOpcionexurl($url); $data['Modulo'] = $opciones->buscaModulosxurl($url); $tamanio = 10; $data['ClienteZona'] = $dataClienteZona->listado($id, $tamanio); $total = count($data['ClienteZona']); for ($i = 0; $i < $total; $i++) { if ($data['ClienteZona'][$i]['idcliente'] != '' && $data['ClienteZona'][$i]['idcliente'] != 0) { $data['ClienteZona'][$i]['nombrecli'] = $cliente->nombrexid($data['ClienteZona'][$i]['idcliente']); } if ($data['ClienteZona'][$i]['idzona'] != '' && $data['ClienteZona'][$i]['idzona'] != 0) { $data['ClienteZona'][$i]['nombrezona'] = $zona->nombrexid($data['ClienteZona'][$i]['idzona']); } } $data['Paginacion'] = 1; $data['Pagina'] = 1; $this->view->show("/mantenimiento/clientezona.phtml"); }
public function verificaCpf(Cliente $objCliente) { $conexao = $this->abreConexao(); $sql = "SELECT * FROM " . TBL_CLIENTES . " WHERE cpf = '" . $objCliente->getCpf() . "'"; $banco = $conexao->query($sql); $numLinhas = $banco->num_rows; return $numLinhas; $this->fechaConexao(); }
public function excluir() { $objeto = new Cliente(); $objeto->load($_GET['id']); if ($objeto->excluir()) { redirecionar('?pagina=cliente&acao=listar', 'registro excluido com sucesso!'); } else { redirecionar('?pagina=cliente&acao=listar', 'falha ao excluir registro!'); } }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ private function createCliente($cliente) { $usuario = $this->crearUsuarioPasajero($cliente['identificacion']); $cliente = new Cliente(); $cliente->identificacion = $cliente['identificacion']; $cliente->nombres = $cliente['nombres']; $cliente->telefono = $cliente['telefono']; $cliente->direccion = $cliente['direccion']; $cliente->usuario_id = $cliente->id; return array('cliente' => $cliente->save(), 'usuario' => $usuario); }
public function salvar() { $obj2 = new Cliente(); if (!$obj2->load($this->getcliente_cpf_cnpj())) { //if (!$this->getcliente_cpf_cnpj()) { $result = DB::getConexao()->query("INSERT INTO `cliente`(`cliente_cpf_cnpj`,`cliente_nome`,`cliente_descricao`)\n VALUES ('{$this->cliente_cpf_cnpj}','{$this->cliente_nome}','{$this->cliente_descricao}')"); return $result; } else { return DB::getConexao()->query("UPDATE `cliente`\n SET \n `cliente_nome` = '{$this->cliente_nome}', \n `cliente_descricao` = '{$this->cliente_descricao}' \n \n WHERE `cliente_cpf_cnpj` = '{$this->cliente_cpf_cnpj}';"); } }
private function getListaCliente($lista) { $listaAux = array(); foreach ($lista as $item) { $cliente = new Cliente(); $cliente->setIdCliente($item["idCliente"]); $cliente->setNombre($item["nombre"]); $cliente->setDireccion($item["Direccion"]); $listaAux[] = $cliente; } return $listaAux; }
function buscarxOrdenVenta() { $idOrdenVenta = $_REQUEST['id']; $cliente = new Cliente(); $data = $cliente->buscaxOrdenVenta($idOrdenVenta); $dataRespuesta['razonsocial'] = !empty($data[0]['razonsocial']) ? html_entity_decode($data[0]['razonsocial'], ENT_QUOTES, 'UTF-8') : ""; $dataRespuesta['idcliente'] = !empty($data[0]['idcliente']) ? $data[0]['idcliente'] : ""; $dataRespuesta['codcliente'] = !empty($data[0]['codcliente']) ? $data[0]['codcliente'] : ""; $dataRespuesta['codantiguo'] = !empty($data[0]['codantiguo']) ? $data[0]['codantiguo'] : ""; $dataRespuesta['codigov'] = !empty($data[0]['codigov']) ? $data[0]['codigov'] : ""; $dataRespuesta['ruc'] = !empty($data[0]['ruc']) ? $data[0]['ruc'] : ""; echo json_encode($dataRespuesta); }
public function run() { // going 'Faker' :) on the polls table. $faker = Faker::create(); for ($i = 1; $i <= 100; $i++) { $cliente = new Cliente(); $cliente->direccion = $faker->address; $cliente->nombre = $faker->name; $cliente->email = $faker->email; $cliente->telefono = $faker->phoneNumber; $cliente->farmacia_id = $faker->numberBetween(1, 5); $cliente->save(); } }
private function loginCliente($user, $passw) { // chiediamo al modello di caricare i dati e li passiamo alla vista. // Il passaggio e' fatto semplicemente popolando delle variabili // che poi vengono lette dalla vista. $q = "SELECT * FROM cliente\r\n WHERE Username = '******' AND Password ='******'"; $res = $db->query($q); if (mysql_num_rows($res) == 1) { $row = mysql_fetch_array($res); $cliente = new Cliente(); $cliente->setUsername($user); $cliente->setPassword($passw); $cliente->setIdCliente($idCliente); $cliente->setCognome($cognome); $cliente->setNome($nome); $cliente->setTelefono($telefono); $this->showCliente($cliente); //header('Location: index.php'); } else { ?> <script type="text/javascript"> alert('utente non trovato!'); </script> <?php } }
public function verificaLogin(Cliente $objCliente) { $conexao = $this->abreConexao(); $sql = "SELECT *\n FROM " . TBL_CLIENTES . "\n WHERE email = '" . $objCliente->getEmail() . "'\n AND senha = '" . $objCliente->getSenha() . "'\n "; $banco = $conexao->query($sql); $numLinha = $banco->num_rows; if ($numLinha == 1) { $retorno = $banco->fetch_assoc(); } else { $retorno = 0; } return $retorno; $this->fechaConexao(); }
/** mappatura proprietà cliente */ public static function map(Cliente $cliente, array $properties) { if (array_key_exists('ID', $properties)) { $cliente->setID($properties['ID']); } if (array_key_exists('EMAIL', $properties)) { $cliente->setEMAIL($properties['EMAIL']); } if (array_key_exists('PASSWORD', $properties)) { $cliente->setPASSWORD($properties['PASSWORD']); } if (array_key_exists('ATTIVO', $properties)) { $cliente->setATTIVO($properties['ATTIVO']); } }
public function RegistrarCliente($nombres, $doc_ident, $atencion_a, $direccion, $telefono, $correo, $referencia) { $resultado = array('valor' => 1, 'message' => 'Servicio Registrado correctamente.'); $cliente = new Cliente(); $cliente->nombres = $nombres; $cliente->doc_ident = $doc_ident; $cliente->atencion_a = $atencion_a; $cliente->direccion = $direccion; $cliente->telefono = $telefono; $cliente->correo = $correo; $cliente->referencia = $referencia; if (!$cliente->save()) { $resultado = array('valor' => 0, 'message' => 'No hemos podido Registrar el servicio, intentelo nuevamente'); } return $resultado; }
public function getIndex() { //Session::put('infocliente',Auth::user()->id); $cliente = Cliente::find(Auth::user()->id); $elcli = Auth::user()->id; date_default_timezone_set("America/Bogota"); $accesoanterior = $cliente->updated_at; $nombrec = $cliente->nombre; $cliente->updated_at = Carbon::now(); $cliente->save(); $cuentas = Cuenta::where('cedula', Auth::user()->id)->get(); $ahorros = array(); $corriente = array(); if (!is_null($cuentas)) { foreach ($cuentas as $cuenta) { if ($cuenta->tipo == 'A') { $aho = Ahorros::where('cuenta', $cuenta->codigo)->first(); array_push($ahorros, $aho); } else { $corr = Corriente::where('cuenta', $cuenta->codigo)->first(); array_push($corriente, $corr); } } } return View::make('bienvenidas.bienvenida')->with('ultacceso', $accesoanterior)->with('corriente', $corriente)->with('ahorros', $ahorros)->with('cuentas', $cuentas)->with('elcli', $elcli)->with('nombrec', $nombrec); //primer pantallazo }
public function update() { $inputs = Input::all(); $reglas = array('nombres' => 'required|min:4', 'apellido' => 'required'); $mensajes = array('required' => 'Campo Obligatorio'); $validar = Validator::make($inputs, $reglas); if ($validar->fails()) { Input::flash(); return Redirect::back()->withInput()->withErrors($validar); } else { $id = Input::get('id'); $cliente = Cliente::find($id); $cliente->nombres = Input::get('nombres'); $cliente->apellido = Input::get('apellido'); $cliente->tipo_doc = Input::get('tipo_doc'); $cliente->documento = Input::get('documento'); $cliente->email = Input::get('email'); $cliente->calle = Input::get('calle'); $cliente->num = Input::get('num'); $cliente->piso = Input::get('piso'); $cliente->localidad = Input::get('localidad'); $cliente->telefono = Input::get('telefono'); $cliente->celular = Input::get('celular'); $cliente->save(); return Redirect::to('lista_clientes')->with('error', 'El Cliente ha sido actualizado con Éxito')->withInput(); } }
function login(Request $request, Response $response) { $response = $response->withHeader('Content-type', 'application/json'); $data = json_decode($request->getBody(), true); $cont = 0; $std = 0; $roles = array(); $dataCliente = Cliente::select("email", "nombres", "apellidos")->where('email', '=', $data['usuario'])->where('pass', '=', $data['pass'])->first(); if ($dataCliente != null) { $cont++; array_push($roles, "cliente"); } $dataEmpresa = Empresa::select("email", "nombre", "foto")->where('email', '=', $data['usuario'])->where('pass', '=', $data['pass'])->first(); if ($dataEmpresa != null) { $cont++; array_push($roles, "empresa"); } $dataUsuario = Usuario::select("id", "nombres", "apellidos", "idSucursal", "idCategoria")->where('id', '=', $data['usuario'])->where('pass', '=', $data['pass'])->first(); if ($dataUsuario != null) { $cont++; array_push($roles, "usuario"); } if ($cont > 0) { $response = $response->withStatus(200); $std = 1; } else { $response = $response->withStatus(404); } $response->getBody()->write(json_encode(array("std" => $std, "roles" => $roles))); return $response; }
function addUser() { $app = \Slim\Slim::getInstance(); $fields = json_decode($app->request->getBody()); $user = new Usuario(); $message = false; if ($user->addUser($fields)) { $message = true; } $result = $user->addUser($fields); if ($result > 0 && $fields->tipo_usuario == 'cliente') { $cliente = new Cliente(); $cliente->addClienteRelation($result, 1); } echo $message; }
function pago($nro_tarjeta, $cod_seg, $fecha_exp, $monto, $ci, $nro_afiliado) { $client = Cliente::first('all', array('conditions' => array(' ci = ?', $ci))); $tarjeta = Tarjeta::first('all', array('conditions' => array(' nro_tarjeta = ?', $nro_tarjeta))); $banco = Cuenta::first('all', array('conditions' => array(' nro_afiliado = ?', $nro_afiliado))); // var_dump($client->nombre); if ($client != NULL && $tarjeta != NULL && $banco != NULL) { $cuentaCliente = Cuenta::first('all', array('conditions' => array(' ci_cliente = ?', $ci))); if ($cuentaCliente->nro_afiliado == $tarjeta->nro_afiliado && $cod_seg == $tarjeta->cod_seg) { if ($monto <= $cuentaCliente->saldo) { $cuentaCliente->saldo = $cuentaCliente->saldo - $monto; $cuentaCliente->save(); $banco->saldo = $banco->saldo + $monto; $banco->save(); Transaccion::create(array('nro_tarjeta' => $nro_tarjeta, 'ci' => $ci, 'fecha_transaccion' => date("Y-m-d H:i:s"), 'monto' => $monto, "nro_afiliado_adquiriente" => $nro_afiliado, 'cod' => "00")); return "00"; } else { Transaccion::create(array('nro_tarjeta' => $nro_tarjeta, 'ci' => $ci, 'fecha_transaccion' => date("Y-m-d H:i:s"), 'monto' => $monto, "nro_afiliado_adquiriente" => $nro_afiliado, 'cod' => "01")); return "01"; } } else { Transaccion::create(array('nro_tarjeta' => $nro_tarjeta, 'ci' => $ci, 'fecha_transaccion' => date("Y-m-d H:i:s"), 'monto' => $monto, "nro_afiliado_adquiriente" => $nro_afiliado, 'cod' => "10")); return "10"; } } else { Transaccion::create(array('nro_tarjeta' => $nro_tarjeta, 'ci' => $ci, 'fecha_transaccion' => date("Y-m-d H:i:s"), 'monto' => $monto, "nro_afiliado_adquiriente" => $nro_afiliado, 'cod' => "10")); return "10"; } }
public function all($id) { if ($id == '') { $sql = "SELECT * FROM `cliente`;"; $vai = new MySQLDB(); $result = $vai->executeQuery($sql); } else { $sql = "SELECT `idcliente`, `nome`, `cnpj`, `email`, `senha`, `site`, `endereco`, `complemento`, `bairro`, `cep`, `cidade`, `estado`, `ativo`, `telefone` FROM `cliente` WHERE `idcliente` = {$id};"; $vai = new MySQLDB(); $result = $vai->executeQuery($sql); } while ($dados = mysql_fetch_array($result)) { $cliente = new Cliente(); $cliente->setidcliente(array('idcliente' => $dados['idcliente'])); $cliente->setnome(array('nome' => $dados['nome'])); $cliente->setcnpj(array('cnpj' => $dados['cnpj'])); $cliente->setemail(array('email' => $dados['email'])); $cliente->setsenha(array('senha' => $dados['senha'])); $cliente->setsite(array('site' => $dados['site'])); $cliente->setendereco(array('endereco' => $dados['endereco'])); $cliente->setcomplemento(array('complemento' => $dados['complemento'])); $cliente->setbairro(array('bairro' => $dados['bairro'])); $cliente->setcep(array('cep' => $dados['cep'])); $cliente->setcidade(array('cidade' => $dados['cidade'])); $cliente->setestado(array('estado' => $dados['estado'])); $cliente->setativo(array('ativo' => $dados['ativo'])); $cliente->settelefone(array('telefone' => $dados['telefone'])); $arr[] = $cliente; } return $arr; }
/** * Store a newly created conversa in storage. * * @return Response */ public function store() { $validator = Validator::make($data = Input::all(), Conversa::$rules); //return Conversa::create($data); if ($validator->fails()) { return Response::json(array('success' => false)); } $conversa = Conversa::create($data); if ($conversa) { $alert[] = ['class' => 'alert-success', 'message' => '<strong><i class="fa fa-check"></i></strong>Conversa salva com sucesso!']; // AGENDAR PRÓXIMA CONVERSA if (isset($data['tarefa_title']) and !empty($data['tarefa_title'])) { $cliente = Cliente::find($data['cliente_id']); if (!empty($data['tarefa_title'])) { $tarefa_title = $data['tarefa_title']; } else { $tarefa_title = "Conversa agendada com " . $cliente->nome; } $tarefa = Tarefa::create(['start' => date('Y-m-d H:i:s', strtotime($data['tarefa_date'])), 'cliente_id' => $data['cliente_id'], 'conversa_id' => $conversa->id, 'title' => $tarefa_title, 'tipo' => $data['tarefa_tipo']]); if ($tarefa) { $alert[] = ['class' => 'alert-success', 'message' => '<strong><i class="icon-alarm"></i></strong> Próxima conversa agendada para ' . date('d \\d\\e F', strtotime($tarefa->start))]; } } } else { $alert[] = ['class' => 'alert-warning', 'message' => '<strong><i class="fa fa-times"></i></strong> Erro! Não foi possível salvar a conversa.']; } Session::flash('alerts', $alert); return Redirect::to(URL::previous()); //return Response::json(array('success' => true)); }
public static function getInstanceBySQLRow(array $row) { //idcliente,url,fechaingreso,estado,tb.descripcion,email,acceso,fechabaja $cliente = new \Cliente(); $cliente->setUrl($row["url"]); $cliente->setFechaIngreso($row["fechaingreso"]); $cliente->setEstado($row["estado"]); $cliente->setDescripcion($row["descripcion"]); $cliente->setEmail($row["email"]); $cliente->setAcceso($row["acceso"]); $cliente->setFechaBaja($row["fechabaja"]); return $cliente; }
public function uniqueEmail($attributes, $paramns) { $email = $this->email; $email_no_banco = Cliente::model()->find("email='{$email}'"); if (count($email_no_banco) > 0) { $this->addError('email', utf8_encode('O e-mail já está sendo usado.')); } }
public function update($id) { $cliente = Cliente::find($id); $data = Input::get('cliente'); $cliente->fill($data); $cliente->save(); return Redirect::route('clientes.show', $id); }
public function getCliente2($id) { $conexion = new Conexion(); $ctrlUsuario = new ControllerUsuario(); $consulta = $conexion->prepare('SELECT * FROM ' . self::TABLA . ' WHERE id = :id'); $consulta->bindParam(':id', $id); $consulta->execute(); $registro = $consulta->fetch(); if ($registro) { $nuevo = new Cliente(); $nuevo->construir($registro); $nuevo->usuario = $ctrlUsuario->getUsuario2($registro['usuario_id']); return $nuevo; } else { return false; } }
/** * Run the database seeds. * * @return void */ public function run() { Eloquent::unguard(); // $this->call('UserTableSeeder'); MaterialCategoria::create(array('nombre' => 'Sin Categoria', 'tipo' => 'unidad')); ModuloCategoria::create(array('nombre' => 'Sin Categoria')); Cliente::create(array('nombre' => 'Anonimo', 'apellido' => 'equis', 'persona' => 'n', 'identificacion' => '00000', 'telefono' => '00000', 'email' => '*****@*****.**', 'celular' => '00000', 'sexo' => 'm', 'nacimiento' => '00-00-00')); User::create(array('username' => 'master', 'email' => '*****@*****.**', 'password' => Hash::make('123456'), 'role' => 'master')); }