Example #1
0
    public function createLoginByIp($ip, $customerId = null, $status = 0)
    {
        $database = new Database();
        return $database->executeSql('
			INSERT INTO Login (LoginIp, LoginTime, Customer_Id, status)
			VALUES (?,NOW(),?,?)', [$ip, $customerId, $status]);
    }
Example #2
0
    public function getTotalAmountByOrderId($order_Id)
    {
        $total = 0;
        $database = new Database();
        $allOrderMeals = $database->query('SELECT  Meal_id, Quantite, UnitPrice FROM `OrderLine`
WHERE Order_Id = ?', [$order_Id]);
        foreach ($allOrderMeals as $oneMeal) {
            $total += $oneMeal['Quantite'] * $oneMeal['UnitPrice'];
        }
        $database->executeSql('UPDATE `Order` SET TotalAmount = ?, TaxeAmount = (?*`Order`.TaxeRate/100), CompliteTimestamp = NOW() WHERE Id
 = ?', [$total, $total, $order_Id]);
    }
    public function registerCustomer($FirstName, $LastName, $Birthdate, $Phone, $Address, $Address2, $City, $ZipCode, $Email, $password)
    {
        //HASH PHP5.5
        //$passwordHash = password_hash($password, PASSWORD_DEFAULT);
        //HASH MANO <PHP5.5
        $passwordHash = $this->hasPassword($password);
        $Database = new Database();
        return $Database->executeSql('
		INSERT INTO Customer 
			(FirstName,
			LastName,
			Birthdate,
			Phone,
			Address,
			Address2,
			City,
			ZipCode,
			Email,
			password,
			CreationTimestamp,
			LastLoginTimestamp) 
		VALUES 
			(?,?,?,?,?,?,?,?,?,?,NOW(),NOW())', [$FirstName, $LastName, $Birthdate, $Phone, $Address, $Address2, $City, $ZipCode, $Email, $passwordHash]);
    }
Example #4
0
 public static function getPostBySql($sql)
 {
     $database = new Database();
     return $database->executeSql($sql);
 }
Example #5
0
    public function addMeal($name, $description, $photo, $quantityInStock, $buyPrice, $salePrice)
    {
        $query = new Database();
        return $query->executeSql('INSER INTO Meal
			(Name, Description, Photo, QuantityInStock, BuyPrice, SalePrice) VALUES (?,?,?,?,?)', [$name, $description, $photo, $quantityInStock, $buyPrice, $salePrice]);
    }
Example #6
0
 public static function logIn($email, $password)
 {
     $db = new Database();
     $sql = sprintf("SELECT * FROM users where email = '%s' AND password = '******'", $email, $password);
     return $db->executeSql($sql);
 }
Example #7
0
 public static function getBySql($sql)
 {
     $db = new Database();
     return $db->executeSql($sql);
 }
Example #8
0
 public function deletBooking($bookingId)
 {
     $database = new Database();
     $database->executeSql('DELETE FROM Booking WHERE Id = ?', [$bookingId]);
 }
 public function register($Customer_Id, $BookingDate, $BookingTime, $NumberOfSeats)
 {
     $query = new Database();
     return $query->executeSql('INSERT INTO Booking (Customer_Id, BookingDate, BookingTime, CreationTimestamp, NumberOfSeats) VALUES (?,?,?,?,?) ', [$Customer_Id, $BookingDate, $BookingTime, date("Y-m-d G:i:s"), $NumberOfSeats]);
 }
Example #10
0
 private function updateLastLoginTimestamp($Id)
 {
     $Database = new Database();
     $Database->executeSql('UPDATE Customer SET LastLoginTimestamp = NOW() WHERE Id = ?', [$Id]);
 }