wiki:ImportantUseCase4

Правење на резервација

Актери

  • Најавен Корисник

Чекор 1

Корисникот се наоѓа на почетната страна на апликацијата.

Чекор 2

Корисникот клика на копчето Програма од навигацијата каде му се прикажуваат сите филмови моментално достапни во сите кина.

select f.name ,f.genre,f.age_category ,f.description  from films
where now() between start_date and end_date 

Чекор 3

Корисникот може да ги филтрира филмовите според киното во кое се прикажуваат моментално.

Чекор 4


Со кликање на копчето резервирај, корисникот е пренасочен кон друга страна каде може да избере конкретна проекција

Чекор 5

Се прикажуваат повеќе опаѓачки листи кои се филтрираат во зависност од предходните избрани податоци. Корисникот започнува со избирање на еден од понудените датуми. За избраниот датум на кој ја има проекцијата може да избере сала, за таа сала се нудат времињата во кои го има филмот тој ден. Корисникот има избор за тип на седиште и број на седиште и на крај може да внесе код за попуст.

Добивање на салите според одредено кино и филм.

select pr.projection_room_number from projection_rooms pr 
join cinemas c on c.id_cinema=pr.id_cinema and c.id_cinema=1
join projection_is_played_in_room pipir on pipir.id_room=pr.id_room 
join projections p on p.id_projection = pipir .id_projection
join films f on f.id_film =p.id_film and f.id_film = 1

Добивање на времето според киното, филмот и собата

select date_time_start from projections p 
join films f on f.id_film=p.id_film and f.id_film =1
join cinema_plays_film cpf on cpf.id_film=f.id_film and cpf.id_cinema=1
join projection_is_played_in_room pipir on p.id_projection=pipir .id_projection  and pipir.id_room=1

Претставување на типовите на седиште.

select name from categories

Претставување на седиштата каде има избор и се од селектираниот тип.

select seat_number from seats s  
join projection_rooms pr on pr.id_room =s.id_room  and pr.id_room = 1
join cinemas c on c.id_cinema=pr.id_cinema and c.id_cinema=1
join projection_is_played_in_room pipir on pipir.id_room=pr.id_room 
join projections p on p.id_projection = pipir .id_projection
join films f on f.id_film =p.id_film and f.id_film = 1
where s.id_category = 3

Чекор 6

Се прави проверка на валидноста на внесениот код за попуст.

select percent from discounts d 
where validity<=now() and code='DFL2'

Чекор 7

Корисникот за да си ја поврди резервацијата кликнува на копчето резервирај. Се извршува проверка за дали е слободно избраното седиште.

select 
case 
        when t.id_customer=null then true
        else false
end
from tickets t 
where t.id_ticket=1

Чекор 8

Се пресметува цената на блиетот.

select 
case 
        when p.type_of_technology = '3D' and to_char( p.date_time_start  , 'dy' )  ilike 'sat' 
        and to_char( p.date_time_start  , 'dy' )  ilike 'fri'
        and to_char( p.date_time_start  , 'dy' )  ilike 'sun' 
        then 360
        when p.type_of_technology = '3D' and to_char( p.date_time_start  , 'dy' )  ilike 'mon' 
        and to_char( p.date_time_start  , 'dy' )  ilike 'tue'
        and to_char( p.date_time_start  , 'dy' )  ilike 'wen'
        and to_char( p.date_time_start  , 'dy' )  ilike 'thu' 
        then 330
        when p.type_of_technology = '3D' and p.date_time_start=f.start_date then 370
        when p.type_of_technology = '2D' and to_char( p.date_time_start  , 'dy' )  ilike 'sat' 
        and to_char( p.date_time_start  , 'dy' )  ilike 'fri'
        and to_char( p.date_time_start  , 'dy' )  ilike 'sun' 
        then 290
        when p.type_of_technology = '2D' and to_char( p.date_time_start  , 'dy' )  ilike 'mon' 
        and to_char( p.date_time_start  , 'dy' )  ilike 'tue'
        and to_char( p.date_time_start  , 'dy' )  ilike 'wen'
        and to_char( p.date_time_start  , 'dy' )  ilike 'thu' 
        then 270
        when p.type_of_technology = '2D' and p.date_time_start=f.start_date then 300
        else 250
end
 +
case 
        when f.duration between 120 and 140 then 30
        when f.duration<120 then 0
        when f.duration between 140 and  180 then 60
        when f.duration>180 then 80
end
from tickets t 
left join projections p on p.id_projection=t.id_projection 
left join films f on f.id_film = p.id_film 
left join discounts d on d.id_discount = t.id_discount 
where t.id_ticket = 1

Чекор 9

Ако е резервацијата валидна, таа се внесува во базата.

insert into tickets(price,date_reserved,ID_customer,ID_projection,ID_seat) values
(350,now(),4,3,2);

Last modified 18 months ago Last modified on 12/25/22 21:51:22

Attachments (4)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.