Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
128 righe
3.9 KiB
128 righe
3.9 KiB
<?php |
|
|
|
require_once "IDataClass.php"; |
|
/* |
|
* To change this license header, choose License Headers in Project Properties. |
|
* To change this template file, choose Tools | Templates |
|
* and open the template in the editor. |
|
*/ |
|
|
|
/** |
|
* Description of UTENTI |
|
* |
|
* @author Stefano |
|
*/ |
|
class Domanda_Imprese extends DataClass { |
|
|
|
const TABLE_NAME = "DOMANDA_IMPRESE"; |
|
|
|
public $ID_DOMANDA = 0; // Primary key |
|
public $DENOMINAZIONE = null; |
|
public $CODICE_FISCALE_IMPRESA = null; |
|
public $PARTITA_IVA = null; |
|
|
|
public function __construct($src = null) { |
|
global $con; |
|
if ($src == null) |
|
return; |
|
if (is_array($src)) { |
|
if (isset($src['ID_DOMANDA']) && $src['ID_DOMANDA'] > 0) { |
|
$this->_loadAndFillObject($src['ID_DOMANDA'], self::TABLE_NAME, $src); |
|
} else { |
|
$this->_loadByRow($src, $stripSlashes); |
|
} |
|
} elseif (intval($src)) { |
|
|
|
} |
|
} |
|
|
|
public static function loadById($id_domanda = 0) { |
|
global $con, $LoggedAccount; |
|
if ($id_domanda > 0 && $id_domanda != "") { |
|
$sql = "SELECT * FROM " . self::TABLE_NAME . " WHERE ID_DOMANDA = :id_domanda"; |
|
$query = $con->prepare($sql); |
|
$query->bindParam(":id_domanda", $id_domanda); |
|
try { |
|
$query->execute(); |
|
$it = $query->fetchAll(PDO::FETCH_ASSOC); |
|
$response = $it; |
|
if ($fillObject) { |
|
Utils::FillObjectFromRow($this, $response); |
|
} |
|
} catch (Exception $exc) { |
|
$exc->getMessage(); |
|
} |
|
} |
|
return $response; |
|
} |
|
|
|
public function Save() { |
|
global $con; |
|
$vars = get_object_vars($this); |
|
$sql = Utils::prepareQuery(self::TABLE_NAME, $vars); |
|
$queryabi = $con->prepare($sql); |
|
foreach ($vars as $k => $v) { |
|
if ($k == "ID" && $v == 0) |
|
continue; |
|
$queryabi->bindValue(":" . $k, $v); |
|
} |
|
try { |
|
$it = parent::_Save($queryabi); |
|
} catch (Exception $exc) { |
|
$it['descrizioneErrore'] = $exc->getMessage(); |
|
} |
|
return $it; |
|
} |
|
|
|
public static function deleteImprese($id_domanda = 0) { |
|
global $con; |
|
$return = array(); |
|
if (intval($id_domanda) > 0) { |
|
$sql = "DELETE FROM " . self::TABLE_NAME . " WHERE ID_DOMANDA=:id_domanda"; |
|
$query = $con->prepare($sql); |
|
$query->bindParam("id_domanda", $id_domanda); |
|
try { |
|
$query->execute(); |
|
$return['esito'] = 1; |
|
} catch (Exception $exc) { |
|
$return['esito'] = -999; |
|
$return['decrizioneErrore'] = $exc->getMessage(); |
|
} |
|
} |
|
return $return; |
|
} |
|
|
|
public static function LoadDataTable($searchQuery = "", $searchArray = array(), $columnName = array(), $columnSortOrder = array(), $start = 0, $offset = 0) { |
|
|
|
return parent::_loadDataTable(self::TABLE_NAME, $searchQuery, $searchArray, $columnName, $columnSortOrder, $start, $offset); |
|
} |
|
|
|
public function Delete() { |
|
return parent::_Delete(self::TABLE_NAME, "ID_DOMANDA = " . $this->ID_DOMANDA); |
|
} |
|
|
|
/** |
|
* Elimina l'oggetto corrente dal database e restituisce TRUE se ha successo |
|
* |
|
* @return bool Risultato booleano dell'operazione |
|
*/ |
|
public function LogicalDelete() { |
|
return parent::_LogicalDelete(self::TABLE_NAME, "id = " . $this->id); |
|
} |
|
|
|
/** |
|
* Funzione per la visualizzazione dei logs |
|
* @param type $record |
|
* @param type $campo |
|
*/ |
|
public function Parse(&$record, $campo = "") { |
|
$props = get_class_vars(get_class($this)); |
|
switch ($campo) { |
|
|
|
default: |
|
array_push($record, array("Campo" => $campo, "Valore" => $this->$campo)); |
|
break; |
|
} |
|
} |
|
|
|
}
|
|
|