From da43c0a16a682d738503a863d5a45304d52a1cd9 Mon Sep 17 00:00:00 2001 From: OscarRui <79144467+OscarRui@users.noreply.github.com> Date: Sun, 11 Apr 2021 19:08:22 +0200 Subject: [PATCH] Add files via upload --- panel_manager/includes/room_dao.php | 25 ++++++++++++++++++++++++- panel_manager/includes/session_dao.php | 25 ++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/panel_manager/includes/room_dao.php b/panel_manager/includes/room_dao.php index 7661e82..0990b94 100644 --- a/panel_manager/includes/room_dao.php +++ b/panel_manager/includes/room_dao.php @@ -15,7 +15,7 @@ public function createRoom($id, $idcinema, $numCol, $numRows){ $sql = sprintf( "INSERT INTO rooms( id, idcinema, numCol, numRows) - VALUES ( '%s', '%s', '%i', '%i')", + VALUES ( '%d', '%d', '%i', '%i')", $id, $idcinema, $numCol, $numRows ); return $sql; @@ -34,6 +34,29 @@ return new RoomDTO($id, $idcinema, $numCol, $numRows); } + //Edit Hall. + public function editHall($id, $idcinema, $numCol, $numRows){ + + $sql = sprintf( "UPDATE `hall` + SET `numrows` = '%i' , `numcolumns` = '%i' + WHERE `hall`.`number` = '%d' AND `hall`.`idcinema` = '%d';", + $numRows,$numCol,$id, $idcinema ); + + $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); + + return $resul; + } + + //Delete Hall. + public function deleteHall($id, $idcinema){ + + $sql = sprintf( "DELETE FROM `hall` WHERE `hall`.`number` = '%d' AND `hall`.`idcinema` = '%d';",$id,$idcinema); + + $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); + + return $resul; + } + } ?> \ No newline at end of file diff --git a/panel_manager/includes/session_dao.php b/panel_manager/includes/session_dao.php index a30a04e..cb8bb7c 100644 --- a/panel_manager/includes/session_dao.php +++ b/panel_manager/includes/session_dao.php @@ -30,6 +30,30 @@ return $resul; } + + //Edit Session. + public function editSession($id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format){ + + $sql = sprintf( "UPDATE `session` + SET `idfilm` = '%d' , `idhall` = '%d', `idcinema` = '%d', `date` = '%s', + `start_time` = '%s', `seat_price` = '%d', `format` = '%s' + WHERE `session`.`id` = '%d';", + $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $id); + + $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); + + return $resul; + } + + //Delete Session. + public function deleteSession($id){ + + $sql = sprintf( "DELETE FROM `session` WHERE `session`.`id` = '%d'",$id); + + $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); + + return $resul; + } //Returns a query to check if the session in this cinema, hall and scheudle exists. public function selectSession($cinema, $hall, $start, $date){ @@ -48,7 +72,6 @@ - //Create a new Session Data Transfer Object. public function loadSession( $id, $idfilm, $idhall, $date, $startTime, $seatPrice, $format){ return new SessionDTO( $id, $idfilm, $idhall, $date, $startTime, $seatPrice, $format);