├── .gitattributes
├── .gitignore
├── README.md
├── Tổng quan về đồ án.doc
├── Tổng quan về đồ án.docx
├── build.xml
├── manifest.mf
├── nbproject
├── build-impl.xml
├── genfiles.properties
├── project.properties
└── project.xml
├── quanlysieuthidienthoai.sql
├── screenshots
├── login.png
├── main.png
├── phanquyen.png
├── products.png
├── sell.png
└── thongke.png
├── src
├── giaodienchuan
│ ├── Main.java
│ ├── images
│ │ ├── Product Images
│ │ │ ├── blackberry-evolve6xvk3-640.jpg
│ │ │ ├── huawei-mate-20-black-400x460.jpg
│ │ │ ├── huawei-p30-pro-1-400x460.jpg
│ │ │ ├── huawei-y9-2019-blue-400x460.jpg
│ │ │ ├── iphone-8-plus-256gb-gold-400x460.jpg
│ │ │ ├── iphone-xr-128gb-red-400x400.jpg
│ │ │ ├── iphone-xr-256gb-white-400x400.jpg
│ │ │ ├── iphone-xr-black-400x400.jpg
│ │ │ ├── iphone-xs-max-512gb-gold-400x460.jpg
│ │ │ ├── nokia-61-plus-2-400x400.jpg
│ │ │ ├── nokia-61-plus-3-400x460.jpg
│ │ │ ├── nokia-81-silver-18thangbh-400x460.jpg
│ │ │ ├── nokia-81-silver-400x460.jpg
│ │ │ ├── oppo-a7-32gb-gold-400x400.jpg
│ │ │ ├── oppo-a7-400x460.jpg
│ │ │ ├── oppo-f11-mtp-400x400.jpg
│ │ │ ├── oppo-f7-red-mtp-400x460.jpg
│ │ │ ├── oppo-find-x-1-400x460-400x460.jpg
│ │ │ ├── oppo-r17-pro-2-400x460.jpg
│ │ │ ├── philips-s327-400-400x460.jpg
│ │ │ ├── samsung-galaxy-a30-blue-400x400.jpg
│ │ │ ├── samsung-galaxy-a50-128gb-blue-docquyen-400x400.jpg
│ │ │ ├── samsung-galaxy-a9-2018-blue-400x400.jpg
│ │ │ ├── samsung-galaxy-note-9-512gb-blue-400x460.jpg
│ │ │ ├── samsung-galaxy-s10-plus-512gb-ceramic-black-400x460.jpg
│ │ │ ├── vivo-v11-400x460.jpg
│ │ │ ├── vivo-v15-quanghai-400x460.jpg
│ │ │ ├── vivo-y85-red-docquyen-400x460.jpg
│ │ │ ├── xiaomi-mi-8-1-400x460-400x460.jpg
│ │ │ └── xiaomi-redmi-note-6-pro-black-1-400x460.jpg
│ │ ├── icons8_add_30px.png
│ │ ├── icons8_agreement_30px.png
│ │ ├── icons8_angle_down_30px.png
│ │ ├── icons8_assistant_100px.png
│ │ ├── icons8_assistant_30px.png
│ │ ├── icons8_bar_chart_30px.png
│ │ ├── icons8_calendar_30px.png
│ │ ├── icons8_calendar_31_30px.png
│ │ ├── icons8_cancel_30px_1.png
│ │ ├── icons8_circled_user_male_30px.png
│ │ ├── icons8_circled_user_male_skin_type_1_2_40px.png
│ │ ├── icons8_client_company_30px.png
│ │ ├── icons8_commercial_development_management_64px.png
│ │ ├── icons8_company_100px.png
│ │ ├── icons8_company_30px.png
│ │ ├── icons8_computer_support_99px.png
│ │ ├── icons8_data_backup_30px.png
│ │ ├── icons8_database_restore_30px.png
│ │ ├── icons8_delete_30px_1.png
│ │ ├── icons8_delete_forever_30px_1.png
│ │ ├── icons8_dossier_folder_30px.png
│ │ ├── icons8_downloads_30px.png
│ │ ├── icons8_exit_30px.png
│ │ ├── icons8_flow_chart_30px_1.png
│ │ ├── icons8_futures_30px.png
│ │ ├── icons8_gift_30px.png
│ │ ├── icons8_google_mobile_100px.png
│ │ ├── icons8_key_30px.png
│ │ ├── icons8_login_rounded_down_64px.png
│ │ ├── icons8_maintenance_30px.png
│ │ ├── icons8_more_20px.png
│ │ ├── icons8_ms_excel_30px.png
│ │ ├── icons8_multiple_smartphones_30px.png
│ │ ├── icons8_ok_30px.png
│ │ ├── icons8_opened_folder_20px.png
│ │ ├── icons8_opened_folder_30px.png
│ │ ├── icons8_password_40px.png
│ │ ├── icons8_person_male_100px.png
│ │ ├── icons8_pie_chart_30px.png
│ │ ├── icons8_police_badge_30px.png
│ │ ├── icons8_refresh_30px.png
│ │ ├── icons8_replay_30px.png
│ │ ├── icons8_settings_30px.png
│ │ ├── icons8_settings_30px_1.png
│ │ ├── icons8_show_property_30px.png
│ │ ├── icons8_shutdown_30px_1.png
│ │ ├── icons8_small_business_30px_3.png
│ │ ├── icons8_student_female_30px.png
│ │ ├── icons8_support_30px.png
│ │ ├── icons8_system_information_99px.png
│ │ ├── icons8_thumb_up_99px.png
│ │ ├── icons8_truck_30px.png
│ │ ├── icons8_us_dollar_30px.png
│ │ ├── icons8_user_30px.png
│ │ ├── icons8_windows_phone_store_30px.png
│ │ └── icons8_wrench_30px.png
│ └── model
│ │ ├── BackEnd
│ │ ├── ConnectionDB
│ │ │ └── ConnectionDB.java
│ │ ├── PriceFormatter.java
│ │ ├── QuanLyChiTietHoaDon
│ │ │ ├── ChiTietHoaDon.java
│ │ │ ├── QuanLyChiTietHoaDonBUS.java
│ │ │ └── QuanLyChiTietHoaDonDAO.java
│ │ ├── QuanLyChiTietPN
│ │ │ ├── ChiTietPhieuNhap.java
│ │ │ ├── QuanLyChiTietPhieuNhapBUS.java
│ │ │ └── QuanLyChiTietPhieuNhapDAO.java
│ │ ├── QuanLyHoaDon
│ │ │ ├── HoaDon.java
│ │ │ ├── QuanLyHoaDonBUS.java
│ │ │ └── QuanLyHoaDonDAO.java
│ │ ├── QuanLyKhachHang
│ │ │ ├── KhachHang.java
│ │ │ ├── QuanLyKhachHangBUS.java
│ │ │ └── QuanLyKhachHangDAO.java
│ │ ├── QuanLyKhuyenMai
│ │ │ ├── KhuyenMai.java
│ │ │ ├── QuanLyKhuyenMaiBUS.java
│ │ │ └── QuanLyKhuyenMaiDAO.java
│ │ ├── QuanLyLoaiSanPham
│ │ │ ├── LoaiSanPham.java
│ │ │ ├── QuanLyLoaiSanPhamBUS.java
│ │ │ └── QuanLyLoaiSanPhamDAO.java
│ │ ├── QuanLyNCC
│ │ │ ├── NhaCungCap.java
│ │ │ ├── QuanLyNhaCungCapBUS.java
│ │ │ └── QuanLyNhaCungCapDAO.java
│ │ ├── QuanLyNhanVien
│ │ │ ├── NhanVien.java
│ │ │ ├── QuanLyNhanVienBUS.java
│ │ │ └── QuanLyNhanVienDAO.java
│ │ ├── QuanLyPhieuNhap
│ │ │ ├── PhieuNhap.java
│ │ │ ├── QuanLyPhieuNhapBUS.java
│ │ │ └── QuanLyPhieuNhapDAO.java
│ │ ├── QuanLyQuyen
│ │ │ ├── QuanLyQuyenBUS.java
│ │ │ ├── QuanLyQuyenDAO.java
│ │ │ └── Quyen.java
│ │ ├── QuanLySanPham
│ │ │ ├── QuanLySanPhamBUS.java
│ │ │ ├── QuanLySanPhamDAO.java
│ │ │ └── SanPham.java
│ │ ├── QuanLyTaiKhoan
│ │ │ ├── QuanLyTaiKhoanBUS.java
│ │ │ ├── QuanLyTaiKhoanDAO.java
│ │ │ └── TaiKhoan.java
│ │ ├── ReadWriteFile
│ │ │ └── WorkWithFile.java
│ │ ├── WorkWithExcel
│ │ │ ├── DocExcel.java
│ │ │ ├── MyJOptionPane.java
│ │ │ └── XuatExcel.java
│ │ └── WritePDF
│ │ │ └── WritePDF.java
│ │ └── FrontEnd
│ │ ├── FormChon
│ │ ├── ChonKhachHangForm.java
│ │ ├── ChonKhuyenMaiForm.java
│ │ ├── ChonLoaiSanPhamForm.java
│ │ ├── ChonNhaCungCapForm.java
│ │ ├── ChonNhanVienForm.java
│ │ ├── ChonQuyenForm.java
│ │ └── ChonSanPhamForm.java
│ │ ├── FormHienThi
│ │ ├── FormHienThi.java
│ │ ├── HienThiChiTietHoaDon.java
│ │ ├── HienThiChiTietPN.java
│ │ ├── HienThiHoaDon.java
│ │ ├── HienThiKhachHang.java
│ │ ├── HienThiKhuyenMai.java
│ │ ├── HienThiLoaiSanPham.java
│ │ ├── HienThiNhaCungCap.java
│ │ ├── HienThiNhanVien.java
│ │ ├── HienThiPhieuNhap.java
│ │ ├── HienThiQuyen.java
│ │ ├── HienThiSanPham.java
│ │ └── HienThiTaiKhoan.java
│ │ ├── FormQuanLy
│ │ ├── BanHangForm.java
│ │ ├── BeginForm.java
│ │ ├── EmptyPage.java
│ │ ├── FormHang.java
│ │ ├── NhapHangForm.java
│ │ ├── QuanLyChiTietHoaDonForm.java
│ │ ├── QuanLyChiTietPhieuNhapForm.java
│ │ ├── QuanLyHoaDonForm.java
│ │ ├── QuanLyKhachHangForm.java
│ │ ├── QuanLyKhuyenMaiForm.java
│ │ ├── QuanLyLoaiSanPhamForm.java
│ │ ├── QuanLyNhaCungCapForm.java
│ │ ├── QuanLyNhanVienForm.java
│ │ ├── QuanLyPhieuNhapForm.java
│ │ ├── QuanLyQuyenForm.java
│ │ ├── QuanLySanPhamForm.java
│ │ ├── QuanLyTaiKhoanForm.java
│ │ └── ThongKe
│ │ │ ├── ThongKeForm.java
│ │ │ ├── ThongKeForm_NewVersion.java
│ │ │ └── ThongKeHuuForm.java
│ │ ├── FormThemSua
│ │ ├── ThemSuaChiTietHoaDonForm.java
│ │ ├── ThemSuaChiTietPhieuNhapForm.java
│ │ ├── ThemSuaHoaDonForm.java
│ │ ├── ThemSuaKhachHangForm.java
│ │ ├── ThemSuaKhuyenMaiForm.java
│ │ ├── ThemSuaLoaiSanPhamForm.java
│ │ ├── ThemSuaNhaCungCapForm.java
│ │ ├── ThemSuaNhanVienForm.java
│ │ ├── ThemSuaPhieuNhapForm.java
│ │ ├── ThemSuaQuyenForm.java
│ │ ├── ThemSuaSanPhamForm.java
│ │ └── ThemSuaTaiKhoanForm.java
│ │ ├── GiaoDienChuan
│ │ ├── DoiMatKhauForm.java
│ │ ├── GiaoDienChuan.java
│ │ ├── LoginForm.form
│ │ ├── LoginForm.java
│ │ └── MyTable.java
│ │ ├── MyButton
│ │ ├── DateButton.java
│ │ ├── ExportExcelButton.java
│ │ ├── FileButton.java
│ │ ├── ImportExcelButton.java
│ │ ├── MoreButton.java
│ │ ├── RefreshButton.java
│ │ ├── SuaButton.java
│ │ ├── ThemButton.java
│ │ └── XoaButton.java
│ │ └── NavBar
│ │ ├── NavBarButton.java
│ │ ├── NavBarContainer.java
│ │ ├── NavBarItem.java
│ │ ├── NavBarSeperator.java
│ │ └── NavBarTitle.java
└── lib
│ ├── LGoodDatePicker-10.4.1.jar
│ ├── POI
│ ├── commons-codec-1.12.jar
│ ├── commons-collections4-4.3.jar
│ └── poi-4.1.0.jar
│ ├── itextpdf-5.5.12.jar
│ └── mysql-connector-java-5.1.23-bin.jar
├── temp
└── test
├── ButtonTabComponent.java
├── CountDownDialog.java
├── EditComboBox.java
├── JOptionPaneExample.java
├── KControls.jar
├── QLChucVu
├── ChonChucVuForm.java
├── ChucVu
│ ├── ChucVu.java
│ ├── ChucVuBUS.java
│ └── ChucVuDAO.java
├── HienThiChucVu.java
├── QuanLyChucVuForm.java
└── ThemSuaChucVuForm.java
├── QLSV
├── QuanLySinhVienBUS.java
├── QuanLySinhVienDAO.java
├── QuanLySinhVienForm.java
├── SinhVien.java
└── qlsv_Cua_Co.java
├── SearchPanel.java
├── SpringUtilities.java
├── TableIcon.java
├── TableRowRenderingTip.java
└── springLayoutTest.java
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | **/nbproject/private/
2 | **/nbproject/Makefile-*.mk
3 | **/nbproject/Package-*.bash
4 | build/
5 | nbbuild/
6 | dist/
7 | nbdist/
8 | .nb-gradle/
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ĐỒ ÁN JAVA - QUẢN LÝ ĐIỆN THOẠI
2 |
3 | Donate? Muốn hỗ trợ mình 1 ly cafe <3 [Donate here](https://github.com/HoangTran0410/HoangTran0410/blob/main/DONATE.md)
4 |
5 | ### *THÀNH VIÊN NHÓM*:
6 |
7 | Stt | Mã sinh viên | Tên
8 | ---- | ---- | ---
9 | 1 | 3117410091 | [Trần Văn Hoàng](https://www.facebook.com/profile.php?id=100004848287494)
10 | 2 | 3117410057 | [Trần Thanh Giang](https://www.facebook.com/thanhgiang.tran.1276)
11 | 3 | 3117410110 | [Nguyễn Thiên Hữu](https://www.facebook.com/thienhuu.nguyen.10420)
12 | 4 | 3117410097 | [Hứa Hoàng Huy](https://www.facebook.com/hua.hoanghuy.7)
13 |
14 | ### *HƯỚNG DẪN, CÀI ĐẶT VÀ CHẠY THỬ*:
15 |
16 | Các bạn vui lòng tải về và xem file `Tổng quan về đồ án.docx` hoặc `Tổng quan về đồ án.doc` nếu không xem được `.docx`
17 |
18 | [VIDEO hướng dẫn](https://www.loom.com/share/4993ded95b9f4a1abc8af7704516057b)
19 |
20 | ### *SCREENSHOTS:*
21 | 
22 | 
23 | 
24 | 
25 | 
26 |
27 |
31 |
--------------------------------------------------------------------------------
/Tổng quan về đồ án.doc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/Tổng quan về đồ án.doc
--------------------------------------------------------------------------------
/Tổng quan về đồ án.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/Tổng quan về đồ án.docx
--------------------------------------------------------------------------------
/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Builds, tests, and runs the project GiaoDienChuan.
12 |
13 |
73 |
74 |
--------------------------------------------------------------------------------
/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/nbproject/genfiles.properties:
--------------------------------------------------------------------------------
1 | build.xml.data.CRC32=f5bc77a1
2 | build.xml.script.CRC32=9d4311f9
3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48
4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6 | nbproject/build-impl.xml.data.CRC32=f5bc77a1
7 | nbproject/build-impl.xml.script.CRC32=b6f7357e
8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48
9 |
--------------------------------------------------------------------------------
/nbproject/project.properties:
--------------------------------------------------------------------------------
1 | annotation.processing.enabled=true
2 | annotation.processing.enabled.in.editor=false
3 | annotation.processing.processor.options=
4 | annotation.processing.processors.list=
5 | annotation.processing.run.all.processors=true
6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
7 | build.classes.dir=${build.dir}/classes
8 | build.classes.excludes=**/*.java,**/*.form
9 | # This directory is removed when the project is cleaned:
10 | build.dir=build
11 | build.generated.dir=${build.dir}/generated
12 | build.generated.sources.dir=${build.dir}/generated-sources
13 | # Only compile against the classpath explicitly listed here:
14 | build.sysclasspath=ignore
15 | build.test.classes.dir=${build.dir}/test/classes
16 | build.test.results.dir=${build.dir}/test/results
17 | # Uncomment to specify the preferred debugger connection transport:
18 | #debug.transport=dt_socket
19 | debug.classpath=\
20 | ${run.classpath}
21 | debug.test.classpath=\
22 | ${run.test.classpath}
23 | # Files in build.classes.dir which should be excluded from distribution jar
24 | dist.archive.excludes=
25 | # This directory is removed when the project is cleaned:
26 | dist.dir=dist
27 | dist.jar=${dist.dir}/GiaoDienChuan.jar
28 | dist.javadoc.dir=${dist.dir}/javadoc
29 | excludes=
30 | file.reference.commons-codec-1.12.jar=src\\lib\\POI\\commons-codec-1.12.jar
31 | file.reference.commons-collections4-4.3.jar=src\\lib\\POI\\commons-collections4-4.3.jar
32 | file.reference.itextpdf-5.5.12.jar=src\\lib\\itextpdf-5.5.12.jar
33 | file.reference.LGoodDatePicker-10.4.1.jar-1=src\\lib\\LGoodDatePicker-10.4.1.jar
34 | file.reference.mysql-connector-java-5.1.23-bin.jar=src\\lib\\mysql-connector-java-5.1.23-bin.jar
35 | file.reference.poi-4.1.0.jar-1=src\\lib\\POI\\poi-4.1.0.jar
36 | includes=**
37 | jar.compress=false
38 | javac.classpath=\
39 | ${file.reference.mysql-connector-java-5.1.23-bin.jar}:\
40 | ${file.reference.LGoodDatePicker-10.4.1.jar-1}:\
41 | ${file.reference.poi-4.1.0.jar-1}:\
42 | ${file.reference.commons-collections4-4.3.jar}:\
43 | ${file.reference.commons-codec-1.12.jar}:\
44 | ${file.reference.itextpdf-5.5.12.jar}
45 | # Space-separated list of extra javac options
46 | javac.compilerargs=
47 | javac.deprecation=false
48 | javac.external.vm=true
49 | javac.processorpath=\
50 | ${javac.classpath}
51 | javac.source=1.8
52 | javac.target=1.8
53 | javac.test.classpath=\
54 | ${javac.classpath}:\
55 | ${build.classes.dir}
56 | javac.test.processorpath=\
57 | ${javac.test.classpath}
58 | javadoc.additionalparam=
59 | javadoc.author=false
60 | javadoc.encoding=${source.encoding}
61 | javadoc.noindex=false
62 | javadoc.nonavbar=false
63 | javadoc.notree=false
64 | javadoc.private=false
65 | javadoc.splitindex=true
66 | javadoc.use=true
67 | javadoc.version=false
68 | javadoc.windowtitle=
69 | main.class=giaodienchuan.Main
70 | manifest.file=manifest.mf
71 | meta.inf.dir=${src.dir}/META-INF
72 | mkdist.disabled=false
73 | platform.active=default_platform
74 | run.classpath=\
75 | ${javac.classpath}:\
76 | ${build.classes.dir}
77 | # Space-separated list of JVM arguments used when running the project.
78 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
79 | # To set system properties for unit tests define test-sys-prop.name=value:
80 | run.jvmargs=
81 | run.test.classpath=\
82 | ${javac.test.classpath}:\
83 | ${build.test.classes.dir}
84 | source.encoding=UTF-8
85 | src.dir=src
86 | test.src.dir=test
87 |
--------------------------------------------------------------------------------
/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.java.j2seproject
4 |
5 |
6 | GiaoDienChuan
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/screenshots/login.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/screenshots/login.png
--------------------------------------------------------------------------------
/screenshots/main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/screenshots/main.png
--------------------------------------------------------------------------------
/screenshots/phanquyen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/screenshots/phanquyen.png
--------------------------------------------------------------------------------
/screenshots/products.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/screenshots/products.png
--------------------------------------------------------------------------------
/screenshots/sell.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/screenshots/sell.png
--------------------------------------------------------------------------------
/screenshots/thongke.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/screenshots/thongke.png
--------------------------------------------------------------------------------
/src/giaodienchuan/Main.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan;
2 |
3 | import giaodienchuan.model.FrontEnd.GiaoDienChuan.LoginForm;
4 | import javax.swing.UIManager;
5 | import javax.swing.UnsupportedLookAndFeelException;
6 |
7 | public class Main {
8 |
9 | public static void main(String[] args) {
10 | try {
11 | UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
12 | } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | UnsupportedLookAndFeelException e) {
13 |
14 | }
15 |
16 | new LoginForm().setVisible(true);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/blackberry-evolve6xvk3-640.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/blackberry-evolve6xvk3-640.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/huawei-mate-20-black-400x460.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/huawei-mate-20-black-400x460.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/huawei-p30-pro-1-400x460.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/huawei-p30-pro-1-400x460.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/huawei-y9-2019-blue-400x460.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/huawei-y9-2019-blue-400x460.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/iphone-8-plus-256gb-gold-400x460.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/iphone-8-plus-256gb-gold-400x460.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/iphone-xr-128gb-red-400x400.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/iphone-xr-128gb-red-400x400.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/iphone-xr-256gb-white-400x400.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/iphone-xr-256gb-white-400x400.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/iphone-xr-black-400x400.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/iphone-xr-black-400x400.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/iphone-xs-max-512gb-gold-400x460.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/iphone-xs-max-512gb-gold-400x460.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/nokia-61-plus-2-400x400.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/nokia-61-plus-2-400x400.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/nokia-61-plus-3-400x460.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/nokia-61-plus-3-400x460.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/nokia-81-silver-18thangbh-400x460.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/nokia-81-silver-18thangbh-400x460.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/nokia-81-silver-400x460.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/nokia-81-silver-400x460.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/oppo-a7-32gb-gold-400x400.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/oppo-a7-32gb-gold-400x400.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/oppo-a7-400x460.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/oppo-a7-400x460.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/oppo-f11-mtp-400x400.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/oppo-f11-mtp-400x400.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/oppo-f7-red-mtp-400x460.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/oppo-f7-red-mtp-400x460.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/oppo-find-x-1-400x460-400x460.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/oppo-find-x-1-400x460-400x460.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/oppo-r17-pro-2-400x460.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/oppo-r17-pro-2-400x460.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/philips-s327-400-400x460.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/philips-s327-400-400x460.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/samsung-galaxy-a30-blue-400x400.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/samsung-galaxy-a30-blue-400x400.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/samsung-galaxy-a50-128gb-blue-docquyen-400x400.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/samsung-galaxy-a50-128gb-blue-docquyen-400x400.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/samsung-galaxy-a9-2018-blue-400x400.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/samsung-galaxy-a9-2018-blue-400x400.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/samsung-galaxy-note-9-512gb-blue-400x460.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/samsung-galaxy-note-9-512gb-blue-400x460.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/samsung-galaxy-s10-plus-512gb-ceramic-black-400x460.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/samsung-galaxy-s10-plus-512gb-ceramic-black-400x460.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/vivo-v11-400x460.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/vivo-v11-400x460.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/vivo-v15-quanghai-400x460.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/vivo-v15-quanghai-400x460.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/vivo-y85-red-docquyen-400x460.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/vivo-y85-red-docquyen-400x460.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/xiaomi-mi-8-1-400x460-400x460.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/xiaomi-mi-8-1-400x460-400x460.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/Product Images/xiaomi-redmi-note-6-pro-black-1-400x460.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/Product Images/xiaomi-redmi-note-6-pro-black-1-400x460.jpg
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_add_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_add_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_agreement_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_agreement_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_angle_down_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_angle_down_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_assistant_100px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_assistant_100px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_assistant_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_assistant_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_bar_chart_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_bar_chart_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_calendar_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_calendar_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_calendar_31_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_calendar_31_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_cancel_30px_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_cancel_30px_1.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_circled_user_male_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_circled_user_male_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_circled_user_male_skin_type_1_2_40px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_circled_user_male_skin_type_1_2_40px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_client_company_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_client_company_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_commercial_development_management_64px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_commercial_development_management_64px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_company_100px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_company_100px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_company_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_company_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_computer_support_99px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_computer_support_99px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_data_backup_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_data_backup_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_database_restore_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_database_restore_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_delete_30px_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_delete_30px_1.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_delete_forever_30px_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_delete_forever_30px_1.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_dossier_folder_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_dossier_folder_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_downloads_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_downloads_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_exit_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_exit_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_flow_chart_30px_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_flow_chart_30px_1.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_futures_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_futures_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_gift_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_gift_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_google_mobile_100px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_google_mobile_100px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_key_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_key_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_login_rounded_down_64px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_login_rounded_down_64px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_maintenance_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_maintenance_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_more_20px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_more_20px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_ms_excel_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_ms_excel_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_multiple_smartphones_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_multiple_smartphones_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_ok_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_ok_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_opened_folder_20px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_opened_folder_20px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_opened_folder_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_opened_folder_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_password_40px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_password_40px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_person_male_100px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_person_male_100px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_pie_chart_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_pie_chart_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_police_badge_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_police_badge_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_refresh_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_refresh_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_replay_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_replay_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_settings_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_settings_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_settings_30px_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_settings_30px_1.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_show_property_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_show_property_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_shutdown_30px_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_shutdown_30px_1.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_small_business_30px_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_small_business_30px_3.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_student_female_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_student_female_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_support_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_support_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_system_information_99px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_system_information_99px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_thumb_up_99px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_thumb_up_99px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_truck_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_truck_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_us_dollar_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_us_dollar_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_user_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_user_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_windows_phone_store_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_windows_phone_store_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/images/icons8_wrench_30px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/giaodienchuan/images/icons8_wrench_30px.png
--------------------------------------------------------------------------------
/src/giaodienchuan/model/BackEnd/PriceFormatter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package giaodienchuan.model.BackEnd;
7 |
8 | import java.math.BigDecimal;
9 | import java.text.NumberFormat;
10 | import java.util.Locale;
11 |
12 | /**
13 | *
14 | * @author DELL
15 | */
16 | public class PriceFormatter {
17 |
18 | public static String format(float num) {
19 | BigDecimal trieu = new BigDecimal(num * 1000000);
20 | Locale vietnam = new Locale("vi", "VN");
21 | NumberFormat fmoney = NumberFormat.getCurrencyInstance(vietnam);
22 |
23 | return fmoney.format(trieu);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/BackEnd/QuanLyChiTietHoaDon/ChiTietHoaDon.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.BackEnd.QuanLyChiTietHoaDon;
2 |
3 | public class ChiTietHoaDon {
4 |
5 | private String maHoaDon;
6 | private String maSanPham;
7 | private int soLuong;
8 | private float donGia;
9 |
10 | public ChiTietHoaDon(String mahd, String masp, int soluong, float dongia) {
11 | this.maHoaDon = mahd;
12 | this.maSanPham = masp;
13 | this.soLuong = soluong;
14 | this.donGia = dongia;
15 | }
16 |
17 | public String getMaHoaDon() {
18 | return maHoaDon;
19 | }
20 |
21 | public void setMaHoaDon(String maHoaDon) {
22 | this.maHoaDon = maHoaDon;
23 | }
24 |
25 | public String getMaSanPham() {
26 | return maSanPham;
27 | }
28 |
29 | public void setMaSanPham(String maSanPham) {
30 | this.maSanPham = maSanPham;
31 | }
32 |
33 | public int getSoLuong() {
34 | return soLuong;
35 | }
36 |
37 | public void setSoLuong(int soLuong) {
38 | this.soLuong = soLuong;
39 | }
40 |
41 | public float getDonGia() {
42 | return donGia;
43 | }
44 |
45 | public void setDonGia(float donGia) {
46 | this.donGia = donGia;
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/BackEnd/QuanLyChiTietHoaDon/QuanLyChiTietHoaDonDAO.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.BackEnd.QuanLyChiTietHoaDon;
2 |
3 | import giaodienchuan.model.BackEnd.ConnectionDB.ConnectionDB;
4 | import java.sql.ResultSet;
5 | import java.sql.SQLException;
6 | import java.util.ArrayList;
7 | import javax.swing.JOptionPane;
8 |
9 | public class QuanLyChiTietHoaDonDAO {
10 |
11 | ConnectionDB connection;
12 |
13 | public QuanLyChiTietHoaDonDAO() {
14 | }
15 |
16 | public ArrayList readDB() {
17 | connection = new ConnectionDB();
18 | ArrayList dshd = new ArrayList<>();
19 | try {
20 | String qry = "SELECT * FROM chitiethoadon";
21 | ResultSet rs = connection.sqlQuery(qry);
22 | if (rs != null) {
23 | while (rs.next()) {
24 | ChiTietHoaDon hd = new ChiTietHoaDon(rs.getString("MaHD"), rs.getString("MaSP"), rs.getInt("SoLuong"), rs.getFloat("DonGia"));
25 | dshd.add(hd);
26 | }
27 | }
28 | } catch (SQLException e) {
29 | JOptionPane.showMessageDialog(null, "Khong tim thay du lieu !!");
30 | } finally {
31 | connection.closeConnect();
32 | }
33 | return dshd;
34 | }
35 |
36 | public Boolean add(ChiTietHoaDon hd) {
37 | connection = new ConnectionDB();
38 | Boolean success = connection.sqlUpdate("INSERT INTO chitiethoadon(MaHD,MaSP,SoLuong,DonGia) VALUES ('"
39 | + hd.getMaHoaDon() + "','"
40 | + hd.getMaSanPham() + "','"
41 | + hd.getSoLuong() + "','"
42 | + hd.getDonGia() + "');");
43 | connection.closeConnect();
44 | return success;
45 | }
46 |
47 | public Boolean delete(String _mahd, String _masp) {
48 | connection = new ConnectionDB();
49 | Boolean success = connection.sqlUpdate("DELETE FROM chitiethoadon WHERE "
50 | + "MaHD='" + _mahd
51 | + "' AND MaSP='" + _masp + "';");
52 | connection.closeConnect();
53 | return success;
54 | }
55 |
56 | public Boolean deleteAll(String _mahd) {
57 | connection = new ConnectionDB();
58 | Boolean success = connection.sqlUpdate("DELETE FROM chitiethoadon WHERE MaHD='" + _mahd + "';");
59 | connection.closeConnect();
60 | return success;
61 | }
62 |
63 | public Boolean update(ChiTietHoaDon ct) {
64 | connection = new ConnectionDB();
65 | Boolean success = connection.sqlUpdate("UPDATE chitiethoadon set "
66 | + "SoLuong='" + ct.getSoLuong()
67 | + "', DonGia='" + ct.getDonGia()
68 | + "' WHERE MaHD='" + ct.getMaHoaDon() + "' AND MaSP='" + ct.getMaSanPham() + "';");
69 | connection.closeConnect();
70 | return success;
71 | }
72 |
73 | public Boolean update(String maHoaDon, String maSanPham, int soLuong, float donGia) {
74 | ChiTietHoaDon hd = new ChiTietHoaDon(maHoaDon, maSanPham, soLuong, donGia);
75 | return update(hd);
76 | }
77 |
78 | public void closeConnection() {
79 | connection.closeConnect();
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/BackEnd/QuanLyChiTietPN/ChiTietPhieuNhap.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package giaodienchuan.model.BackEnd.QuanLyChiTietPN;
7 |
8 | /**
9 | *
10 | * @author Admin
11 | */
12 | public class ChiTietPhieuNhap {
13 |
14 | String ma;
15 | String maSP;
16 | Integer soLuong;
17 | Float donGia;
18 |
19 | public ChiTietPhieuNhap() {
20 |
21 | }
22 |
23 | public ChiTietPhieuNhap(String ma, String maSP, Integer soLuong, Float donGia) {
24 | this.ma = ma;
25 | this.maSP = maSP;
26 | this.soLuong = soLuong;
27 | this.donGia = donGia;
28 | }
29 |
30 | public String getMa() {
31 | return ma;
32 | }
33 |
34 | public String getMaSP() {
35 | return maSP;
36 | }
37 |
38 | public Integer getSoLuong() {
39 | return soLuong;
40 | }
41 |
42 | public Float getDonGia() {
43 | return donGia;
44 | }
45 |
46 | public void setMa(String ma) {
47 | this.ma = ma;
48 | }
49 |
50 | public void setMaSP(String maSP) {
51 | this.maSP = maSP;
52 | }
53 |
54 | public void setSoLuong(Integer soLuong) {
55 | this.soLuong = soLuong;
56 | }
57 |
58 | public void setDonGia(Float donGia) {
59 | this.donGia = donGia;
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/BackEnd/QuanLyChiTietPN/QuanLyChiTietPhieuNhapDAO.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package giaodienchuan.model.BackEnd.QuanLyChiTietPN;
7 |
8 | import giaodienchuan.model.BackEnd.ConnectionDB.ConnectionDB;
9 | import java.sql.ResultSet;
10 | import java.sql.SQLException;
11 | import java.util.ArrayList;
12 | import javax.swing.JOptionPane;
13 |
14 | /**
15 | *
16 | * @author Admin
17 | */
18 | public class QuanLyChiTietPhieuNhapDAO {
19 |
20 | ConnectionDB qlctpnConnection;
21 |
22 | public ArrayList readDB() {
23 | ArrayList dsctpn = new ArrayList<>();
24 | qlctpnConnection = new ConnectionDB();
25 | try {
26 |
27 | String query = "SELECT * FROM chitietphieunhap";
28 | ResultSet r = qlctpnConnection.sqlQuery(query);
29 | if (r != null) {
30 | while (r.next()) {
31 | String ma = r.getString(1);
32 | String maSP = r.getString(2);
33 | Integer soLuong = r.getInt(3);
34 | Float donGia = r.getFloat(4);
35 |
36 | ChiTietPhieuNhap ctpn = new ChiTietPhieuNhap(ma, maSP, soLuong, donGia);
37 | dsctpn.add(ctpn);
38 | }
39 | }
40 | } catch (SQLException ex) {
41 | JOptionPane.showMessageDialog(null, "Không thấy data cần tìm trong ResultSet");
42 |
43 | } finally {
44 | qlctpnConnection.closeConnect();
45 | }
46 | return dsctpn;
47 |
48 | }
49 |
50 | public ArrayList search(String columName, String value) {
51 | ArrayList dsctpn = new ArrayList<>();
52 | qlctpnConnection = new ConnectionDB();
53 | try {
54 |
55 | String query = "SELECT * FROM chitietphieunhap WHERE" + columName + "LIKE '%" + value + "%'";
56 | ResultSet r = qlctpnConnection.sqlQuery(query);
57 | if (r != null) {
58 | while (r.next()) {
59 | String ma = r.getString(1);
60 | String maSP = r.getString(2);
61 | Integer soLuong = r.getInt(3);
62 | Float donGia = r.getFloat(4);
63 |
64 | ChiTietPhieuNhap ctpn = new ChiTietPhieuNhap(ma, maSP, soLuong, donGia);
65 | dsctpn.add(ctpn);
66 | }
67 | }
68 | } catch (SQLException ex) {
69 | JOptionPane.showMessageDialog(null, "Không thấy data cần tìm trong ResultSet");
70 |
71 | } finally {
72 | qlctpnConnection.closeConnect();
73 | }
74 | return dsctpn;
75 |
76 | }
77 |
78 | public boolean add(ChiTietPhieuNhap ctpn) {
79 | qlctpnConnection = new ConnectionDB();
80 | Boolean ok = qlctpnConnection.sqlUpdate("INSERT INTO `chitietphieunhap`(`MaPN`,`MaSP`,`SoLuong`,`DonGia`) VALUE('"
81 | + ctpn.getMa() + "', '" + ctpn.getMaSP() + "','" + ctpn.getSoLuong() + "','" + ctpn.getDonGia() + "')");
82 | qlctpnConnection.closeConnect();
83 | return ok;
84 |
85 | }
86 |
87 | public Boolean deleteAll(String _mapn) {
88 | qlctpnConnection = new ConnectionDB();
89 | Boolean success = qlctpnConnection.sqlUpdate("DELETE FROM chitietphieunhap WHERE MaPN='" + _mapn + "';");
90 | qlctpnConnection.closeConnect();
91 | return success;
92 | }
93 |
94 | public Boolean delete(String _mapn, String _masp) {
95 | qlctpnConnection = new ConnectionDB();
96 | Boolean success = qlctpnConnection.sqlUpdate("DELETE FROM chitietphieunhap WHERE MaPN='" + _mapn + "' AND MaSP='" + _masp + "';");
97 | qlctpnConnection.closeConnect();
98 | return success;
99 | }
100 |
101 | public boolean update(String mapn, String masp, int soluong, float dongia) {
102 | qlctpnConnection = new ConnectionDB();
103 | Boolean ok = qlctpnConnection.sqlUpdate("UPDATE `chitietphieunhap` SET "
104 | + "SoLuong='" + soluong
105 | + "',DonGia='" + dongia
106 | + "' WHERE MaPN='" + mapn + "' AND MaSP='" + masp + "';");
107 | qlctpnConnection.closeConnect();
108 | return ok;
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/BackEnd/QuanLyHoaDon/HoaDon.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.BackEnd.QuanLyHoaDon;
2 |
3 | import java.time.LocalDate;
4 | import java.time.LocalTime;
5 |
6 | public class HoaDon {
7 |
8 | private String maHoaDon = "";
9 | private String maNhanVien = "";
10 | private String maKhachHang = "";
11 | private String maKhuyenMai = "";
12 | private LocalDate ngayLap;
13 | private LocalTime gioLap;
14 | private float TongTien = 0;
15 |
16 | public HoaDon() {
17 | ngayLap = LocalDate.now();
18 | gioLap = LocalTime.now();
19 | }
20 |
21 | public HoaDon(String maHoaDon, String maNhanVien, String maKhachHang, String maKhuyenMai, LocalDate ngayNhap, LocalTime gioNhap, float tongTien) {
22 | this.maHoaDon = maHoaDon;
23 | this.maNhanVien = maNhanVien;
24 | this.maKhachHang = maKhachHang;
25 | this.maKhuyenMai = maKhuyenMai;
26 | this.ngayLap = ngayNhap;
27 | this.gioLap = gioNhap;
28 | this.TongTien = tongTien;
29 | }
30 |
31 | public String getMaHoaDon() {
32 | return maHoaDon;
33 | }
34 |
35 | public void setMaHoaDon(String maHoaDon) {
36 | this.maHoaDon = maHoaDon;
37 | }
38 |
39 | public String getMaNhanVien() {
40 | return maNhanVien;
41 | }
42 |
43 | public void setMaNhanVien(String maNhanVien) {
44 | this.maNhanVien = maNhanVien;
45 | }
46 |
47 | public String getMaKhachHang() {
48 | return maKhachHang;
49 | }
50 |
51 | public void setMaKhachHang(String maKhachHang) {
52 | this.maKhachHang = maKhachHang;
53 | }
54 |
55 | public LocalDate getNgayLap() {
56 | return ngayLap;
57 | }
58 |
59 | public void setNgayLap(LocalDate ngayLap) {
60 | this.ngayLap = ngayLap;
61 | }
62 |
63 | public LocalTime getGioLap() {
64 | return gioLap;
65 | }
66 |
67 | public void setGioLap(LocalTime gioLap) {
68 | this.gioLap = gioLap;
69 | }
70 |
71 | public float getTongTien() {
72 | return TongTien;
73 | }
74 |
75 | public void setTongTien(float TongTien) {
76 | this.TongTien = TongTien;
77 | }
78 |
79 | public String getMaKhuyenMai() {
80 | return maKhuyenMai;
81 | }
82 |
83 | public void setMaKhuyenMai(String maKhuyenMai) {
84 | this.maKhuyenMai = maKhuyenMai;
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/BackEnd/QuanLyHoaDon/QuanLyHoaDonDAO.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.BackEnd.QuanLyHoaDon;
2 |
3 | import giaodienchuan.model.BackEnd.ConnectionDB.ConnectionDB;
4 | import java.sql.ResultSet;
5 | import java.sql.SQLException;
6 | import java.time.LocalDate;
7 | import java.time.LocalTime;
8 | import java.util.ArrayList;
9 | import javax.swing.JOptionPane;
10 |
11 | public class QuanLyHoaDonDAO {
12 |
13 | ConnectionDB connection;
14 |
15 | public QuanLyHoaDonDAO() {
16 | }
17 |
18 | public ArrayList readDB() {
19 | connection = new ConnectionDB();
20 | ArrayList dshd = new ArrayList<>();
21 | try {
22 | String qry = "SELECT * FROM hoadon";
23 | ResultSet rs = connection.sqlQuery(qry);
24 | if (rs != null) {
25 | while (rs.next()) {
26 | HoaDon hd = new HoaDon();
27 | hd.setMaHoaDon(rs.getString("MaHD"));
28 | hd.setMaNhanVien(rs.getString("MaNV"));
29 | hd.setMaKhachHang(rs.getString("MaKH"));
30 | hd.setMaKhuyenMai(rs.getString("MaKM"));
31 | hd.setNgayLap(rs.getDate("NgayLap").toLocalDate());
32 | hd.setGioLap(rs.getTime("GioLap").toLocalTime());
33 | hd.setTongTien(rs.getFloat("TongTien"));
34 | dshd.add(hd);
35 | }
36 | }
37 | } catch (SQLException e) {
38 | JOptionPane.showMessageDialog(null, "Không đọc được dữ liệu bảng hóa đơn !!");
39 | } finally {
40 | connection.closeConnect();
41 | }
42 | return dshd;
43 | }
44 |
45 | public Boolean add(HoaDon hd) {
46 | connection = new ConnectionDB();
47 | Boolean success = connection.sqlUpdate("INSERT INTO hoadon(MaHD,MaNV,MaKH,MaKM,NgayLap,GioLap,TongTien) VALUES ('"
48 | + hd.getMaHoaDon() + "','"
49 | + hd.getMaNhanVien() + "','"
50 | + hd.getMaKhachHang() + "','"
51 | + hd.getMaKhuyenMai()+ "','"
52 | + hd.getNgayLap() + "','"
53 | + hd.getGioLap() + "','"
54 | + hd.getTongTien() + "');");
55 | connection.closeConnect();
56 | return success;
57 | }
58 |
59 | public Boolean delete(String mahd) {
60 | connection = new ConnectionDB();
61 | if (!connection.sqlUpdate("DELETE FROM hoadon WHERE MaHD='" + mahd + "';")) {
62 | JOptionPane.showMessageDialog(null, "Vui long xoa het chi tiet cua hoa don truoc !!!");
63 | connection.closeConnect();
64 | return false;
65 | }
66 | connection.closeConnect();
67 | return true;
68 | }
69 |
70 | public Boolean update(HoaDon hd) {
71 | connection = new ConnectionDB();
72 | Boolean success = connection.sqlUpdate("UPDATE hoadon SET "
73 | + "MaNV='" + hd.getMaNhanVien()
74 | + "', MaKH='" + hd.getMaKhachHang()
75 | + "', MaKM='" + hd.getMaKhuyenMai()
76 | + "', NgayLap='" + hd.getNgayLap()
77 | + "', GioLap='" + hd.getGioLap()
78 | + "', TongTien='" + hd.getTongTien()
79 | + "' WHERE MaHD='" + hd.getMaHoaDon() + "';");
80 | connection.closeConnect();
81 | return success;
82 | }
83 |
84 | public Boolean updateTongTien(String _mahd,float _tongTien){
85 | connection = new ConnectionDB();
86 | Boolean success = connection.sqlUpdate("UPDATE hoadon SET TongTien='" + _tongTien + "' WHERE MaHD='" +_mahd + "';");
87 | connection.closeConnect();
88 | return success;
89 | }
90 |
91 | public Boolean update(String maHoaDon, String maNhanVien, String maKhachHang, String makm, LocalDate ngayLap, LocalTime gioLap, float tongTien) {
92 | HoaDon hd = new HoaDon();
93 | hd.setMaHoaDon(maHoaDon);
94 | hd.setMaNhanVien(maNhanVien);
95 | hd.setMaKhachHang(maKhachHang);
96 | hd.setMaKhuyenMai(makm);
97 | hd.setNgayLap(ngayLap);
98 | hd.setGioLap(gioLap);
99 | hd.setTongTien(tongTien);
100 | return update(hd);
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/BackEnd/QuanLyKhachHang/KhachHang.java:
--------------------------------------------------------------------------------
1 |
2 | package giaodienchuan.model.BackEnd.QuanLyKhachHang;
3 |
4 |
5 | public class KhachHang {
6 | String MaKH, TenKH, DiaChi, SDT;
7 | int TrangThai;
8 |
9 | public KhachHang(String MaKH, String TenKH, String DiaChi, String SDT, int TrangThai) {
10 | this.MaKH = MaKH;
11 | this.TenKH = TenKH;
12 | this.DiaChi = DiaChi;
13 | this.SDT = SDT;
14 | this.TrangThai = TrangThai;
15 | }
16 |
17 | public String getMaKH() {
18 | return MaKH;
19 | }
20 |
21 | public void setMaKH(String MaKH) {
22 | this.MaKH = MaKH;
23 | }
24 |
25 | public String getTenKH() {
26 | return TenKH;
27 | }
28 |
29 | public void setTenKH(String TenKH) {
30 | this.TenKH = TenKH;
31 | }
32 |
33 | public String getDiaChi() {
34 | return DiaChi;
35 | }
36 |
37 | public void setDiaChi(String DiaChi) {
38 | this.DiaChi = DiaChi;
39 | }
40 |
41 | public String getSDT() {
42 | return SDT;
43 | }
44 |
45 | public void setSDT(String SDT) {
46 | this.SDT = SDT;
47 | }
48 |
49 | public int getTrangThai() {
50 | return TrangThai;
51 | }
52 |
53 | public void setTrangThai(int TrangThai) {
54 | this.TrangThai = TrangThai;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/BackEnd/QuanLyKhuyenMai/KhuyenMai.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package giaodienchuan.model.BackEnd.QuanLyKhuyenMai;
7 |
8 | import java.time.LocalDate;
9 |
10 | /**
11 | *
12 | * @author DELL
13 | */
14 | public class KhuyenMai {
15 |
16 | String MaKM, TenKM;
17 | float DieuKienKM, PhanTramKM;
18 | LocalDate NgayBD, NgayKT;
19 |
20 | public KhuyenMai(String makm, String tenkm, float dkkm, float phantramkm, LocalDate ngaybd, LocalDate ngaykt) {
21 | this.MaKM = makm;
22 | this.TenKM = tenkm;
23 | this.DieuKienKM = dkkm;
24 | this.PhanTramKM = phantramkm;
25 | this.NgayBD = ngaybd;
26 | this.NgayKT = ngaykt;
27 | }
28 |
29 | public String getTrangThai() {
30 | LocalDate now = LocalDate.now();
31 | if (now.isBefore(this.NgayBD)) {
32 | return "Chưa bắt đầu";
33 | } else if (now.isAfter(this.NgayKT)) {
34 | return "Đã kết thúc";
35 | } else {
36 | return "Đang diễn ra";
37 | }
38 | }
39 |
40 | public String getMaKM() {
41 | return MaKM;
42 | }
43 |
44 | public void setMaKM(String MaKM) {
45 | this.MaKM = MaKM;
46 | }
47 |
48 | public String getTenKM() {
49 | return TenKM;
50 | }
51 |
52 | public void setTenKM(String TenKM) {
53 | this.TenKM = TenKM;
54 | }
55 |
56 | public float getDieuKienKM() {
57 | return DieuKienKM;
58 | }
59 |
60 | public void setDieuKienKM(float DieuKienKM) {
61 | this.DieuKienKM = DieuKienKM;
62 | }
63 |
64 | public float getPhanTramKM() {
65 | return PhanTramKM;
66 | }
67 |
68 | public void setPhanTramKM(float PhanTramKM) {
69 | this.PhanTramKM = PhanTramKM;
70 | }
71 |
72 | public LocalDate getNgayBD() {
73 | return NgayBD;
74 | }
75 |
76 | public void setNgayBD(LocalDate NgayBD) {
77 | this.NgayBD = NgayBD;
78 | }
79 |
80 | public LocalDate getNgayKT() {
81 | return NgayKT;
82 | }
83 |
84 | public void setNgayKT(LocalDate NgayKT) {
85 | this.NgayKT = NgayKT;
86 | }
87 |
88 | }
89 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/BackEnd/QuanLyLoaiSanPham/LoaiSanPham.java:
--------------------------------------------------------------------------------
1 |
2 | package giaodienchuan.model.BackEnd.QuanLyLoaiSanPham;
3 |
4 | public class LoaiSanPham {
5 | String MaLSP, TenLSP, MoTa;
6 |
7 | public LoaiSanPham(String MaLSP, String TenLSP, String MoTa) {
8 | this.MaLSP = MaLSP;
9 | this.TenLSP = TenLSP;
10 | this.MoTa = MoTa;
11 | }
12 |
13 | public String getMoTa() {
14 | return MoTa;
15 | }
16 |
17 | public void setMoTa(String MoTa) {
18 | this.MoTa = MoTa;
19 | }
20 |
21 | public String getMaLSP() {
22 | return MaLSP;
23 | }
24 |
25 | public void setMaLSP(String MaLSP) {
26 | this.MaLSP = MaLSP;
27 | }
28 |
29 | public String getTenLSP() {
30 | return TenLSP;
31 | }
32 |
33 | public void setTenLSP(String TenLSP) {
34 | this.TenLSP = TenLSP;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/BackEnd/QuanLyLoaiSanPham/QuanLyLoaiSanPhamBUS.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.BackEnd.QuanLyLoaiSanPham;
2 |
3 | import java.util.ArrayList;
4 |
5 | public class QuanLyLoaiSanPhamBUS {
6 |
7 | private ArrayList dslsp = new ArrayList<>();
8 | private QuanLyLoaiSanPhamDAO qllspDAO = new QuanLyLoaiSanPhamDAO();
9 |
10 | public QuanLyLoaiSanPhamBUS() {
11 | dslsp = qllspDAO.readDB();
12 | }
13 |
14 | public void showConsole() {
15 | dslsp.forEach((lsp) -> {
16 | System.out.print(lsp.getMaLSP() + " ");
17 | System.out.print(lsp.getTenLSP());
18 | });
19 | }
20 |
21 | public String[] getHeaders() {
22 | return new String[]{"Mã loại", "Tên loại", "Mô tả"};
23 | }
24 |
25 | public String getNextID() {
26 | return "LSP" + String.valueOf(this.dslsp.size() + 1);
27 | }
28 |
29 | public void readDB() {
30 | dslsp = qllspDAO.readDB();
31 | }
32 |
33 | public LoaiSanPham getLoaiSanPham(String maloai) {
34 | for (LoaiSanPham lsp : dslsp) {
35 | if (lsp.getMaLSP().equals(maloai)) {
36 | return lsp;
37 | }
38 | }
39 | return null;
40 | }
41 |
42 | public ArrayList search(String value, String type) {
43 | // Phương pháp tìm từ database
44 | // QuanLySanPhamDAO qlspDB = new QuanLySanPhamDAO();
45 | // dssp = qlspDB.search(columnName, value);
46 | // qlspDB.close();
47 |
48 | // phương pháp tìm từ arraylist
49 | ArrayList result = new ArrayList<>();
50 |
51 | dslsp.forEach((lsp) -> {
52 | if (type.equals("Tất cả")) {
53 | if (lsp.getMaLSP().toLowerCase().contains(value.toLowerCase())
54 | || lsp.getTenLSP().toLowerCase().contains(value.toLowerCase())
55 | || lsp.getMoTa().toLowerCase().contains(value.toLowerCase())) {
56 | result.add(lsp);
57 | }
58 | } else {
59 | switch (type) {
60 | case "Mã loại":
61 | if (lsp.getMaLSP().toLowerCase().contains(value.toLowerCase())) {
62 | result.add(lsp);
63 | }
64 | break;
65 | case "Tên loại":
66 | if (lsp.getTenLSP().toLowerCase().contains(value.toLowerCase())) {
67 | result.add(lsp);
68 | }
69 | break;
70 | case "Mô tả":
71 | if (lsp.getMoTa().toLowerCase().contains(value.toLowerCase())) {
72 | result.add(lsp);
73 | }
74 | break;
75 |
76 | }
77 | }
78 |
79 | });
80 |
81 | return result;
82 | }
83 |
84 | public Boolean add(LoaiSanPham lsp) {
85 | Boolean ok = qllspDAO.add(lsp);
86 |
87 | if (ok) {
88 | dslsp.add(lsp);
89 | }
90 | return ok;
91 | }
92 |
93 | public Boolean add(String malsp, String tenlsp, String mota) {
94 | LoaiSanPham lsp = new LoaiSanPham(malsp, tenlsp, mota);
95 | return add(lsp);
96 | }
97 |
98 | public Boolean delete(String malsp) {
99 | Boolean ok = qllspDAO.delete(malsp);
100 |
101 | if (ok) {
102 | for (int i = (dslsp.size() - 1); i >= 0; i--) {
103 | if (dslsp.get(i).getMaLSP().equals(malsp)) {
104 | dslsp.remove(i);
105 | }
106 | }
107 | }
108 | return ok;
109 | }
110 |
111 | public Boolean update(String malsp, String tenlsp, String mota) {
112 | Boolean ok = qllspDAO.update(malsp, tenlsp, mota);
113 |
114 | if (ok) {
115 | dslsp.forEach((lsp) -> {
116 | if (lsp.getMaLSP().equals(malsp)) {
117 | lsp.setTenLSP(tenlsp);
118 | lsp.setMoTa(mota);
119 | }
120 | });
121 | }
122 |
123 | return ok;
124 | }
125 |
126 | public ArrayList getDslsp() {
127 | return dslsp;
128 | }
129 | }
130 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/BackEnd/QuanLyLoaiSanPham/QuanLyLoaiSanPhamDAO.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.BackEnd.QuanLyLoaiSanPham;
2 |
3 | import giaodienchuan.model.BackEnd.ConnectionDB.ConnectionDB;
4 | import java.sql.ResultSet;
5 | import java.sql.SQLException;
6 | import java.util.ArrayList;
7 | import javax.swing.JOptionPane;
8 |
9 | public class QuanLyLoaiSanPhamDAO {
10 |
11 | ConnectionDB qllspConnection;
12 |
13 | public QuanLyLoaiSanPhamDAO() {
14 |
15 | }
16 |
17 | public ArrayList readDB() {
18 | qllspConnection = new ConnectionDB();
19 | ArrayList dslsp = new ArrayList<>();
20 | try {
21 | String qry = "SELECT * FROM loaisanpham";
22 | ResultSet r = qllspConnection.sqlQuery(qry);
23 | if (r != null) {
24 | while (r.next()) {
25 | String malsp = r.getString(1);
26 | String tenlsp = r.getString(2);
27 | String mota = r.getString(3);
28 |
29 | dslsp.add(new LoaiSanPham(malsp, tenlsp, mota));
30 | }
31 | }
32 |
33 | } catch (SQLException ex) {
34 | JOptionPane.showMessageDialog(null, "-- ERROR! Lỗi đọc dữ liệu bảng loại sản phẩm");
35 | } finally {
36 | qllspConnection.closeConnect();
37 | }
38 | return dslsp;
39 | }
40 |
41 | public ArrayList search(String columnName, String value) {
42 | qllspConnection = new ConnectionDB();
43 | ArrayList dslsp = new ArrayList<>();
44 |
45 | try {
46 | String qry = "SELECT * FROM loaisanpham WHERE " + columnName + " LIKE '%" + value + "%'";
47 | ResultSet r = qllspConnection.sqlQuery(qry);
48 | if (r != null) {
49 | while (r.next()) {
50 | String malsp = r.getString(1);
51 | String tenlsp = r.getString(2);
52 | String mota = r.getString(3);
53 |
54 | dslsp.add(new LoaiSanPham(malsp, tenlsp, mota));
55 | }
56 | }
57 |
58 | } catch (SQLException ex) {
59 | JOptionPane.showMessageDialog(null, "-- ERROR! Lỗi tìm dữ liệu " + columnName + " = " + value + " bảng loại sản phẩm");
60 | } finally {
61 | qllspConnection.closeConnect();
62 | }
63 |
64 | return dslsp;
65 | }
66 |
67 | public Boolean add(LoaiSanPham lsp) {
68 | qllspConnection = new ConnectionDB();
69 | Boolean ok = qllspConnection.sqlUpdate("INSERT INTO `loaisanpham` (`MaLSP`, `TenLSP`, `MoTa`) VALUES ('"
70 | + lsp.getMaLSP() + "', '" + lsp.getTenLSP() + "', '" + lsp.getMoTa()+ "');");
71 | qllspConnection.closeConnect();
72 | return ok;
73 | }
74 |
75 | public Boolean delete(String malsp) {
76 | qllspConnection = new ConnectionDB();
77 | Boolean ok = qllspConnection.sqlUpdate("DELETE FROM `loaisanpham` WHERE `loaisanpham`.`MaLSP` = '" + malsp + "'");
78 | qllspConnection.closeConnect();
79 | return ok;
80 | }
81 |
82 | public Boolean update(String MaLSP, String TenLSP, String Mota) {
83 | qllspConnection = new ConnectionDB();
84 | Boolean ok = qllspConnection.sqlUpdate("Update loaisanpham Set TenLSP='" + TenLSP + "', MoTa='" + Mota + "' where MaLSP='" + MaLSP + "'");
85 | qllspConnection.closeConnect();
86 | return ok;
87 | }
88 |
89 | public void close() {
90 | qllspConnection.closeConnect();
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/BackEnd/QuanLyNCC/NhaCungCap.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package giaodienchuan.model.BackEnd.QuanLyNCC;
7 |
8 | /**
9 | *
10 | * @author Admin
11 | */
12 | public class NhaCungCap {
13 | private String maNCC;
14 | private String tenNCC;
15 | private String diaChi;
16 | private String SDT;
17 | private String Fax;
18 |
19 | public NhaCungCap(){
20 |
21 | }
22 | public NhaCungCap(String maNCC,String tenNCC, String diaChi, String SDT, String Fax)
23 | {
24 | this.maNCC=maNCC;
25 | this.tenNCC=tenNCC;
26 | this.diaChi=diaChi;
27 | this.SDT=SDT;
28 | this.Fax=Fax;
29 | }
30 | public NhaCungCap(NhaCungCap n)
31 | {
32 | this.maNCC=n.maNCC;
33 | this.tenNCC=n.tenNCC;
34 | this.diaChi=n.diaChi;
35 | this.SDT=n.SDT;
36 | this.Fax=n.Fax;
37 | }
38 |
39 | public String getMaNCC() {
40 | return maNCC;
41 | }
42 |
43 | public String getTenNCC() {
44 | return tenNCC;
45 | }
46 |
47 | public String getDiaChi() {
48 | return diaChi;
49 | }
50 |
51 | public String getSDT() {
52 | return SDT;
53 | }
54 |
55 | public String getFax() {
56 | return Fax;
57 | }
58 |
59 | public void setMaNCC(String maNCC) {
60 | this.maNCC = maNCC;
61 | }
62 |
63 | public void setTenNCC(String tenNCC) {
64 | this.tenNCC = tenNCC;
65 | }
66 |
67 | public void setDiaChi(String diaChi) {
68 | this.diaChi = diaChi;
69 | }
70 |
71 | public void setSDT(String SDT) {
72 | this.SDT = SDT;
73 | }
74 |
75 | public void setFax(String Fax) {
76 | this.Fax = Fax;
77 | }
78 |
79 |
80 | }
81 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/BackEnd/QuanLyNCC/QuanLyNhaCungCapDAO.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package giaodienchuan.model.BackEnd.QuanLyNCC;
7 |
8 | ;
9 |
10 | import giaodienchuan.model.BackEnd.ConnectionDB.ConnectionDB;
11 | import giaodienchuan.model.BackEnd.QuanLySanPham.SanPham;
12 | import java.sql.Connection;
13 | import java.sql.ResultSet;
14 | import java.util.ArrayList;
15 | import java.sql.SQLException;
16 | import javax.swing.JOptionPane;
17 |
18 | /**
19 | *
20 | * @author Admin
21 | */
22 |
23 |
24 | public class QuanLyNhaCungCapDAO {
25 |
26 | ConnectionDB qlnccConnection;
27 |
28 | // public QuanLyNhaCungCapDAO(){
29 | // nhaCungCapDB.logIn("root","");
30 | // }
31 | public ArrayList readDB() {
32 | ArrayList dsncc = new ArrayList<>();
33 | qlnccConnection = new ConnectionDB();
34 | try {
35 | String qry = "SELECT * FROM nhacungcap";
36 | ResultSet r = qlnccConnection.sqlQuery(qry);
37 | if (r != null) {
38 | while (r.next()) {
39 | String ma = r.getString(1);
40 | String ten = r.getString(2);
41 | String diachi = r.getString(3);
42 | String sdt = r.getString(4);
43 | String fax = r.getString(5);
44 |
45 | dsncc.add(new NhaCungCap(ma, ten, diachi, sdt, fax));
46 | }
47 | }
48 | } catch (SQLException ex) {
49 | JOptionPane.showMessageDialog(null, "Không thấy data cần tìm trong ResultSet");
50 | } finally {
51 | qlnccConnection.closeConnect();
52 | }
53 | return dsncc;
54 | }
55 |
56 | public ArrayList search(String columnName, String value) {
57 | qlnccConnection = new ConnectionDB();
58 | ArrayList dsncc = new ArrayList<>();
59 |
60 | try {
61 | String qry = "SELECT * FROM sanpham WHERE " + columnName + " LIKE '%" + value + "%'";
62 | ResultSet r = qlnccConnection.sqlQuery(qry);
63 | if (r != null) {
64 | while (r.next()) {
65 | String mancc = r.getString(1);
66 | String tenncc = r.getString(2);
67 | String diachi = r.getString(3);
68 | String sdt = r.getString(4);
69 | String fax = r.getString(5);
70 | dsncc.add(new NhaCungCap(mancc, tenncc, diachi, sdt, fax));
71 | }
72 | }
73 |
74 | } catch (SQLException ex) {
75 | JOptionPane.showMessageDialog(null, "-- ERROR! Lỗi tìm dữ liệu " + columnName + " = " + value + " bảng sản phẩm");
76 | } finally {
77 | qlnccConnection.closeConnect();
78 | }
79 |
80 | return dsncc;
81 | }
82 |
83 | public Boolean add(NhaCungCap ncc) {
84 | qlnccConnection = new ConnectionDB();
85 | Boolean ok = qlnccConnection.sqlUpdate("INSERT INTO `nhacungcap` (`MaNCC`, `TenNCC`, `DiaChi`,`SDT`,`Fax`) VALUES ('"
86 | + ncc.getMaNCC() + "', '"
87 | + ncc.getTenNCC() + "', '"
88 | + ncc.getDiaChi() + "','"
89 | + ncc.getSDT() + "','"
90 | + ncc.getFax() + "');");
91 |
92 | qlnccConnection.closeConnect();
93 | return ok;
94 | }
95 |
96 | public Boolean delete(String mancc) {
97 | qlnccConnection = new ConnectionDB();
98 | Boolean ok = qlnccConnection.sqlUpdate("DELETE FROM `nhacungcap` WHERE `nhacungcap`.`MaNCC` = '" + mancc + "'");
99 | qlnccConnection.closeConnect();
100 | return ok;
101 | }
102 |
103 | public Boolean update(String ma, String ten, String diachi, String sdt, String fax) {
104 | qlnccConnection = new ConnectionDB();
105 | Boolean ok = qlnccConnection.sqlUpdate("Update NhaCungCap Set MaNCC='" + ma + "',TenNCC='" + ten + "',DiaChi='" + diachi + "',SDT='" + sdt + "',Fax='" + fax + "' where MaNCC='" + ma + "'");
106 | qlnccConnection.closeConnect();
107 | return ok;
108 | }
109 |
110 | public void close() {
111 | qlnccConnection.closeConnect();
112 | }
113 |
114 | }
115 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/BackEnd/QuanLyNhanVien/NhanVien.java:
--------------------------------------------------------------------------------
1 |
2 | package giaodienchuan.model.BackEnd.QuanLyNhanVien;
3 |
4 | import java.time.LocalDate;
5 |
6 | public class NhanVien {
7 |
8 | String MaNV, TenNV, DiaChi, SDT;
9 | LocalDate NgaySinh;
10 | int TrangThai;
11 |
12 | public NhanVien(String MaNV, String TenNV, LocalDate NgaySinh, String DiaChi, String SDT, int trangthai) {
13 | this.MaNV = MaNV;
14 | this.TenNV = TenNV;
15 | this.NgaySinh = NgaySinh;
16 | this.DiaChi = DiaChi;
17 | this.SDT = SDT;
18 | this.TrangThai = trangthai;
19 | }
20 |
21 | public String getMaNV() {
22 | return MaNV;
23 | }
24 |
25 | public void setMaNV(String MaNV) {
26 | this.MaNV = MaNV;
27 | }
28 |
29 | public String getTenNV() {
30 | return TenNV;
31 | }
32 |
33 | public void setTenNV(String TenNV) {
34 | this.TenNV = TenNV;
35 | }
36 |
37 | public LocalDate getNgaySinh() {
38 | return NgaySinh;
39 | }
40 |
41 | public void setNgaySinh(LocalDate NgaySinh) {
42 | this.NgaySinh = NgaySinh;
43 | }
44 |
45 | public String getDiaChi() {
46 | return DiaChi;
47 | }
48 |
49 | public void setDiaChi(String DiaChi) {
50 | this.DiaChi = DiaChi;
51 | }
52 |
53 | public String getSDT() {
54 | return SDT;
55 | }
56 |
57 | public void setSDT(String SDT) {
58 | this.SDT = SDT;
59 | }
60 |
61 | public int getTrangThai() {
62 | return TrangThai;
63 | }
64 |
65 | public void setTrangThai(int TrangThai) {
66 | this.TrangThai = TrangThai;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/BackEnd/QuanLyPhieuNhap/PhieuNhap.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package giaodienchuan.model.BackEnd.QuanLyPhieuNhap;
7 |
8 | import java.time.LocalDate;
9 | import java.time.LocalTime;
10 |
11 | /**
12 | *
13 | * @author Admin
14 | */
15 | public class PhieuNhap {
16 |
17 | String maPN;
18 | String maNCC;
19 | String maNV;
20 | LocalDate ngayNhap;
21 | LocalTime gioNhap;
22 | float tongTien = 0;
23 |
24 | public PhieuNhap() {
25 | this.ngayNhap = LocalDate.now();
26 | this.gioNhap = LocalTime.now();
27 | }
28 |
29 | public PhieuNhap(String maPN, String maNCC, String maNV, LocalDate ngayNhap, LocalTime gioNhap, float tongTien) {
30 |
31 | this.maPN = maPN;
32 | this.maNCC = maNCC;
33 | this.maNV = maNV;
34 | this.ngayNhap = ngayNhap;
35 | this.gioNhap = gioNhap;
36 | this.tongTien = tongTien;
37 | }
38 |
39 | public String getMaPN() {
40 | return maPN;
41 | }
42 |
43 | public String getMaNCC() {
44 | return maNCC;
45 | }
46 |
47 | public String getMaNV() {
48 | return maNV;
49 | }
50 |
51 | public LocalDate getNgayNhap() {
52 | return ngayNhap;
53 | }
54 |
55 | public LocalTime getGioNhap() {
56 | return gioNhap;
57 | }
58 |
59 | public Float getTongTien() {
60 | return tongTien;
61 | }
62 |
63 | public void setMaPN(String maPN) {
64 | this.maPN = maPN;
65 | }
66 |
67 | public void setMaNCC(String maNCC) {
68 | this.maNCC = maNCC;
69 | }
70 |
71 | public void setMaNV(String maNV) {
72 | this.maNV = maNV;
73 | }
74 |
75 | public void setNgayNhap(LocalDate ngayNhap) {
76 | this.ngayNhap = ngayNhap;
77 | }
78 |
79 | public void setGioNhap(LocalTime gioNhap) {
80 | this.gioNhap = gioNhap;
81 | }
82 |
83 | public void setTongTien(float tongTien) {
84 | this.tongTien = tongTien;
85 | }
86 |
87 | }
88 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/BackEnd/QuanLyPhieuNhap/QuanLyPhieuNhapDAO.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package giaodienchuan.model.BackEnd.QuanLyPhieuNhap;
7 |
8 | import giaodienchuan.model.BackEnd.ConnectionDB.ConnectionDB;
9 | import java.sql.ResultSet;
10 | import java.sql.SQLException;
11 | import java.time.LocalDate;
12 | import java.time.LocalTime;
13 | import java.util.ArrayList;
14 | import javax.swing.JOptionPane;
15 |
16 | /**
17 | *
18 | * @author Admin
19 | */
20 | public class QuanLyPhieuNhapDAO {
21 |
22 | ConnectionDB connection;
23 |
24 | public QuanLyPhieuNhapDAO() {
25 | }
26 |
27 | public ArrayList readDB() {
28 | connection = new ConnectionDB();
29 | ArrayList dspn = new ArrayList<>();
30 | try {
31 | String qry = "SELECT * FROM phieunhap";
32 | ResultSet rs = connection.sqlQuery(qry);
33 | if (rs != null) {
34 |
35 | while (rs.next()) {
36 | PhieuNhap pn = new PhieuNhap();
37 |
38 | pn.setMaPN(rs.getString(1));
39 | pn.setMaNCC(rs.getString(2));
40 | pn.setMaNV(rs.getString(3));
41 | pn.setNgayNhap(rs.getDate(4).toLocalDate());
42 | pn.setGioNhap(rs.getTime(5).toLocalTime());
43 | pn.setTongTien(rs.getFloat(6));
44 | dspn.add(pn);
45 | }
46 | }
47 | } catch (SQLException e) {
48 | JOptionPane.showMessageDialog(null, "Khong tim thay du lieu !!");
49 | } finally {
50 | connection.closeConnect();
51 | }
52 | return dspn;
53 | }
54 |
55 | public Boolean add(PhieuNhap pn) {
56 | connection = new ConnectionDB();
57 | Boolean ok = connection.sqlUpdate("INSERT INTO phieunhap(MaPN,MaNCC,MaNV,NgayNhap,GioNhap,TongTien) VALUES ('"
58 | + pn.getMaPN() + "','"
59 | + pn.getMaNCC() + "','"
60 | + pn.getMaNV() + "','"
61 | + pn.getNgayNhap() + "','"
62 | + pn.getGioNhap() + "','"
63 | + pn.getTongTien() + "');");
64 | connection.closeConnect();
65 | return ok;
66 | }
67 |
68 | public Boolean delete(String mapn) {
69 | connection = new ConnectionDB();
70 | if (!connection.sqlUpdate("DELETE FROM phieunhap WHERE MaPN='" + mapn + "';")) {
71 | JOptionPane.showMessageDialog(null, "Vui long xoa het chi tiet cua phiếu nhập truoc !!!");
72 | connection.closeConnect();
73 | return false;
74 | }
75 | connection.closeConnect();
76 | return false;
77 | }
78 |
79 | public Boolean update(PhieuNhap pn) {
80 | connection = new ConnectionDB();
81 | Boolean ok = connection.sqlUpdate("UPDATE phieunhap SET "
82 | + "MaNCC='" + pn.getMaNCC()
83 | + "', MaNV='" + pn.getMaNV()
84 | + "', NgayNhap='" + pn.getNgayNhap()
85 | + "', GioNhap='" + pn.getGioNhap()
86 | + "', TongTien='" + pn.getTongTien()
87 | + "' WHERE MaPN='" + pn.getMaPN() + "';");
88 | connection.closeConnect();
89 | return ok;
90 | }
91 |
92 | public Boolean updateTongTien(String _mapn, float _tongTien) {
93 | connection = new ConnectionDB();
94 | Boolean ok = connection.sqlUpdate("UPDATE phieunhap SET TongTien='" + _tongTien + "' WHERE MaPN='" + _mapn + "';");
95 | connection.closeConnect();
96 | return ok;
97 | }
98 |
99 | public Boolean update(String maPN, String maNCC, String maNV, LocalDate ngayNhap, LocalTime gioNhap, float tongTien) {
100 | PhieuNhap pn = new PhieuNhap();
101 | pn.setMaPN(maPN);
102 | pn.setMaNCC(maNCC);
103 | pn.setMaNV(maNV);
104 | pn.setNgayNhap(ngayNhap);
105 | pn.setGioNhap(gioNhap);
106 | pn.setTongTien(tongTien);
107 | return update(pn);
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/BackEnd/QuanLyQuyen/QuanLyQuyenBUS.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.BackEnd.QuanLyQuyen;
2 |
3 | import java.util.ArrayList;
4 |
5 | public class QuanLyQuyenBUS {
6 |
7 | private ArrayList dsq = new ArrayList<>();
8 | QuanLyQuyenDAO qlqDAO = new QuanLyQuyenDAO();
9 |
10 | public QuanLyQuyenBUS() {
11 | dsq = qlqDAO.readDB();
12 | }
13 |
14 | public void showConsole() {
15 | dsq.forEach((q) -> {
16 | System.out.print(q.getMaQuyen() + " ");
17 | System.out.print(q.getChiTietQuyen());
18 | });
19 | }
20 |
21 | public String[] getHeaders() {
22 | return new String[]{"Mã quyền", "Tên quyền", "Chi tiết quyền"};
23 | }
24 |
25 | public void readDB() {
26 | dsq = qlqDAO.readDB();
27 | }
28 |
29 | public String getNextID() {
30 | return "Q" + String.valueOf(this.dsq.size() + 1);
31 | }
32 |
33 | public Quyen getQuyen(String maquyen) {
34 | for (Quyen q : dsq) {
35 | if (q.getMaQuyen().equals(maquyen)) {
36 | return q;
37 | }
38 | }
39 | return null;
40 | }
41 |
42 | public ArrayList search(String value, String type) {
43 | ArrayList result = new ArrayList<>();
44 |
45 | dsq.forEach((q) -> {
46 | if (type.equals("Tất cả")) {
47 | if (q.getMaQuyen().toLowerCase().contains(value.toLowerCase())
48 | || q.getTenQuyen().toLowerCase().contains(value.toLowerCase())
49 | || q.getChiTietQuyen().toLowerCase().contains(value.toLowerCase())) {
50 | result.add(q);
51 | }
52 | } else {
53 | switch (type) {
54 | case "Mã quyền":
55 | if (q.getMaQuyen().toLowerCase().contains(value.toLowerCase())) {
56 | result.add(q);
57 | }
58 | break;
59 | case "Tên quyền":
60 | if (q.getTenQuyen().toLowerCase().contains(value.toLowerCase())) {
61 | result.add(q);
62 | }
63 | break;
64 | case "Chi tiết quyền":
65 | if (q.getChiTietQuyen().toLowerCase().contains(value.toLowerCase())) {
66 | result.add(q);
67 | }
68 | break;
69 | }
70 | }
71 |
72 | });
73 |
74 | return result;
75 | }
76 |
77 | public Boolean add(Quyen sp) {
78 | Boolean ok = qlqDAO.add(sp);
79 |
80 | if (ok) {
81 | dsq.add(sp);
82 | }
83 | return ok;
84 | }
85 |
86 | public Boolean add(String maquyen, String tenquyen, String chitiet) {
87 | Quyen sp = new Quyen(maquyen, tenquyen, chitiet);
88 | return add(sp);
89 | }
90 |
91 | public Boolean delete(String maquyen) {
92 | Boolean ok = qlqDAO.delete(maquyen);
93 |
94 | if (ok) {
95 | for (int i = (dsq.size() - 1); i >= 0; i--) {
96 | if (dsq.get(i).getMaQuyen().equals(maquyen)) {
97 | dsq.remove(i);
98 | }
99 | }
100 | }
101 | return ok;
102 | }
103 |
104 | public Boolean update(String maquyen, String tenquyen, String chitiet) {
105 | Boolean ok = qlqDAO.update(maquyen, tenquyen, chitiet);
106 |
107 | if (ok) {
108 | dsq.forEach((q) -> {
109 | if (q.getMaQuyen().equals(maquyen)) {
110 | q.setTenQuyen(tenquyen);
111 | q.setChiTietQuyen(chitiet);
112 | }
113 | });
114 | }
115 |
116 | return ok;
117 | }
118 |
119 | public ArrayList getDsq() {
120 | return dsq;
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/BackEnd/QuanLyQuyen/QuanLyQuyenDAO.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.BackEnd.QuanLyQuyen;
2 |
3 | import giaodienchuan.model.BackEnd.ConnectionDB.ConnectionDB;
4 | import java.sql.ResultSet;
5 | import java.sql.SQLException;
6 | import java.util.ArrayList;
7 | import javax.swing.JOptionPane;
8 |
9 | public class QuanLyQuyenDAO {
10 |
11 | ConnectionDB qlqConnection;
12 |
13 | public QuanLyQuyenDAO() {
14 |
15 | }
16 |
17 | public ArrayList readDB() {
18 | qlqConnection = new ConnectionDB();
19 | ArrayList dsq = new ArrayList<>();
20 | try {
21 | String qry = "SELECT * FROM phanquyen";
22 | ResultSet r = qlqConnection.sqlQuery(qry);
23 | if (r != null) {
24 | while (r.next()) {
25 | String maq = r.getString("MaQuyen");
26 | String tenq = r.getString("TenQuyen");
27 | String chitietq = r.getString("ChiTietQuyen");
28 |
29 | dsq.add(new Quyen(maq, tenq, chitietq));
30 | }
31 | }
32 |
33 | } catch (SQLException ex) {
34 | JOptionPane.showMessageDialog(null, "-- ERROR! Lỗi đọc dữ liệu bảng phân quyền");
35 | } finally {
36 | qlqConnection.closeConnect();
37 | }
38 | return dsq;
39 | }
40 |
41 | public ArrayList search(String columnName, String value) {
42 | qlqConnection = new ConnectionDB();
43 | ArrayList dsq = new ArrayList<>();
44 |
45 | try {
46 | String qry = "SELECT * FROM phanquyen WHERE " + columnName + " LIKE '%" + value + "%'";
47 | ResultSet r = qlqConnection.sqlQuery(qry);
48 | if (r != null) {
49 | while (r.next()) {
50 | String maq = r.getString("MaQuyen");
51 | String tenq = r.getString("TenQuyen");
52 | String chitietq = r.getString("ChiTietQuyen");
53 |
54 | dsq.add(new Quyen(maq, tenq, chitietq));
55 | }
56 | }
57 |
58 | } catch (SQLException ex) {
59 | JOptionPane.showMessageDialog(null, "-- ERROR! Lỗi tìm dữ liệu " + columnName + " = " + value + " bảng phân quyền");
60 | } finally {
61 | qlqConnection.closeConnect();
62 | }
63 |
64 | return dsq;
65 | }
66 |
67 | public Boolean add(Quyen q) {
68 | qlqConnection = new ConnectionDB();
69 | Boolean ok = qlqConnection.sqlUpdate("INSERT INTO `phanquyen` (`MaQuyen`, `TenQuyen`, `ChiTietQuyen`) VALUES ('"
70 | + q.getMaQuyen()+ "', '"
71 | + q.getTenQuyen()+ "', '"
72 | + q.getChiTietQuyen()+ "');");
73 | qlqConnection.closeConnect();
74 | return ok;
75 | }
76 |
77 | public Boolean delete(String maq) {
78 | qlqConnection = new ConnectionDB();
79 | Boolean ok = qlqConnection.sqlUpdate("DELETE FROM `phanquyen` WHERE `phanquyen`.`MaQuyen` = '" + maq + "'");
80 | qlqConnection.closeConnect();
81 | return ok;
82 | }
83 |
84 | public Boolean update(String maq, String tenquyen, String chitietquyen) {
85 | qlqConnection = new ConnectionDB();
86 | Boolean ok = qlqConnection.sqlUpdate("Update phanquyen Set "
87 | + "TenQuyen='" + tenquyen
88 | + "',ChiTietQuyen='" + chitietquyen
89 | + "' where MaQuyen='" + maq + "';");
90 | qlqConnection.closeConnect();
91 | return ok;
92 | }
93 |
94 | public void close() {
95 | qlqConnection.closeConnect();
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/BackEnd/QuanLyQuyen/Quyen.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.BackEnd.QuanLyQuyen;
2 |
3 | public class Quyen {
4 |
5 | String MaQuyen, TenQuyen, ChiTietQuyen;
6 |
7 | public Quyen(String maquyen, String tenquyen, String chitietquyen) {
8 | this.MaQuyen = maquyen;
9 | this.TenQuyen = tenquyen;
10 | this.ChiTietQuyen = chitietquyen;
11 | }
12 |
13 | public String getTenQuyen() {
14 | return TenQuyen;
15 | }
16 |
17 | public void setTenQuyen(String TenQuyen) {
18 | this.TenQuyen = TenQuyen;
19 | }
20 |
21 | public String getMaQuyen() {
22 | return MaQuyen;
23 | }
24 |
25 | public void setMaQuyen(String MaQuyen) {
26 | this.MaQuyen = MaQuyen;
27 | }
28 |
29 | public String getChiTietQuyen() {
30 | return ChiTietQuyen;
31 | }
32 |
33 | public void setChiTietQuyen(String ChiTietQuyen) {
34 | this.ChiTietQuyen = ChiTietQuyen;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/BackEnd/QuanLySanPham/SanPham.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.BackEnd.QuanLySanPham;
2 |
3 | public class SanPham {
4 |
5 | String MaSP, MaLSP, TenSP, fileNameHinhAnh;
6 | float DonGia;
7 | int SoLuong, TrangThai;
8 |
9 | public SanPham(String MaSP, String MaLSP, String TenSP, float DonGia, int SoLuong, String url, int TrangThai) {
10 | this.MaSP = MaSP;
11 | this.MaLSP = MaLSP;
12 | this.TenSP = TenSP;
13 | this.DonGia = DonGia;
14 | this.SoLuong = SoLuong;
15 | this.fileNameHinhAnh = url;
16 | this.TrangThai = TrangThai;
17 | }
18 |
19 | public String getFileNameHinhAnh() {
20 | return fileNameHinhAnh;
21 | }
22 |
23 | public void setFileNameHinhAnh(String fileNameHinhAnh) {
24 | this.fileNameHinhAnh = fileNameHinhAnh;
25 | }
26 |
27 | public String getMaSP() {
28 | return MaSP;
29 | }
30 |
31 | public void setMaSP(String MaSP) {
32 | this.MaSP = MaSP;
33 | }
34 |
35 | public String getMaLSP() {
36 | return MaLSP;
37 | }
38 |
39 | public void setMaLSP(String MaLSP) {
40 | this.MaLSP = MaLSP;
41 | }
42 |
43 | public String getTenSP() {
44 | return TenSP;
45 | }
46 |
47 | public void setTenSP(String TenSP) {
48 | this.TenSP = TenSP;
49 | }
50 |
51 | public float getDonGia() {
52 | return DonGia;
53 | }
54 |
55 | public void setDonGia(float DonGia) {
56 | this.DonGia = DonGia;
57 | }
58 |
59 | public int getSoLuong() {
60 | return SoLuong;
61 | }
62 |
63 | public void setSoLuong(int SoLuong) {
64 | this.SoLuong = SoLuong;
65 | }
66 |
67 | public int getTrangThai() {
68 | return TrangThai;
69 | }
70 |
71 | public void setTrangThai(int TrangThai) {
72 | this.TrangThai = TrangThai;
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/BackEnd/QuanLyTaiKhoan/QuanLyTaiKhoanBUS.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.BackEnd.QuanLyTaiKhoan;
2 |
3 | import java.util.ArrayList;
4 |
5 | public class QuanLyTaiKhoanBUS {
6 |
7 | private ArrayList dstk = new ArrayList<>();
8 | QuanLyTaiKhoanDAO qltkDAO = new QuanLyTaiKhoanDAO();
9 |
10 | public QuanLyTaiKhoanBUS() {
11 | dstk = qltkDAO.readDB();
12 | }
13 |
14 | public void showConsole() {
15 | dstk.forEach((tk) -> {
16 | System.out.print(tk.getUsername() + " ");
17 | System.out.print(tk.getPassword() + " ");
18 | System.out.println(tk.getMaNV() + " ");
19 | System.out.println(tk.getMaQuyen());
20 | });
21 | }
22 |
23 | public String[] getHeaders() {
24 | return new String[]{"Tên tài khoản", "Mật khẩu", "Mã nhân viên", "Mã quyền"};
25 | }
26 |
27 | public void readDB() {
28 | dstk = qltkDAO.readDB();
29 | }
30 |
31 | public TaiKhoan getTaiKhoan(String tentk) {
32 | for (TaiKhoan tk : dstk) {
33 | if (tk.getUsername().equals(tentk)) {
34 | return tk;
35 | }
36 | }
37 | return null;
38 | }
39 |
40 | public ArrayList search(String value, String type) {
41 | ArrayList result = new ArrayList<>();
42 |
43 | dstk.forEach((tk) -> {
44 | if (type.equals("Tất cả")) {
45 | if (tk.getUsername().toLowerCase().contains(value.toLowerCase())
46 | || tk.getPassword().toLowerCase().contains(value.toLowerCase())
47 | || tk.getMaNV().toLowerCase().contains(value.toLowerCase())
48 | || tk.getMaQuyen().toLowerCase().contains(value.toLowerCase())) {
49 | result.add(tk);
50 | }
51 | } else {
52 | switch (type) {
53 | case "Tên tài khoản":
54 | if (tk.getUsername().toLowerCase().contains(value.toLowerCase())) {
55 | result.add(tk);
56 | }
57 | break;
58 | case "Mật khẩu":
59 | if (tk.getPassword().toLowerCase().contains(value.toLowerCase())) {
60 | result.add(tk);
61 | }
62 | break;
63 | case "Mã nhân viên":
64 | if (tk.getMaNV().toLowerCase().contains(value.toLowerCase())) {
65 | result.add(tk);
66 | }
67 | break;
68 | case "Mã quyền":
69 | if (tk.getMaQuyen().toLowerCase().contains(value.toLowerCase())) {
70 | result.add(tk);
71 | }
72 | break;
73 | }
74 | }
75 |
76 | });
77 |
78 | return result;
79 | }
80 |
81 | public Boolean add(TaiKhoan tk) {
82 | Boolean ok = qltkDAO.add(tk);
83 |
84 | if (ok) {
85 | dstk.add(tk);
86 | }
87 | return ok;
88 | }
89 |
90 | public Boolean add(String username, String pass, String maNV, String maQuyen) {
91 | TaiKhoan tk = new TaiKhoan(username, pass, maNV, maQuyen);
92 | return add(tk);
93 | }
94 |
95 | public Boolean delete(String username) {
96 | Boolean ok = qltkDAO.delete(username);
97 |
98 | if (ok) {
99 | for (int i = (dstk.size() - 1); i >= 0; i--) {
100 | if (dstk.get(i).getUsername().equals(username)) {
101 | dstk.remove(i);
102 | }
103 | }
104 | }
105 | return ok;
106 | }
107 |
108 | public Boolean update(String username, String pass, String maNV, String maQuyen) {
109 | Boolean ok = qltkDAO.update(username, pass, maNV, maQuyen);
110 |
111 | if (ok) {
112 | dstk.forEach((tk) -> {
113 | if (tk.getUsername().equals(username)) {
114 | tk.setPassword(pass);
115 | tk.setMaNV(maNV);
116 | tk.setMaQuyen(maQuyen);
117 | }
118 | });
119 | }
120 |
121 | return ok;
122 | }
123 |
124 | public ArrayList getDstk() {
125 | return dstk;
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/BackEnd/QuanLyTaiKhoan/QuanLyTaiKhoanDAO.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.BackEnd.QuanLyTaiKhoan;
2 |
3 | import giaodienchuan.model.BackEnd.ConnectionDB.ConnectionDB;
4 | import java.sql.ResultSet;
5 | import java.sql.SQLException;
6 | import java.util.ArrayList;
7 | import javax.swing.JOptionPane;
8 |
9 | public class QuanLyTaiKhoanDAO {
10 |
11 | ConnectionDB qltkConnectiion;
12 |
13 | public QuanLyTaiKhoanDAO() {
14 |
15 | }
16 |
17 | public ArrayList readDB() {
18 | qltkConnectiion = new ConnectionDB();
19 | ArrayList dstk = new ArrayList<>();
20 | try {
21 | String qry = "SELECT * FROM taikhoan";
22 | ResultSet r = qltkConnectiion.sqlQuery(qry);
23 | if (r != null) {
24 | while (r.next()) {
25 | String ten = r.getString("TenTaiKhoan");
26 | String pass = r.getString("MatKhau");
27 | String manv = r.getString("MaNV");
28 | String maquyen = r.getString("MaQuyen");
29 |
30 | dstk.add(new TaiKhoan(ten, pass, manv, maquyen));
31 | }
32 | }
33 |
34 | } catch (SQLException ex) {
35 | JOptionPane.showMessageDialog(null, "-- ERROR! Lỗi đọc dữ liệu bảng tài khoản");
36 | } finally {
37 | qltkConnectiion.closeConnect();
38 | }
39 | return dstk;
40 | }
41 |
42 | public Boolean add(TaiKhoan tk) {
43 | qltkConnectiion = new ConnectionDB();
44 | Boolean ok = qltkConnectiion.sqlUpdate("INSERT INTO `taikhoan` (`TenTaiKhoan`, `MatKhau`, `MaNV`, `MAQuyen`) VALUES ('"
45 | + tk.getUsername() + "', '" + tk.getPassword() + "', '" + tk.getMaNV() + "', '" + tk.getMaQuyen() + "');");
46 | qltkConnectiion.closeConnect();
47 | return ok;
48 | }
49 |
50 | public Boolean delete(String username) {
51 | qltkConnectiion = new ConnectionDB();
52 | Boolean ok = qltkConnectiion.sqlUpdate("DELETE FROM `taikhoan` WHERE `taikhoan`.`TenTaiKhoan` = '" + username + "'");
53 | qltkConnectiion.closeConnect();
54 | return ok;
55 | }
56 |
57 | public Boolean update(String username, String pass, String maNV, String maQuyen) {
58 | qltkConnectiion = new ConnectionDB();
59 | Boolean ok = qltkConnectiion.sqlUpdate("Update taikhoan Set MatKhau='" + pass + "',MaNV='" + maNV
60 | + "',MaQuyen='" + maQuyen + "' where TenTaiKhoan='" + username + "'");
61 | qltkConnectiion.closeConnect();
62 | return ok;
63 | }
64 |
65 | public void close() {
66 | qltkConnectiion.closeConnect();
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/BackEnd/QuanLyTaiKhoan/TaiKhoan.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.BackEnd.QuanLyTaiKhoan;
2 |
3 | public class TaiKhoan {
4 | String username, password, maNV, maQuyen;
5 |
6 | public TaiKhoan(String username, String password, String maNV, String maQuyen) {
7 | this.username = username;
8 | this.password = password;
9 | this.maNV = maNV;
10 | this.maQuyen = maQuyen;
11 | }
12 |
13 | public String getMaNV() {
14 | return maNV;
15 | }
16 |
17 | public void setMaNV(String maNV) {
18 | this.maNV = maNV;
19 | }
20 |
21 | public String getUsername() {
22 | return username;
23 | }
24 |
25 | public void setUsername(String username) {
26 | this.username = username;
27 | }
28 |
29 | public String getPassword() {
30 | return password;
31 | }
32 |
33 | public void setPassword(String password) {
34 | this.password = password;
35 | }
36 |
37 | public String getMaQuyen() {
38 | return maQuyen;
39 | }
40 |
41 | public void setMaQuyen(String maQuyen) {
42 | this.maQuyen = maQuyen;
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/BackEnd/ReadWriteFile/WorkWithFile.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package giaodienchuan.model.BackEnd.ReadWriteFile;
7 |
8 | import java.io.DataInputStream;
9 | import java.io.DataOutputStream;
10 | import java.io.FileInputStream;
11 | import java.io.FileNotFoundException;
12 | import java.io.FileOutputStream;
13 | import java.io.IOException;
14 | import java.util.logging.Level;
15 | import java.util.logging.Logger;
16 |
17 | /**
18 | *
19 | * @author DELL
20 | */
21 | public class WorkWithFile {
22 |
23 | String urlFile;
24 |
25 | public WorkWithFile(String urlFile) {
26 | this.urlFile = urlFile;
27 | }
28 |
29 | public void write(String s) {
30 | try (DataOutputStream os = new DataOutputStream(new FileOutputStream(this.urlFile, false))) {
31 | os.writeUTF(s);
32 |
33 | } catch (FileNotFoundException ex) {
34 | Logger.getLogger(WorkWithFile.class.getName()).log(Level.SEVERE, null, ex);
35 | } catch (IOException ex) {
36 | Logger.getLogger(WorkWithFile.class.getName()).log(Level.SEVERE, null, ex);
37 | }
38 | }
39 |
40 | public String read() {
41 | String result = "";
42 | try (DataInputStream os = new DataInputStream(new FileInputStream(this.urlFile))) {
43 | result += os.readUTF();
44 |
45 | } catch (FileNotFoundException ex) {
46 | Logger.getLogger(WorkWithFile.class.getName()).log(Level.SEVERE, null, ex);
47 | } catch (IOException ex) {
48 | Logger.getLogger(WorkWithFile.class.getName()).log(Level.SEVERE, null, ex);
49 | }
50 |
51 | return result;
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/BackEnd/WorkWithExcel/MyJOptionPane.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package giaodienchuan.model.BackEnd.WorkWithExcel;
7 |
8 | import giaodienchuan.model.FrontEnd.GiaoDienChuan.MyTable;
9 | import java.awt.BorderLayout;
10 | import javax.swing.BorderFactory;
11 | import javax.swing.JComboBox;
12 | import javax.swing.JOptionPane;
13 | import javax.swing.JPanel;
14 |
15 | /**
16 | *
17 | * @author DELL
18 | */
19 | public class MyJOptionPane extends JOptionPane {
20 |
21 | JComboBox cb = new JComboBox<>(new String[] {"Ghi đè", "Bỏ qua", "Ghi đè tất cả", "Bỏ qua tất cả"});
22 | JPanel pl = new JPanel();
23 |
24 | public MyJOptionPane(MyTable mtb, String defaultSelect) {
25 | cb.setBorder(BorderFactory.createTitledBorder("Hành động:"));
26 | cb.setSelectedItem(defaultSelect);
27 | mtb.resizeColumnWidth();
28 |
29 | pl.setLayout(new BorderLayout());
30 | pl.add(mtb, BorderLayout.CENTER);
31 | pl.add(cb, BorderLayout.SOUTH);
32 |
33 | this.showMessageDialog(null, pl, "Trùng mã", QUESTION_MESSAGE);
34 | }
35 |
36 | public String getAnswer() {
37 | return cb.getSelectedItem().toString();
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/FormChon/ChonKhachHangForm.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.FormChon;
2 |
3 | import giaodienchuan.model.FrontEnd.FormHienThi.HienThiKhachHang;
4 | import java.awt.BorderLayout;
5 | import java.awt.event.ActionEvent;
6 | import javax.swing.ImageIcon;
7 | import javax.swing.JButton;
8 | import javax.swing.JFrame;
9 | import javax.swing.JOptionPane;
10 | import javax.swing.JPanel;
11 | import javax.swing.JTextField;
12 |
13 | public class ChonKhachHangForm extends JFrame {
14 |
15 | HienThiKhachHang formHienThi = new HienThiKhachHang();
16 |
17 | JButton btnOK = new JButton("Chọn");
18 | JButton btnCancel = new JButton("Thoát");
19 | JTextField txTarget;
20 |
21 | public ChonKhachHangForm(JTextField _txTarget) {
22 | this.setTitle("Chọn khách hàng");
23 | this.setLayout(new BorderLayout());
24 | this.setSize(1200 - 200, 600);
25 | this.setLocationRelativeTo(null);
26 | this.txTarget = _txTarget;
27 |
28 | // ======= Buttons Panel ===========
29 | btnCancel.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_cancel_30px_1.png")));
30 | btnOK.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_ok_30px.png")));
31 |
32 | JPanel plBtns = new JPanel();
33 | plBtns.add(btnOK);
34 | plBtns.add(btnCancel);
35 |
36 | this.add(formHienThi, BorderLayout.CENTER);
37 | this.add(plBtns, BorderLayout.SOUTH);
38 | this.setVisible(true);
39 |
40 | // actionlistener
41 | btnOK.addActionListener((ActionEvent ae) -> {
42 | String makh = formHienThi.getSelectedRow(1);
43 | if (makh != null) {
44 | this.txTarget.setText(makh);
45 | this.dispose();
46 |
47 | } else {
48 | JOptionPane.showMessageDialog(this, "Chưa chọn khách hàng nào!");
49 | }
50 | });
51 |
52 | btnCancel.addActionListener((ae) -> {
53 | this.dispose();
54 | });
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/FormChon/ChonKhuyenMaiForm.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package giaodienchuan.model.FrontEnd.FormChon;
7 |
8 | import giaodienchuan.model.FrontEnd.FormHienThi.HienThiKhuyenMai;
9 | import java.awt.BorderLayout;
10 | import java.awt.event.ActionEvent;
11 | import javax.swing.ImageIcon;
12 | import javax.swing.JButton;
13 | import javax.swing.JFrame;
14 | import javax.swing.JOptionPane;
15 | import javax.swing.JPanel;
16 | import javax.swing.JTextField;
17 |
18 | /**
19 | *
20 | * @author DELL
21 | */
22 | public class ChonKhuyenMaiForm extends JFrame {
23 |
24 | HienThiKhuyenMai formHienThi = new HienThiKhuyenMai();
25 |
26 | JButton btnOK = new JButton("Chọn");
27 | JButton btnCancel = new JButton("Thoát");
28 | JTextField txTarget;
29 |
30 | public ChonKhuyenMaiForm(JTextField _txTarget) {
31 | this.setTitle("Chọn khuyến mãi");
32 | this.setLayout(new BorderLayout());
33 | this.setSize(1200 - 200, 600);
34 | this.setLocationRelativeTo(null);
35 | this.txTarget = _txTarget;
36 |
37 | // ======= Buttons Panel ===========
38 | btnCancel.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_cancel_30px_1.png")));
39 | btnOK.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_ok_30px.png")));
40 |
41 | JPanel plBtns = new JPanel();
42 | plBtns.add(btnOK);
43 | plBtns.add(btnCancel);
44 |
45 | this.add(formHienThi, BorderLayout.CENTER);
46 | this.add(plBtns, BorderLayout.SOUTH);
47 | this.setVisible(true);
48 |
49 | // actionlistener
50 | btnOK.addActionListener((ActionEvent ae) -> {
51 | String makm = formHienThi.getSelectedRow(1);
52 | if (makm != null) {
53 | this.txTarget.setText(makm);
54 | this.dispose();
55 |
56 | } else {
57 | JOptionPane.showMessageDialog(this, "Chưa chọn khuyến mãi nào!");
58 | }
59 | });
60 |
61 | btnCancel.addActionListener((ae) -> {
62 | this.dispose();
63 | });
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/FormChon/ChonLoaiSanPhamForm.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.FormChon;
2 |
3 | import giaodienchuan.model.FrontEnd.FormHienThi.HienThiLoaiSanPham;
4 | import java.awt.BorderLayout;
5 | import java.awt.event.ActionEvent;
6 | import javax.swing.ImageIcon;
7 | import javax.swing.JButton;
8 | import javax.swing.JFrame;
9 | import javax.swing.JOptionPane;
10 | import javax.swing.JPanel;
11 | import javax.swing.JTextField;
12 |
13 | public class ChonLoaiSanPhamForm extends JFrame {
14 |
15 | HienThiLoaiSanPham formHienThi = new HienThiLoaiSanPham();
16 |
17 | JButton btnOK = new JButton("Chọn");
18 | JButton btnCancel = new JButton("Thoát");
19 | JTextField txTarget;
20 |
21 | public ChonLoaiSanPhamForm(JTextField _txTarget) {
22 | this.setTitle("Chọn Loại Sản Phẩm");
23 | this.setLayout(new BorderLayout());
24 | this.setSize(1200 - 200, 600);
25 | this.setLocationRelativeTo(null);
26 | this.txTarget = _txTarget;
27 |
28 | // ======= Buttons Panel ===========
29 | btnCancel.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_cancel_30px_1.png")));
30 | btnOK.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_ok_30px.png")));
31 |
32 | JPanel plBtns = new JPanel();
33 | plBtns.add(btnOK);
34 | plBtns.add(btnCancel);
35 |
36 | this.add(formHienThi, BorderLayout.CENTER);
37 | this.add(plBtns, BorderLayout.SOUTH);
38 | this.setVisible(true);
39 |
40 | // actionlistener
41 | btnOK.addActionListener((ActionEvent ae) -> {
42 | String masp = formHienThi.getSelectedRow(1);
43 | if (masp != null) {
44 | this.txTarget.setText(masp);
45 | this.dispose();
46 |
47 | } else {
48 | JOptionPane.showMessageDialog(this, "Chưa chọn sản phẩm nào!");
49 | }
50 | });
51 |
52 | btnCancel.addActionListener((ae) -> {
53 | this.dispose();
54 | });
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/FormChon/ChonNhaCungCapForm.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package giaodienchuan.model.FrontEnd.FormChon;
7 |
8 | import giaodienchuan.model.FrontEnd.FormHienThi.HienThiNhaCungCap;
9 | import java.awt.BorderLayout;
10 | import java.awt.event.ActionEvent;
11 | import javax.swing.JButton;
12 | import javax.swing.JFrame;
13 | import javax.swing.JTextField;
14 | import javax.swing.ImageIcon;
15 | import javax.swing.JOptionPane;
16 | import javax.swing.JPanel;
17 |
18 | /**
19 | *
20 | * @author Admin
21 | */
22 | public class ChonNhaCungCapForm extends JFrame {
23 |
24 | HienThiNhaCungCap formHienThi = new HienThiNhaCungCap();
25 |
26 | JButton btnOK = new JButton("Chọn");
27 | JButton btnCancel = new JButton("Thoát");
28 | JTextField txTarget;
29 |
30 | public ChonNhaCungCapForm(JTextField _txTarget) {
31 | this.setTitle("Chọn nhà cung cấp");
32 | this.setLayout(new BorderLayout());
33 | this.setSize(1200 - 200, 600);
34 | this.setLocationRelativeTo(null);
35 | this.txTarget = _txTarget;
36 |
37 | // ======= Buttons Panel ===========
38 | btnCancel.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_cancel_30px_1.png")));
39 | btnOK.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_ok_30px.png")));
40 |
41 | JPanel plBtns = new JPanel();
42 | plBtns.add(btnOK);
43 | plBtns.add(btnCancel);
44 |
45 | this.add(formHienThi, BorderLayout.CENTER);
46 | this.add(plBtns, BorderLayout.SOUTH);
47 | this.setVisible(true);
48 |
49 | // actionlistener
50 | btnOK.addActionListener((ActionEvent ae) -> {
51 | String mancc = formHienThi.getSelectedRow(1);
52 | if (mancc != null) {
53 | this.txTarget.setText(mancc);
54 | this.dispose();
55 |
56 | } else {
57 | JOptionPane.showMessageDialog(this, "Chưa chọn nhà cung cấp nào!");
58 | }
59 | });
60 |
61 | btnCancel.addActionListener((ae) -> {
62 | this.dispose();
63 | });
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/FormChon/ChonNhanVienForm.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.FormChon;
2 |
3 |
4 | import giaodienchuan.model.FrontEnd.FormHienThi.HienThiNhanVien;
5 | import java.awt.BorderLayout;
6 | import java.awt.event.ActionEvent;
7 | import javax.swing.ImageIcon;
8 | import javax.swing.JButton;
9 | import javax.swing.JFrame;
10 | import javax.swing.JOptionPane;
11 | import javax.swing.JPanel;
12 | import javax.swing.JTextField;
13 |
14 | public class ChonNhanVienForm extends JFrame {
15 |
16 | HienThiNhanVien formHienThi = new HienThiNhanVien();
17 |
18 | JButton btnOK = new JButton("Chọn");
19 | JButton btnCancel = new JButton("Thoát");
20 | JTextField txMaNV;
21 |
22 | public ChonNhanVienForm(JTextField _txMaNV) {
23 | this.setLayout(new BorderLayout());
24 | this.setTitle("Chọn nhân viên");
25 | this.setSize(1200 - 200, 600);
26 | this.setLocationRelativeTo(null);
27 | this.txMaNV = _txMaNV;
28 |
29 | // ======= Buttons Panel ===========
30 | btnCancel.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_cancel_30px_1.png")));
31 | btnOK.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_ok_30px.png")));
32 |
33 | JPanel plBtns = new JPanel();
34 | plBtns.add(btnOK);
35 | plBtns.add(btnCancel);
36 |
37 | this.add(formHienThi, BorderLayout.CENTER);
38 | this.add(plBtns, BorderLayout.SOUTH);
39 | this.setVisible(true);
40 |
41 | btnOK.addActionListener((ActionEvent ae) -> {
42 | String manv = formHienThi.getSelectedRow(1);
43 | if (manv != null) {
44 | this.txMaNV.setText(manv);
45 | this.dispose();
46 |
47 | } else {
48 | JOptionPane.showMessageDialog(this, "Chưa chọn nhân viên nào!");
49 | }
50 | });
51 |
52 | btnCancel.addActionListener((ae) -> {
53 | this.dispose();
54 | });
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/FormChon/ChonQuyenForm.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.FormChon;
2 |
3 | import giaodienchuan.model.FrontEnd.FormHienThi.HienThiQuyen;
4 | import java.awt.BorderLayout;
5 | import java.awt.event.ActionEvent;
6 | import javax.swing.ImageIcon;
7 | import javax.swing.JButton;
8 | import javax.swing.JFrame;
9 | import javax.swing.JOptionPane;
10 | import javax.swing.JPanel;
11 | import javax.swing.JTextField;
12 |
13 | public class ChonQuyenForm extends JFrame {
14 | HienThiQuyen formHienThi = new HienThiQuyen();
15 |
16 | JButton btnOK = new JButton("Chọn");
17 | JButton btnCancel = new JButton("Thoát");
18 | JTextField txMaQuyen;
19 | JTextField txChiTietQuyen;
20 |
21 | public ChonQuyenForm(JTextField _txMaQuyen, JTextField _txChiTietQuyen) {
22 | this.setLayout(new BorderLayout());
23 | this.setTitle("Chọn quyền");
24 | this.setSize(1200 - 200, 600);
25 | this.setLocationRelativeTo(null);
26 | this.txMaQuyen = _txMaQuyen;
27 | this.txChiTietQuyen = _txChiTietQuyen;
28 |
29 | // ======= Buttons Panel ===========
30 | btnCancel.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_cancel_30px_1.png")));
31 | btnOK.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_ok_30px.png")));
32 |
33 | JPanel plBtns = new JPanel();
34 | plBtns.add(btnOK);
35 | plBtns.add(btnCancel);
36 |
37 | this.add(formHienThi, BorderLayout.CENTER);
38 | this.add(plBtns, BorderLayout.SOUTH);
39 | this.setVisible(true);
40 |
41 | btnOK.addActionListener((ActionEvent ae) -> {
42 | String maq = formHienThi.getSelectedRow(1);
43 | String chitietquyen = formHienThi.getSelectedRow(2);
44 | if (maq != null) {
45 | if (this.txMaQuyen != null) {
46 | this.txMaQuyen.setText(maq);
47 | }
48 | if (this.txChiTietQuyen != null) {
49 | this.txChiTietQuyen.setText(chitietquyen);
50 | }
51 | this.dispose();
52 | } else {
53 | JOptionPane.showMessageDialog(this, "Chưa chọn quyền nào!");
54 | }
55 |
56 | });
57 |
58 | btnCancel.addActionListener((ae) -> {
59 | this.dispose();
60 | });
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/FormChon/ChonSanPhamForm.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.FormChon;
2 |
3 | import giaodienchuan.model.FrontEnd.FormHienThi.HienThiSanPham;
4 | import java.awt.BorderLayout;
5 | import java.awt.event.ActionEvent;
6 | import javax.swing.ImageIcon;
7 | import javax.swing.JButton;
8 | import javax.swing.JFrame;
9 | import javax.swing.JOptionPane;
10 | import javax.swing.JPanel;
11 | import javax.swing.JTextField;
12 |
13 | public class ChonSanPhamForm extends JFrame {
14 |
15 | HienThiSanPham formHienThi = new HienThiSanPham();
16 |
17 | JButton btnOK = new JButton("Chọn");
18 | JButton btnCancel = new JButton("Thoát");
19 | JTextField txMasp;
20 | JTextField txMalsp;
21 | JTextField txTensp;
22 | JTextField txDonGia;
23 | JTextField txSoluong;
24 |
25 | public ChonSanPhamForm(JTextField _masp, JTextField _malsp, JTextField _tensp, JTextField _donGia, JTextField _soLuong) {
26 | this.setLayout(new BorderLayout());
27 | this.setTitle("Chọn Sản Phẩm");
28 | this.setSize(1200 - 200, 800);
29 | this.setLocationRelativeTo(null);
30 | this.txMasp = _masp;
31 | this.txMalsp = _malsp;
32 | this.txTensp = _tensp;
33 | this.txDonGia = _donGia;
34 | this.txSoluong = _soLuong;
35 |
36 | // ======= Buttons Panel ===========
37 | btnCancel.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_cancel_30px_1.png")));
38 | btnOK.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_ok_30px.png")));
39 |
40 | JPanel plBtns = new JPanel();
41 | plBtns.add(btnOK);
42 | plBtns.add(btnCancel);
43 |
44 | this.add(formHienThi, BorderLayout.CENTER);
45 | this.add(plBtns, BorderLayout.SOUTH);
46 | this.setVisible(true);
47 |
48 | btnOK.addActionListener((ActionEvent ae) -> {
49 | if (formHienThi.getSelectedRow(1) != null) {
50 | if (this.txMasp != null) {
51 | this.txMasp.setText(formHienThi.getSelectedRow(1));
52 | }
53 | if (this.txMalsp != null) {
54 | this.txMalsp.setText(formHienThi.getSelectedRow(2));
55 | }
56 | if (this.txTensp != null) {
57 | this.txTensp.setText(formHienThi.getSelectedRow(3));
58 | }
59 | if (this.txDonGia != null) {
60 | this.txDonGia.setText(formHienThi.getSelectedRow(4));
61 | }
62 | if (this.txSoluong != null) {
63 | this.txSoluong.setText(formHienThi.getSelectedRow(5));
64 | }
65 | this.dispose();
66 | } else {
67 | JOptionPane.showMessageDialog(this, "Chưa chọn sản phẩm nào!");
68 | }
69 |
70 | });
71 |
72 | btnCancel.addActionListener((ae) -> {
73 | this.dispose();
74 | });
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/FormHienThi/FormHienThi.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package giaodienchuan.model.FrontEnd.FormHienThi;
7 |
8 | import giaodienchuan.model.FrontEnd.GiaoDienChuan.MyTable;
9 | import javax.swing.JPanel;
10 |
11 | /**
12 | *
13 | * @author DELL
14 | */
15 | public class FormHienThi extends JPanel {
16 |
17 | MyTable mtb;
18 |
19 | public FormHienThi() {
20 |
21 | }
22 |
23 | public String getSelectedRow(int col) {
24 | int i = mtb.getTable().getSelectedRow();
25 | if (i >= 0) {
26 | int realI = mtb.getTable().convertRowIndexToModel(i);
27 | return mtb.getModel().getValueAt(realI, col).toString();
28 | }
29 | return null;
30 | }
31 |
32 | public MyTable getTable() {
33 | return this.mtb;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/FormHienThi/HienThiChiTietPN.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package giaodienchuan.model.FrontEnd.FormHienThi;
7 |
8 | import giaodienchuan.model.BackEnd.PriceFormatter;
9 | import giaodienchuan.model.BackEnd.QuanLyChiTietPN.ChiTietPhieuNhap;
10 | import giaodienchuan.model.BackEnd.QuanLyChiTietPN.QuanLyChiTietPhieuNhapBUS;
11 | import giaodienchuan.model.BackEnd.QuanLySanPham.QuanLySanPhamBUS;
12 | import giaodienchuan.model.FrontEnd.GiaoDienChuan.MyTable;
13 | import java.awt.BorderLayout;
14 | import java.awt.event.ActionEvent;
15 | import java.util.ArrayList;
16 | import javax.swing.BorderFactory;
17 | import javax.swing.ImageIcon;
18 | import javax.swing.JButton;
19 | import javax.swing.JComboBox;
20 | import javax.swing.JLabel;
21 | import javax.swing.JPanel;
22 | import javax.swing.JTextField;
23 | import javax.swing.event.DocumentEvent;
24 | import javax.swing.event.DocumentListener;
25 |
26 | /**
27 | *
28 | * @author Admin
29 | */
30 | public class HienThiChiTietPN extends FormHienThi {
31 |
32 | QuanLyChiTietPhieuNhapBUS qlctpn = new QuanLyChiTietPhieuNhapBUS();
33 | QuanLySanPhamBUS qlspBUS = new QuanLySanPhamBUS();
34 |
35 | JTextField txTim = new JTextField(15);
36 | JComboBox cbTypeSearch = new JComboBox(new String[]{"Tất cả", "Mã phiếu nhập", "Mã sản phẩm", "Số lượng", "Đơn giá"});
37 | JButton btnRefresh = new JButton("Làm mới");
38 | String mapn;
39 |
40 | public HienThiChiTietPN(String _mapn) {
41 | setLayout(new BorderLayout());
42 | this.mapn = _mapn;
43 |
44 | mtb = new MyTable();
45 | mtb.setHeaders(new String[]{"STT", "Mã phiếu nhập", "Mã sản phẩm", "Tên sản phẩm", "Số lượng", "Đơn giá", "Thành tiền"});
46 | mtb.setAlignment(0, JLabel.CENTER);
47 | mtb.setAlignment(4, JLabel.CENTER);
48 | mtb.setAlignment(5, JLabel.RIGHT);
49 | mtb.setAlignment(6, JLabel.RIGHT);
50 | mtb.setupSort();
51 | setDataToTable(qlctpn.search("Mã phiếu nhập", this.mapn), mtb);
52 |
53 | JPanel plHeader = new JPanel();
54 | JPanel plTim = new JPanel();
55 | plTim.setBorder(BorderFactory.createTitledBorder("Tìm kiếm"));
56 | txTim.setBorder(BorderFactory.createTitledBorder(" ")); // tạo border rỗng
57 | plTim.add(cbTypeSearch);
58 | plTim.add(txTim);
59 | plHeader.add(plTim);
60 |
61 | btnRefresh.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_data_backup_30px.png")));
62 | plHeader.add(btnRefresh);
63 |
64 | txTim.getDocument().addDocumentListener(new DocumentListener() {
65 | @Override
66 | public void changedUpdate(DocumentEvent e) {
67 | txSearchOnChange();
68 | }
69 |
70 | @Override
71 | public void removeUpdate(DocumentEvent e) {
72 | txSearchOnChange();
73 | }
74 |
75 | @Override
76 | public void insertUpdate(DocumentEvent e) {
77 | txSearchOnChange();
78 | }
79 | });
80 | btnRefresh.addActionListener((ActionEvent ae) -> {
81 | refresh();
82 | });
83 | this.add(plHeader, BorderLayout.NORTH);
84 | this.add(mtb, BorderLayout.CENTER);
85 | }
86 |
87 | public void refresh() {
88 | qlctpn.readDB();
89 | setDataToTable(qlctpn.search("Mã phiếu nhập", this.mapn), mtb);
90 | }
91 |
92 | private void txSearchOnChange() {
93 | setDataToTable(qlctpn.search(cbTypeSearch.getSelectedItem().toString(), txTim.getText()), mtb);
94 | }
95 |
96 | private void setDataToTable(ArrayList data, MyTable mtb) {
97 | mtb.clear();
98 | int stt = 1; // lưu số thứ tự dòng hiện tại
99 | for (ChiTietPhieuNhap pn : data) {
100 | mtb.addRow(new String[]{
101 | String.valueOf(stt),
102 | pn.getMa(),
103 | pn.getMaSP(),
104 | qlspBUS.getSanPham(pn.getMaSP()).getTenSP(),
105 | String.valueOf(pn.getSoLuong()),
106 | PriceFormatter.format(pn.getDonGia()),
107 | PriceFormatter.format(pn.getSoLuong() * pn.getDonGia())
108 | });
109 | stt++;
110 | }
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/FormHienThi/HienThiLoaiSanPham.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.FormHienThi;
2 |
3 | import giaodienchuan.model.BackEnd.QuanLyLoaiSanPham.LoaiSanPham;
4 | import giaodienchuan.model.BackEnd.QuanLyLoaiSanPham.QuanLyLoaiSanPhamBUS;
5 | import giaodienchuan.model.FrontEnd.GiaoDienChuan.MyTable;
6 | import java.awt.BorderLayout;
7 | import java.awt.Dimension;
8 | import java.awt.event.ActionEvent;
9 | import java.util.ArrayList;
10 | import javax.swing.BorderFactory;
11 | import javax.swing.ImageIcon;
12 | import javax.swing.JButton;
13 | import javax.swing.JComboBox;
14 | import javax.swing.JLabel;
15 | import javax.swing.JPanel;
16 | import javax.swing.JTextField;
17 | import javax.swing.event.DocumentEvent;
18 | import javax.swing.event.DocumentListener;
19 |
20 | public class HienThiLoaiSanPham extends FormHienThi {
21 |
22 | QuanLyLoaiSanPhamBUS qllsp = new QuanLyLoaiSanPhamBUS();
23 |
24 | JTextField txTim = new JTextField(15);
25 | JComboBox cbTypeSearch;
26 | JButton btnRefresh = new JButton("Làm mới");
27 |
28 | // index
29 | final int MALSP_I = 1, TENLSP_I = 2, MOTA_I = 3;
30 |
31 | public HienThiLoaiSanPham() {
32 | setLayout(new BorderLayout());
33 |
34 | mtb = new MyTable();
35 | mtb.setPreferredSize(new Dimension(1200 - 250, 600));
36 | mtb.setHeaders(new String[]{"STT", "Mã loại", "Tên loại", "Mô tả"});
37 | mtb.setColumnsWidth(new double[]{.5, 3, 4, 5});
38 | mtb.setAlignment(0, JLabel.CENTER);
39 | mtb.setupSort();
40 | setDataToTable(qllsp.getDslsp(), mtb);
41 |
42 | // ======== search panel ===========
43 | cbTypeSearch = new JComboBox<>(new String[]{"Tất cả", "Mã loại", "Tên loại", "Mô tả"});
44 |
45 | JPanel plHeader = new JPanel();
46 | JPanel plTim = new JPanel();
47 | plTim.setBorder(BorderFactory.createTitledBorder("Tìm kiếm"));
48 | txTim.setBorder(BorderFactory.createTitledBorder("Tất cả")); // tạo border rỗng
49 | plTim.add(cbTypeSearch);
50 | plTim.add(txTim);
51 | plHeader.add(plTim);
52 |
53 | btnRefresh.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_data_backup_30px.png")));
54 | plHeader.add(btnRefresh);
55 |
56 | cbTypeSearch.addActionListener((ActionEvent e) -> {
57 | txTim.setBorder(BorderFactory.createTitledBorder(cbTypeSearch.getSelectedItem().toString()));
58 | txTim.requestFocus();
59 | if (!txTim.getText().equals("")) {
60 | txSearchOnChange();
61 | }
62 | });
63 |
64 | btnRefresh.addActionListener((ae) -> {
65 | refresh();
66 | });
67 |
68 | // https://stackoverflow.com/questions/3953208/value-change-listener-to-jtextfield
69 | txTim.getDocument().addDocumentListener(new DocumentListener() {
70 | @Override
71 | public void changedUpdate(DocumentEvent e) {
72 | txSearchOnChange();
73 | }
74 |
75 | @Override
76 | public void removeUpdate(DocumentEvent e) {
77 | txSearchOnChange();
78 | }
79 |
80 | @Override
81 | public void insertUpdate(DocumentEvent e) {
82 | txSearchOnChange();
83 | }
84 | });
85 |
86 | //=========== add all to this jpanel ===========
87 | this.add(plHeader, BorderLayout.NORTH);
88 | this.add(mtb, BorderLayout.CENTER);
89 | }
90 |
91 | public void refresh() {
92 | qllsp.readDB();
93 | setDataToTable(qllsp.getDslsp(), mtb);
94 | }
95 |
96 | private void txSearchOnChange() {
97 | setDataToTable(qllsp.search(txTim.getText(), cbTypeSearch.getSelectedItem().toString()), mtb);
98 | }
99 |
100 | private void setDataToTable(ArrayList data, MyTable table) {
101 | table.clear();
102 | int stt = 1; // lưu số thứ tự dòng hiện tại
103 | for (LoaiSanPham lsp : data) {
104 | table.addRow(new String[]{String.valueOf(stt), lsp.getMaLSP(), lsp.getTenLSP(), lsp.getMoTa()});
105 | stt++;
106 | }
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/FormHienThi/HienThiQuyen.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.FormHienThi;
2 |
3 | import giaodienchuan.model.BackEnd.QuanLyQuyen.QuanLyQuyenBUS;
4 | import giaodienchuan.model.BackEnd.QuanLyQuyen.Quyen;
5 | import giaodienchuan.model.FrontEnd.GiaoDienChuan.MyTable;
6 | import java.awt.BorderLayout;
7 | import java.awt.Dimension;
8 | import java.awt.event.ActionEvent;
9 | import java.util.ArrayList;
10 | import javax.swing.BorderFactory;
11 | import javax.swing.ImageIcon;
12 | import javax.swing.JButton;
13 | import javax.swing.JComboBox;
14 | import javax.swing.JLabel;
15 | import javax.swing.JPanel;
16 | import javax.swing.JTextField;
17 | import javax.swing.event.DocumentEvent;
18 | import javax.swing.event.DocumentListener;
19 |
20 | public class HienThiQuyen extends FormHienThi {
21 |
22 | QuanLyQuyenBUS qlqBUS = new QuanLyQuyenBUS();
23 |
24 | JTextField txTim = new JTextField(15);
25 | JComboBox cbTypeSearch;
26 | JButton btnRefresh = new JButton("Làm mới");
27 |
28 | // index
29 | final int MAQUYEN_I = 1, CHITIET_I = 2;
30 |
31 | public HienThiQuyen() {
32 | setLayout(new BorderLayout());
33 |
34 | mtb = new MyTable();
35 | mtb.setPreferredSize(new Dimension(1200 - 250, 600));
36 | mtb.setHeaders(new String[]{"STT", "Mã quyền", "Tên quyền", "Chi tiết quyền"});
37 | mtb.setColumnsWidth(new double[]{.5, 2, 2, 2});
38 | mtb.setAlignment(0, JLabel.CENTER);
39 | mtb.setupSort();
40 | setDataToTable(qlqBUS.getDsq(), mtb);
41 |
42 | // ======== search panel ===========
43 | cbTypeSearch = new JComboBox<>(new String[]{"Tất cả", "Mã quyền", "Tên quyền", "Chi tiết quyền"});
44 |
45 | JPanel plHeader = new JPanel();
46 | JPanel plTim = new JPanel();
47 | plTim.setBorder(BorderFactory.createTitledBorder("Tìm kiếm"));
48 | txTim.setBorder(BorderFactory.createTitledBorder(" ")); // tạo border rỗng
49 | plTim.add(cbTypeSearch);
50 | plTim.add(txTim);
51 | plHeader.add(plTim);
52 |
53 | btnRefresh.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_data_backup_30px.png")));
54 | plHeader.add(btnRefresh);
55 |
56 | cbTypeSearch.addActionListener((ActionEvent e) -> {
57 | txTim.requestFocus();
58 | if (!txTim.getText().equals("")) {
59 | txSearchOnChange();
60 | }
61 | });
62 |
63 | btnRefresh.addActionListener((ae) -> {
64 | refresh();
65 | });
66 |
67 | // https://stackoverflow.com/questions/3953208/value-change-listener-to-jtextfield
68 | txTim.getDocument().addDocumentListener(new DocumentListener() {
69 | @Override
70 | public void changedUpdate(DocumentEvent e) {
71 | txSearchOnChange();
72 | }
73 |
74 | @Override
75 | public void removeUpdate(DocumentEvent e) {
76 | txSearchOnChange();
77 | }
78 |
79 | @Override
80 | public void insertUpdate(DocumentEvent e) {
81 | txSearchOnChange();
82 | }
83 | });
84 |
85 | //=========== add all to this jpanel ===========
86 | this.add(plHeader, BorderLayout.NORTH);
87 | this.add(mtb, BorderLayout.CENTER);
88 | }
89 |
90 | public void refresh() {
91 | qlqBUS.readDB();
92 | setDataToTable(qlqBUS.getDsq(), mtb);
93 | }
94 |
95 | private void txSearchOnChange() {
96 | setDataToTable(qlqBUS.search(txTim.getText(), cbTypeSearch.getSelectedItem().toString()), mtb);
97 | }
98 |
99 | private void setDataToTable(ArrayList data, MyTable table) {
100 | table.clear();
101 | int stt = 1; // lưu số thứ tự dòng hiện tại
102 | for (Quyen q : data) {
103 | table.addRow(new String[]{
104 | String.valueOf(stt),
105 | q.getMaQuyen(),
106 | q.getTenQuyen(),
107 | q.getChiTietQuyen()});
108 | stt++;
109 | }
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/FormHienThi/HienThiTaiKhoan.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.FormHienThi;
2 |
3 | import giaodienchuan.model.BackEnd.QuanLyTaiKhoan.QuanLyTaiKhoanBUS;
4 | import giaodienchuan.model.BackEnd.QuanLyTaiKhoan.TaiKhoan;
5 | import giaodienchuan.model.FrontEnd.GiaoDienChuan.MyTable;
6 | import java.awt.BorderLayout;
7 | import java.awt.Dimension;
8 | import java.awt.event.ActionEvent;
9 | import java.util.ArrayList;
10 | import javax.swing.BorderFactory;
11 | import javax.swing.ImageIcon;
12 | import javax.swing.JButton;
13 | import javax.swing.JComboBox;
14 | import javax.swing.JLabel;
15 | import javax.swing.JPanel;
16 | import javax.swing.JTextField;
17 | import javax.swing.event.DocumentEvent;
18 | import javax.swing.event.DocumentListener;
19 |
20 | public class HienThiTaiKhoan extends FormHienThi {
21 |
22 | QuanLyTaiKhoanBUS qltk = new QuanLyTaiKhoanBUS();
23 |
24 | JTextField txTim = new JTextField(15);
25 | JComboBox cbTypeSearch;
26 | JButton btnRefresh = new JButton("Làm mới");
27 |
28 | // index
29 | final int USERNAME_I = 1, PASSWORD_I = 2, MANV_I = 3, MAQUYEN_I = 4;
30 |
31 | public HienThiTaiKhoan() {
32 | setLayout(new BorderLayout());
33 |
34 | mtb = new MyTable();
35 | mtb.setPreferredSize(new Dimension(1200 - 250, 600));
36 | mtb.setHeaders(new String[]{"STT", "Tên tài khoản", "Mật khẩu", "Mã nhân viên", "Mã quyền"});
37 | mtb.setColumnsWidth(new double[]{.5, 2, 2, 3, 2});
38 | mtb.setAlignment(0, JLabel.CENTER);
39 | mtb.setupSort();
40 | setDataToTable(qltk.getDstk(), mtb);
41 |
42 | // ======== search panel ===========
43 | cbTypeSearch = new JComboBox<>(new String[]{"Tất cả", "Tên tài khoản", "Mật khẩu", "Mã nhân viên", "Mã quyền"});
44 |
45 | JPanel plHeader = new JPanel();
46 | JPanel plTim = new JPanel();
47 | plTim.setBorder(BorderFactory.createTitledBorder("Tìm kiếm"));
48 | txTim.setBorder(BorderFactory.createTitledBorder(" ")); // tạo border rỗng
49 | plTim.add(cbTypeSearch);
50 | plTim.add(txTim);
51 | plHeader.add(plTim);
52 |
53 | btnRefresh.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_data_backup_30px.png")));
54 | plHeader.add(btnRefresh);
55 |
56 | cbTypeSearch.addActionListener((ActionEvent e) -> {
57 | txTim.requestFocus();
58 | if (!txTim.getText().equals("")) {
59 | txSearchOnChange();
60 | }
61 | });
62 |
63 | btnRefresh.addActionListener((ae) -> {
64 | refresh();
65 | });
66 |
67 | // https://stackoverflow.com/questions/3953208/value-change-listener-to-jtextfield
68 | txTim.getDocument().addDocumentListener(new DocumentListener() {
69 | @Override
70 | public void changedUpdate(DocumentEvent e) {
71 | txSearchOnChange();
72 | }
73 |
74 | @Override
75 | public void removeUpdate(DocumentEvent e) {
76 | txSearchOnChange();
77 | }
78 |
79 | @Override
80 | public void insertUpdate(DocumentEvent e) {
81 | txSearchOnChange();
82 | }
83 | });
84 |
85 | //=========== add all to this jpanel ===========
86 | this.add(plHeader, BorderLayout.NORTH);
87 | this.add(mtb, BorderLayout.CENTER);
88 | }
89 |
90 | public void refresh() {
91 | qltk.readDB();
92 | setDataToTable(qltk.getDstk(), mtb);
93 | }
94 |
95 | private void txSearchOnChange() {
96 | setDataToTable(qltk.search(txTim.getText(), cbTypeSearch.getSelectedItem().toString()), mtb);
97 | }
98 |
99 | private void setDataToTable(ArrayList data, MyTable table) {
100 | table.clear();
101 | int stt = 1; // lưu số thứ tự dòng hiện tại
102 | for (TaiKhoan tk : data) {
103 | table.addRow(new String[]{String.valueOf(stt), tk.getUsername(), tk.getPassword(), tk.getMaNV(), tk.getMaQuyen()});
104 | stt++;
105 | }
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/FormQuanLy/BanHangForm.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package giaodienchuan.model.FrontEnd.FormQuanLy;
7 |
8 | import javax.swing.JPanel;
9 |
10 | /**
11 | *
12 | * @author DELL
13 | */
14 | public class BanHangForm extends JPanel {
15 |
16 | public BanHangForm(int width, int height) {
17 | setLayout(null);
18 |
19 | ChonSanPhamPanel cspbh = new ChonSanPhamPanel(0, 0, width - 555, height);
20 | this.add(cspbh);
21 |
22 | HoaDonBanHang hdbh = new HoaDonBanHang(width - 550, 0, 550, height);
23 | this.add(hdbh);
24 |
25 | hdbh.setTarget(cspbh);
26 | cspbh.setTarget(hdbh);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/FormQuanLy/BeginForm.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package giaodienchuan.model.FrontEnd.FormQuanLy;
7 |
8 | import java.awt.Font;
9 | import java.awt.GridBagLayout;
10 | import javax.swing.ImageIcon;
11 | import javax.swing.JLabel;
12 | import javax.swing.JPanel;
13 |
14 | /**
15 | *
16 | * @author DELL
17 | */
18 | public class BeginForm extends JPanel {
19 |
20 | JLabel lbInfo;
21 |
22 | public BeginForm(String text) {
23 | setLayout(new GridBagLayout());
24 |
25 | lbInfo = new JLabel(text);
26 | lbInfo.setFont(new Font("Arial", Font.BOLD, 40));
27 | lbInfo.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_thumb_up_99px.png")));
28 |
29 | add(lbInfo);
30 | }
31 |
32 | public void setLabelText(String text) {
33 | lbInfo.setText(text);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/FormQuanLy/EmptyPage.java:
--------------------------------------------------------------------------------
1 |
2 | package giaodienchuan.model.FrontEnd.FormQuanLy;
3 |
4 | import java.awt.Font;
5 | import java.awt.GridBagLayout;
6 | import javax.swing.ImageIcon;
7 | import javax.swing.JLabel;
8 | import javax.swing.JPanel;
9 |
10 | public class EmptyPage extends JPanel {
11 |
12 | JLabel lbInfo;
13 |
14 | public EmptyPage() {
15 | setLayout(new GridBagLayout());
16 |
17 | lbInfo = new JLabel("Hệ thống đang bảo trì");
18 | lbInfo.setFont(new Font("Arial", Font.BOLD, 40));
19 | lbInfo.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_computer_support_99px.png")));
20 |
21 | add(lbInfo);
22 | }
23 |
24 | public void setLabelText(String text) {
25 | lbInfo.setText(text);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/FormQuanLy/NhapHangForm.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package giaodienchuan.model.FrontEnd.FormQuanLy;
7 |
8 | import javax.swing.JPanel;
9 |
10 | /**
11 | *
12 | * @author DELL
13 | */
14 | public class NhapHangForm extends JPanel {
15 |
16 | public NhapHangForm(int width, int height) {
17 | setLayout(null);
18 |
19 | ChonSanPhamPanel cspnh = new ChonSanPhamPanel(0, 0, width - 555, height);
20 | this.add(cspnh);
21 |
22 | PhieuNhapHang pnh = new PhieuNhapHang(width - 550, 0, 550, height);
23 | this.add(pnh);
24 |
25 | pnh.setTarget(cspnh);
26 | cspnh.setTarget(pnh);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/FormQuanLy/QuanLyChiTietHoaDonForm.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.FormQuanLy;
2 |
3 | import giaodienchuan.model.BackEnd.QuanLyChiTietHoaDon.QuanLyChiTietHoaDonBUS;
4 | import giaodienchuan.model.FrontEnd.FormHienThi.HienThiChiTietHoaDon;
5 | import giaodienchuan.model.FrontEnd.FormThemSua.ThemSuaChiTietHoaDonForm;
6 | import java.awt.BorderLayout;
7 | import java.awt.event.ActionEvent;
8 | import java.awt.event.WindowAdapter;
9 | import java.awt.event.WindowEvent;
10 | import javax.swing.ImageIcon;
11 | import javax.swing.JButton;
12 | import javax.swing.JFrame;
13 | import javax.swing.JOptionPane;
14 | import javax.swing.JPanel;
15 |
16 | public class QuanLyChiTietHoaDonForm extends JFrame {
17 |
18 | HienThiChiTietHoaDon formHienThi;
19 |
20 | String mahd;
21 |
22 | JButton btnThem = new JButton("Thêm");
23 | JButton btnXoa = new JButton("Xóa");
24 | JButton btnSua = new JButton("Sửa");
25 |
26 | public QuanLyChiTietHoaDonForm(String _mahd) {
27 | setLayout(new BorderLayout());
28 |
29 | this.mahd = _mahd;
30 | this.setTitle("Chi tiết hóa đơn " + this.mahd);
31 | formHienThi = new HienThiChiTietHoaDon(this.mahd);
32 |
33 | // buttons
34 | btnThem.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_add_30px.png")));
35 | btnXoa.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_delete_forever_30px_1.png")));
36 | btnSua.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_support_30px.png")));
37 |
38 | JPanel plBtn = new JPanel();
39 | // Không cho phép thêm sửa xóa trong quản lý, chỉ trong bán hàng mới được
40 | // plBtn.add(btnThem);
41 | // plBtn.add(btnXoa);
42 | // plBtn.add(btnSua);
43 | btnThem.setEnabled(false);
44 | btnXoa.setEnabled(false);
45 | btnSua.setEnabled(false);
46 |
47 | this.add(formHienThi, BorderLayout.CENTER);
48 | this.add(plBtn, BorderLayout.NORTH);
49 |
50 | // actionlistener
51 | btnThem.addActionListener((ActionEvent ae) -> {
52 | btnThemMouseClicked();
53 | });
54 | btnXoa.addActionListener((ActionEvent ae) -> {
55 | btnXoaMouseClicked();
56 | });
57 | btnSua.addActionListener((ActionEvent ae) -> {
58 | btnSuaMouseClicked();
59 | });
60 |
61 | this.setSize(900, 500);
62 | this.setLocationRelativeTo(null);
63 | this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
64 | this.setVisible(true);
65 | }
66 |
67 | private void btnSuaMouseClicked() {
68 | String masp = formHienThi.getSelectedRow(2);
69 | ThemSuaChiTietHoaDonForm themcthd = new ThemSuaChiTietHoaDonForm("Sửa", this.mahd, masp);
70 | themcthd.addWindowListener(new WindowAdapter() {
71 | @Override
72 | public void windowClosed(WindowEvent e) {
73 | formHienThi.refresh();
74 | }
75 | });
76 | }
77 |
78 | private void btnXoaMouseClicked() {
79 | String masp = formHienThi.getSelectedRow(1);
80 | String soluong = formHienThi.getSelectedRow(2);
81 | if (masp != null) {
82 | if (JOptionPane.showConfirmDialog(null, "Bạn có chắc muốn xóa " + soluong + " sản phẩm " + masp + " của hóa đơn "+ this.mahd +"?", "Chú ý", JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION) {
83 | new QuanLyChiTietHoaDonBUS().delete(this.mahd, masp);
84 | formHienThi.refresh();
85 | }
86 |
87 | } else {
88 | JOptionPane.showMessageDialog(null, "Chưa chọn chi tiết nào để xóa");
89 | }
90 | }
91 |
92 | private void btnThemMouseClicked() {
93 | ThemSuaChiTietHoaDonForm themcthd = new ThemSuaChiTietHoaDonForm("Thêm", this.mahd, "");
94 | themcthd.addWindowListener(new WindowAdapter() {
95 | @Override
96 | public void windowClosed(WindowEvent e) {
97 | formHienThi.refresh();
98 | }
99 | });
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/FormQuanLy/QuanLyChiTietPhieuNhapForm.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package giaodienchuan.model.FrontEnd.FormQuanLy;
7 |
8 | import giaodienchuan.model.BackEnd.QuanLyChiTietPN.QuanLyChiTietPhieuNhapBUS;
9 | import giaodienchuan.model.FrontEnd.FormHienThi.HienThiChiTietPN;
10 | import giaodienchuan.model.FrontEnd.FormThemSua.ThemSuaChiTietPhieuNhapForm;
11 | import java.awt.BorderLayout;
12 | import java.awt.event.ActionEvent;
13 | import java.awt.event.WindowAdapter;
14 | import java.awt.event.WindowEvent;
15 | import javax.swing.ImageIcon;
16 | import javax.swing.JButton;
17 | import javax.swing.JFrame;
18 | import javax.swing.JOptionPane;
19 | import javax.swing.JPanel;
20 |
21 | /**
22 | *
23 | * @author Admin
24 | */
25 | public class QuanLyChiTietPhieuNhapForm extends JFrame {
26 |
27 | HienThiChiTietPN formHienThi;
28 |
29 | String mapn;
30 |
31 | JButton btnThem = new JButton("Thêm");
32 | JButton btnXoa = new JButton("Xóa");
33 | JButton btnSua = new JButton("Sửa");
34 |
35 | public QuanLyChiTietPhieuNhapForm(String _mapn) {
36 | setLayout(new BorderLayout());
37 |
38 | this.mapn = _mapn;
39 | this.setTitle("Chi tiết phiếu nhập " + this.mapn);
40 | formHienThi = new HienThiChiTietPN(this.mapn);
41 |
42 | // buttons
43 | btnThem.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_add_30px.png")));
44 | btnXoa.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_delete_forever_30px_1.png")));
45 | btnSua.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_support_30px.png")));
46 |
47 | btnThem.setEnabled(false);
48 | btnXoa.setEnabled(false);
49 | btnSua.setEnabled(false);
50 |
51 | JPanel plBtn = new JPanel();
52 | // plBtn.add(btnThem);
53 | // plBtn.add(btnXoa);
54 | // plBtn.add(btnSua);
55 |
56 | this.add(formHienThi, BorderLayout.CENTER);
57 | this.add(plBtn, BorderLayout.NORTH);
58 |
59 | // actionlistener
60 | btnThem.addActionListener((ActionEvent ae) -> {
61 | btnThemMouseClicked();
62 | });
63 | btnXoa.addActionListener((ActionEvent ae) -> {
64 | btnXoaMouseClicked();
65 | });
66 | btnSua.addActionListener((ActionEvent ae) -> {
67 | btnSuaMouseClicked();
68 | });
69 |
70 | this.setSize(900, 500);
71 | this.setLocationRelativeTo(null);
72 | this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
73 | this.setVisible(true);
74 | }
75 |
76 | private void btnXoaMouseClicked() {
77 | String masp = formHienThi.getSelectedRow(2);
78 | if (masp != null) {
79 | if (JOptionPane.showConfirmDialog(null, "Bạn có chắc muốn xóa sản phẩm " + masp + " của phiếu nhập " + this.mapn + "?", "Chú ý", JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION) {
80 | new QuanLyChiTietPhieuNhapBUS().delete(this.mapn, masp);
81 | formHienThi.refresh();
82 | }
83 |
84 | } else {
85 | JOptionPane.showMessageDialog(null, "Chưa chọn chi tiết nào để xóa");
86 | }
87 | }
88 |
89 | private void btnSuaMouseClicked() {
90 | String masp = formHienThi.getSelectedRow(2);
91 | System.out.println("masp:" + masp);
92 |
93 | ThemSuaChiTietPhieuNhapForm themctpn = new ThemSuaChiTietPhieuNhapForm("Sửa", this.mapn, masp);
94 | themctpn.addWindowListener(new WindowAdapter() {
95 | @Override
96 | public void windowClosed(WindowEvent e) {
97 | formHienThi.refresh();
98 | }
99 | });
100 | }
101 |
102 | private void btnThemMouseClicked() {
103 | ThemSuaChiTietPhieuNhapForm themcthd = new ThemSuaChiTietPhieuNhapForm("Thêm", this.mapn, "");
104 | themcthd.addWindowListener(new WindowAdapter() {
105 | @Override
106 | public void windowClosed(WindowEvent e) {
107 | formHienThi.refresh();
108 | }
109 | });
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/FormQuanLy/QuanLyNhaCungCapForm.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.FormQuanLy;
2 |
3 | import giaodienchuan.model.BackEnd.QuanLyNCC.QuanLyNhaCungCapBUS;
4 | import giaodienchuan.model.BackEnd.WorkWithExcel.DocExcel;
5 | import giaodienchuan.model.BackEnd.WorkWithExcel.XuatExcel;
6 | import giaodienchuan.model.FrontEnd.FormHienThi.HienThiNhaCungCap;
7 | import giaodienchuan.model.FrontEnd.FormThemSua.ThemSuaNhaCungCapForm;
8 | import giaodienchuan.model.FrontEnd.GiaoDienChuan.LoginForm;
9 | import giaodienchuan.model.FrontEnd.MyButton.ExportExcelButton;
10 | import giaodienchuan.model.FrontEnd.MyButton.ImportExcelButton;
11 | import giaodienchuan.model.FrontEnd.MyButton.SuaButton;
12 | import giaodienchuan.model.FrontEnd.MyButton.ThemButton;
13 | import giaodienchuan.model.FrontEnd.MyButton.XoaButton;
14 | import java.awt.BorderLayout;
15 | import java.awt.event.ActionEvent;
16 | import javax.swing.JOptionPane;
17 | import javax.swing.JPanel;
18 |
19 | public class QuanLyNhaCungCapForm extends JPanel {
20 |
21 | HienThiNhaCungCap formHienThi = new HienThiNhaCungCap();
22 |
23 | ThemButton btnThem = new ThemButton();
24 | SuaButton btnSua = new SuaButton();
25 | XoaButton btnXoa = new XoaButton();
26 | ExportExcelButton btnXuatExcel = new ExportExcelButton();
27 | ImportExcelButton btnNhapExcel = new ImportExcelButton();
28 |
29 | public QuanLyNhaCungCapForm() {
30 | setLayout(new BorderLayout());
31 |
32 | if (!LoginForm.quyenLogin.getChiTietQuyen().contains("qlNCC")) {
33 | btnThem.setEnabled(false);
34 | btnXoa.setEnabled(false);
35 | btnSua.setEnabled(false);
36 | btnNhapExcel.setEnabled(false);
37 | }
38 |
39 | JPanel plBtn = new JPanel();
40 | plBtn.add(btnThem);
41 | plBtn.add(btnXoa);
42 | plBtn.add(btnSua);
43 | plBtn.add(btnXuatExcel);
44 | plBtn.add(btnNhapExcel);
45 |
46 | this.add(formHienThi, BorderLayout.CENTER);
47 | this.add(plBtn, BorderLayout.NORTH);
48 |
49 | btnThem.addActionListener((ActionEvent ae) -> {
50 | btnThemMouseClicked();
51 | });
52 | btnXoa.addActionListener((ActionEvent ae) -> {
53 | btnXoaMouseClicked();
54 | });
55 | btnSua.addActionListener((ActionEvent ae) -> {
56 | btnSuaMouseClicked();
57 | formHienThi.refresh();
58 | });
59 | btnNhapExcel.addActionListener((ActionEvent ae) -> {
60 | new DocExcel().docFileExcelNhaCungCap();
61 | });
62 | btnXuatExcel.addActionListener((ActionEvent ae) -> {
63 | new XuatExcel().xuatFileExcelNhaCungCap();
64 | });
65 | }
66 |
67 | private void btnSuaMouseClicked() {
68 | String mancc = formHienThi.getSelectedRow(1);
69 | if (mancc != null) {
70 | ThemSuaNhaCungCapForm suancc = new ThemSuaNhaCungCapForm("Sửa", mancc);
71 |
72 | suancc.addWindowListener(new java.awt.event.WindowAdapter() {
73 | @Override
74 | public void windowClosed(java.awt.event.WindowEvent windowEvent) {
75 | formHienThi.refresh();
76 | }
77 | });
78 |
79 | } else {
80 | JOptionPane.showMessageDialog(null, "Chưa chọn nhà cung cấp nào để sửa");
81 | }
82 | }
83 |
84 | private void btnXoaMouseClicked() {
85 | String mancc = formHienThi.getSelectedRow(1);
86 | if (mancc != null) {
87 | if (JOptionPane.showConfirmDialog(null, "Bạn có chắc muốn xóa nhà cung cấp " + mancc + " ?", "Chú ý", JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION) {
88 | new QuanLyNhaCungCapBUS().delete(mancc);
89 | formHienThi.refresh();
90 | }
91 |
92 | } else {
93 | JOptionPane.showMessageDialog(null, "Chưa chọn nhà cung cấp nào để xóa");
94 | }
95 | }
96 |
97 | private void btnThemMouseClicked() {
98 | ThemSuaNhaCungCapForm themncc = new ThemSuaNhaCungCapForm("Thêm", "");
99 | themncc.addWindowListener(new java.awt.event.WindowAdapter() {
100 | @Override
101 | public void windowClosed(java.awt.event.WindowEvent windowEvent) {
102 | formHienThi.refresh();
103 | }
104 | });
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/FormQuanLy/QuanLyQuyenForm.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.FormQuanLy;
2 |
3 | import giaodienchuan.model.BackEnd.QuanLyQuyen.QuanLyQuyenBUS;
4 | import giaodienchuan.model.BackEnd.WorkWithExcel.DocExcel;
5 | import giaodienchuan.model.BackEnd.WorkWithExcel.XuatExcel;
6 | import giaodienchuan.model.FrontEnd.FormHienThi.HienThiQuyen;
7 | import giaodienchuan.model.FrontEnd.FormThemSua.ThemSuaQuyenForm;
8 | import giaodienchuan.model.FrontEnd.GiaoDienChuan.LoginForm;
9 | import giaodienchuan.model.FrontEnd.MyButton.ExportExcelButton;
10 | import giaodienchuan.model.FrontEnd.MyButton.ImportExcelButton;
11 | import giaodienchuan.model.FrontEnd.MyButton.SuaButton;
12 | import giaodienchuan.model.FrontEnd.MyButton.ThemButton;
13 | import giaodienchuan.model.FrontEnd.MyButton.XoaButton;
14 | import java.awt.BorderLayout;
15 | import java.awt.event.ActionEvent;
16 | import javax.swing.JOptionPane;
17 | import javax.swing.JPanel;
18 |
19 | public class QuanLyQuyenForm extends JPanel {
20 |
21 | HienThiQuyen formHienThi = new HienThiQuyen();
22 |
23 | ThemButton btnThem = new ThemButton();
24 | SuaButton btnSua = new SuaButton();
25 | XoaButton btnXoa = new XoaButton();
26 |
27 | ExportExcelButton btnXuatExcel = new ExportExcelButton();
28 | ImportExcelButton btnNhapExcel = new ImportExcelButton();
29 |
30 | public QuanLyQuyenForm() {
31 | setLayout(new BorderLayout());
32 |
33 | // buttons
34 | if (!LoginForm.quyenLogin.getChiTietQuyen().contains("qlQuyen")) {
35 | btnThem.setEnabled(false);
36 | btnXoa.setEnabled(false);
37 | btnSua.setEnabled(false);
38 | btnNhapExcel.setEnabled(false);
39 | }
40 |
41 | JPanel plBtn = new JPanel();
42 | plBtn.add(btnThem);
43 | plBtn.add(btnXoa);
44 | plBtn.add(btnSua);
45 | plBtn.add(btnXuatExcel);
46 | plBtn.add(btnNhapExcel);
47 |
48 | this.add(formHienThi, BorderLayout.CENTER);
49 | this.add(plBtn, BorderLayout.NORTH);
50 |
51 | // actionlistener
52 | btnThem.addActionListener((ActionEvent ae) -> {
53 | btnThemMouseClicked();
54 | });
55 | btnXoa.addActionListener((ActionEvent ae) -> {
56 | btnXoaMouseClicked();
57 | });
58 | btnSua.addActionListener((ActionEvent ae) -> {
59 | btnSuaMouseClicked();
60 | formHienThi.refresh();
61 | });
62 | btnXuatExcel.addActionListener((ActionEvent ae) -> {
63 | new XuatExcel().xuatFileExcelQuyen();
64 | });
65 | btnNhapExcel.addActionListener((ActionEvent ae) -> {
66 | new DocExcel().docFileExcelQuyen();
67 | });
68 | }
69 |
70 | private void btnSuaMouseClicked() {
71 | String maquyen = formHienThi.getSelectedRow(1);
72 | if (maquyen != null) {
73 | ThemSuaQuyenForm suaq = new ThemSuaQuyenForm("Sửa", maquyen);
74 |
75 | // https://stackoverflow.com/questions/4154780/jframe-catch-dispose-event
76 | suaq.addWindowListener(new java.awt.event.WindowAdapter() {
77 | @Override
78 | public void windowClosed(java.awt.event.WindowEvent windowEvent) {
79 | formHienThi.refresh();
80 | }
81 | });
82 |
83 | } else {
84 | JOptionPane.showMessageDialog(null, "Chưa chọn quyền nào để sửa");
85 | }
86 | }
87 |
88 | private void btnXoaMouseClicked() {
89 | String maquyen = formHienThi.getSelectedRow(1);
90 | if (maquyen != null) {
91 | if (JOptionPane.showConfirmDialog(null, "Bạn có chắc muốn xóa quyền " + maquyen + " ?", "Chú ý", JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION) {
92 | new QuanLyQuyenBUS().delete(maquyen);
93 | formHienThi.refresh();
94 | }
95 |
96 | } else {
97 | JOptionPane.showMessageDialog(null, "Chưa chọn quyền nào để xóa");
98 | }
99 | }
100 |
101 | private void btnThemMouseClicked() {
102 | ThemSuaQuyenForm themq = new ThemSuaQuyenForm("Thêm", "");
103 | themq.addWindowListener(new java.awt.event.WindowAdapter() {
104 | @Override
105 | public void windowClosed(java.awt.event.WindowEvent windowEvent) {
106 | formHienThi.refresh();
107 | }
108 | });
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/GiaoDienChuan/DoiMatKhauForm.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package giaodienchuan.model.FrontEnd.GiaoDienChuan;
7 |
8 | import giaodienchuan.model.BackEnd.QuanLyTaiKhoan.QuanLyTaiKhoanBUS;
9 | import giaodienchuan.model.BackEnd.QuanLyTaiKhoan.TaiKhoan;
10 | import java.awt.BorderLayout;
11 | import javax.swing.BorderFactory;
12 | import javax.swing.ImageIcon;
13 | import javax.swing.JButton;
14 | import javax.swing.JFrame;
15 | import javax.swing.JOptionPane;
16 | import javax.swing.JPanel;
17 | import javax.swing.JPasswordField;
18 |
19 | /**
20 | *
21 | * @author DELL
22 | */
23 | public class DoiMatKhauForm extends JFrame {
24 |
25 | TaiKhoan tk;
26 |
27 | JPasswordField txMatKhauCu = new JPasswordField(15);
28 | JPasswordField txMatKhauMoi = new JPasswordField(15);
29 | JPasswordField txXacNhanMatKhau = new JPasswordField(15);
30 |
31 | JButton btnDongY = new JButton("Đồng ý");
32 | JButton btnHuy = new JButton("Hủy");
33 |
34 | public DoiMatKhauForm(String matk) {
35 | setLayout(new BorderLayout());
36 | setSize(350, 350);
37 | setTitle("Đổi mật khẩu");
38 | setLocationRelativeTo(null);
39 | tk = new QuanLyTaiKhoanBUS().getTaiKhoan(matk);
40 |
41 | // input
42 | JPanel plInput = new JPanel();
43 | txMatKhauCu.setBorder(BorderFactory.createTitledBorder("Mật khẩu cũ: "));
44 | txMatKhauMoi.setBorder(BorderFactory.createTitledBorder("Mật khẩu mới: "));
45 | txXacNhanMatKhau.setBorder(BorderFactory.createTitledBorder("Xác nhận mật khẩu: "));
46 |
47 | plInput.add(txMatKhauCu);
48 | plInput.add(txMatKhauMoi);
49 | plInput.add(txXacNhanMatKhau);
50 |
51 | this.add(plInput, BorderLayout.CENTER);
52 |
53 | // button
54 | JPanel plButton = new JPanel();
55 | plButton.add(btnDongY);
56 | plButton.add(btnHuy);
57 |
58 | btnHuy.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_cancel_30px_1.png")));
59 | btnDongY.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_ok_30px.png")));
60 |
61 | btnHuy.addActionListener((ae) -> {
62 | this.dispose();
63 | });
64 | btnDongY.addActionListener((ae) -> {
65 | if(checkPass()) {
66 | if(new QuanLyTaiKhoanBUS().update(tk.getUsername(), txMatKhauMoi.getText(), tk.getMaNV(), tk.getMaQuyen())) {
67 | JOptionPane.showMessageDialog(this, "Đổi mật khẩu thành công!");
68 | this.dispose();
69 | }
70 |
71 | }
72 | });
73 |
74 | this.add(plButton, BorderLayout.SOUTH);
75 | }
76 |
77 | private Boolean checkPass() {
78 | String mkcu = txMatKhauCu.getText();
79 | String mkmoi = txMatKhauMoi.getText();
80 | String xnmk = txXacNhanMatKhau.getText();
81 |
82 | if (!mkcu.equals(tk.getPassword())) {
83 | JOptionPane.showMessageDialog(txMatKhauCu, "Mật khẩu cũ không đúng!");
84 | txMatKhauCu.requestFocus();
85 | return false;
86 |
87 | } else if (mkmoi.equals("") || xnmk.equals("")) {
88 | JOptionPane.showMessageDialog(txMatKhauMoi, "Mật khẩu mới không được để trống!");
89 | txMatKhauMoi.requestFocus();
90 | return false;
91 |
92 | } else if (!mkmoi.equals(xnmk)) {
93 | JOptionPane.showMessageDialog(txXacNhanMatKhau, "Mật khẩu mới không khớp!");
94 | txXacNhanMatKhau.requestFocus();
95 | return false;
96 | }
97 |
98 | return true;
99 | }
100 |
101 | }
102 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/MyButton/DateButton.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package giaodienchuan.model.FrontEnd.MyButton;
7 |
8 | import com.github.lgooddatepicker.components.DatePicker;
9 | import javax.swing.ImageIcon;
10 | import javax.swing.JButton;
11 |
12 | /**
13 | *
14 | * @author DELL
15 | */
16 | public class DateButton extends JButton {
17 |
18 | public DateButton(DatePicker dp) {
19 | ImageIcon dPickerIcon = new ImageIcon(getClass().getResource("/giaodienchuan/images/icons8_calendar_31_30px.png"));
20 | JButton datePickerButton = dp.getComponentToggleCalendarButton();
21 | datePickerButton.setText("");
22 | datePickerButton.setIcon(dPickerIcon);
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/MyButton/ExportExcelButton.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package giaodienchuan.model.FrontEnd.MyButton;
7 |
8 | import javax.swing.ImageIcon;
9 | import javax.swing.JButton;
10 |
11 | /**
12 | *
13 | * @author DELL
14 | */
15 | public class ExportExcelButton extends JButton {
16 |
17 | public ExportExcelButton() {
18 | this.setText("Xuất Excel");
19 | this.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_ms_excel_30px.png")));
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/MyButton/FileButton.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.MyButton;
2 |
3 | import javax.swing.ImageIcon;
4 | import javax.swing.JButton;
5 |
6 | public class FileButton extends JButton {
7 |
8 | public FileButton() {
9 | this.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_opened_folder_20px.png")));
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/MyButton/ImportExcelButton.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package giaodienchuan.model.FrontEnd.MyButton;
7 |
8 | import javax.swing.ImageIcon;
9 | import javax.swing.JButton;
10 |
11 | /**
12 | *
13 | * @author DELL
14 | */
15 | public class ImportExcelButton extends JButton {
16 |
17 | public ImportExcelButton() {
18 | this.setText("Nhập Excel");
19 | this.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_ms_excel_30px.png")));
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/MyButton/MoreButton.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.MyButton;
2 |
3 | import java.awt.Dimension;
4 | import javax.swing.ImageIcon;
5 | import javax.swing.JButton;
6 |
7 | public class MoreButton extends JButton {
8 |
9 | public MoreButton() {
10 | this.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_more_20px.png")));
11 | this.setPreferredSize(new Dimension(30, 30));
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/MyButton/RefreshButton.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package giaodienchuan.model.FrontEnd.MyButton;
7 |
8 | import javax.swing.ImageIcon;
9 | import javax.swing.JButton;
10 |
11 | /**
12 | *
13 | * @author DELL
14 | */
15 | public class RefreshButton extends JButton {
16 |
17 | public RefreshButton() {
18 | this.setText("Làm mới");
19 | this.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_data_backup_30px.png")));
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/MyButton/SuaButton.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package giaodienchuan.model.FrontEnd.MyButton;
7 |
8 | import javax.swing.ImageIcon;
9 | import javax.swing.JButton;
10 |
11 | /**
12 | *
13 | * @author DELL
14 | */
15 | public class SuaButton extends JButton {
16 | public SuaButton() {
17 | this.setText("Sửa");
18 | this.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_support_30px.png")));
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/MyButton/ThemButton.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package giaodienchuan.model.FrontEnd.MyButton;
7 |
8 | import javax.swing.ImageIcon;
9 | import javax.swing.JButton;
10 |
11 | /**
12 | *
13 | * @author DELL
14 | */
15 | public class ThemButton extends JButton {
16 |
17 | public ThemButton() {
18 | this.setText("Thêm");
19 | this.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_add_30px.png")));
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/MyButton/XoaButton.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package giaodienchuan.model.FrontEnd.MyButton;
7 |
8 | import javax.swing.ImageIcon;
9 | import javax.swing.JButton;
10 |
11 | /**
12 | *
13 | * @author DELL
14 | */
15 | public class XoaButton extends JButton {
16 | public XoaButton() {
17 | this.setText("Xóa");
18 | this.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_delete_forever_30px_1.png")));
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/NavBar/NavBarButton.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.NavBar;
2 |
3 | import java.awt.Color;
4 | import java.awt.Cursor;
5 | import java.awt.Rectangle;
6 | import java.awt.event.MouseAdapter;
7 | import java.awt.event.MouseEvent;
8 | import javax.swing.ImageIcon;
9 | import javax.swing.JLabel;
10 |
11 | public class NavBarButton extends NavBarItem {
12 |
13 | protected Color bgHover, colorHover;
14 | protected Boolean actived = false;
15 | protected JLabel lbIcon;
16 |
17 | public NavBarButton(Rectangle rec, String text, String iconUrl) {
18 | super(rec, text);
19 | this.bgHover = new Color(49, 49, 49);
20 | this.colorHover = new Color(255, 255, 255);
21 |
22 | // icon
23 | setIconFromString(iconUrl);
24 |
25 | // mouse event
26 | addMouseListener(new MouseAdapter() {
27 | @Override
28 | public void mouseEntered(MouseEvent me) {
29 | setHovered(true);
30 | setCursor(new Cursor(Cursor.HAND_CURSOR));
31 | }
32 |
33 | @Override
34 | public void mouseExited(MouseEvent me) {
35 | setHovered(false);
36 | setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
37 | }
38 | });
39 | }
40 |
41 | public void setHovered(Boolean hovering) {
42 | if (!actived) {
43 | if (hovering) {
44 | setBackground(bgHover);
45 | lbLabel.setForeground(colorHover);
46 | } else {
47 | setBackground(bgDefault);
48 | lbLabel.setForeground(colorDefault);
49 | }
50 | }
51 | }
52 |
53 | public void setBgHover(Color bgHover) {
54 | this.bgHover = bgHover;
55 | }
56 |
57 | public void setColorHover(Color colorHover) {
58 | this.colorHover = colorHover;
59 | }
60 |
61 | // ======== setup Icon ==========
62 | public void setIconFromString(String iconUrl) {
63 | lbIcon = new JLabel();
64 | lbIcon.setIcon(new ImageIcon(getClass().getResource("/giaodienchuan/images/" + iconUrl)));
65 | add(lbIcon);
66 | }
67 |
68 | public void setIconLocation(Rectangle rec) {
69 | lbIcon.setBounds(rec);
70 | }
71 |
72 | // ===== calculate position of icon and label ======
73 | public void relocate() {
74 | Rectangle rec = getBounds();
75 | lbIcon.setBounds(rec.width / 10, rec.height / 4, rec.width / 4, (int) (rec.height / 1.75));
76 | lbLabel.setBounds(rec.width / 4, rec.height / 4, rec.width * 3 / 4, (int) (rec.height / 1.75));
77 | }
78 |
79 | // dùng cho nút logout
80 | public void relocate2() {
81 | Rectangle rec = getBounds();
82 | lbIcon.setBounds(5, rec.height / 4, rec.width / 4, (int) (rec.height / 1.75));
83 | lbLabel.setBounds(rec.width / 4, rec.height / 4, rec.width * 3 / 4, (int) (rec.height / 1.75));
84 | }
85 |
86 | // ======== active ==========
87 | public void setActive(Boolean stage) {
88 | this.actived = stage;
89 | if (this.actived) {
90 | this.setBackground(new Color(20, 20, 20));
91 | lbLabel.setForeground(Color.white);
92 | } else {
93 | this.setBackground(bgDefault);
94 | lbLabel.setForeground(colorDefault);
95 | }
96 | }
97 |
98 | public Boolean getActive() {
99 | return this.actived;
100 | }
101 |
102 | public void switchActive() {
103 | this.actived = !this.actived;
104 | setActive(actived);
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/NavBar/NavBarContainer.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.NavBar;
2 |
3 | import java.awt.Color;
4 | import java.awt.Dimension;
5 | import java.awt.Rectangle;
6 | import java.util.ArrayList;
7 | import javax.swing.JPanel;
8 |
9 | public class NavBarContainer extends JPanel {
10 |
11 | private int bottomPos = 0;
12 | private ArrayList navItems = new ArrayList<>();
13 |
14 | public NavBarContainer(Rectangle rec) {
15 | setLayout(null);
16 | setBounds(rec);
17 | setPreferredSize(new Dimension(rec.width, rec.height));
18 | setBackground(new Color(35, 35, 35));
19 | }
20 |
21 | public void addItem(NavBarItem item, Boolean fullWidth) {
22 | if (fullWidth) {
23 | item.setBounds(0, bottomPos, getWidth(), item.getHeight());
24 | if(item instanceof NavBarButton) {
25 | NavBarButton btnitem = (NavBarButton)item;
26 | btnitem.relocate();
27 | }
28 | } else {
29 | item.setLocation(item.getBounds().x, item.getBounds().y);
30 | }
31 |
32 | bottomPos += item.getHeight();
33 | navItems.add(item); // add to arraylist
34 | add(item); // add to jpanel
35 | }
36 |
37 | public void addItem(NavBarItem i) {
38 | addItem(i, true);
39 | }
40 |
41 | public NavBarItem getItem(int i) {
42 | return navItems.get(i);
43 | }
44 |
45 | public int getLength() {
46 | return navItems.size();
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/NavBar/NavBarItem.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.NavBar;
2 |
3 | import java.awt.Color;
4 | import java.awt.Font;
5 | import java.awt.Rectangle;
6 | import javax.swing.JLabel;
7 | import javax.swing.JPanel;
8 |
9 | public class NavBarItem extends JPanel {
10 |
11 | protected JLabel lbLabel;
12 | protected Color bgDefault, colorDefault;
13 | protected int fontSize = 16;
14 | public String text;
15 |
16 | public NavBarItem(Rectangle rec, String text) {
17 | this.bgDefault = new Color(35, 35, 35);
18 | this.colorDefault = new Color(150, 150, 150);
19 | this.text = text;
20 |
21 | setLayout(null);
22 | setBounds(rec);
23 | setBackground(this.bgDefault);
24 |
25 | lbLabel = new JLabel(text);
26 | lbLabel.setForeground(this.colorDefault);
27 | setFontSize(fontSize);
28 | add(lbLabel);
29 |
30 | setLabel(text);
31 | }
32 |
33 | public void setLabel(String text) {
34 | lbLabel.setText(text);
35 | }
36 |
37 | public void setFontSize(int size) {
38 | fontSize = size;
39 | lbLabel.setFont(new Font(Font.DIALOG, Font.BOLD, fontSize));
40 | }
41 |
42 | public void setBgDefault(Color bgDefault) {
43 | this.bgDefault = bgDefault;
44 | setBackground(this.bgDefault);
45 | }
46 |
47 | public void setColorDefault(Color colorDefault) {
48 | this.colorDefault = colorDefault;
49 | lbLabel.setForeground(this.colorDefault);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/NavBar/NavBarSeperator.java:
--------------------------------------------------------------------------------
1 |
2 | package giaodienchuan.model.FrontEnd.NavBar;
3 |
4 | import java.awt.Color;
5 | import java.awt.Rectangle;
6 |
7 | public class NavBarSeperator extends NavBarItem {
8 |
9 | public NavBarSeperator(Rectangle rec) {
10 | super(rec, "");
11 | setBackground(new Color(150, 150, 150));
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/src/giaodienchuan/model/FrontEnd/NavBar/NavBarTitle.java:
--------------------------------------------------------------------------------
1 |
2 | package giaodienchuan.model.FrontEnd.NavBar;
3 |
4 | import java.awt.Color;
5 | import java.awt.GridBagLayout;
6 | import java.awt.Rectangle;
7 |
8 | public class NavBarTitle extends NavBarItem {
9 |
10 | public NavBarTitle(Rectangle rec, String text) {
11 | super(rec, text);
12 | setLayout(new GridBagLayout());
13 |
14 | setFontSize(20);
15 | lbLabel.setForeground(Color.WHITE);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/lib/LGoodDatePicker-10.4.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/lib/LGoodDatePicker-10.4.1.jar
--------------------------------------------------------------------------------
/src/lib/POI/commons-codec-1.12.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/lib/POI/commons-codec-1.12.jar
--------------------------------------------------------------------------------
/src/lib/POI/commons-collections4-4.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/lib/POI/commons-collections4-4.3.jar
--------------------------------------------------------------------------------
/src/lib/POI/poi-4.1.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/lib/POI/poi-4.1.0.jar
--------------------------------------------------------------------------------
/src/lib/itextpdf-5.5.12.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/lib/itextpdf-5.5.12.jar
--------------------------------------------------------------------------------
/src/lib/mysql-connector-java-5.1.23-bin.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/src/lib/mysql-connector-java-5.1.23-bin.jar
--------------------------------------------------------------------------------
/temp:
--------------------------------------------------------------------------------
1 | admin admin
--------------------------------------------------------------------------------
/test/CountDownDialog.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.Test;
2 |
3 | import java.awt.Color;
4 | import java.awt.Container;
5 | import java.awt.Dimension;
6 | import java.awt.Toolkit;
7 | import javax.swing.JButton;
8 | import javax.swing.JDialog;
9 | import javax.swing.JFrame;
10 | import javax.swing.JPanel;
11 |
12 | public class CountDownDialog {
13 |
14 | private JFrame parentFrame;
15 | private JDialog dialog;
16 |
17 | protected void init() {
18 | this.dialog = new JDialog(this.parentFrame, "Copie", true);
19 | this.dialog.setResizable(false);
20 | this.dialog.getContentPane().add(createPane());
21 | this.dialog.pack();
22 | this.dialog.setSize(450, 250);
23 | Dimension Size = Toolkit.getDefaultToolkit().getScreenSize();
24 | this.dialog.setLocation(new Double((Size.getWidth() / 2) - (dialog.getWidth() / 2)).intValue(), new Double((Size.getHeight() / 2) - (dialog.getHeight() / 2)).intValue());
25 | }
26 |
27 | protected Container createPane() {
28 | JPanel mainPanel = new JPanel();
29 | mainPanel.setBackground(new Color(0, 51, 153));
30 | JButton b1 = new JButton("Hello");
31 | mainPanel.add(b1);
32 | return mainPanel;
33 |
34 | }
35 |
36 | public void show() {
37 | if (this.dialog == null) {
38 | init();
39 | }
40 | this.dialog.setVisible(true);
41 | }
42 |
43 | protected void close() {
44 | this.dialog.dispose();
45 | this.dialog.setVisible(false);
46 | }
47 |
48 | public void setFrame(JFrame frame) {
49 | parentFrame = (JFrame) frame;
50 | }
51 |
52 | public static void main(String args[]) {
53 | CountDownDialog obj = new CountDownDialog();
54 | obj.init();
55 | obj.show();
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/test/EditComboBox.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.Test;
2 |
3 | import java.awt.BorderLayout;
4 | import java.awt.Container;
5 | import java.awt.event.ActionEvent;
6 | import java.awt.event.ActionListener;
7 |
8 | import javax.swing.JComboBox;
9 | import javax.swing.JFrame;
10 | import javax.swing.JScrollPane;
11 | import javax.swing.JTextArea;
12 |
13 | public class EditComboBox {
14 |
15 | public static void main(String args[]) {
16 | String labels[] = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J"};
17 | JFrame frame = new JFrame("Editable JComboBox");
18 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
19 | Container contentPane = frame.getContentPane();
20 |
21 | final JComboBox comboBox = new JComboBox(labels);
22 | comboBox.setMaximumRowCount(5);
23 | comboBox.setEditable(true);
24 | contentPane.add(comboBox, BorderLayout.NORTH);
25 |
26 | final JTextArea textArea = new JTextArea();
27 | JScrollPane scrollPane = new JScrollPane(textArea);
28 | contentPane.add(scrollPane, BorderLayout.CENTER);
29 |
30 | ActionListener actionListener = new ActionListener() {
31 | public void actionPerformed(ActionEvent actionEvent) {
32 | textArea.append("Selected: " + comboBox.getSelectedItem());
33 | textArea.append(", Position: " + comboBox.getSelectedIndex());
34 | textArea.append(System.getProperty("line.separator"));
35 | }
36 | };
37 | comboBox.addActionListener(actionListener);
38 |
39 | frame.setSize(300, 200);
40 | frame.setVisible(true);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/test/JOptionPaneExample.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.Test;
2 |
3 | import java.awt.*;
4 | import java.io.IOException;
5 | import java.net.MalformedURLException;
6 | import java.net.URL;
7 | import javax.swing.*;
8 | import javax.imageio.ImageIO;
9 |
10 | public class JOptionPaneExample {
11 |
12 | private void displayGUI() {
13 | JOptionPane.showConfirmDialog(null,
14 | getPanel(),
15 | "JOptionPane Example : ",
16 | JOptionPane.OK_CANCEL_OPTION,
17 | JOptionPane.PLAIN_MESSAGE);
18 | }
19 |
20 | private JPanel getPanel() {
21 | JPanel panel = new JPanel();
22 | JLabel label = new JLabel("Java Technology Dive Log");
23 | ImageIcon image = null;
24 | try {
25 | image = new ImageIcon(ImageIO.read(
26 | new URL("http://i.imgur.com/6mbHZRU.png")));
27 | } catch(MalformedURLException mue) {
28 | mue.printStackTrace();
29 | } catch(IOException ioe) {
30 | ioe.printStackTrace();
31 | }
32 |
33 | label.setIcon(image);
34 | panel.add(label);
35 |
36 | return panel;
37 | }
38 |
39 | public static void main(String[] args) {
40 | SwingUtilities.invokeLater(new Runnable() {
41 | @Override
42 | public void run() {
43 | new JOptionPaneExample().displayGUI();
44 | }
45 | });
46 | }
47 | }
--------------------------------------------------------------------------------
/test/KControls.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HoangTran0410/SmartPhone_Store_Manage_Java/52da6f0c3f9ddb7bc71c3c21196547fefc605f45/test/KControls.jar
--------------------------------------------------------------------------------
/test/QLChucVu/ChonChucVuForm.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.Test.QLChucVu;
2 |
3 | import giaodienchuan.model.FrontEnd.Test.QLChucVu.HienThiChucVu;
4 | import java.awt.BorderLayout;
5 | import java.awt.event.ActionEvent;
6 | import javax.swing.ImageIcon;
7 | import javax.swing.JButton;
8 | import javax.swing.JFrame;
9 | import javax.swing.JOptionPane;
10 | import javax.swing.JPanel;
11 | import javax.swing.JTextField;
12 |
13 | public class ChonChucVuForm extends JFrame {
14 |
15 | HienThiChucVu formHienThi = new HienThiChucVu();
16 |
17 | JButton btnOK = new JButton("Chọn");
18 | JButton btnCancel = new JButton("Thoát");
19 | JTextField txTarget;
20 |
21 | public ChonChucVuForm(JTextField _txTarget) {
22 | this.setTitle("Chọn chức vụ");
23 | this.setLayout(new BorderLayout());
24 | this.setSize(500, 600);
25 | this.setLocationRelativeTo(null);
26 | this.txTarget = _txTarget;
27 |
28 | // ======= Buttons Panel ===========
29 | btnCancel.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_cancel_30px_1.png")));
30 | btnOK.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_ok_30px.png")));
31 |
32 | JPanel plBtns = new JPanel();
33 | plBtns.add(btnOK);
34 | plBtns.add(btnCancel);
35 |
36 | this.add(formHienThi, BorderLayout.CENTER);
37 | this.add(plBtns, BorderLayout.SOUTH);
38 | this.setVisible(true);
39 |
40 | // actionlistener
41 | btnOK.addActionListener((ActionEvent ae) -> {
42 | String masp = formHienThi.getSelectedChucVu();
43 | if (masp != null) {
44 | this.txTarget.setText(masp);
45 | this.dispose();
46 |
47 | } else {
48 | JOptionPane.showMessageDialog(this, "Chưa chọn chức vụ nào!");
49 | }
50 | });
51 |
52 | btnCancel.addActionListener((ae) -> {
53 | this.dispose();
54 | });
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/test/QLChucVu/ChucVu/ChucVu.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package giaodienchuan.model.FrontEnd.Test.QLChucVu.ChucVu;
7 |
8 | /**
9 | *
10 | * @author DELL
11 | */
12 | public class ChucVu {
13 | String MaCV;
14 | String TenCV;
15 |
16 | public ChucVu(String MaCV, String TenCV) {
17 | this.MaCV = MaCV;
18 | this.TenCV = TenCV;
19 | }
20 |
21 | public String getMaCV() {
22 | return MaCV;
23 | }
24 |
25 | public void setMaCV(String MaCV) {
26 | this.MaCV = MaCV;
27 | }
28 |
29 | public String getTenCV() {
30 | return TenCV;
31 | }
32 |
33 | public void setTenCV(String TenCV) {
34 | this.TenCV = TenCV;
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/test/QLChucVu/ChucVu/ChucVuBUS.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.Test.QLChucVu.ChucVu;
2 |
3 | import java.util.ArrayList;
4 |
5 | public class ChucVuBUS {
6 |
7 | private ArrayList dscv = new ArrayList<>();
8 | ChucVuDAO qlcvDAO = new ChucVuDAO();
9 |
10 | public ChucVuBUS() {
11 | dscv = qlcvDAO.readDB();
12 | }
13 |
14 | public void showConsole() {
15 | dscv.forEach((cv) -> {
16 | System.out.print(cv.getMaCV() + " ");
17 | System.out.println(cv.getTenCV() + " ");
18 | });
19 | }
20 |
21 | public String[] getHeaders() {
22 | return new String[]{"Mã chức vụ", "Tên chức vụ"};
23 | }
24 |
25 | public void readDB() {
26 | dscv = qlcvDAO.readDB();
27 | }
28 |
29 | public ChucVu getChucVu(String macv) {
30 | for(ChucVu cv : dscv) {
31 | if(cv.getMaCV().equals(macv))
32 | return cv;
33 | }
34 | return null;
35 | }
36 |
37 | public ArrayList search(String value, String type) {
38 | ArrayList result = new ArrayList<>();
39 |
40 | dscv.forEach((cv) -> {
41 | if (type.equals("Tất cả")) {
42 | if (cv.getMaCV().toLowerCase().contains(value.toLowerCase())
43 | || cv.getTenCV().toLowerCase().contains(value.toLowerCase())) {
44 | result.add(cv);
45 | }
46 | } else {
47 | switch (type) {
48 | case "Mã chức vụ":
49 | if (cv.getMaCV().toLowerCase().contains(value.toLowerCase())) {
50 | result.add(cv);
51 | }
52 | break;
53 | case "Tên chức vụ":
54 | if (cv.getTenCV().toLowerCase().contains(value.toLowerCase())) {
55 | result.add(cv);
56 | }
57 | break;
58 | }
59 | }
60 |
61 | });
62 |
63 | return result;
64 | }
65 |
66 | public Boolean add(ChucVu cv) {
67 | Boolean ok = qlcvDAO.add(cv);
68 | if (ok) {
69 | dscv.add(cv);
70 | }
71 | return ok;
72 | }
73 |
74 | public Boolean add(String macv, String tencv) {
75 | ChucVu cv = new ChucVu(macv, tencv);
76 | return add(cv);
77 | }
78 |
79 | public Boolean delete(String macv) {
80 | Boolean ok = qlcvDAO.delete(macv);
81 | if (ok) {
82 | for (int i = (dscv.size() - 1); i >= 0; i--) {
83 | if (dscv.get(i).getMaCV().equals(macv)) {
84 | dscv.remove(i);
85 | }
86 | }
87 | }
88 | return ok;
89 | }
90 |
91 | public Boolean update(String macv, String tencv) {
92 | Boolean ok = qlcvDAO.update(macv, tencv);
93 |
94 | if (ok) {
95 | dscv.forEach((cv) -> {
96 | if (cv.getMaCV().equals(macv)) {
97 | cv.setTenCV(tencv);
98 | }
99 | });
100 | }
101 |
102 | return ok;
103 | }
104 |
105 | public ArrayList getDscv() {
106 | return dscv;
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/test/QLChucVu/ChucVu/ChucVuDAO.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.Test.QLChucVu.ChucVu;
2 |
3 | import giaodienchuan.model.BackEnd.ConnectionDB.ConnectionDB;
4 |
5 | import java.sql.ResultSet;
6 | import java.sql.SQLException;
7 | import java.util.ArrayList;
8 | import javax.swing.JOptionPane;
9 |
10 | public class ChucVuDAO {
11 |
12 | ConnectionDB cvConnection;
13 |
14 | public ChucVuDAO() {
15 |
16 | }
17 |
18 | public ArrayList readDB() {
19 | cvConnection = new ConnectionDB();
20 | ArrayList dscv = new ArrayList<>();
21 | try {
22 | String qry = "SELECT * FROM chucvu";
23 | ResultSet r = cvConnection.sqlQuery(qry);
24 | if (r != null) {
25 | while (r.next()) {
26 | String macv = r.getString(1);
27 | String tencv = r.getString(2);
28 |
29 | dscv.add(new ChucVu(macv, tencv));
30 | }
31 | }
32 |
33 | } catch (SQLException ex) {
34 | JOptionPane.showMessageDialog(null, "-- ERROR! Lỗi đọc dữ liệu bảng chức vụ");
35 | } finally {
36 | cvConnection.closeConnect();
37 | }
38 | return dscv;
39 | }
40 |
41 | public ArrayList search(String columnName, String value) {
42 | cvConnection = new ConnectionDB();
43 | ArrayList dscv = new ArrayList<>();
44 |
45 | try {
46 | String qry = "SELECT * FROM chucvu WHERE " + columnName + " LIKE '%" + value + "%'";
47 | ResultSet r = cvConnection.sqlQuery(qry);
48 | if (r != null) {
49 | while (r.next()) {
50 | String macv = r.getString(1);
51 | String tencv = r.getString(2);
52 | dscv.add(new ChucVu(macv, tencv));
53 | }
54 | }
55 |
56 | } catch (SQLException ex) {
57 | JOptionPane.showMessageDialog(null, "-- ERROR! Lỗi tìm dữ liệu " + columnName + " = " + value + " bảng chức vụ");
58 | } finally {
59 | cvConnection.closeConnect();
60 | }
61 |
62 | return dscv;
63 | }
64 |
65 | public Boolean add(ChucVu cv) {
66 | cvConnection = new ConnectionDB();
67 | Boolean ok = cvConnection.sqlUpdate("INSERT INTO `chucvu` (`MaCV`, `TenCV`) VALUES ('"
68 | + cv.getMaCV() + "', '" + cv.getTenCV() + "');");
69 | cvConnection.closeConnect();
70 | return ok;
71 | }
72 |
73 | public Boolean delete(String macv) {
74 | cvConnection = new ConnectionDB();
75 | Boolean ok = cvConnection.sqlUpdate("DELETE FROM `chucvu` WHERE `chucvu`.`MaCV` = '" + macv + "'");
76 | cvConnection.closeConnect();
77 | return ok;
78 | }
79 |
80 | public Boolean update(String MaCV, String TenCV) {
81 | cvConnection = new ConnectionDB();
82 | Boolean ok = cvConnection.sqlUpdate("Update ChucVu Set TenCV='" + TenCV + "' WHERE MaCV='" + MaCV + "'");
83 | cvConnection.closeConnect();
84 | return ok;
85 | }
86 |
87 | public void close() {
88 | cvConnection.closeConnect();
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/test/QLChucVu/HienThiChucVu.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.Test.QLChucVu;
2 |
3 | import giaodienchuan.model.FrontEnd.Test.QLChucVu.ChucVu.ChucVu;
4 | import giaodienchuan.model.FrontEnd.Test.QLChucVu.ChucVu.ChucVuBUS;
5 | import giaodienchuan.model.FrontEnd.GiaoDienChuan.MyTable;
6 | import java.awt.BorderLayout;
7 | import java.awt.Dimension;
8 | import java.awt.event.ActionEvent;
9 | import java.util.ArrayList;
10 | import javax.swing.BorderFactory;
11 | import javax.swing.ImageIcon;
12 | import javax.swing.JButton;
13 | import javax.swing.JComboBox;
14 | import javax.swing.JLabel;
15 | import javax.swing.JPanel;
16 | import javax.swing.JTextField;
17 | import javax.swing.event.DocumentEvent;
18 | import javax.swing.event.DocumentListener;
19 |
20 | public class HienThiChucVu extends JPanel {
21 |
22 | ChucVuBUS qlcv = new ChucVuBUS();
23 | MyTable mtb;
24 |
25 | JTextField txTim = new JTextField(15);
26 | JComboBox cbTypeSearch;
27 | JButton btnRefresh = new JButton("Làm mới");
28 |
29 | // index
30 | final int MACV_I = 1, TENCV_I = 2;
31 |
32 | public HienThiChucVu() {
33 | setLayout(new BorderLayout());
34 |
35 | mtb = new MyTable();
36 | mtb.setPreferredSize(new Dimension(1200 - 250, 600));
37 | mtb.setHeaders(new String[]{"STT", "Mã chức vụ", "Tên chức vụ"});
38 | mtb.setColumnsWidth(new double[]{.5, 2, 2});
39 | mtb.setAlignment(0, JLabel.CENTER);
40 | setDataToTable(qlcv.getDscv(), mtb);
41 |
42 | // ======== search panel ===========
43 | cbTypeSearch = new JComboBox<>(new String[]{"Tất cả", "Mã chức vụ", "Tên chức vụ"});
44 |
45 | JPanel plHeader = new JPanel();
46 | JPanel plTim = new JPanel();
47 | plTim.setBorder(BorderFactory.createTitledBorder("Tìm kiếm"));
48 | txTim.setBorder(BorderFactory.createTitledBorder(" ")); // tạo border rỗng
49 | plTim.add(cbTypeSearch);
50 | plTim.add(txTim);
51 | plHeader.add(plTim);
52 |
53 | btnRefresh.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_data_backup_30px.png")));
54 | plHeader.add(btnRefresh);
55 |
56 | cbTypeSearch.addActionListener((ActionEvent e) -> {
57 | txTim.requestFocus();
58 | if (!txTim.getText().equals("")) {
59 | txSearchOnChange();
60 | }
61 | });
62 |
63 | btnRefresh.addActionListener((ae) -> {
64 | refresh();
65 | });
66 |
67 | // https://stackoverflow.com/questions/3953208/value-change-listener-to-jtextfield
68 | txTim.getDocument().addDocumentListener(new DocumentListener() {
69 | @Override
70 | public void changedUpdate(DocumentEvent e) {
71 | txSearchOnChange();
72 | }
73 |
74 | @Override
75 | public void removeUpdate(DocumentEvent e) {
76 | txSearchOnChange();
77 | }
78 |
79 | @Override
80 | public void insertUpdate(DocumentEvent e) {
81 | txSearchOnChange();
82 | }
83 | });
84 |
85 | //=========== add all to this jpanel ===========
86 | this.add(plHeader, BorderLayout.NORTH);
87 | this.add(mtb, BorderLayout.CENTER);
88 | }
89 |
90 | public void refresh() {
91 | qlcv.readDB();
92 | setDataToTable(qlcv.getDscv(), mtb);
93 | }
94 |
95 | public String getSelectedChucVu() {
96 | int i = mtb.getTable().getSelectedRow();
97 | if (i >= 0) {
98 | return mtb.getModel().getValueAt(i, MACV_I).toString();
99 | }
100 | return null;
101 | }
102 |
103 | private void txSearchOnChange() {
104 | setDataToTable(qlcv.search(txTim.getText(), cbTypeSearch.getSelectedItem().toString()), mtb);
105 | }
106 |
107 | private void setDataToTable(ArrayList data, MyTable table) {
108 | table.clear();
109 | int stt = 1; // lưu số thứ tự dòng hiện tại
110 | for (ChucVu cv : data) {
111 | table.addRow(new String[]{String.valueOf(stt), cv.getMaCV(), cv.getTenCV()});
112 | stt++;
113 | }
114 | }
115 | }
--------------------------------------------------------------------------------
/test/QLChucVu/QuanLyChucVuForm.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.Test.QLChucVu;
2 |
3 | import giaodienchuan.model.FrontEnd.Test.QLChucVu.ChucVu.ChucVuBUS;
4 | import giaodienchuan.model.FrontEnd.Test.QLChucVu.ThemSuaChucVuForm;
5 | import java.awt.BorderLayout;
6 | import java.awt.event.ActionEvent;
7 | import javax.swing.ImageIcon;
8 | import javax.swing.JButton;
9 | import javax.swing.JOptionPane;
10 | import javax.swing.JPanel;
11 |
12 | public class QuanLyChucVuForm extends JPanel {
13 |
14 | HienThiChucVu formHienThi = new HienThiChucVu();
15 |
16 | JButton btnThem = new JButton("Thêm");
17 | JButton btnSua = new JButton("Sửa");
18 | JButton btnXoa = new JButton("Xóa");
19 |
20 | public QuanLyChucVuForm() {
21 | setLayout(new BorderLayout());
22 |
23 | // buttons
24 | btnThem.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_add_30px.png")));
25 | btnXoa.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_delete_forever_30px_1.png")));
26 | btnSua.setIcon(new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_support_30px.png")));
27 |
28 | JPanel plBtn = new JPanel();
29 | plBtn.add(btnThem);
30 | plBtn.add(btnXoa);
31 | plBtn.add(btnSua);
32 |
33 | this.add(plBtn, BorderLayout.NORTH);
34 | this.add(formHienThi, BorderLayout.CENTER);
35 |
36 | // actionlistener
37 | btnThem.addActionListener((ActionEvent ae) -> {
38 | btnThemMouseClicked();
39 | });
40 | btnXoa.addActionListener((ActionEvent ae) -> {
41 | btnXoaMouseClicked();
42 | });
43 | btnSua.addActionListener((ActionEvent ae) -> {
44 | btnSuaMouseClicked();
45 | });
46 | }
47 |
48 | private void btnSuaMouseClicked() {
49 | String macv = formHienThi.getSelectedChucVu();
50 | if (macv != null) {
51 | ThemSuaChucVuForm suacv = new ThemSuaChucVuForm("Sửa", macv);
52 |
53 | // https://stackoverflow.com/questions/4154780/jframe-catch-dispose-event
54 | suacv.addWindowListener(new java.awt.event.WindowAdapter() {
55 | @Override
56 | public void windowClosed(java.awt.event.WindowEvent windowEvent) {
57 | formHienThi.refresh();
58 | }
59 | });
60 |
61 | } else {
62 | JOptionPane.showMessageDialog(null, "Chưa chọn chức vụ nào để sửa");
63 | }
64 | }
65 |
66 | private void btnXoaMouseClicked() {
67 | String macv = formHienThi.getSelectedChucVu();
68 | if (macv != null) {
69 | if (JOptionPane.showConfirmDialog(null, "Bạn có chắc muốn xóa chức vụ " + macv + " ?", "Chú ý", JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION) {
70 | new ChucVuBUS().delete(macv);
71 | formHienThi.refresh();
72 | }
73 |
74 | } else {
75 | JOptionPane.showMessageDialog(null, "Chưa chọn chức vụ nào để xóa");
76 | }
77 | }
78 |
79 | private void btnThemMouseClicked() {
80 | ThemSuaChucVuForm themcv = new ThemSuaChucVuForm("Thêm", "");
81 | themcv.addWindowListener(new java.awt.event.WindowAdapter() {
82 | @Override
83 | public void windowClosed(java.awt.event.WindowEvent windowEvent) {
84 | formHienThi.refresh();
85 | }
86 | });
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/test/QLSV/QuanLySinhVienBUS.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.Test.QLSV;
2 |
3 | import java.util.ArrayList;
4 |
5 | public class QuanLySinhVienBUS {
6 | public ArrayList dssv = new ArrayList<>();
7 |
8 | public QuanLySinhVienBUS() {
9 |
10 | }
11 |
12 | public void showConsole() {
13 | dssv.forEach((sv) -> {
14 | System.out.print(sv.getMssv() + " ");
15 | System.out.print(sv.getHo() + " ");
16 | System.out.println(sv.getTen());
17 | });
18 | }
19 |
20 | public void readDB() {
21 | QuanLySinhVienDAO qlsvDB = new QuanLySinhVienDAO();
22 | dssv = qlsvDB.readDB();
23 | qlsvDB.close();
24 | }
25 |
26 | public Boolean add(SinhVien sv) {
27 | QuanLySinhVienDAO qlsvDB = new QuanLySinhVienDAO();
28 | Boolean ok = qlsvDB.add(sv);
29 | qlsvDB.close();
30 |
31 | if (ok) {
32 | dssv.add(sv);
33 | }
34 | return ok;
35 | }
36 |
37 | public Boolean add(String mssv, String ho, String ten) {
38 | SinhVien sv = new SinhVien(mssv, ho, ten);
39 | return add(sv);
40 | }
41 |
42 | public Boolean delete(String mssv) {
43 | QuanLySinhVienDAO qlsvDB = new QuanLySinhVienDAO();
44 | Boolean ok = qlsvDB.delete(mssv);
45 | qlsvDB.close();
46 |
47 | if (ok) {
48 | for(int i = (dssv.size() - 1); i >= 0; i--) {
49 | if(dssv.get(i).getMssv().equals(mssv)) {
50 | dssv.remove(i);
51 | }
52 | }
53 | }
54 | return ok;
55 | }
56 |
57 | public Boolean update(String mssv, String ho, String ten) {
58 | QuanLySinhVienDAO qlsvDB = new QuanLySinhVienDAO();
59 | Boolean ok = qlsvDB.update(mssv, ho, ten);
60 | qlsvDB.close();
61 |
62 | if(ok) {
63 | dssv.forEach((sv) -> {
64 | if(sv.getMssv().equals(mssv)) {
65 | sv.setHo(ho);
66 | sv.setTen(ten);
67 | }
68 | });
69 | }
70 |
71 | return ok;
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/test/QLSV/QuanLySinhVienDAO.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.Test.QLSV;
2 |
3 | import giaodienchuan.model.BackEnd.ConnectionDB.ConnectionDB;
4 | import java.sql.ResultSet;
5 | import java.sql.SQLException;
6 | import java.util.ArrayList;
7 | import javax.swing.JOptionPane;
8 |
9 | public class QuanLySinhVienDAO {
10 |
11 | ConnectionDB qlsvDB = new ConnectionDB("qlsv");
12 |
13 | public QuanLySinhVienDAO() {
14 | qlsvDB.logIn("root", "");
15 | }
16 |
17 | public ArrayList readDB() {
18 | ArrayList dssv = new ArrayList<>();
19 | try {
20 | String qry = "SELECT * FROM sinhvien";
21 | ResultSet r = qlsvDB.sqlQuery(qry);
22 | if (r != null) {
23 | while (r.next()) {
24 | String mssv = r.getString(1);
25 | String ho = r.getString(2);
26 | String ten = r.getString(3);
27 | dssv.add(new SinhVien(mssv, ho, ten));
28 | }
29 | }
30 |
31 | } catch (SQLException ex) {
32 | JOptionPane.showMessageDialog(null, "Không thấy data cần tìm trong ResultSet");
33 | }
34 | return dssv;
35 | }
36 |
37 | public Boolean add(SinhVien sv) {
38 | Boolean ok = qlsvDB.sqlUpdate("INSERT INTO `sinhvien` (`mssv`, `ho`, `ten`) VALUES ('"
39 | + sv.getMssv() + "', '" + sv.getHo() + "', '" + sv.getTen() + "');");
40 | return ok;
41 | }
42 |
43 | public Boolean delete(String mssv) {
44 | Boolean ok = qlsvDB.sqlUpdate("DELETE FROM `sinhvien` WHERE `sinhvien`.`mssv` = '" + mssv + "'");
45 | return ok;
46 | }
47 |
48 | public Boolean update(String mssv, String ho, String ten) {
49 | Boolean ok = qlsvDB.sqlUpdate("Update SinhVien Set ho='" + ho + "',ten='" + ten + "' where mssv='" + mssv + "'");
50 | return ok;
51 | }
52 |
53 | public void close() {
54 | qlsvDB.closeConnect();
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/test/QLSV/SinhVien.java:
--------------------------------------------------------------------------------
1 |
2 | package giaodienchuan.model.FrontEnd.Test.QLSV;
3 |
4 |
5 | public class SinhVien {
6 | String mssv, ho, ten;
7 |
8 | public SinhVien(String mssv, String ho, String ten) {
9 | this.mssv = mssv;
10 | this.ho = ho;
11 | this.ten = ten;
12 | }
13 |
14 | public String getMssv() {
15 | return mssv;
16 | }
17 |
18 | public void setMssv(String mssv) {
19 | this.mssv = mssv;
20 | }
21 |
22 | public String getHo() {
23 | return ho;
24 | }
25 |
26 | public void setHo(String ho) {
27 | this.ho = ho;
28 | }
29 |
30 | public String getTen() {
31 | return ten;
32 | }
33 |
34 | public void setTen(String ten) {
35 | this.ten = ten;
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/test/SearchPanel.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.Test;
2 |
3 | import java.awt.Color;
4 | import java.awt.GridBagConstraints;
5 | import java.awt.GridBagLayout;
6 | import javax.swing.BorderFactory;
7 | import javax.swing.JButton;
8 | import javax.swing.JFrame;
9 | import javax.swing.JPanel;
10 | import javax.swing.JTextField;
11 |
12 | public class SearchPanel extends JPanel {
13 |
14 | JButton btnSearchID = new JButton("Tìm theo Mã");
15 | JButton btnSearchName = new JButton("Tìm theo Tên");
16 | JTextField txSearch = new JTextField(15);
17 |
18 | GridBagConstraints gbc = new GridBagConstraints();
19 |
20 | public SearchPanel() {
21 | setLayout(new GridBagLayout());
22 | setBorder(BorderFactory.createTitledBorder("Tìm kiếm :"));
23 |
24 | // style components
25 | txSearch.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
26 | btnSearchID.setBackground(Color.white);
27 | btnSearchName.setBackground(Color.white);
28 |
29 | // add component
30 | gbc.gridx = 0;
31 | gbc.gridy = 1;
32 | add(btnSearchID, gbc);
33 |
34 | gbc.gridx = 1;
35 | gbc.gridy = 1;
36 | add(btnSearchName, gbc);
37 |
38 | gbc.gridx = 0;
39 | gbc.gridy = 0;
40 | gbc.gridwidth = 2;
41 | gbc.fill = GridBagConstraints.HORIZONTAL;
42 | add(txSearch, gbc);
43 | }
44 |
45 | public static void main(String[] args) {
46 | JFrame f = new JFrame();
47 | SearchPanel s = new SearchPanel();
48 |
49 | f.setTitle("Giao dien chuan");
50 | f.setLayout(new GridBagLayout());
51 |
52 | f.add(s);
53 |
54 | f.pack();
55 | f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
56 | f.setVisible(true);
57 | f.setLocationRelativeTo(null);
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/test/TableIcon.java:
--------------------------------------------------------------------------------
1 | package giaodienchuan.model.FrontEnd.Test;
2 |
3 | import java.awt.*;
4 | import javax.swing.*;
5 | import javax.swing.table.*;
6 |
7 | //https://stackoverflow.com/questions/4941372/how-to-insert-image-into-jtable-cell
8 | public class TableIcon extends JPanel {
9 |
10 | public TableIcon() {
11 | Icon aboutIcon = new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_add_30px.png"));
12 | Icon addIcon = new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_bar_chart_30px.png"));
13 | Icon copyIcon = new ImageIcon(this.getClass().getResource("/giaodienchuan/images/icons8_cancel_30px_1.png"));
14 |
15 | String[] columnNames = {"Picture", "Description"};
16 | Object[][] data = {
17 | {aboutIcon, "About"},
18 | {addIcon, "Add"},
19 | {copyIcon, "Copy"}};
20 |
21 | DefaultTableModel model = new DefaultTableModel(data, columnNames) {
22 | // Returning the Class of each column will allow different
23 | // renderers to be used based on Class
24 | @Override
25 | public Class getColumnClass(int column) {
26 | return getValueAt(0, column).getClass();
27 | }
28 | };
29 | JTable table = new JTable(model);
30 | table.setPreferredScrollableViewportSize(table.getPreferredSize());
31 |
32 | JScrollPane scrollPane = new JScrollPane(table);
33 | add(scrollPane);
34 | }
35 |
36 | private static void createAndShowGUI() {
37 | JFrame frame = new JFrame("Table Icon");
38 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
39 | frame.add(new TableIcon());
40 | frame.setLocationByPlatform(true);
41 | frame.pack();
42 | frame.setVisible(true);
43 | }
44 |
45 | public static void main(String[] args) {
46 | EventQueue.invokeLater(new Runnable() {
47 | public void run() {
48 | createAndShowGUI();
49 | }
50 | });
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/test/springLayoutTest.java:
--------------------------------------------------------------------------------
1 |
2 | package giaodienchuan.model.FrontEnd.Test;
3 |
4 | import java.awt.BorderLayout;
5 | import javax.swing.JFrame;
6 | import javax.swing.JLabel;
7 | import javax.swing.JPanel;
8 | import javax.swing.JTextField;
9 | import javax.swing.SpringLayout;
10 |
11 | public class springLayoutTest {
12 |
13 | public static void main(String[] args) {
14 | JFrame f = new JFrame();
15 | f.setLayout(null);
16 | f.setTitle("Giao diện chuẩn");
17 | f.setSize(800, 600);
18 | f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
19 |
20 | String[] labels = {"Name: ", "Fax: ", "Email: ", "Address: "};
21 | int numPairs = labels.length;
22 |
23 | //Create and populate the panel.
24 | JPanel p = new JPanel(new SpringLayout());
25 | p.setSize(200, 150);
26 | for (int i = 0; i < numPairs; i++) {
27 | JLabel l = new JLabel(labels[i], JLabel.TRAILING);
28 | p.add(l);
29 | JTextField textField = new JTextField(10);
30 | l.setLabelFor(textField);
31 | p.add(textField);
32 | }
33 |
34 | //Lay out the panel.
35 | SpringUtilities.makeCompactGrid(p,
36 | numPairs, 2, //rows, cols
37 | 6, 6, //initX, initY
38 | 6, 6); //xPad, yPad
39 |
40 | f.add(p, BorderLayout.SOUTH);
41 | f.setVisible(true);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------