Ejemplo n.º 1
0
<?php

/**
 * Created by IntelliJ IDEA.
 * User: Pranav
 * Date: 27-03-2016
 * Time: 16:03
 */
require_once 'CustomerController.php';
$data = json_decode($_GET['data']);
if (!isset($_SESSION['token'])) {
    session_start();
}
$userId = $_SESSION['token'];
$opt = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC);
//echo json_encode($data);
switch ($data->operation) {
    case 'addCustomer':
        CustomerController::saveCustomer(null, $data->data);
        break;
    case 'getCustomerDetails':
        CustomerController::getAllCustomerBySearch($data->searchKeyword, $data->searchBy);
        break;
    case 'modifyCustomer':
        //echo(json_encode($data->custId));
        CustomerController::updateCustomer($data->data->customer_id, $data->data);
        break;
    case "getCustomerList":
        CustomerController::getCustomerList();
        break;
}
Ejemplo n.º 2
0
         $personId = $_POST['hdnPersonId'];
         $addressId = $_POST['hdnAddressId'];
         $firstName = $_POST['txtFirstName'];
         $surname = $_POST['txtSurname'];
         $phoneNumber = $_POST['txtPhone'];
         $mobileNumber = $_POST['txtMobile'];
         $emailAddress = $_POST['txtEmail'];
         $mailingList = $chkMailingList;
         $streetAddress = $_POST['txtStreetAddress'];
         $suburb = $_POST['txtSuburb'];
         $city = $_POST['txtCity'];
         $postcode = $_POST['txtPostcode'];
         $state = $_POST['txtState'];
         $result = $personCon->updatePerson($personId, $firstName, $surname, $phoneNumber, $mobileNumber, $emailAddress, $chkMailingList);
         if ($result->errorInfo()[2] == null) {
             $custResult = $custCon->updateCustomer($custId, $personId);
             if ($custResult->errorInfo()[2] == null) {
                 $addressResult = $addressCon->updateAddress($addressId, $streetAddress, $suburb, $city, $postcode, $state, $personId);
                 if ($addressResult->errorInfo()[2] == null) {
                     $editResult = true;
                 } else {
                     $editResult = $addressResult->errorInfo()[2];
                 }
             } else {
                 $editResult = $custResult->errorInfo()[2];
             }
         } else {
             $editResult = $result->errorInfo()[2];
         }
     }
 }