Exemplo n.º 1
0
        $phone = isset($_POST['phone']) ? $_POST['phone'] : '';
        $participants = isset($_POST['participants']) ? $_POST['participants'] : '';
        $observations = isset($_POST['observations']) ? $_POST['observations'] : '';
        $customer = array('id' => $id, 'name' => $name, 'email' => $email, 'phone' => $phone, 'participants' => $participants, 'observations' => $observations);
}
/*
echo 'action: '.$action;
echo '$customer';
print_r($customer);
*/
$c = new Connection();
$conn = $c->getConnection();
$customerDAO = new CustomerDAO($conn);
switch ($action) {
    case 'new':
        $insert_id = $customerDAO->create($customer);
        break;
    case 'update':
        $customerDAO->update($customer);
        break;
    case 'delete':
        //echo 'delete dao'.$id; exit;
        $customerDAO->delete($id);
        break;
}
if ($isAjax) {
    echo json_encode($response);
    exit;
} else {
    header("Location: " . $siteUrl . "/customer_list.php?r=" . mt_rand(0, 9999999));
}
Exemplo n.º 2
0
 public function delete()
 {
     $customerDAO = new CustomerDAO(DataSource::getInstance());
     $customerDAO->delete((int) $_POST['del_cust_id']);
     echo '1';
 }