예제 #1
0
 $row = $offer->fetch();
 $rowCount = count($row);
 if ($rowCount > 0) {
     $sellerId = $row['seller_id'];
     $carId = $row['car_id'];
     $preferredPrice = $row['preferred_price'];
     $description = $row['description'];
     $status = $row['status'];
     $offerDate = $row['offer_date'];
     $seller = $sellerCon->getSeller($sellerId);
     if ($seller->errorInfo()[2] == null) {
         $seller = $seller->fetch();
         $sellerCount = count($seller);
         if ($sellerCount > 0) {
             $personId = $seller['person_id'];
             $person = $personCon->getPerson($personId);
             if ($person->errorInfo()[2] == null) {
                 $person = $person->fetch();
                 $personCount = count($person);
                 if ($personCount > 0) {
                     $firstName = $person['first_name'];
                     $surname = $person['surname'];
                     $sellerName = $firstName . ' ' . $surname;
                     $car = $carCon->getCar($carId);
                     if ($car->errorInfo()[2] == null) {
                         $car = $car->fetch();
                         $carCount = count($car);
                         if ($carCount > 0) {
                             $carRego = $car['rego_number'];
                             $medias = $mediaCon->getMediaForOffer($offerId);
                             if ($medias->errorInfo()[2] == null) {
예제 #2
0
    public function printSellers()
    {
        $sellers = $this->getSellers();
        $personCon = new PersonController();
        if ($sellers->errorInfo()[2] == null) {
            $rows = $sellers->fetchAll();
            $rowCount = count($rows);
            if ($rowCount > 0) {
                ?>
                <table class="table table-responsive table-hover">
                    <tr>
                        <th>Surname</th><th>First Name</th><th>Email Address</th><th>Actions</th>
                    </tr>
                    <?php 
                foreach ($rows as $row) {
                    $person = $personCon->getPerson($row['person_id']);
                    if ($person->errorInfo()[2] == null) {
                        $personRow = $person->fetch();
                        $personCount = count($personRow);
                        if ($personCount > 0) {
                            ?>
                                <tr>
                                    <td><?php 
                            echo $personRow['surname'];
                            ?>
</td><td><?php 
                            echo $personRow['first_name'];
                            ?>
</td><td><?php 
                            echo $personRow['email_address'];
                            ?>
</td>
                                    <td><a href="./view.php?id=<?php 
                            echo $row['seller_id'];
                            ?>
" class="btn btn-info"><span class="glyphicon glyphicon-briefcase"></span> View</a> <a href="./edit.php?id=<?php 
                            echo $row['seller_id'];
                            ?>
" class="btn btn-primary"><span class="glyphicon glyphicon-edit"></span> Edit</a> <a href="./delete.php?id=<?php 
                            echo $row['seller_id'];
                            ?>
" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> Delete</a></td>
                                </tr>
                            <?php 
                        }
                    } else {
                        ?>
                            <div class="alert alert-danger" role="alert">
                                <strong>Uh oh!</strong> The database returned the following error:<br/>
                                <em><?php 
                        echo $person->errorInfo()[2];
                        ?>
</em>
                            </div>
                        <?php 
                    }
                }
                ?>
                </table>
            <?php 
            } else {
                ?>
                <div class="alert alert-info" role="alert">
                    <strong>No results.</strong> There are no sellers to display<br/>
                    Use the form above to add some.
                </div>
            <?php 
            }
        } else {
            ?>
            <div class="alert alert-danger" role="alert">
                <strong>Uh oh!</strong> The database returned the following error:<br/>
                <em><?php 
            echo $sellers->errorInfo()[2];
            ?>
</em>
            </div>
        <?php 
        }
        $sellers->closeCursor();
    }
예제 #3
0
    public function printSales()
    {
        $sales = $this->getSales();
        $offerCon = new OfferController();
        $sellerCon = new SellerController();
        $custCon = new CustomerController();
        $personCon = new PersonController();
        $carCon = new CarController();
        if ($sales->errorInfo()[2] == null) {
            $rows = $sales->fetchAll();
            $rowCount = count($rows);
            if ($rowCount > 0) {
                ?>
                <table class="table table-responsive table-hover">
                    <tr>
                        <th>Sale Date</th><th>Car Rego</th><th>Seller</th><th>Buyer</th><th>Sold Price</th><th>Actions</th>
                    </tr>
                    <?php 
                foreach ($rows as $row) {
                    $offer = $offerCon->getOffer($row['offer_id']);
                    $offerRow = $offer->fetch();
                    if (count($offerRow) > 0) {
                        $buyer = $custCon->getCustomer($row['customer_id']);
                        $buyerRow = $buyer->fetch();
                        if (count($buyerRow) > 0) {
                            $person = $personCon->getPerson($buyerRow['person_id']);
                            $personRow = $person->fetch();
                            $buyerName = $personRow['first_name'] . ' ' . $personRow['surname'];
                            $seller = $sellerCon->getSeller($offerRow['seller_id']);
                            $sellerRow = $seller->fetch();
                            if (count($sellerRow) > 0) {
                                $person = $personCon->getPerson($sellerRow['person_id']);
                                $personRow = $person->fetch();
                                if (count($personRow) > 0) {
                                    $car = $carCon->getCar($offerRow['car_id']);
                                    $carRow = $car->fetch();
                                    if (count($carRow) > 0) {
                                        ?>
                                            <tr>
                                                <td><?php 
                                        echo $row['sale_date'];
                                        ?>
</td><td><?php 
                                        echo $carRow['rego_number'];
                                        ?>
</td><td><?php 
                                        echo $personRow['first_name'] . ' ' . $personRow['surname'];
                                        ?>
</td><td><?php 
                                        echo $buyerName;
                                        ?>
</td><td>$<?php 
                                        echo ucfirst($row['total_price']);
                                        ?>
</td><td><a href="./edit.php?id=<?php 
                                        echo $row['sale_id'];
                                        ?>
" class="btn btn-primary"><span class="glyphicon glyphicon-edit"></span> Edit</a> <a href="./delete.php?id=<?php 
                                        echo $row['sale_id'];
                                        ?>
" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> Delete</a></td>
                                            </tr>
                                        <?php 
                                    } else {
                                        ?>
                                            <div class="alert alert-danger" role="alert">
                                                <strong>Uh oh!</strong> The database returned the following error:<br/>
                                                <em><?php 
                                        echo $carRow->errorInfo()[2];
                                        ?>
</em>
                                            </div>
                                        <?php 
                                    }
                                } else {
                                    ?>
                                        <div class="alert alert-danger" role="alert">
                                            <strong>Uh oh!</strong> The database returned the following error:<br/>
                                            <em><?php 
                                    echo $personRow->errorInfo()[2];
                                    ?>
</em>
                                        </div>
                                    <?php 
                                }
                            } else {
                                ?>
                                    <div class="alert alert-danger" role="alert">
                                        <strong>Uh oh!</strong> The database returned the following error:<br/>
                                        <em><?php 
                                echo $sellerRow->errorInfo()[2];
                                ?>
</em>
                                    </div>
                                <?php 
                            }
                        } else {
                            ?>
                                <div class="alert alert-danger" role="alert">
                                    <strong>Uh oh!</strong> The database returned the following error:<br/>
                                    <em><?php 
                            echo $buyerRow->errorInfo()[2];
                            ?>
</em>
                                </div>
                            <?php 
                        }
                    } else {
                        ?>
                            <div class="alert alert-danger" role="alert">
                                <strong>Uh oh!</strong> The database returned the following error:<br/>
                                <em><?php 
                        echo $offerRow->errorInfo()[2];
                        ?>
</em>
                            </div>
                        <?php 
                    }
                }
                ?>
                </table>
            <?php 
            } else {
                ?>
                <div class="alert alert-info" role="alert">
                    <strong>No results.</strong> There are no sales to display<br/>
                    Use the form above to add some.
                </div>
            <?php 
            }
        } else {
            ?>
            <div class="alert alert-danger" role="alert">
                <strong>Uh oh!</strong> The database returned the following error:<br/>
                <em><?php 
            echo $sales->errorInfo()[2];
            ?>
</em>
            </div>
        <?php 
        }
        $sales->closeCursor();
    }
예제 #4
0
 $addressCon = new AddressController();
 function checkSelected($id1, $id2)
 {
     if ($id1 == $id2) {
         echo 'selected';
     }
 }
 if (isset($_GET['id'])) {
     $sellerId = $_GET['id'];
     $seller = $sellerCon->getSeller($sellerId);
     if ($seller->errorInfo()[2] == null) {
         $row = $seller->fetch();
         $rowCount = count($row);
         if ($rowCount > 0) {
             $personId = $row['person_id'];
             $person = $personCon->getPerson($personId);
             if ($person->errorInfo()[2] == null) {
                 $personRow = $person->fetch();
                 $personCount = count($personRow);
                 if ($personCount > 0) {
                     $address = $addressCon->getAddress($personId);
                     if ($address->errorInfo()[2] == null) {
                         $addressRow = $address->fetch();
                         $addressCount = count($addressRow);
                         if ($addressCount > 0) {
                             $firstName = $personRow['first_name'];
                             $surname = $personRow['surname'];
                             $phoneNumber = $personRow['phone_number'];
                             $mobileNumber = $personRow['mobile_number'];
                             $emailAddress = $personRow['email_address'];
                             $mailingList = $personRow['mailing_list'];
예제 #5
0
 $featureCon = new FeatureController();
 $foCon = new Feature_OfferController();
 $mediaCon = new MediaController();
 $carCon = new CarController();
 $makeCon = new MakeController();
 $modelCon = new ModelController();
 $saleCon = new SaleController();
 $empCon = new EmployeeController();
 $offer = $offerCon->getOffer($_POST['txtOfferId']);
 if ($offer->errorInfo()[2] == null) {
     $row = $offer->fetch();
     $rowCount = count($row);
     if ($rowCount > 0) {
         $seller = $sellerCon->getSeller($row['seller_id']);
         $seller = $seller->fetch();
         $person = $personCon->getPerson($seller['person_id']);
         $person = $person->fetch();
         $car = $carCon->getCar($row['car_id']);
         $car = $car->fetch();
         $model = $modelCon->getModel($car['model_id']);
         $model = $model->fetch();
         $modelName = $model['model_name'];
         $make = $makeCon->getMake($model['make_id']);
         $make = $make->fetch();
         $makeName = $make['make_name'];
         $fo = $foCon->getFeaturesForOffer($_POST['txtOfferId']);
         $features = array();
         $featureIds = array();
         foreach ($fo as $f) {
             $featureIds[] = $f['feature_id'];
         }