Esempio n. 1
0
<style>
    .error {
        color: red;
    }
</style>
<?php 
/**
 * Created by PhpStorm.
 * User: Danie
 * Date: 2014/10/18
 * Time: 07:25 PM
 */
include "Header.inc.php";
//    echo buildPostForDebug($_POST);
//    die;
$recordBase = new BaseBranch();
if (Database::getConnection() === false) {
    die("ERROR: Could not connect. " . printf('%s', dbGetErrorMsg()));
}
$recordTemplate = BaseBranch::$Branch;
if (!isset($_POST['id']) && !isset($_POST['Create'])) {
    echo "<div class='error'> <h3>No ID was received for ACTION.PHP</h3></div>";
    die;
}
if (isset($_POST['Update'])) {
    // Update BusinessEntity - update branch's record's BusinessParentId (Division) with new value
    // Get BusinessEntity with id = $_POST['BusinessEntityId'] and update BusinessParentId with $_POST['Division']
    // Get the BusinessEntity record
    $sqlCommand = "BEGIN UPDATE BusinessEntity SET BusinessEntityParentId = {$_POST['Division']} WHERE Id = {$_POST['BusinessEntityId']} END";
    $result = sqlsrv_query(Database::getConnection(), $sqlCommand);
    if (!$result) {
Esempio n. 2
0
 public function getPeer()
 {
     if (self::$peer === null) {
         self::$peer = new BranchPeer();
     }
     return self::$peer;
 }