├── .idea
├── .gitignore
├── vcs.xml
├── modules.xml
├── libraries
│ ├── TourismAgency.xml
│ └── TourismAgency1.xml
├── misc.xml
└── uiDesigner.xml
├── tourism.sql
├── postgresql-42.7.0.jar
├── .gitignore
├── TourismAgency.iml
├── src
├── App.java
├── core
│ ├── ComboItem.java
│ ├── Db.java
│ └── Helper.java
├── entity
│ ├── Pension.java
│ ├── Season.java
│ ├── User.java
│ ├── Hotel.java
│ ├── Reservation.java
│ └── Room.java
├── view
│ ├── PensionView.java
│ ├── SeasonView.java
│ ├── LoginView.java
│ ├── Layout.java
│ ├── PensionView.form
│ ├── UserView.java
│ ├── SeasonView.form
│ ├── HotelAddView.java
│ ├── UserView.form
│ ├── LoginView.form
│ ├── AdminView.form
│ ├── AdminView.java
│ ├── RoomAddView.java
│ ├── ReservationAddView.java
│ ├── HotelAddView.form
│ ├── RoomAddView.form
│ ├── EmployeeView.form
│ └── ReservationAddView.form
├── business
│ ├── SeasonManager.java
│ ├── PensionManager.java
│ ├── HotelManager.java
│ ├── UserManager.java
│ ├── ReservationManager.java
│ └── RoomManager.java
└── dao
│ ├── PensionDao.java
│ ├── SeasonDao.java
│ ├── HotelDao.java
│ ├── UserDao.java
│ ├── ReservationDao.java
│ └── RoomDao.java
└── README.md
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/tourism.sql:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Yldrmceyy/TourismManagmentSystem/HEAD/tourism.sql
--------------------------------------------------------------------------------
/postgresql-42.7.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Yldrmceyy/TourismManagmentSystem/HEAD/postgresql-42.7.0.jar
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/libraries/TourismAgency.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/libraries/TourismAgency1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ### IntelliJ IDEA ###
2 | out/
3 | !**/src/main/**/out/
4 | !**/src/test/**/out/
5 |
6 | ### Eclipse ###
7 | .apt_generated
8 | .classpath
9 | .factorypath
10 | .project
11 | .settings
12 | .springBeans
13 | .sts4-cache
14 | bin/
15 | !**/src/main/**/bin/
16 | !**/src/test/**/bin/
17 |
18 | ### NetBeans ###
19 | /nbproject/private/
20 | /nbbuild/
21 | /dist/
22 | /nbdist/
23 | /.nb-gradle/
24 |
25 | ### VS Code ###
26 | .vscode/
27 |
28 | ### Mac OS ###
29 | .DS_Store
--------------------------------------------------------------------------------
/TourismAgency.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/App.java:
--------------------------------------------------------------------------------
1 | import business.UserManager;
2 | import core.Db;
3 | import core.Helper;
4 | import entity.User;
5 | import view.AdminView;
6 | import view.EmployeeView;
7 | import view.LoginView;
8 | import view.UserView;
9 |
10 | import java.sql.Connection;
11 | import java.sql.DriverManager;
12 |
13 | public class App {
14 | public static void main(String[] args) {
15 | // Uygulama temasını ayarlamak için Helper.setTheme() fonksiyonu kullanılır.
16 | Helper.setTheme();
17 |
18 | // LoginView sınıfından bir örnek oluşturulur.
19 | LoginView loginView = new LoginView();
20 |
21 | // Kullıcı girişi için kullanlır
22 | //EmployeeView employeeView = new EmployeeView(new User());
23 |
24 |
25 |
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/core/ComboItem.java:
--------------------------------------------------------------------------------
1 | package core;
2 |
3 | // Constructor: Öğenin anahtar ve değerini alarak bir ComboItem oluşturur
4 | public class ComboItem {
5 | private int key ;
6 | private String value;
7 |
8 | public ComboItem(int key, String value) {
9 | // Öğenin anahtar değeri
10 | this.key = key;
11 |
12 | // Öğenin görünen değeri
13 | this.value = value;
14 | }
15 |
16 | public int getKey() {
17 | return key;
18 | }
19 |
20 | public void setKey(int key) {
21 | this.key = key;
22 | }
23 |
24 | public String getValue() {
25 | return value;
26 | }
27 |
28 | public void setValue(String value) {
29 | this.value = value;
30 | }
31 |
32 | @Override
33 | public String toString() {
34 | return this.value;
35 | }
36 | }
--------------------------------------------------------------------------------
/src/entity/Pension.java:
--------------------------------------------------------------------------------
1 | package entity;
2 |
3 | import core.ComboItem;
4 |
5 | //Pansiyon tanımlamaları
6 | public class Pension {
7 | private int pencion_id;
8 | private int hotel_id;
9 | private String pencion_type;
10 |
11 | // Pansiyon parametresiz metodu
12 | public Pension() {
13 |
14 | }
15 |
16 | //getter setterlar
17 | public int getPencionId() {
18 | return pencion_id;
19 | }
20 |
21 | public void setPencionId(int pencion_id) {
22 | this.pencion_id = pencion_id;
23 | }
24 |
25 | public int getHotelId() {
26 | return hotel_id;
27 | }
28 |
29 | public void setHotelId(int hotel_id) {
30 | this.hotel_id = hotel_id;
31 | }
32 |
33 | public String getPencionType() {
34 | return pencion_type;
35 | }
36 |
37 | public void setPencionType(String pencion_type) {
38 | this.pencion_type = pencion_type;
39 | }
40 |
41 | //toString metodu
42 | @Override
43 | public String toString() {
44 | return "Pencion{" +
45 | "pencion_id=" + pencion_id +
46 | ", hotel_id=" + hotel_id +
47 | ", pencion_type='" + pencion_type + '\'' +
48 | '}';
49 | }
50 |
51 | public ComboItem getComboItem() {
52 | return new ComboItem(this.getPencionId(), this.getPencionType());
53 | }
54 | }
--------------------------------------------------------------------------------
/src/core/Db.java:
--------------------------------------------------------------------------------
1 | package core;
2 |
3 | import java.sql.Connection;
4 | import java.sql.DriverManager;
5 | import java.sql.SQLException;
6 |
7 | public class Db {
8 | // Singleton tasarım deseni kullanılarak oluşturulmuş olan instance
9 | private static Db instance = null;
10 | // Veritabanı bağlantısı için kullanılan Connection nesnesi
11 | private Connection connection = null;
12 | // Veritabanı URL'si
13 | private final String DB_URL = "jdbc:postgresql://localhost:5432/tourism";
14 | // Veritabanı kullanıcı adı
15 | private final String DB_USERNAME = "postgres";
16 | // Veritabanı şifresi
17 | private final String DB_PASS = "postgres";
18 |
19 | //Database connection
20 | private Db() {
21 | try {
22 | this.connection = DriverManager.getConnection(DB_URL, DB_USERNAME, DB_PASS);
23 | } catch (SQLException e) {
24 | System.out.println(e.getMessage());
25 | }
26 | }
27 | // Veritabanı bağlantısını döndüren metod
28 | public Connection getConnection() {
29 | return this.connection;
30 | }
31 |
32 | // Singleton tasarım deseni gereği oluşturulmuş olan veya mevcut instance'ı döndüren metod
33 | public static Connection getInstance() {
34 | try {
35 | // Eğer instance null ise veya bağlantı kapalı ise yeni bir instance oluşturulur
36 | if (instance == null || instance.getConnection().isClosed()) {
37 | instance = new Db();
38 | }
39 |
40 | } catch (SQLException e) {
41 | // Bağlantı durumu kontrolünde hata olması durumunda hata mesajı yazdırılır
42 | System.out.println(e.getMessage());
43 | }
44 | return instance.getConnection();
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/view/PensionView.java:
--------------------------------------------------------------------------------
1 | package view;
2 |
3 | import business.HotelManager;
4 | import business.PensionManager;
5 | import entity.Hotel;
6 |
7 | import javax.swing.*;
8 |
9 | // PencionView sınıfı, pansiyon eklemek için kullanılan arayüzü temsil eder ve Layout sınıfından türetilmiştir.
10 | public class PensionView extends Layout {
11 |
12 | // Arayüzdeki bileşenlerin tanımlandığı değişkenler.
13 | private JPanel container;
14 | private JComboBox cmb_pencion;
15 | private JButton btn_pencion_save;
16 | private JLabel lbl_hotel_id;
17 | private Hotel hotel;
18 | private HotelManager hotelManager;
19 | private PensionManager pencionManager;
20 |
21 | // PencionView sınıfının constructor'ı. Arayüz bileşenleri, otel yöneticisi ve pansiyon yöneticisi başlatılır.
22 | public PensionView(Hotel hotel) {
23 | this.pencionManager = new PensionManager(hotel);
24 | this.hotelManager = new HotelManager();
25 | this.hotel = hotel;
26 | this.add(container);
27 | this.guiInitilaze(400, 350);
28 | this.lbl_hotel_id.setText(String.valueOf(this.hotel.getId()));
29 | lbl_hotel_id.setText("OTEL ID : " + hotel.getId());
30 |
31 |
32 | // "btn_pencion_save" butonuna ActionListener ekleniyor.
33 | btn_pencion_save.addActionListener(e -> {
34 |
35 | // Seçilen pansiyon tipi alınıp ekrana yazdırılıyor.
36 | this.cmb_pencion.getSelectedItem().toString();
37 | System.out.println(this.cmb_pencion.getSelectedItem().toString());
38 |
39 | // Pansiyon yöneticisi aracılığıyla pansiyon kaydediliyor ve pencere kapatılıyor.
40 | pencionManager.savePencion(hotel, String.valueOf(cmb_pencion.getSelectedItem()));
41 | dispose();
42 | });
43 | }
44 | }
--------------------------------------------------------------------------------
/src/entity/Season.java:
--------------------------------------------------------------------------------
1 | package entity;
2 |
3 | import core.ComboItem;
4 |
5 | import java.time.LocalDate;
6 |
7 | public class Season {
8 | private int season_id;
9 | private int hotel_id;
10 | private LocalDate season_strt_date;
11 | private LocalDate season_fnsh_date;
12 |
13 |
14 | public Season() {
15 | }
16 |
17 | public int getSeason_id() {
18 | return season_id;
19 | }
20 |
21 | public void setSeason_id(int season_id) {
22 | this.season_id = season_id;
23 | }
24 |
25 | public int getHotel_id() {
26 | return hotel_id;
27 | }
28 |
29 | public void setHotel_id(int hotel_id) {
30 | this.hotel_id = hotel_id;
31 | }
32 |
33 | public LocalDate getSeason_strt_date() {
34 | return season_strt_date;
35 | }
36 |
37 | public void setSeason_strt_date(LocalDate season_strt_date) {
38 | this.season_strt_date = season_strt_date;
39 | }
40 |
41 | public LocalDate getSeason_fnsh_date() {
42 | return season_fnsh_date;
43 | }
44 |
45 | public void setSeason_fnsh_date(LocalDate season_fnsh_date) {
46 | this.season_fnsh_date = season_fnsh_date;
47 | }
48 |
49 | //Sezon nesnesinin toString metodu
50 | @Override
51 | public String toString() {
52 | return "Season{" +
53 | "season_id=" + season_id +
54 | ", hotel_id=" + hotel_id +
55 | ", season_strt_date='" + season_strt_date + '\'' +
56 | ", season_fnsh_date='" + season_fnsh_date + '\'' +
57 | '}';
58 | }
59 |
60 | //ComboItem döndüren metot
61 | public ComboItem getComboItem() {
62 | return new ComboItem(this.getSeason_id(), this.getSeason_strt_date() + " - " + this.getSeason_fnsh_date());
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/business/SeasonManager.java:
--------------------------------------------------------------------------------
1 | package business;
2 |
3 | import dao.SeasonDao;
4 | import core.Helper;
5 | import entity.Hotel;
6 | import entity.Season;
7 |
8 | import java.time.LocalDate;
9 | import java.util.ArrayList;
10 |
11 | public class SeasonManager {
12 | private final SeasonDao seasonDao;
13 | private Hotel hotel;
14 |
15 | // Constructor: Otel ve SeasonDao nesnelerini başlatır
16 | public SeasonManager(Hotel hotel) {
17 | this.hotel = hotel;
18 | this.seasonDao = new SeasonDao();
19 | }
20 |
21 | // Belirli bir otel için sezon kaydını yapar
22 | public boolean saveSeason(Hotel hotel, LocalDate strDate, LocalDate endDate) {
23 | if (hotel.getId() != 0) {
24 | Helper.showMsg("done");
25 | }
26 | return this.seasonDao.saveSeason(hotel, strDate, endDate);
27 | }
28 |
29 | // Tablo için uygun veri yapısını oluşturan metod
30 | public ArrayList