├── .gitignore ├── .gitattributes ├── manifest.mf ├── 1_6Jp3vJWe7VFlFHZ9WhSJng.jpg ├── README.md ├── src └── edu │ └── ijse │ ├── lib │ └── mysql-connector-j-8.4.0.jar │ ├── dao │ ├── SuperDao.java │ ├── custom │ │ ├── BookDao.java │ │ ├── MemberDao.java │ │ ├── CategoryDao.java │ │ ├── IssueDao.java │ │ └── impl │ │ │ ├── IssueDaoImpl.java │ │ │ ├── MemberDaoImpl.java │ │ │ ├── BookDaoImpl.java │ │ │ └── CategoryDaoImpl.java │ ├── CrudDao.java │ ├── CrudUtil.java │ └── DaoFactory.java │ ├── service │ ├── SuperService.java │ ├── custom │ │ ├── BookService.java │ │ ├── MemberService.java │ │ ├── IssueService.java │ │ ├── CategoryService.java │ │ └── impl │ │ │ ├── CategoryServiceImpl.java │ │ │ ├── IssueServiceImpl.java │ │ │ ├── MemberServiceImpl.java │ │ │ └── BookServiceImpl.java │ └── ServiceFactory.java │ ├── Main.java │ ├── db │ └── DBConnection.java │ ├── controller │ ├── BookController.java │ ├── IssueController.java │ ├── MemberController.java │ └── CategoryController.java │ ├── dto │ ├── CategoryDto.java │ ├── MemberDto.java │ ├── BookDto.java │ └── IssueDto.java │ ├── entity │ ├── CategoryEntity.java │ ├── MemberEntity.java │ ├── BookEntity.java │ └── IssueEntity.java │ └── view │ ├── Menu.java │ ├── Login.form │ ├── Login.java │ ├── Menu.form │ ├── CategoryView.form │ ├── BookIssueView.form │ ├── BooksView.form │ ├── MemberView.form │ ├── CategoryView.java │ ├── BookReturnView.form │ └── BookIssueView.java ├── nbproject ├── private │ ├── private.properties │ └── private.xml ├── genfiles.properties ├── project.xml └── project.properties └── database.sql /.gitignore: -------------------------------------------------------------------------------- 1 | /dist/ 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /1_6Jp3vJWe7VFlFHZ9WhSJng.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pawan-ML/Coursework2-OOP/HEAD/1_6Jp3vJWe7VFlFHZ9WhSJng.jpg -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Coursework 2 | 2nd course work 3 | Database sql file also included here 4 | Charutha Pawan CMJD 106 [Physical] 5 | -------------------------------------------------------------------------------- /src/edu/ijse/lib/mysql-connector-j-8.4.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pawan-ML/Coursework2-OOP/HEAD/src/edu/ijse/lib/mysql-connector-j-8.4.0.jar -------------------------------------------------------------------------------- /nbproject/private/private.properties: -------------------------------------------------------------------------------- 1 | compile.on.save=true 2 | user.properties.file=C:\\Users\\tharu\\AppData\\Roaming\\NetBeans\\22\\build.properties 3 | -------------------------------------------------------------------------------- /src/edu/ijse/dao/SuperDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template 4 | */ 5 | package edu.ijse.dao; 6 | 7 | /** 8 | * 9 | * @author tharu 10 | */ 11 | public interface SuperDao { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/edu/ijse/service/SuperService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template 4 | */ 5 | package edu.ijse.service; 6 | 7 | /** 8 | * 9 | * @author tharu 10 | */ 11 | public interface SuperService { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/edu/ijse/dao/custom/BookDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template 4 | */ 5 | package edu.ijse.dao.custom; 6 | 7 | import edu.ijse.dao.CrudDao; 8 | import edu.ijse.entity.BookEntity; 9 | /** 10 | * 11 | * @author tharu 12 | */ 13 | public interface BookDao extends CrudDao { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/edu/ijse/dao/custom/MemberDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template 4 | */ 5 | package edu.ijse.dao.custom; 6 | 7 | 8 | import edu.ijse.dao.CrudDao; 9 | import edu.ijse.entity.MemberEntity; 10 | /** 11 | * 12 | * @author tharu 13 | */ 14 | public interface MemberDao extends CrudDao { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=703f7b52 2 | build.xml.script.CRC32=7f723b73 3 | build.xml.stylesheet.CRC32=f85dc8f2@1.111.0.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=703f7b52 7 | nbproject/build-impl.xml.script.CRC32=0c9795aa 8 | nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.111.0.48 9 | -------------------------------------------------------------------------------- /src/edu/ijse/dao/custom/CategoryDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template 4 | */ 5 | package edu.ijse.dao.custom; 6 | 7 | import edu.ijse.dao.CrudDao; 8 | import edu.ijse.entity.CategoryEntity; 9 | 10 | /** 11 | * 12 | * @author tharu 13 | */ 14 | public interface CategoryDao extends CrudDao{ 15 | 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/edu/ijse/dao/custom/IssueDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template 4 | */ 5 | package edu.ijse.dao.custom; 6 | 7 | /** 8 | * 9 | * @author tharu 10 | */ 11 | import edu.ijse.dao.CrudDao; 12 | import edu.ijse.dao.CrudUtil; 13 | import edu.ijse.entity.IssueEntity; 14 | 15 | public interface IssueDao extends CrudDao{ 16 | 17 | } 18 | -------------------------------------------------------------------------------- /nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | LibraryProject 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /nbproject/private/private.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | file:/D:/IJSE/Class/CMJD/CMJD106/LibraryProject/src/edu/ijse/view/MemberView.java 7 | file:/D:/IJSE/Class/CMJD/CMJD106/LibraryProject/src/edu/ijse/view/CategoryView.java 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/edu/ijse/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template 4 | */ 5 | package edu.ijse; 6 | import edu.ijse.view.Login; 7 | /** 8 | * 9 | * @author tharu 10 | */ 11 | public class Main { 12 | 13 | /** 14 | * @param args the command line arguments 15 | */ 16 | public static void main(String[] args){ 17 | // TODO code application logic here 18 | new Login().setVisible(true); 19 | // new CategoryView().setVisible(true); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/edu/ijse/dao/CrudDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template 4 | */ 5 | package edu.ijse.dao; 6 | 7 | import java.util.ArrayList; 8 | 9 | /** 10 | * 11 | * @author tharu 12 | */ 13 | public interface CrudDao extends SuperDao{ 14 | boolean create(T t) throws Exception; 15 | boolean update(T t) throws Exception; 16 | boolean delete(ID id) throws Exception; 17 | T get(ID id) throws Exception; 18 | ArrayList getAll() throws Exception; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/edu/ijse/service/custom/BookService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template 4 | */ 5 | package edu.ijse.service.custom; 6 | 7 | import edu.ijse.dto.BookDto; 8 | import edu.ijse.service.SuperService; 9 | import java.util.ArrayList; 10 | /** 11 | * 12 | * @author tharu 13 | */ 14 | public interface BookService extends SuperService{ 15 | String save(BookDto bookDto) throws Exception; 16 | String update(BookDto bookDto) throws Exception; 17 | String delete(String bookId) throws Exception; 18 | BookDto get(String bookId) throws Exception; 19 | ArrayList getAll() throws Exception; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/edu/ijse/service/custom/MemberService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template 4 | */ 5 | package edu.ijse.service.custom; 6 | 7 | 8 | import edu.ijse.dto.MemberDto; 9 | import edu.ijse.service.SuperService; 10 | import java.util.ArrayList; 11 | /** 12 | * 13 | * @author tharu 14 | */ 15 | public interface MemberService extends SuperService{ 16 | String save(MemberDto memberDto) throws Exception; 17 | String update(MemberDto memberDto) throws Exception; 18 | String delete(String nic) throws Exception; 19 | MemberDto get(String nic) throws Exception; 20 | ArrayList getAll() throws Exception; 21 | } 22 | -------------------------------------------------------------------------------- /src/edu/ijse/service/custom/IssueService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template 4 | */ 5 | package edu.ijse.service.custom; 6 | 7 | /** 8 | * 9 | * @author tharu 10 | */ 11 | import edu.ijse.dto.IssueDto; 12 | import edu.ijse.service.SuperService; 13 | import java.util.ArrayList; 14 | 15 | public interface IssueService extends SuperService { 16 | String save(IssueDto issueDto) throws Exception; 17 | String update(IssueDto issueDto) throws Exception; 18 | String delete(String nic) throws Exception; 19 | IssueDto get(String nic) throws Exception; 20 | ArrayList getAll() throws Exception; 21 | 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/edu/ijse/service/custom/CategoryService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template 4 | */ 5 | package edu.ijse.service.custom; 6 | 7 | import edu.ijse.dto.CategoryDto; 8 | import edu.ijse.service.SuperService; 9 | import java.util.ArrayList; 10 | 11 | /** 12 | * 13 | * @author tharu 14 | */ 15 | public interface CategoryService extends SuperService{ 16 | String save(CategoryDto categoryDto) throws Exception; 17 | String update(CategoryDto categoryDto) throws Exception; 18 | String delete(String catcode) throws Exception; 19 | CategoryDto get(String catcode) throws Exception; 20 | ArrayList getAll()throws Exception; 21 | } 22 | -------------------------------------------------------------------------------- /src/edu/ijse/db/DBConnection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template 4 | */ 5 | package edu.ijse.db; 6 | 7 | import java.sql.Connection; 8 | import java.sql.DriverManager; 9 | import java.sql.SQLException; 10 | 11 | /** 12 | * 13 | * @author anjan 14 | */ 15 | public class DBConnection { 16 | private static DBConnection dBConnection; 17 | private Connection connection; 18 | 19 | private DBConnection() throws ClassNotFoundException, SQLException{ 20 | Class.forName("com.mysql.cj.jdbc.Driver"); 21 | connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/library", "root", "Vismine@123"); 22 | } 23 | 24 | public static DBConnection getInstance() throws ClassNotFoundException, SQLException{ 25 | if(dBConnection == null){ 26 | dBConnection = new DBConnection(); 27 | } 28 | return dBConnection; 29 | } 30 | 31 | public Connection getConnection(){ 32 | return connection; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/edu/ijse/controller/BookController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template 4 | */ 5 | package edu.ijse.controller; 6 | 7 | import edu.ijse.dto.BookDto; 8 | import java.util.ArrayList; 9 | import edu.ijse.service.ServiceFactory; 10 | import edu.ijse.service.custom.BookService; 11 | /** 12 | * 13 | * @author tharu 14 | */ 15 | public class BookController { 16 | private BookService bookService = (BookService)ServiceFactory.getInstance().getService(ServiceFactory.ServiceType.BOOK); 17 | 18 | public String save(BookDto bookDto) throws Exception{ 19 | return bookService.save(bookDto); 20 | } 21 | 22 | public String update(BookDto bookDto) throws Exception{ 23 | return bookService.update(bookDto); 24 | } 25 | 26 | public String delete(String bookId) throws Exception{ 27 | return bookService.delete(bookId); 28 | } 29 | 30 | public ArrayList getAll() throws Exception{ 31 | return bookService.getAll(); 32 | } 33 | 34 | public BookDto get(String bookId) throws Exception{ 35 | return bookService.get(bookId); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/edu/ijse/controller/IssueController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template 4 | */ 5 | package edu.ijse.controller; 6 | 7 | import edu.ijse.dto.IssueDto; 8 | import edu.ijse.service.ServiceFactory; 9 | import edu.ijse.service.custom.IssueService; 10 | import java.util.ArrayList; 11 | /** 12 | * 13 | * @author tharu 14 | */ 15 | public class IssueController { 16 | private IssueService issueService = (IssueService)ServiceFactory.getInstance().getService(ServiceFactory.ServiceType.BISSUE); 17 | 18 | public String save(IssueDto issueDto) throws Exception{ 19 | return issueService.save(issueDto); 20 | } 21 | 22 | public String update(IssueDto issueDto) throws Exception{ 23 | return issueService.update(issueDto); 24 | } 25 | 26 | public String delete(String nic) throws Exception{ 27 | return issueService.delete(nic); 28 | } 29 | 30 | public ArrayList getAll() throws Exception{ 31 | return issueService.getAll(); 32 | } 33 | 34 | public IssueDto get(String nic) throws Exception{ 35 | return issueService.get(nic); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/edu/ijse/dao/CrudUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template 4 | */ 5 | package edu.ijse.dao; 6 | 7 | import edu.ijse.db.DBConnection; 8 | import java.sql.Connection; 9 | import java.sql.PreparedStatement; 10 | import java.sql.ResultSet; 11 | 12 | /** 13 | * 14 | * @author tharu 15 | */ 16 | public class CrudUtil { 17 | private static PreparedStatement getPreparedStatement(String sql, Object... args) throws Exception{ 18 | Connection connection = DBConnection.getInstance().getConnection(); 19 | PreparedStatement statement = connection.prepareStatement(sql); 20 | if(args != null){ 21 | for (int i = 0; i < args.length; i++) { 22 | statement.setObject(i+1, args[i]); 23 | } 24 | } 25 | return statement; 26 | } 27 | 28 | public static boolean executeUpdate(String sql, Object... args) throws Exception{ 29 | return getPreparedStatement(sql, args).executeUpdate() > 0; 30 | } 31 | public static ResultSet executeQuery(String sql, Object... args) throws Exception{ 32 | return getPreparedStatement(sql, args).executeQuery(); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/edu/ijse/controller/MemberController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template 4 | */ 5 | package edu.ijse.controller; 6 | 7 | 8 | import edu.ijse.dto.MemberDto; 9 | import java.util.ArrayList; 10 | import edu.ijse.service.custom.MemberService; 11 | import edu.ijse.service.ServiceFactory; 12 | /** 13 | * 14 | * @author tharu 15 | */ 16 | public class MemberController { 17 | 18 | 19 | private MemberService memberService = (MemberService)ServiceFactory.getInstance().getService(ServiceFactory.ServiceType.MEMBER); 20 | 21 | public String save(MemberDto memberDto) throws Exception{ 22 | return memberService.save(memberDto); 23 | } 24 | 25 | public String update(MemberDto memberDto) throws Exception{ 26 | return memberService.update(memberDto); 27 | } 28 | 29 | public String delete(String nic) throws Exception{ 30 | return memberService.delete(nic); 31 | } 32 | 33 | public ArrayList getAll() throws Exception{ 34 | return memberService.getAll(); 35 | } 36 | 37 | public MemberDto get(String nic) throws Exception{ 38 | return memberService.get(nic); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/edu/ijse/controller/CategoryController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template 4 | */ 5 | package edu.ijse.controller; 6 | 7 | import edu.ijse.dto.CategoryDto; 8 | import edu.ijse.service.ServiceFactory; 9 | import edu.ijse.service.custom.CategoryService; 10 | import java.util.ArrayList; 11 | 12 | /** 13 | * 14 | * @author tharu 15 | */ 16 | public class CategoryController { 17 | private CategoryService categoryService = (CategoryService)ServiceFactory.getInstance().getService(ServiceFactory.ServiceType.CATEGORY); 18 | public String save(CategoryDto categoryDto) throws Exception { 19 | return categoryService.save(categoryDto); 20 | } 21 | public String update(CategoryDto categoryDto) throws Exception { 22 | return categoryService.update(categoryDto); 23 | } 24 | public String delete(String catcode) throws Exception { 25 | return categoryService.delete(catcode); 26 | } 27 | public ArrayList getAll() throws Exception{ 28 | return categoryService.getAll(); 29 | } 30 | public CategoryDto get(String catcode) throws Exception { 31 | return categoryService.get(catcode); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/edu/ijse/service/ServiceFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template 4 | */ 5 | package edu.ijse.service; 6 | 7 | import edu.ijse.service.custom.impl.BookServiceImpl; 8 | import edu.ijse.service.custom.impl.CategoryServiceImpl; 9 | import edu.ijse.service.custom.impl.IssueServiceImpl; 10 | import edu.ijse.service.custom.impl.MemberServiceImpl; 11 | 12 | public class ServiceFactory { 13 | private static ServiceFactory serviceFactory; 14 | 15 | public static ServiceFactory getInstance(){ 16 | if(serviceFactory==null){ 17 | serviceFactory =new ServiceFactory(); 18 | } 19 | return serviceFactory; 20 | } 21 | public SuperService getService(ServiceType serviceType){ 22 | switch (serviceType){ 23 | case CATEGORY: 24 | return new CategoryServiceImpl(); 25 | case BOOK: 26 | return new BookServiceImpl(); 27 | case MEMBER: 28 | return new MemberServiceImpl(); 29 | case BISSUE: 30 | return new IssueServiceImpl(); 31 | default: 32 | return null; 33 | } 34 | } 35 | public enum ServiceType{ 36 | CATEGORY, BOOK, MEMBER, BISSUE 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/edu/ijse/dao/DaoFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template 4 | */ 5 | package edu.ijse.dao; 6 | 7 | import edu.ijse.dao.custom.impl.BookDaoImpl; 8 | import edu.ijse.dao.custom.impl.CategoryDaoImpl; 9 | import edu.ijse.dao.custom.impl.IssueDaoImpl; 10 | import edu.ijse.dao.custom.impl.MemberDaoImpl; 11 | 12 | /** 13 | * 14 | * @author tharu 15 | */ 16 | public class DaoFactory { 17 | private static DaoFactory daoFactory; 18 | private DaoFactory(){ 19 | } 20 | public static DaoFactory getInstance(){ 21 | if(daoFactory == null){ 22 | daoFactory=new DaoFactory(); 23 | } 24 | return daoFactory; 25 | } 26 | 27 | public SuperDao getDao(DaoTypes type){ 28 | switch(type){ 29 | case CATEGORY: 30 | return new CategoryDaoImpl(); 31 | case BOOK: 32 | return new BookDaoImpl(); 33 | case MEMBERS: 34 | return new MemberDaoImpl(); 35 | case BISSUE: 36 | return new IssueDaoImpl(); 37 | default: 38 | return null; 39 | } 40 | } 41 | 42 | public enum DaoTypes{ 43 | CATEGORY, BOOK, MEMBERS, ORDERS, ORDER_DETAIL,BISSUE; 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/edu/ijse/dto/CategoryDto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template 4 | */ 5 | package edu.ijse.dto; 6 | 7 | /** 8 | * 9 | * @author tharu 10 | */ 11 | public class CategoryDto { 12 | private String catcode; 13 | private String title; 14 | private String description; 15 | 16 | public CategoryDto() { 17 | } 18 | 19 | public CategoryDto(String catcode, String title, String description) { 20 | this.catcode = catcode; 21 | this.title = title; 22 | this.description = description; 23 | } 24 | 25 | 26 | 27 | @Override 28 | public String toString() { 29 | return "CategoryDto{" + "catcode=" + getCatcode() + ", title=" + getTitle() + ", description=" + getDescription() + '}'; 30 | } 31 | 32 | /** 33 | * @return the catcode 34 | */ 35 | public String getCatcode() { 36 | return catcode; 37 | } 38 | 39 | /** 40 | * @param catcode the catcode to set 41 | */ 42 | public void setCatcode(String catcode) { 43 | this.catcode = catcode; 44 | } 45 | 46 | /** 47 | * @return the title 48 | */ 49 | public String getTitle() { 50 | return title; 51 | } 52 | 53 | /** 54 | * @param title the title to set 55 | */ 56 | public void setTitle(String title) { 57 | this.title = title; 58 | } 59 | 60 | /** 61 | * @return the description 62 | */ 63 | public String getDescription() { 64 | return description; 65 | } 66 | 67 | /** 68 | * @param description the description to set 69 | */ 70 | public void setDescription(String description) { 71 | this.description = description; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/edu/ijse/entity/CategoryEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template 4 | */ 5 | package edu.ijse.entity; 6 | 7 | /** 8 | * 9 | * @author tharu 10 | */ 11 | public class CategoryEntity { 12 | private String catcode; 13 | private String title; 14 | private String description; 15 | 16 | public CategoryEntity() { 17 | } 18 | 19 | public CategoryEntity(String catcode, String title, String description) { 20 | this.catcode = catcode; 21 | this.title = title; 22 | this.description = description; 23 | } 24 | 25 | /** 26 | * @return the catcode 27 | */ 28 | public String getCatcode() { 29 | return catcode; 30 | } 31 | 32 | /** 33 | * @param catcode the catcode to set 34 | */ 35 | public void setCatcode(String catcode) { 36 | this.catcode = catcode; 37 | } 38 | 39 | /** 40 | * @return the title 41 | */ 42 | public String getTitle() { 43 | return title; 44 | } 45 | 46 | /** 47 | * @param title the title to set 48 | */ 49 | public void setTitle(String title) { 50 | this.title = title; 51 | } 52 | 53 | /** 54 | * @return the description 55 | */ 56 | public String getDescription() { 57 | return description; 58 | } 59 | 60 | /** 61 | * @param description the description to set 62 | */ 63 | public void setDescription(String description) { 64 | this.description = description; 65 | } 66 | 67 | @Override 68 | public String toString() { 69 | return "CategoryEntity{" + "catcode=" + catcode + ", title=" + title + ", description=" + description + '}'; 70 | } 71 | 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/edu/ijse/dto/MemberDto.java: -------------------------------------------------------------------------------- 1 | package edu.ijse.dto; 2 | 3 | /* 4 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 5 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template 6 | */ 7 | 8 | /** 9 | * 10 | * @author tharu 11 | */ 12 | public class MemberDto { 13 | private String nic; 14 | private String name; 15 | private String address; 16 | private String password; 17 | 18 | public MemberDto() { 19 | } 20 | 21 | public MemberDto(String nic, String name, String address, String password) { 22 | this.nic = nic; 23 | this.name = name; 24 | this.address = address; 25 | this.password = password; 26 | } 27 | 28 | /** 29 | * @return the nic 30 | */ 31 | public String getNic() { 32 | return nic; 33 | } 34 | 35 | /** 36 | * @param nic the nic to set 37 | */ 38 | public void setNic(String nic) { 39 | this.nic = nic; 40 | } 41 | 42 | /** 43 | * @return the name 44 | */ 45 | public String getName() { 46 | return name; 47 | } 48 | 49 | /** 50 | * @param name the name to set 51 | */ 52 | public void setName(String name) { 53 | this.name = name; 54 | } 55 | 56 | /** 57 | * @return the address 58 | */ 59 | public String getAddress() { 60 | return address; 61 | } 62 | 63 | /** 64 | * @param address the address to set 65 | */ 66 | public void setAddress(String address) { 67 | this.address = address; 68 | } 69 | 70 | /** 71 | * @return the password 72 | */ 73 | public String getPassword() { 74 | return password; 75 | } 76 | 77 | /** 78 | * @param password the password to set 79 | */ 80 | public void setPassword(String password) { 81 | this.password = password; 82 | } 83 | 84 | @Override 85 | public String toString() { 86 | return "MemberDto{" + "nic=" + nic + ", name=" + name + ", address=" + address + ", password=" + password + '}'; 87 | } 88 | 89 | 90 | } 91 | -------------------------------------------------------------------------------- /src/edu/ijse/entity/MemberEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template 4 | */ 5 | package edu.ijse.entity; 6 | 7 | /** 8 | * 9 | * @author tharu 10 | */ 11 | public class MemberEntity { 12 | private String nic; 13 | private String name; 14 | private String address; 15 | private String password; 16 | 17 | public MemberEntity() { 18 | } 19 | 20 | public MemberEntity(String nic, String name, String address, String password) { 21 | this.nic = nic; 22 | this.name = name; 23 | this.address = address; 24 | this.password = password; 25 | } 26 | 27 | /** 28 | * @return the nic 29 | */ 30 | public String getNic() { 31 | return nic; 32 | } 33 | 34 | /** 35 | * @param nic the nic to set 36 | */ 37 | public void setNic(String nic) { 38 | this.nic = nic; 39 | } 40 | 41 | /** 42 | * @return the name 43 | */ 44 | public String getName() { 45 | return name; 46 | } 47 | 48 | /** 49 | * @param name the name to set 50 | */ 51 | public void setName(String name) { 52 | this.name = name; 53 | } 54 | 55 | /** 56 | * @return the address 57 | */ 58 | public String getAddress() { 59 | return address; 60 | } 61 | 62 | /** 63 | * @param address the address to set 64 | */ 65 | public void setAddress(String address) { 66 | this.address = address; 67 | } 68 | 69 | /** 70 | * @return the password 71 | */ 72 | public String getPassword() { 73 | return password; 74 | } 75 | 76 | /** 77 | * @param password the password to set 78 | */ 79 | public void setPassword(String password) { 80 | this.password = password; 81 | } 82 | 83 | @Override 84 | public String toString() { 85 | return "MemberEntity{" + "nic=" + nic + ", name=" + name + ", address=" + address + ", password=" + password + '}'; 86 | } 87 | 88 | 89 | } 90 | -------------------------------------------------------------------------------- /src/edu/ijse/dao/custom/impl/IssueDaoImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template 4 | */ 5 | package edu.ijse.dao.custom.impl; 6 | 7 | /** 8 | * 9 | * @author tharu 10 | */ 11 | import edu.ijse.dao.custom.IssueDao; 12 | import edu.ijse.entity.IssueEntity; 13 | import java.util.ArrayList; 14 | import edu.ijse.dao.CrudUtil; 15 | import java.sql.ResultSet; 16 | 17 | 18 | public class IssueDaoImpl implements IssueDao{ 19 | 20 | @Override 21 | public boolean create(IssueEntity t) throws Exception { 22 | return CrudUtil.executeUpdate("INSERT INTO issue VALUES (?,?,?,?,?)", t.getNic(),t.getBookid(),t.getIssuedate(),t.getDuedate(),t.getReturnBook()); 23 | } 24 | 25 | @Override 26 | public boolean update(IssueEntity t) throws Exception { 27 | return CrudUtil.executeUpdate("UPDATE issue SET returnBook=? WHERE NIC=?", "Yes",t.getNic()); 28 | } 29 | 30 | @Override 31 | public boolean delete(String id) throws Exception { 32 | return CrudUtil.executeUpdate("UPDATE issue SET returnBook='Yes' WHERE NIC=?", id); 33 | } 34 | 35 | @Override 36 | public IssueEntity get(String id) throws Exception { 37 | ResultSet rst = CrudUtil.executeQuery("SELECT * FROM issue WHERE NIC = ?", id); 38 | if(rst.next()){ 39 | IssueEntity entity = new IssueEntity(rst.getString("nic"), 40 | rst.getString("bookid"), rst.getString("issuedate"), 41 | rst.getString("duedate"), rst.getString("returnbook")); 42 | return entity; 43 | } 44 | return null; 45 | } 46 | 47 | @Override 48 | public ArrayList getAll() throws Exception { 49 | ArrayList itemEntities = new ArrayList<>(); 50 | ResultSet rst = CrudUtil.executeQuery("SELECT * FROM issue"); 51 | while (rst.next()) { 52 | IssueEntity entity = new IssueEntity(rst.getString("NIC"), 53 | rst.getString("bookid"),rst.getString("issueDate"),rst.getString("dueDate"),rst.getString("returnBook")); 54 | itemEntities.add(entity); 55 | } 56 | return itemEntities; 57 | } 58 | 59 | } 60 | 61 | -------------------------------------------------------------------------------- /src/edu/ijse/dao/custom/impl/MemberDaoImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template 4 | */ 5 | package edu.ijse.dao.custom.impl; 6 | 7 | import edu.ijse.dao.DaoFactory; 8 | import edu.ijse.dao.custom.MemberDao; 9 | import edu.ijse.dto.MemberDto; 10 | import edu.ijse.entity.MemberEntity; 11 | import edu.ijse.service.custom.MemberService; 12 | import java.util.ArrayList; 13 | import edu.ijse.dao.CrudUtil; 14 | import java.util.ArrayList; 15 | import java.sql.ResultSet; 16 | /** 17 | * 18 | * @author tharu 19 | */ 20 | public class MemberDaoImpl implements MemberDao{ 21 | 22 | @Override 23 | public boolean create(MemberEntity t) throws Exception { 24 | return CrudUtil.executeUpdate("INSERT INTO members VALUES(?,?,?,?)", t.getNic(),t.getName(),t.getAddress(),t.getPassword()); 25 | 26 | } 27 | 28 | @Override 29 | public boolean update(MemberEntity t) throws Exception { 30 | return CrudUtil.executeUpdate("UPDATE members SET Name=?, Address=?, password=? WHERE NIC=?", t.getName(),t.getAddress(),t.getPassword(),t.getNic()); 31 | } 32 | 33 | @Override 34 | public boolean delete(String id) throws Exception { 35 | return CrudUtil.executeUpdate("DELETE FROM members WHERE NIC =?", id); 36 | } 37 | 38 | @Override 39 | public MemberEntity get(String id) throws Exception { 40 | ResultSet rst = CrudUtil.executeQuery("SELECT * FROM members WHERE NIC = ?", id); 41 | if(rst.next()){ 42 | MemberEntity entity = new MemberEntity(rst.getString("NIC"),rst.getString("Name"), rst.getString("Address"),rst.getString("password")); 43 | return entity; 44 | } 45 | return null; 46 | } 47 | 48 | @Override 49 | public ArrayList getAll() throws Exception { 50 | ArrayList memberEntities = new ArrayList<>(); 51 | ResultSet rst = CrudUtil.executeQuery("SELECT * FROM members;"); 52 | while (rst.next()) { 53 | MemberEntity entity = new MemberEntity(rst.getString("NIC"),rst.getString("Name"), rst.getString("Address"),rst.getString("password")); 54 | memberEntities.add(entity); 55 | } 56 | return memberEntities; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/edu/ijse/dao/custom/impl/BookDaoImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template 4 | */ 5 | package edu.ijse.dao.custom.impl; 6 | 7 | import edu.ijse.dao.custom.BookDao; 8 | import edu.ijse.entity.BookEntity; 9 | import java.util.ArrayList; 10 | import edu.ijse.dao.CrudUtil; 11 | import java.sql.ResultSet; 12 | /** 13 | * 14 | * @author tharu 15 | */ 16 | public class BookDaoImpl implements BookDao{ 17 | 18 | @Override 19 | public boolean create(BookEntity t) throws Exception { 20 | return CrudUtil.executeUpdate("INSERT INTO books VALUES(?,?,?,?,?)", t.getBookId(),t.getBtitle(),t.getAuthor(),t.getBcategory(),t.getDate());} 21 | 22 | @Override 23 | public boolean update(BookEntity t) throws Exception { 24 | return CrudUtil.executeUpdate("UPDATE books SET Author = ?, Category =?, Date = ?, Title = ? WHERE bookId = ?", 25 | t.getAuthor(),t.getBcategory(),t.getDate(),t.getBtitle(),t.getBookId()); } 26 | 27 | @Override 28 | public boolean delete(String id) throws Exception { 29 | return CrudUtil.executeUpdate("DELETE FROM books WHERE bookId=?", id); 30 | } 31 | 32 | @Override 33 | public BookEntity get(String id) throws Exception { 34 | ResultSet rst = CrudUtil.executeQuery("SELECT * FROM books WHERE bookId = ?", id); 35 | if(rst.next()){ 36 | BookEntity entity = new BookEntity(rst.getString("bookId"), 37 | rst.getString("Title"), rst.getString("Author"), 38 | rst.getString("Date"), rst.getString("Category")); 39 | return entity; 40 | } 41 | return null; 42 | } 43 | 44 | @Override 45 | public ArrayList getAll() throws Exception { 46 | ArrayList bookEntities = new ArrayList<>(); 47 | ResultSet rst = CrudUtil.executeQuery("SELECT * FROM books"); 48 | while (rst.next()) { 49 | BookEntity entity = new BookEntity(rst.getString("bookId"), 50 | rst.getString("Title"), rst.getString("Author"), 51 | rst.getString("Date"), rst.getString("Category")); 52 | bookEntities.add(entity); 53 | } 54 | return bookEntities; 55 | } 56 | 57 | 58 | } 59 | 60 | 61 | -------------------------------------------------------------------------------- /src/edu/ijse/service/custom/impl/CategoryServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template 4 | */ 5 | package edu.ijse.service.custom.impl; 6 | 7 | import edu.ijse.dao.DaoFactory; 8 | import edu.ijse.dao.custom.CategoryDao; 9 | import edu.ijse.dto.CategoryDto; 10 | import edu.ijse.entity.CategoryEntity; 11 | import edu.ijse.service.custom.CategoryService; 12 | import java.util.ArrayList; 13 | 14 | /** 15 | * 16 | * @author tharu 17 | */ 18 | public class CategoryServiceImpl implements CategoryService{ 19 | 20 | private CategoryDao categoryDao = (CategoryDao) DaoFactory.getInstance().getDao(DaoFactory.DaoTypes.CATEGORY); 21 | 22 | @Override 23 | public String save(CategoryDto categoryDto) throws Exception { 24 | CategoryEntity entity= getCategoryEntity(categoryDto); 25 | return categoryDao.create(entity)? "Success" : "Fail"; 26 | } 27 | 28 | @Override 29 | public String update(CategoryDto categoryDto) throws Exception { 30 | CategoryEntity entity= getCategoryEntity(categoryDto); 31 | return categoryDao.update(entity)? "Success" : "Fail"; 32 | } 33 | 34 | @Override 35 | public String delete(String catcode) throws Exception { 36 | return categoryDao.delete(catcode)?"Success" : "Fail" ; 37 | } 38 | 39 | @Override 40 | public CategoryDto get(String catcode) throws Exception { 41 | CategoryEntity entity = categoryDao.get(catcode); 42 | if(entity != null){ 43 | return getCategoryDto(entity); 44 | } 45 | return null; 46 | } 47 | 48 | @Override 49 | public ArrayList getAll() throws Exception { 50 | ArrayList categoryEntitys = categoryDao.getAll(); 51 | if(categoryEntitys != null && !categoryEntitys.isEmpty()){ 52 | ArrayList categoryDtos = new ArrayList<>(); 53 | for(CategoryEntity categoryEntity: categoryEntitys){ 54 | categoryDtos.add(getCategoryDto(categoryEntity)); 55 | } 56 | return categoryDtos; 57 | } 58 | return null; 59 | } 60 | private CategoryEntity getCategoryEntity(CategoryDto categoryDto){ 61 | return new CategoryEntity(categoryDto.getCatcode(), categoryDto.getTitle(), categoryDto.getDescription()); 62 | } 63 | 64 | private CategoryDto getCategoryDto(CategoryEntity entity){ 65 | return new CategoryDto(entity.getCatcode(), entity.getTitle(), entity.getDescription()); 66 | } 67 | 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/edu/ijse/service/custom/impl/IssueServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template 4 | */ 5 | package edu.ijse.service.custom.impl; 6 | 7 | import edu.ijse.dto.IssueDto; 8 | import java.util.ArrayList; 9 | import edu.ijse.service.custom.IssueService; 10 | import edu.ijse.dao.DaoFactory; 11 | import edu.ijse.dao.custom.IssueDao; 12 | import edu.ijse.entity.IssueEntity; 13 | 14 | /** 15 | * 16 | * @author tharu 17 | */ 18 | public class IssueServiceImpl implements IssueService{ 19 | private IssueDao issueDao = (IssueDao)DaoFactory.getInstance().getDao(DaoFactory.DaoTypes.BISSUE); 20 | 21 | @Override 22 | public ArrayList getAll() throws Exception { 23 | ArrayList issueEntitys = issueDao.getAll(); 24 | if(issueEntitys != null && !issueEntitys.isEmpty()){ 25 | ArrayList issueDtos = new ArrayList<>(); 26 | 27 | for (IssueEntity issueEntity : issueEntitys) { 28 | issueDtos.add(getIssueDto(issueEntity)); 29 | } 30 | 31 | return issueDtos; 32 | } 33 | return null; 34 | } 35 | private IssueDto getIssueDto(IssueEntity entity){ 36 | return new IssueDto( 37 | entity.getNic(),entity.getBookid(),entity.getIssuedate(),entity.getDuedate(),entity.getReturnBook() 38 | ); 39 | } 40 | 41 | @Override 42 | public String save(IssueDto issueDto) throws Exception { 43 | IssueEntity entity = getIssueEntity(issueDto); 44 | return issueDao.create(entity)? "Success":"Fail"; 45 | } 46 | 47 | @Override 48 | public String update(IssueDto issueDto) throws Exception { 49 | IssueEntity entity = getIssueEntity(issueDto); 50 | return issueDao.update(entity)? "Success":"Fail"; 51 | } 52 | 53 | @Override 54 | public String delete(String nic) throws Exception { 55 | throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody 56 | } 57 | 58 | @Override 59 | public IssueDto get(String nic) throws Exception { 60 | throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody 61 | } 62 | 63 | private IssueEntity getIssueEntity(IssueDto issueDto){ 64 | return new IssueEntity( 65 | issueDto.getNic(),issueDto.getBookid(),issueDto.getIssuedate(),issueDto.getDuedate(),issueDto.getReturnBook()); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/edu/ijse/dto/BookDto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template 4 | */ 5 | package edu.ijse.dto; 6 | 7 | /** 8 | * 9 | * @author tharu 10 | */ 11 | public class BookDto { 12 | private String bookId; 13 | private String btitle; 14 | private String Author; 15 | private String date; 16 | private String bcategory; 17 | 18 | public BookDto() { 19 | } 20 | 21 | public BookDto(String bookId, String btitle, String Author, String date, String bcategory) { 22 | this.bookId = bookId; 23 | this.btitle = btitle; 24 | this.Author = Author; 25 | this.date = date; 26 | this.bcategory = bcategory; 27 | } 28 | 29 | 30 | 31 | /** 32 | * @return the bookId 33 | */ 34 | public String getBookId() { 35 | return bookId; 36 | } 37 | 38 | /** 39 | * @param bookId the bookId to set 40 | */ 41 | public void setBookId(String bookId) { 42 | this.bookId = bookId; 43 | } 44 | 45 | /** 46 | * @return the btitle 47 | */ 48 | public String getBtitle() { 49 | return btitle; 50 | } 51 | 52 | /** 53 | * @param btitle the btitle to set 54 | */ 55 | public void setBtitle(String btitle) { 56 | this.btitle = btitle; 57 | } 58 | 59 | /** 60 | * @return the Author 61 | */ 62 | public String getAuthor() { 63 | return Author; 64 | } 65 | 66 | /** 67 | * @param Author the Author to set 68 | */ 69 | public void setAuthor(String Author) { 70 | this.Author = Author; 71 | } 72 | 73 | /** 74 | * @return the date 75 | */ 76 | public String getDate() { 77 | return date; 78 | } 79 | 80 | /** 81 | * @param date the date to set 82 | */ 83 | public void setDate(String date) { 84 | this.date = date; 85 | } 86 | 87 | /** 88 | * @return the bcategory 89 | */ 90 | public String getBcategory() { 91 | return bcategory; 92 | } 93 | 94 | /** 95 | * @param bcategory the bcategory to set 96 | */ 97 | public void setBcategory(String bcategory) { 98 | this.bcategory = bcategory; 99 | } 100 | 101 | @Override 102 | public String toString() { 103 | return "BookDto{" + "bookId=" + bookId + ", btitle=" + btitle + ", Author=" + Author + ", date=" + date + ", bcategory=" + bcategory + '}'; 104 | } 105 | 106 | 107 | } 108 | -------------------------------------------------------------------------------- /src/edu/ijse/entity/BookEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template 4 | */ 5 | package edu.ijse.entity; 6 | 7 | /** 8 | * 9 | * @author tharu 10 | */ 11 | public class BookEntity { 12 | private String bookId; 13 | private String btitle; 14 | private String Author; 15 | private String date; 16 | private String bcategory; 17 | 18 | public BookEntity() { 19 | } 20 | 21 | public BookEntity(String bookId, String btitle, String Author, String date, String bcategory) { 22 | this.bookId = bookId; 23 | this.btitle = btitle; 24 | this.Author = Author; 25 | this.date = date; 26 | this.bcategory = bcategory; 27 | } 28 | 29 | 30 | /** 31 | * @return the bookId 32 | */ 33 | public String getBookId() { 34 | return bookId; 35 | } 36 | 37 | /** 38 | * @param bookId the bookId to set 39 | */ 40 | public void setBookId(String bookId) { 41 | this.bookId = bookId; 42 | } 43 | 44 | /** 45 | * @return the btitle 46 | */ 47 | public String getBtitle() { 48 | return btitle; 49 | } 50 | 51 | /** 52 | * @param btitle the btitle to set 53 | */ 54 | public void setBtitle(String btitle) { 55 | this.btitle = btitle; 56 | } 57 | 58 | /** 59 | * @return the Author 60 | */ 61 | public String getAuthor() { 62 | return Author; 63 | } 64 | 65 | /** 66 | * @param Author the Author to set 67 | */ 68 | public void setAuthor(String Author) { 69 | this.Author = Author; 70 | } 71 | 72 | /** 73 | * @return the date 74 | */ 75 | public String getDate() { 76 | return date; 77 | } 78 | 79 | /** 80 | * @param date the date to set 81 | */ 82 | public void setDate(String date) { 83 | this.date = date; 84 | } 85 | 86 | /** 87 | * @return the bcategory 88 | */ 89 | public String getBcategory() { 90 | return bcategory; 91 | } 92 | 93 | /** 94 | * @param bcategory the bcategory to set 95 | */ 96 | public void setBcategory(String bcategory) { 97 | this.bcategory = bcategory; 98 | } 99 | 100 | @Override 101 | public String toString() { 102 | return "BookEntity{" + "bookId=" + bookId + ", btitle=" + btitle + ", Author=" + Author + ", date=" + date + ", bcategory=" + bcategory + '}'; 103 | } 104 | 105 | 106 | 107 | } 108 | -------------------------------------------------------------------------------- /src/edu/ijse/entity/IssueEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template 4 | */ 5 | package edu.ijse.entity; 6 | 7 | /** 8 | * 9 | * @author tharu 10 | */ 11 | public class IssueEntity { 12 | private String nic; 13 | private String bookid; 14 | private String issuedate; 15 | private String duedate; 16 | private String returnBook; 17 | 18 | public IssueEntity() { 19 | } 20 | 21 | public IssueEntity(String nic, String bookid, String issuedate, String duedate,String returnbook) { 22 | this.nic = nic; 23 | this.bookid = bookid; 24 | this.issuedate = issuedate; 25 | this.duedate = duedate; 26 | this.returnBook = returnbook; 27 | } 28 | 29 | /** 30 | * @return the nic 31 | */ 32 | public String getNic() { 33 | return nic; 34 | } 35 | 36 | /** 37 | * @param nic the nic to set 38 | */ 39 | public void setNic(String nic) { 40 | this.nic = nic; 41 | } 42 | 43 | /** 44 | * @return the bookid 45 | */ 46 | public String getBookid() { 47 | return bookid; 48 | } 49 | 50 | /** 51 | * @param bookid the bookid to set 52 | */ 53 | public void setBookid(String bookid) { 54 | this.bookid = bookid; 55 | } 56 | 57 | /** 58 | * @return the issuedate 59 | */ 60 | public String getIssuedate() { 61 | return issuedate; 62 | } 63 | 64 | /** 65 | * @param issuedate the issuedate to set 66 | */ 67 | public void setIssuedate(String issuedate) { 68 | this.issuedate = issuedate; 69 | } 70 | 71 | /** 72 | * @return the duedate 73 | */ 74 | public String getDuedate() { 75 | return duedate; 76 | } 77 | 78 | /** 79 | * @param duedate the duedate to set 80 | */ 81 | public void setDuedate(String duedate) { 82 | this.duedate = duedate; 83 | } 84 | 85 | /** 86 | * @return the returnBook 87 | */ 88 | public String getReturnBook() { 89 | return returnBook; 90 | } 91 | 92 | /** 93 | * @param returnBook the returnBook to set 94 | */ 95 | public void setReturnBook(String returnBook) { 96 | this.returnBook = returnBook; 97 | } 98 | 99 | @Override 100 | public String toString() { 101 | return "IssueEntity{" + "nic=" + nic + ", bookid=" + bookid + ", issuedate=" + issuedate + ", duedate=" + duedate + ", returnBook=" + returnBook + '}'; 102 | } 103 | 104 | 105 | } 106 | -------------------------------------------------------------------------------- /src/edu/ijse/dto/IssueDto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template 4 | */ 5 | package edu.ijse.dto; 6 | 7 | /** 8 | * 9 | * @author tharu 10 | */ 11 | public class IssueDto { 12 | private String nic; 13 | private String bookid; 14 | private String issuedate; 15 | private String duedate; 16 | private String returnBook; 17 | 18 | public IssueDto() { 19 | } 20 | 21 | public IssueDto(String nic, String bookid, String issuedate, String duedate, String returnBook) { 22 | this.nic = nic; 23 | this.bookid = bookid; 24 | this.issuedate = issuedate; 25 | this.duedate = duedate; 26 | this.returnBook = returnBook; 27 | } 28 | 29 | 30 | 31 | /** 32 | * @return the nic 33 | */ 34 | public String getNic() { 35 | return nic; 36 | } 37 | 38 | /** 39 | * @param nic the nic to set 40 | */ 41 | public void setNic(String nic) { 42 | this.nic = nic; 43 | } 44 | 45 | /** 46 | * @return the bookid 47 | */ 48 | public String getBookid() { 49 | return bookid; 50 | } 51 | 52 | /** 53 | * @param bookid the bookid to set 54 | */ 55 | public void setBookid(String bookid) { 56 | this.bookid = bookid; 57 | } 58 | 59 | /** 60 | * @return the issuedate 61 | */ 62 | public String getIssuedate() { 63 | return issuedate; 64 | } 65 | 66 | /** 67 | * @param issuedate the issuedate to set 68 | */ 69 | public void setIssuedate(String issuedate) { 70 | this.issuedate = issuedate; 71 | } 72 | 73 | /** 74 | * @return the duedate 75 | */ 76 | public String getDuedate() { 77 | return duedate; 78 | } 79 | 80 | /** 81 | * @param duedate the duedate to set 82 | */ 83 | public void setDuedate(String duedate) { 84 | this.duedate = duedate; 85 | } 86 | 87 | 88 | 89 | /** 90 | * @return the returnBook 91 | */ 92 | public String getReturnBook() { 93 | return returnBook; 94 | } 95 | 96 | /** 97 | * @param returnBook the returnBook to set 98 | */ 99 | public void setReturnBook(String returnBook) { 100 | this.returnBook = returnBook; 101 | } 102 | 103 | @Override 104 | public String toString() { 105 | return "IssueDto{" + "nic=" + nic + ", bookid=" + bookid + ", issuedate=" + issuedate + ", duedate=" + duedate + ", returnBook=" + returnBook + '}'; 106 | } 107 | 108 | 109 | 110 | } 111 | -------------------------------------------------------------------------------- /src/edu/ijse/service/custom/impl/MemberServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template 4 | */ 5 | package edu.ijse.service.custom.impl; 6 | 7 | 8 | import edu.ijse.dto.MemberDto; 9 | import edu.ijse.service.custom.MemberService; 10 | import java.util.ArrayList; 11 | import edu.ijse.dao.DaoFactory; 12 | import edu.ijse.dao.custom.MemberDao; 13 | import edu.ijse.dto.MemberDto; 14 | import edu.ijse.entity.MemberEntity; 15 | 16 | /** 17 | * 18 | * @author tharu 19 | */ 20 | public class MemberServiceImpl implements MemberService{ 21 | 22 | private MemberDao memberDao = (MemberDao) DaoFactory.getInstance().getDao(DaoFactory.DaoTypes.MEMBERS); 23 | 24 | @Override 25 | public String save(MemberDto memberDto) throws Exception { 26 | 27 | MemberEntity entity = getMemberEntity(memberDto); 28 | return memberDao.create(entity)? "Success":"Fail"; 29 | } 30 | 31 | @Override 32 | public String update(MemberDto memberDto) throws Exception { 33 | 34 | MemberEntity entity = getMemberEntity(memberDto); 35 | return memberDao.update(entity)? "Success":"Fail"; 36 | } 37 | 38 | @Override 39 | public String delete(String nic) throws Exception { 40 | return memberDao.delete(nic)?"Success":"Fail"; 41 | } 42 | 43 | @Override 44 | public MemberDto get(String nic) throws Exception { 45 | MemberEntity entity = memberDao.get(nic); 46 | if(entity != null){ 47 | return getMemberDto(entity); 48 | } 49 | return null; 50 | } 51 | 52 | @Override 53 | public ArrayList getAll() throws Exception { 54 | ArrayList memberEntitys = memberDao.getAll(); 55 | if(memberEntitys != null && !memberEntitys.isEmpty()){ 56 | ArrayList itemDtos = new ArrayList<>(); 57 | 58 | for (MemberEntity memberEntity : memberEntitys) { 59 | itemDtos.add(getMemberDto(memberEntity)); 60 | } 61 | 62 | return itemDtos; 63 | } 64 | return null; 65 | } 66 | 67 | private MemberEntity getMemberEntity(MemberDto memberDto){ 68 | return new MemberEntity( 69 | memberDto.getNic(), 70 | memberDto.getName(), 71 | memberDto.getAddress(), 72 | memberDto.getPassword()); 73 | } 74 | private MemberDto getMemberDto(MemberEntity memberEntity){ 75 | return new MemberDto( 76 | memberEntity.getNic(), 77 | memberEntity.getName(), 78 | memberEntity.getAddress(), 79 | memberEntity.getPassword()); 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /src/edu/ijse/dao/custom/impl/CategoryDaoImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template 4 | */ 5 | package edu.ijse.dao.custom.impl; 6 | 7 | import java.sql.ResultSet; 8 | import edu.ijse.dao.CrudUtil; 9 | import edu.ijse.dao.custom.CategoryDao; 10 | import edu.ijse.entity.CategoryEntity; 11 | import java.util.ArrayList; 12 | 13 | /** 14 | * 15 | * @author tharu 16 | */ 17 | public class CategoryDaoImpl implements CategoryDao{ 18 | 19 | @Override 20 | public boolean create(CategoryEntity t) throws Exception { 21 | return CrudUtil.executeUpdate("INSERT INTO category VALUES(?,?,?)", t.getCatcode(),t.getTitle(),t.getDescription()); 22 | // throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody 23 | } 24 | 25 | @Override 26 | public boolean update(CategoryEntity t) throws Exception { 27 | 28 | return CrudUtil.executeUpdate("UPDATE category SET title = ?, description = ?WHERE code = ?",t.getTitle(),t.getDescription(), t.getCatcode()); 29 | } 30 | 31 | @Override 32 | public boolean delete(String id) throws Exception { 33 | return CrudUtil.executeUpdate(("DELETE FROM category WHERE code = ?"), id); 34 | //throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody 35 | } 36 | 37 | @Override 38 | public CategoryEntity get(String id) throws Exception { 39 | ResultSet rst = CrudUtil.executeQuery("SELECT * FROM category WHERE code = ?", id); 40 | //throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody 41 | if(rst.next()){ 42 | CategoryEntity entity = new CategoryEntity(rst.getString("code"),rst.getString("title"),rst.getString("description")); 43 | return entity; 44 | } 45 | return null; 46 | } 47 | 48 | 49 | @Override 50 | public ArrayList getAll() throws Exception { 51 | // throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody 52 | ArrayList categoryEntitys = new ArrayList<>(); 53 | ResultSet rst = CrudUtil.executeQuery("SELECT * FROM category"); 54 | while(rst.next()){ 55 | CategoryEntity entity = new CategoryEntity(rst.getString("code"),rst.getString("title"),rst.getString("description")); 56 | categoryEntitys.add(entity); 57 | } 58 | return categoryEntitys; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/edu/ijse/service/custom/impl/BookServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template 4 | */ 5 | package edu.ijse.service.custom.impl; 6 | 7 | import java.util.ArrayList; 8 | import edu.ijse.dto.BookDto; 9 | import edu.ijse.service.custom.BookService; 10 | import edu.ijse.dao.DaoFactory; 11 | import edu.ijse.dao.custom.BookDao; 12 | import edu.ijse.entity.BookEntity; 13 | 14 | /** 15 | * 16 | * @author tharu 17 | */ 18 | public class BookServiceImpl implements BookService{ 19 | private BookDao bookDao = (BookDao) DaoFactory.getInstance().getDao(DaoFactory.DaoTypes.BOOK); 20 | 21 | @Override 22 | public String save(BookDto bookDto) throws Exception { 23 | BookEntity entity = getBookEntity(bookDto); 24 | return bookDao.create(entity) ? "Success" : "Fail"; 25 | } 26 | 27 | @Override 28 | public String update(BookDto bookDto) throws Exception { 29 | BookEntity entity = getBookEntity(bookDto); 30 | return bookDao.update(entity) ? "Success" : "Fail"; 31 | } 32 | 33 | @Override 34 | public String delete(String bookId) throws Exception { 35 | return bookDao.delete(bookId) ? "Success" : "Fail"; 36 | } 37 | 38 | @Override 39 | public BookDto get(String bookId) throws Exception { 40 | BookEntity entity = bookDao.get(bookId); 41 | if(entity != null){ 42 | return getbookDto(entity); 43 | } 44 | return null; } 45 | 46 | 47 | public ArrayList getAll() throws Exception { 48 | ArrayList bookEntitys = bookDao.getAll(); 49 | if(bookEntitys != null && !bookEntitys.isEmpty()){ 50 | ArrayList bookDtos = new ArrayList<>(); 51 | 52 | for (BookEntity bookEntity : bookEntitys) { 53 | bookDtos.add(getbookDto(bookEntity)); 54 | } 55 | 56 | return bookDtos; 57 | } 58 | return null; 59 | } 60 | 61 | // private BookDto getBookDto(BookEntity entity){ 62 | // return new BookDto( 63 | // entity.getBookId(), 64 | // entity.getBtitle(), 65 | // entity.getBcategory(), 66 | // entity.getAuthor(), 67 | // entity.getDate()); 68 | // } 69 | private BookEntity getBookEntity(BookDto bookDto){ 70 | return new BookEntity( 71 | bookDto.getBookId(), 72 | bookDto.getBtitle(), 73 | bookDto.getAuthor(), 74 | bookDto.getDate(), 75 | bookDto.getBcategory()); 76 | } 77 | private BookDto getbookDto(BookEntity entity){ 78 | return new BookDto( 79 | entity.getBookId(), 80 | entity.getBtitle(), 81 | entity.getAuthor(), 82 | entity.getDate(), 83 | entity.getBcategory()); 84 | 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /database.sql: -------------------------------------------------------------------------------- 1 | create database library; 2 | 3 | CREATE TABLE category( 4 | code varchar(10), 5 | title varchar(50), 6 | description varchar(255) 7 | ); 8 | INSERT INTO category (code, title, description) VALUES 9 | ('CAT001', 'Fiction', 'Narrative literary works, including novels and short stories.'), 10 | ('CAT002', 'Non-fiction', 'Informative books based on factual information.'), 11 | ('CAT003', 'Science', 'Books related to various scientific disciplines and discoveries.'), 12 | ('CAT004', 'History', 'Historical accounts and studies of past events.'), 13 | ('CAT005', 'Biography', 'Life stories and accounts of notable individuals.'), 14 | ('CAT006', 'Children', 'Books for young readers, including picture books and early readers.'), 15 | ('CAT007', 'Mystery', 'Books centered around suspenseful and thrilling plotlines.'), 16 | ('CAT008', 'Fantasy', 'Books featuring magical or supernatural elements and worlds.'), 17 | ('CAT009', 'Self-Help', 'Guides and advice for personal development and improvement.'), 18 | ('CAT010', 'Technology', 'Books on technological advancements and computer science.'); 19 | 20 | CREATE TABLE books( 21 | BookId varchar(10), 22 | Title varchar(150), 23 | Author varchar(150), 24 | Date varchar(50), 25 | Category varchar(255) 26 | ); 27 | INSERT INTO books (BookId, Title, Author, Date, Category) VALUES 28 | ('B001', 'To Kill a Mockingbird', 'Harper Lee', '1960', 'Fiction'), 29 | ('B002', 'A Brief History of Time', 'Stephen Hawking', '1988', 'Science'), 30 | ('B003', 'The Diary of a Young Girl', 'Anne Frank', '1947', 'Biography'), 31 | ('B004', 'The Very Hungry Caterpillar', 'Eric Carle', '1969', 'Children'), 32 | ('B005', 'The Great Gatsby', 'F. Scott Fitzgerald', '1925', 'Fiction'), 33 | ('B006', 'Sapiens: A Brief History of Humankind', 'Yuval Noah Harari', '2011', 'Non-fiction'), 34 | ('B007', 'The Catcher in the Rye', 'J.D. Salinger', '1951', 'Fiction'), 35 | ('B008', 'The Selfish Gene', 'Richard Dawkins', '1976', 'Science'), 36 | ('B009', 'The Hobbit', 'J.R.R. Tolkien', '1937', 'Fantasy'), 37 | ('B010', 'Steve Jobs', 'Walter Isaacson', '2011', 'Biography'), 38 | ('B011', 'The 7 Habits of Highly Effective People', 'Stephen R. Covey', '1989', 'Self-Help'), 39 | ('B012', 'Guns, Germs, and Steel', 'Jared Diamond', '1997', 'History'), 40 | ('B013', 'The Lean Startup', 'Eric Ries', '2011', 'Technology'), 41 | ('B014', 'Harry Potter and the Philosopher\'s Stone', 'J.K. Rowling', '1997', 'Fantasy'), 42 | ('B015', 'The Girl with the Dragon Tattoo', 'Stieg Larsson', '2005', 'Mystery'); 43 | 44 | select * from books; 45 | ALTER TABLE books 46 | RENAME COLUMN BookId to bookId; 47 | SELECT Category FROM books 48 | 49 | DELETE FROM books WHERE bookId='B016'; 50 | UPDATE books SET Author = 'wik', Category = 'Fantasy', Date = 1925, Title = 'lol' WHERE bookId ='B010'; 51 | 52 | CREATE TABLE members( 53 | NIC varchar(20), 54 | Name varchar(150), 55 | Address varchar(150), 56 | password varchar(50) 57 | ); 58 | INSERT INTO members (NIC, Name, Address, password) VALUES 59 | ('123456789V', 'John Doe', '123 Main St', 'password123'), 60 | ('987654321V', 'Jane Smith', '456 Oak St', 'securepassword'), 61 | ('456123789V', 'Alice Johnson', '789 Pine St', 'mypassword'), 62 | ('321654987V', 'Bob Brown', '101 Maple St', 'password456'); 63 | select*from books; 64 | 65 | CREATE TABLE issue( 66 | NIC varchar(20), 67 | bookid varchar(150), 68 | issueDate varchar(50), 69 | dueDate varchar(50), 70 | returnBook varchar(5) 71 | ); 72 | INSERT INTO issue (NIC, bookid, issueDate, dueDate,returnBook) VALUES 73 | ('123456789V', 'B005', '11-07-2024', '15-07-2024',"NO"); 74 | UPDATE issue SET returnBook='No' WHERE NIC='60160592V'; 75 | 76 | CREATE TABLE login( 77 | username varchar(50), 78 | password varchar(50) 79 | ); 80 | 81 | INSERT INTO login(username,password) VALUES ('admin','admin'); 82 | 83 | -------------------------------------------------------------------------------- /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.modulepath=\ 22 | ${run.modulepath} 23 | debug.test.classpath=\ 24 | ${run.test.classpath} 25 | debug.test.modulepath=\ 26 | ${run.test.modulepath} 27 | # Files in build.classes.dir which should be excluded from distribution jar 28 | dist.archive.excludes= 29 | # This directory is removed when the project is cleaned: 30 | dist.dir=dist 31 | dist.jar=${dist.dir}/LibraryProject.jar 32 | dist.javadoc.dir=${dist.dir}/javadoc 33 | dist.jlink.dir=${dist.dir}/jlink 34 | dist.jlink.output=${dist.jlink.dir}/LibraryProject 35 | excludes= 36 | file.reference.jcalendar-1.4.jar=D:\\IJSE\\jcalendar-1.4.jar\\jcalendar-1.4.jar 37 | file.reference.mysql-connector-j-8.4.0.jar=C:\\Users\\tharu\\Downloads\\Compressed\\mysql-connector-j-8.4.0\\mysql-connector-j-8.4.0\\mysql-connector-j-8.4.0.jar 38 | includes=** 39 | jar.compress=false 40 | javac.classpath=\ 41 | ${file.reference.mysql-connector-j-8.4.0.jar}:\ 42 | ${libs.absolutelayout.classpath}:\ 43 | ${file.reference.jcalendar-1.4.jar} 44 | # Space-separated list of extra javac options 45 | javac.compilerargs= 46 | javac.deprecation=false 47 | javac.external.vm=true 48 | javac.modulepath= 49 | javac.processormodulepath= 50 | javac.processorpath=\ 51 | ${javac.classpath} 52 | javac.source=17 53 | javac.target=17 54 | javac.test.classpath=\ 55 | ${javac.classpath}:\ 56 | ${build.classes.dir} 57 | javac.test.modulepath=\ 58 | ${javac.modulepath} 59 | javac.test.processorpath=\ 60 | ${javac.test.classpath} 61 | javadoc.additionalparam= 62 | javadoc.author=false 63 | javadoc.encoding=${source.encoding} 64 | javadoc.html5=false 65 | javadoc.noindex=false 66 | javadoc.nonavbar=false 67 | javadoc.notree=false 68 | javadoc.private=false 69 | javadoc.splitindex=true 70 | javadoc.use=true 71 | javadoc.version=false 72 | javadoc.windowtitle= 73 | # The jlink additional root modules to resolve 74 | jlink.additionalmodules= 75 | # The jlink additional command line parameters 76 | jlink.additionalparam= 77 | jlink.launcher=true 78 | jlink.launcher.name=LibraryProject 79 | main.class=edu.ijse.Main 80 | manifest.file=manifest.mf 81 | meta.inf.dir=${src.dir}/META-INF 82 | mkdist.disabled=false 83 | platform.active=default_platform 84 | run.classpath=\ 85 | ${javac.classpath}:\ 86 | ${build.classes.dir} 87 | # Space-separated list of JVM arguments used when running the project. 88 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 89 | # To set system properties for unit tests define test-sys-prop.name=value: 90 | run.jvmargs= 91 | run.modulepath=\ 92 | ${javac.modulepath} 93 | run.test.classpath=\ 94 | ${javac.test.classpath}:\ 95 | ${build.test.classes.dir} 96 | run.test.modulepath=\ 97 | ${javac.test.modulepath} 98 | source.encoding=UTF-8 99 | src.dir=src 100 | test.src.dir=test 101 | -------------------------------------------------------------------------------- /src/edu/ijse/view/Menu.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template 4 | */ 5 | package edu.ijse.view; 6 | 7 | /** 8 | * 9 | * @author tharu 10 | */ 11 | import edu.ijse.view.BooksView; 12 | import edu.ijse.view.CategoryView; 13 | import edu.ijse.view.MemberView; 14 | public class Menu extends javax.swing.JFrame { 15 | 16 | /** 17 | * Creates new form Menu 18 | */ 19 | public Menu() { 20 | initComponents(); 21 | } 22 | 23 | /** 24 | * This method is called from within the constructor to initialize the form. 25 | * WARNING: Do NOT modify this code. The content of this method is always 26 | * regenerated by the Form Editor. 27 | */ 28 | @SuppressWarnings("unchecked") 29 | // //GEN-BEGIN:initComponents 30 | private void initComponents() { 31 | 32 | jLabel2 = new javax.swing.JLabel(); 33 | jButton1 = new javax.swing.JButton(); 34 | jButton2 = new javax.swing.JButton(); 35 | jButton3 = new javax.swing.JButton(); 36 | jButton4 = new javax.swing.JButton(); 37 | jButton5 = new javax.swing.JButton(); 38 | jLabel1 = new javax.swing.JLabel(); 39 | 40 | setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); 41 | getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); 42 | 43 | jLabel2.setFont(new java.awt.Font("Segoe UI", 1, 36)); // NOI18N 44 | jLabel2.setForeground(new java.awt.Color(255, 255, 255)); 45 | jLabel2.setText("Library Management System"); 46 | getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 30, 500, 50)); 47 | 48 | jButton1.setBackground(new java.awt.Color(204, 102, 0)); 49 | jButton1.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N 50 | jButton1.setText("Return"); 51 | jButton1.addActionListener(new java.awt.event.ActionListener() { 52 | public void actionPerformed(java.awt.event.ActionEvent evt) { 53 | jButton1ActionPerformed(evt); 54 | } 55 | }); 56 | getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 270, 110, 40)); 57 | 58 | jButton2.setBackground(new java.awt.Color(204, 102, 0)); 59 | jButton2.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N 60 | jButton2.setText("Issue"); 61 | jButton2.addActionListener(new java.awt.event.ActionListener() { 62 | public void actionPerformed(java.awt.event.ActionEvent evt) { 63 | jButton2ActionPerformed(evt); 64 | } 65 | }); 66 | getContentPane().add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 270, 100, 40)); 67 | 68 | jButton3.setBackground(new java.awt.Color(204, 102, 0)); 69 | jButton3.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N 70 | jButton3.setText("Categories"); 71 | jButton3.addActionListener(new java.awt.event.ActionListener() { 72 | public void actionPerformed(java.awt.event.ActionEvent evt) { 73 | jButton3ActionPerformed(evt); 74 | } 75 | }); 76 | getContentPane().add(jButton3, new org.netbeans.lib.awtextra.AbsoluteConstraints(260, 160, 110, 40)); 77 | 78 | jButton4.setBackground(new java.awt.Color(204, 102, 0)); 79 | jButton4.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N 80 | jButton4.setText("Members"); 81 | jButton4.addActionListener(new java.awt.event.ActionListener() { 82 | public void actionPerformed(java.awt.event.ActionEvent evt) { 83 | jButton4ActionPerformed(evt); 84 | } 85 | }); 86 | getContentPane().add(jButton4, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 160, 100, 40)); 87 | 88 | jButton5.setBackground(new java.awt.Color(204, 102, 0)); 89 | jButton5.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N 90 | jButton5.setText("Books"); 91 | jButton5.addActionListener(new java.awt.event.ActionListener() { 92 | public void actionPerformed(java.awt.event.ActionEvent evt) { 93 | jButton5ActionPerformed(evt); 94 | } 95 | }); 96 | getContentPane().add(jButton5, new org.netbeans.lib.awtextra.AbsoluteConstraints(450, 160, 110, 40)); 97 | 98 | jLabel1.setIcon(new javax.swing.ImageIcon("D:\\IJSE\\Class\\CMJD\\CMJD106\\LibraryProject\\Coursework\\1_6Jp3vJWe7VFlFHZ9WhSJng.jpg")); // NOI18N 99 | getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 640, 400)); 100 | 101 | pack(); 102 | }// //GEN-END:initComponents 103 | 104 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed 105 | new BookReturnView().setVisible(true); 106 | }//GEN-LAST:event_jButton1ActionPerformed 107 | 108 | private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed 109 | new CategoryView().setVisible(true); 110 | }//GEN-LAST:event_jButton3ActionPerformed 111 | 112 | private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed 113 | new BooksView().setVisible(true); 114 | }//GEN-LAST:event_jButton5ActionPerformed 115 | 116 | private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed 117 | new MemberView().setVisible(true); 118 | }//GEN-LAST:event_jButton4ActionPerformed 119 | 120 | private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed 121 | new BookIssueView().setVisible(true); 122 | }//GEN-LAST:event_jButton2ActionPerformed 123 | 124 | /** 125 | * @param args the command line arguments 126 | */ 127 | public static void main(String args[]) { 128 | /* Set the Nimbus look and feel */ 129 | // 130 | /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. 131 | * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 132 | */ 133 | try { 134 | for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { 135 | if ("Nimbus".equals(info.getName())) { 136 | javax.swing.UIManager.setLookAndFeel(info.getClassName()); 137 | break; 138 | } 139 | } 140 | } catch (ClassNotFoundException ex) { 141 | java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 142 | } catch (InstantiationException ex) { 143 | java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 144 | } catch (IllegalAccessException ex) { 145 | java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 146 | } catch (javax.swing.UnsupportedLookAndFeelException ex) { 147 | java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 148 | } 149 | // 150 | 151 | /* Create and display the form */ 152 | java.awt.EventQueue.invokeLater(new Runnable() { 153 | public void run() { 154 | new Menu().setVisible(true); 155 | } 156 | }); 157 | } 158 | 159 | // Variables declaration - do not modify//GEN-BEGIN:variables 160 | private javax.swing.JButton jButton1; 161 | private javax.swing.JButton jButton2; 162 | private javax.swing.JButton jButton3; 163 | private javax.swing.JButton jButton4; 164 | private javax.swing.JButton jButton5; 165 | private javax.swing.JLabel jLabel1; 166 | private javax.swing.JLabel jLabel2; 167 | // End of variables declaration//GEN-END:variables 168 | } 169 | -------------------------------------------------------------------------------- /src/edu/ijse/view/Login.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /src/edu/ijse/view/Login.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template 4 | */ 5 | package edu.ijse.view; 6 | 7 | import java.sql.Connection; 8 | import java.sql.DriverManager; 9 | import java.sql.PreparedStatement; 10 | import java.sql.ResultSet; 11 | import java.sql.SQLException; 12 | import javax.swing.JOptionPane; 13 | 14 | /** 15 | * 16 | * @author tharu 17 | */ 18 | 19 | public class Login extends javax.swing.JFrame { 20 | 21 | /** 22 | * Creates new form Menu 23 | */ 24 | public Login() { 25 | initComponents(); 26 | connect(); 27 | } 28 | 29 | /** 30 | * This method is called from within the constructor to initialize the form. 31 | * WARNING: Do NOT modify this code. The content of this method is always 32 | * regenerated by the Form Editor. 33 | */ 34 | Connection con; 35 | PreparedStatement pst; 36 | @SuppressWarnings("unchecked") 37 | // //GEN-BEGIN:initComponents 38 | private void initComponents() { 39 | 40 | jLabel2 = new javax.swing.JLabel(); 41 | btnlogin = new javax.swing.JButton(); 42 | jLabel3 = new javax.swing.JLabel(); 43 | jLabel4 = new javax.swing.JLabel(); 44 | txtpass = new javax.swing.JTextField(); 45 | txtuser = new javax.swing.JTextField(); 46 | jLabel1 = new javax.swing.JLabel(); 47 | 48 | setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); 49 | getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); 50 | 51 | jLabel2.setFont(new java.awt.Font("Segoe UI", 1, 36)); // NOI18N 52 | jLabel2.setForeground(new java.awt.Color(255, 255, 255)); 53 | jLabel2.setText("Login"); 54 | getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 30, 120, 50)); 55 | 56 | btnlogin.setBackground(new java.awt.Color(204, 102, 0)); 57 | btnlogin.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N 58 | btnlogin.setText("Login"); 59 | btnlogin.addActionListener(new java.awt.event.ActionListener() { 60 | public void actionPerformed(java.awt.event.ActionEvent evt) { 61 | btnloginActionPerformed(evt); 62 | } 63 | }); 64 | getContentPane().add(btnlogin, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 260, 100, 40)); 65 | 66 | jLabel3.setBackground(new java.awt.Color(0, 0, 0)); 67 | jLabel3.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N 68 | jLabel3.setForeground(new java.awt.Color(255, 255, 255)); 69 | jLabel3.setText("Password :-"); 70 | getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 200, -1, -1)); 71 | 72 | jLabel4.setBackground(new java.awt.Color(0, 0, 0)); 73 | jLabel4.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N 74 | jLabel4.setForeground(new java.awt.Color(255, 255, 255)); 75 | jLabel4.setText("Username :-"); 76 | getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 160, -1, -1)); 77 | 78 | txtpass.setBackground(new java.awt.Color(153, 51, 0)); 79 | getContentPane().add(txtpass, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 200, 150, -1)); 80 | 81 | txtuser.setBackground(new java.awt.Color(153, 51, 0)); 82 | txtuser.setToolTipText(""); 83 | getContentPane().add(txtuser, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 150, 150, -1)); 84 | 85 | jLabel1.setIcon(new javax.swing.ImageIcon("D:\\IJSE\\Class\\CMJD\\CMJD106\\LibraryProject\\Coursework\\1_6Jp3vJWe7VFlFHZ9WhSJng.jpg")); // NOI18N 86 | getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 640, 400)); 87 | 88 | pack(); 89 | }// //GEN-END:initComponents 90 | 91 | private void btnloginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnloginActionPerformed 92 | login(); 93 | }//GEN-LAST:event_btnloginActionPerformed 94 | 95 | /** 96 | * @param args the command line arguments 97 | */ 98 | public static void main(String args[]) { 99 | /* Set the Nimbus look and feel */ 100 | // 101 | /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. 102 | * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 103 | */ 104 | try { 105 | for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { 106 | if ("Nimbus".equals(info.getName())) { 107 | javax.swing.UIManager.setLookAndFeel(info.getClassName()); 108 | break; 109 | } 110 | } 111 | } catch (ClassNotFoundException ex) { 112 | java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 113 | } catch (InstantiationException ex) { 114 | java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 115 | } catch (IllegalAccessException ex) { 116 | java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 117 | } catch (javax.swing.UnsupportedLookAndFeelException ex) { 118 | java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 119 | } 120 | // 121 | // 122 | 123 | /* Create and display the form */ 124 | java.awt.EventQueue.invokeLater(new Runnable() { 125 | public void run() { 126 | new Login().setVisible(true); 127 | } 128 | }); 129 | } 130 | 131 | // Variables declaration - do not modify//GEN-BEGIN:variables 132 | private javax.swing.JButton btnlogin; 133 | private javax.swing.JLabel jLabel1; 134 | private javax.swing.JLabel jLabel2; 135 | private javax.swing.JLabel jLabel3; 136 | private javax.swing.JLabel jLabel4; 137 | private javax.swing.JTextField txtpass; 138 | private javax.swing.JTextField txtuser; 139 | // End of variables declaration//GEN-END:variables 140 | 141 | private void login() { 142 | String user,pass; 143 | user= txtuser.getText(); 144 | pass = txtpass.getText(); 145 | 146 | PreparedStatement st; 147 | ResultSet rs; 148 | 149 | String query = ("SELECT * FROM login WHERE username=? AND password=? ;"); 150 | 151 | if(user.trim().equals("cusername")) 152 | { 153 | JOptionPane.showMessageDialog(null, "Enter Your Username", "Empty Username", 2); 154 | } 155 | else if(pass.trim().equals("cpassword")) 156 | { 157 | JOptionPane.showMessageDialog(null, "Enter Your Password", "Empty Password", 2); 158 | } 159 | else{ 160 | try { 161 | st = con.prepareStatement(query); 162 | st.setString(1, user); 163 | st.setString(2, pass); 164 | rs = st.executeQuery(); 165 | if(rs.next()) 166 | { 167 | JOptionPane.showMessageDialog(null, "Login done","Login Succesfull",2); 168 | new Menu().setVisible(true); 169 | dispose(); 170 | }else{ 171 | JOptionPane.showMessageDialog(null, "Invalid Username / Password","Login Error",2); 172 | } 173 | } catch (SQLException ex) { 174 | ex.printStackTrace(); 175 | } 176 | } 177 | } 178 | 179 | public void connect(){ 180 | 181 | try { Class.forName("com.mysql.jdbc.Driver"); 182 | con = DriverManager.getConnection("jdbc:mysql://localhost:3306/library?allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=UTC","root","Vismine@123"); 183 | System.out.println("Connected"); 184 | } catch (ClassNotFoundException ex) { 185 | ex.printStackTrace(); 186 | } catch (SQLException ex) { 187 | ex.printStackTrace(); 188 | } 189 | } 190 | } 191 | -------------------------------------------------------------------------------- /src/edu/ijse/view/Menu.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | -------------------------------------------------------------------------------- /src/edu/ijse/view/CategoryView.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 |
227 |
228 |
229 | 230 | 231 | 232 |
233 |
234 |
235 |
236 | 237 | -------------------------------------------------------------------------------- /src/edu/ijse/view/BookIssueView.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 |
253 |
254 |
255 |
256 |
257 |
258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 |
271 | 272 | -------------------------------------------------------------------------------- /src/edu/ijse/view/BooksView.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 |
233 |
234 |
235 | 236 | 237 | 238 |
239 |
240 |
241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 |
293 | 294 | -------------------------------------------------------------------------------- /src/edu/ijse/view/MemberView.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 |
272 |
273 |
274 | 275 | 276 | 277 |
278 |
279 |
280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 |
291 | 292 | -------------------------------------------------------------------------------- /src/edu/ijse/view/CategoryView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template 4 | */ 5 | package edu.ijse.view; 6 | 7 | import edu.ijse.controller.CategoryController; 8 | import edu.ijse.dto.CategoryDto; 9 | import java.util.ArrayList; 10 | import java.util.logging.Level; 11 | import java.util.logging.Logger; 12 | import javax.swing.JOptionPane; 13 | import javax.swing.table.DefaultTableModel; 14 | 15 | public class CategoryView extends javax.swing.JFrame { 16 | 17 | /** 18 | * Creates new form CategoryView 19 | */ 20 | private CategoryController categoryController; 21 | public CategoryView() { 22 | initComponents(); 23 | categoryController = new CategoryController(); 24 | loadTable(); 25 | } 26 | 27 | /** 28 | * This method is called from within the constructor to initialize the form. 29 | * WARNING: Do NOT modify this code. The content of this method is always 30 | * regenerated by the Form Editor. 31 | */ 32 | @SuppressWarnings("unchecked") 33 | // //GEN-BEGIN:initComponents 34 | private void initComponents() { 35 | 36 | lblTitle = new javax.swing.JLabel(); 37 | lblCode = new javax.swing.JLabel(); 38 | txtCode = new javax.swing.JTextField(); 39 | lblDescription = new javax.swing.JLabel(); 40 | txtDesc = new javax.swing.JTextField(); 41 | txtCode1 = new javax.swing.JTextField(); 42 | lblCode1 = new javax.swing.JLabel(); 43 | btnDelete = new javax.swing.JButton(); 44 | btnUpdate = new javax.swing.JButton(); 45 | btnSave = new javax.swing.JButton(); 46 | jScrollPane1 = new javax.swing.JScrollPane(); 47 | cattable = new javax.swing.JTable(); 48 | 49 | setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); 50 | 51 | lblTitle.setBackground(new java.awt.Color(204, 204, 204)); 52 | lblTitle.setFont(new java.awt.Font("Segoe UI", 1, 24)); // NOI18N 53 | lblTitle.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); 54 | lblTitle.setText("Categories"); 55 | 56 | lblCode.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N 57 | lblCode.setText("Code"); 58 | 59 | txtCode.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N 60 | txtCode.addActionListener(new java.awt.event.ActionListener() { 61 | public void actionPerformed(java.awt.event.ActionEvent evt) { 62 | txtCodeActionPerformed(evt); 63 | } 64 | }); 65 | 66 | lblDescription.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N 67 | lblDescription.setText("Description"); 68 | 69 | txtDesc.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N 70 | 71 | txtCode1.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N 72 | txtCode1.addActionListener(new java.awt.event.ActionListener() { 73 | public void actionPerformed(java.awt.event.ActionEvent evt) { 74 | txtCode1ActionPerformed(evt); 75 | } 76 | }); 77 | 78 | lblCode1.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N 79 | lblCode1.setText("Title"); 80 | 81 | btnDelete.setBackground(new java.awt.Color(0, 0, 0)); 82 | btnDelete.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N 83 | btnDelete.setForeground(new java.awt.Color(204, 0, 0)); 84 | btnDelete.setText("Delete"); 85 | btnDelete.addActionListener(new java.awt.event.ActionListener() { 86 | public void actionPerformed(java.awt.event.ActionEvent evt) { 87 | btnDeleteActionPerformed(evt); 88 | } 89 | }); 90 | 91 | btnUpdate.setBackground(new java.awt.Color(0, 0, 0)); 92 | btnUpdate.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N 93 | btnUpdate.setForeground(new java.awt.Color(204, 0, 0)); 94 | btnUpdate.setText("Update"); 95 | btnUpdate.addActionListener(new java.awt.event.ActionListener() { 96 | public void actionPerformed(java.awt.event.ActionEvent evt) { 97 | btnUpdateActionPerformed(evt); 98 | } 99 | }); 100 | 101 | btnSave.setBackground(new java.awt.Color(0, 0, 0)); 102 | btnSave.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N 103 | btnSave.setForeground(new java.awt.Color(204, 0, 0)); 104 | btnSave.setText("Save"); 105 | btnSave.addActionListener(new java.awt.event.ActionListener() { 106 | public void actionPerformed(java.awt.event.ActionEvent evt) { 107 | btnSaveActionPerformed(evt); 108 | } 109 | }); 110 | 111 | cattable.setModel(new javax.swing.table.DefaultTableModel( 112 | new Object [][] { 113 | {null, null, null, null}, 114 | {null, null, null, null}, 115 | {null, null, null, null}, 116 | {null, null, null, null} 117 | }, 118 | new String [] { 119 | "Title 1", "Title 2", "Title 3", "Title 4" 120 | } 121 | )); 122 | cattable.addMouseListener(new java.awt.event.MouseAdapter() { 123 | public void mouseClicked(java.awt.event.MouseEvent evt) { 124 | cattableMouseClicked(evt); 125 | } 126 | }); 127 | jScrollPane1.setViewportView(cattable); 128 | 129 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); 130 | getContentPane().setLayout(layout); 131 | layout.setHorizontalGroup( 132 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 133 | .addComponent(lblTitle, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 134 | .addGroup(layout.createSequentialGroup() 135 | .addGap(36, 36, 36) 136 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 137 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() 138 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 139 | .addGroup(layout.createSequentialGroup() 140 | .addComponent(lblDescription, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE) 141 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) 142 | .addComponent(txtDesc, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE)) 143 | .addGroup(layout.createSequentialGroup() 144 | .addComponent(lblCode, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE) 145 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) 146 | .addComponent(txtCode, javax.swing.GroupLayout.PREFERRED_SIZE, 183, javax.swing.GroupLayout.PREFERRED_SIZE))) 147 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 148 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() 149 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) 150 | .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING) 151 | .addGroup(layout.createSequentialGroup() 152 | .addGap(0, 0, Short.MAX_VALUE) 153 | .addComponent(lblCode1, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE) 154 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) 155 | .addComponent(txtCode1, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE) 156 | .addGap(49, 49, 49) 157 | .addComponent(btnDelete) 158 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) 159 | .addComponent(btnUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE) 160 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) 161 | .addComponent(btnSave))) 162 | .addGap(31, 31, 31)))) 163 | ); 164 | layout.setVerticalGroup( 165 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 166 | .addGroup(layout.createSequentialGroup() 167 | .addComponent(lblTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE) 168 | .addGap(18, 18, 18) 169 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 170 | .addComponent(txtCode) 171 | .addComponent(lblCode)) 172 | .addGap(18, 18, 18) 173 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 174 | .addComponent(txtCode1) 175 | .addComponent(lblCode1) 176 | .addComponent(btnSave) 177 | .addComponent(btnUpdate) 178 | .addComponent(btnDelete)) 179 | .addGap(18, 18, 18) 180 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 181 | .addComponent(txtDesc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 182 | .addComponent(lblDescription)) 183 | .addGap(29, 29, 29) 184 | .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 319, javax.swing.GroupLayout.PREFERRED_SIZE) 185 | .addGap(107, 107, 107)) 186 | ); 187 | 188 | pack(); 189 | }// //GEN-END:initComponents 190 | 191 | private void txtCodeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCodeActionPerformed 192 | // TODO add your handling code here: 193 | }//GEN-LAST:event_txtCodeActionPerformed 194 | 195 | private void txtCode1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCode1ActionPerformed 196 | // TODO add your handling code here: 197 | }//GEN-LAST:event_txtCode1ActionPerformed 198 | 199 | private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteActionPerformed 200 | delitem(); 201 | }//GEN-LAST:event_btnDeleteActionPerformed 202 | 203 | private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUpdateActionPerformed 204 | updateitem(); 205 | }//GEN-LAST:event_btnUpdateActionPerformed 206 | 207 | private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed 208 | saveitem(); 209 | }//GEN-LAST:event_btnSaveActionPerformed 210 | 211 | private void cattableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cattableMouseClicked 212 | searchItem(); 213 | }//GEN-LAST:event_cattableMouseClicked 214 | 215 | // /** 216 | // * @param args the command line arguments 217 | // */ 218 | // //public static void main(String args[]) { 219 | // /* Set the Nimbus look and feel */ 220 | // // 221 | // /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. 222 | // * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 223 | // */ 224 | // try { 225 | // for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { 226 | // if ("Nimbus".equals(info.getName())) { 227 | // javax.swing.UIManager.setLookAndFeel(info.getClassName()); 228 | // break; 229 | // } 230 | // } 231 | // } catch (ClassNotFoundException ex) { 232 | // java.util.logging.Logger.getLogger(CategoryView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 233 | // } catch (InstantiationException ex) { 234 | // java.util.logging.Logger.getLogger(CategoryView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 235 | // } catch (IllegalAccessException ex) { 236 | // java.util.logging.Logger.getLogger(CategoryView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 237 | // } catch (javax.swing.UnsupportedLookAndFeelException ex) { 238 | // java.util.logging.Logger.getLogger(CategoryView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 239 | // } 240 | // // 241 | // 242 | // /* Create and display the form */ 243 | // // java.awt.EventQueue.invokeLater(new Runnable() { 244 | // // public void run() { 245 | // // new CategoryView().setVisible(true); 246 | // // } 247 | // //}); 248 | // // } 249 | 250 | // Variables declaration - do not modify//GEN-BEGIN:variables 251 | private javax.swing.JButton btnDelete; 252 | private javax.swing.JButton btnSave; 253 | private javax.swing.JButton btnUpdate; 254 | private javax.swing.JTable cattable; 255 | private javax.swing.JScrollPane jScrollPane1; 256 | private javax.swing.JLabel lblCode; 257 | private javax.swing.JLabel lblCode1; 258 | private javax.swing.JLabel lblDescription; 259 | private javax.swing.JLabel lblTitle; 260 | private javax.swing.JTextField txtCode; 261 | private javax.swing.JTextField txtCode1; 262 | private javax.swing.JTextField txtDesc; 263 | // End of variables declaration//GEN-END:variables 264 | 265 | private void loadTable() { 266 | try { 267 | String columns[] = {"Catergory code", "Category Name", "Description"}; 268 | DefaultTableModel dtm = new DefaultTableModel(columns, 0) { 269 | @Override 270 | public boolean isCellEditable(int row, int column) { 271 | return false; 272 | } 273 | }; 274 | cattable.setModel(dtm); 275 | 276 | ArrayList categoryDtos = categoryController.getAll(); 277 | for (CategoryDto dto : categoryDtos) { 278 | Object[] rowData = {dto.getCatcode(),dto.getTitle(),dto.getDescription()}; 279 | dtm.addRow(rowData); 280 | } 281 | } catch (Exception e) { 282 | JOptionPane.showMessageDialog(this, "Error at Loading Data to Item Table"); 283 | } 284 | 285 | // throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody 286 | } 287 | 288 | private void delitem() { 289 | try { 290 | String catCode = txtCode.getText(); 291 | String resp = categoryController.delete(catCode); 292 | JOptionPane.showMessageDialog(this, resp); 293 | clearForm(); 294 | loadTable(); 295 | } catch (Exception e) { 296 | JOptionPane.showMessageDialog(this, "Error at Delete Item"); 297 | } 298 | } 299 | 300 | private void updateitem() { 301 | try { 302 | CategoryDto dto = new CategoryDto(txtCode.getText(),txtCode1.getText() ,txtDesc.getText()); 303 | String resp = categoryController.update(dto); 304 | JOptionPane.showMessageDialog(this, resp); 305 | loadTable(); 306 | clearForm(); 307 | 308 | } catch (Exception e) { 309 | JOptionPane.showMessageDialog(this, "Error at update Item"); 310 | } } 311 | 312 | private void saveitem() { 313 | try { 314 | CategoryDto dto = new CategoryDto(txtCode.getText(),txtCode1.getText(), txtDesc.getText()); 315 | String resp = categoryController.save(dto); 316 | JOptionPane.showMessageDialog(this, resp); 317 | clearForm(); 318 | loadTable(); 319 | } catch (Exception ex) { 320 | JOptionPane.showMessageDialog(this, "Error at save data"); 321 | } } 322 | private void searchItem() { 323 | try { 324 | String catcode = cattable.getValueAt(cattable.getSelectedRow(), 0).toString(); 325 | CategoryDto dto = categoryController.get(catcode); 326 | 327 | if (dto != null) { 328 | txtCode.setText(dto.getCatcode()); 329 | txtCode1.setText(dto.getTitle()); 330 | txtDesc.setText(dto.getDescription()); 331 | 332 | } else { 333 | JOptionPane.showMessageDialog(this, "Item Not Found"); 334 | } 335 | 336 | } catch (Exception e) { 337 | JOptionPane.showMessageDialog(this, "Error at loading Item"); 338 | } 339 | } 340 | 341 | private void clearForm() { 342 | txtCode.setText(""); 343 | txtCode1.setText(""); 344 | txtDesc.setText(""); 345 | } 346 | } 347 | -------------------------------------------------------------------------------- /src/edu/ijse/view/BookReturnView.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 |
217 |
218 | 219 | 220 | 221 | 222 | <Editor/> 223 | <Renderer/> 224 | </Column> 225 | <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> 226 | <Title/> 227 | <Editor/> 228 | <Renderer/> 229 | </Column> 230 | <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> 231 | <Title/> 232 | <Editor/> 233 | <Renderer/> 234 | </Column> 235 | <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> 236 | <Title/> 237 | <Editor/> 238 | <Renderer/> 239 | </Column> 240 | </TableColumnModel> 241 | </Property> 242 | <Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor"> 243 | <TableHeader reorderingAllowed="true" resizingAllowed="true"/> 244 | </Property> 245 | </Properties> 246 | <Events> 247 | <EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="tblMouseClicked"/> 248 | </Events> 249 | </Component> 250 | </SubComponents> 251 | </Container> 252 | <Component class="javax.swing.JLabel" name="lblCode2"> 253 | <Properties> 254 | <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> 255 | <Font name="Segoe UI" size="18" style="0"/> 256 | </Property> 257 | <Property name="text" type="java.lang.String" value="Keep Days :- "/> 258 | </Properties> 259 | </Component> 260 | <Component class="javax.swing.JLabel" name="keep"> 261 | <Properties> 262 | <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> 263 | <Font name="Segoe UI" size="18" style="0"/> 264 | </Property> 265 | </Properties> 266 | </Component> 267 | <Component class="javax.swing.JLabel" name="lblCode4"> 268 | <Properties> 269 | <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> 270 | <Font name="Segoe UI" size="18" style="0"/> 271 | </Property> 272 | <Property name="text" type="java.lang.String" value="Additional fee:- "/> 273 | </Properties> 274 | </Component> 275 | <Component class="javax.swing.JLabel" name="lblmsg"> 276 | <Properties> 277 | <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> 278 | <Font name="Segoe UI" size="14" style="0"/> 279 | </Property> 280 | </Properties> 281 | </Component> 282 | <Component class="javax.swing.JButton" name="btnret"> 283 | <Properties> 284 | <Property name="text" type="java.lang.String" value="Returned"/> 285 | </Properties> 286 | <Events> 287 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnretActionPerformed"/> 288 | </Events> 289 | </Component> 290 | <Component class="javax.swing.JLabel" name="lblCode3"> 291 | <Properties> 292 | <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> 293 | <Font name="Segoe UI" size="18" style="0"/> 294 | </Property> 295 | <Property name="text" type="java.lang.String" value="returning date:- "/> 296 | </Properties> 297 | </Component> 298 | <Component class="com.toedter.calendar.JDateChooser" name="isdate"> 299 | </Component> 300 | <Component class="javax.swing.JLabel" name="lblCode5"> 301 | <Properties> 302 | <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> 303 | <Font name="Segoe UI" size="18" style="0"/> 304 | </Property> 305 | <Property name="text" type="java.lang.String" value="issued date:- "/> 306 | </Properties> 307 | </Component> 308 | <Component class="com.toedter.calendar.JDateChooser" name="irdate"> 309 | </Component> 310 | <Component class="javax.swing.JLabel" name="lblfee"> 311 | <Properties> 312 | <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> 313 | <Font name="Segoe UI" size="18" style="0"/> 314 | </Property> 315 | </Properties> 316 | </Component> 317 | <Component class="javax.swing.JButton" name="feeview"> 318 | <Properties> 319 | <Property name="text" type="java.lang.String" value="View Fee"/> 320 | </Properties> 321 | <Events> 322 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="feeviewActionPerformed"/> 323 | </Events> 324 | </Component> 325 | <Component class="javax.swing.JTextField" name="txtid"> 326 | <Properties> 327 | <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> 328 | <Font name="Segoe UI" size="18" style="0"/> 329 | </Property> 330 | </Properties> 331 | <Events> 332 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="txtidActionPerformed"/> 333 | </Events> 334 | </Component> 335 | <Component class="javax.swing.JLabel" name="lblCode"> 336 | <Properties> 337 | <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> 338 | <Font name="Segoe UI" size="18" style="0"/> 339 | </Property> 340 | <Property name="text" type="java.lang.String" value="Book ID :-"/> 341 | </Properties> 342 | </Component> 343 | <Component class="javax.swing.JButton" name="btnSearch1"> 344 | <Properties> 345 | <Property name="text" type="java.lang.String" value="Search"/> 346 | </Properties> 347 | <Events> 348 | <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnSearch1ActionPerformed"/> 349 | </Events> 350 | </Component> 351 | <Component class="javax.swing.JLabel" name="lblbinfo"> 352 | </Component> 353 | </SubComponents> 354 | </Form> 355 | -------------------------------------------------------------------------------- /src/edu/ijse/view/BookIssueView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license 3 | * Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template 4 | */ 5 | package edu.ijse.view; 6 | 7 | import edu.ijse.dto.MemberDto; 8 | import javax.swing.JOptionPane; 9 | import edu.ijse.controller.MemberController; 10 | import edu.ijse.dto.BookDto; 11 | import edu.ijse.controller.BookController; 12 | import edu.ijse.controller.IssueController; 13 | import edu.ijse.dto.IssueDto; 14 | import edu.ijse.controller.IssueController; 15 | import java.text.SimpleDateFormat; 16 | import com.toedter.calendar.JDateChooser; 17 | import java.util.ArrayList; 18 | import javax.swing.table.DefaultTableModel; 19 | 20 | /** 21 | * 22 | * @author tharu 23 | */ 24 | public class BookIssueView extends javax.swing.JFrame { 25 | private MemberController memberController; 26 | private BookController bookController; 27 | private IssueController issueController; 28 | private JDateChooser jDateChooser; 29 | /** 30 | * Creates new form BookIssueView 31 | */ 32 | public BookIssueView() { 33 | initComponents(); 34 | memberController = new MemberController(); 35 | bookController = new BookController(); 36 | issueController = new IssueController(); 37 | jDateChooser = new JDateChooser(); 38 | loadTable(); 39 | } 40 | 41 | /** 42 | * This method is called from within the constructor to initialize the form. 43 | * WARNING: Do NOT modify this code. The content of this method is always 44 | * regenerated by the Form Editor. 45 | */ 46 | @SuppressWarnings("unchecked") 47 | // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents 48 | private void initComponents() { 49 | 50 | lblTitle = new javax.swing.JLabel(); 51 | lblCode = new javax.swing.JLabel(); 52 | txtid = new javax.swing.JTextField(); 53 | lblCode1 = new javax.swing.JLabel(); 54 | txtid1 = new javax.swing.JTextField(); 55 | btnSearch = new javax.swing.JButton(); 56 | btnSearch1 = new javax.swing.JButton(); 57 | lblCode2 = new javax.swing.JLabel(); 58 | lblCode3 = new javax.swing.JLabel(); 59 | isdate = new com.toedter.calendar.JDateChooser(); 60 | dudate = new com.toedter.calendar.JDateChooser(); 61 | jScrollPane1 = new javax.swing.JScrollPane(); 62 | tblb = new javax.swing.JTable(); 63 | lblbinfo = new javax.swing.JLabel(); 64 | lblsinfo = new javax.swing.JLabel(); 65 | btnSearch2 = new javax.swing.JButton(); 66 | 67 | setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); 68 | 69 | lblTitle.setBackground(new java.awt.Color(204, 204, 204)); 70 | lblTitle.setFont(new java.awt.Font("Segoe UI", 1, 24)); // NOI18N 71 | lblTitle.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); 72 | lblTitle.setText("Book Issue"); 73 | 74 | lblCode.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N 75 | lblCode.setText("Book ID :-"); 76 | 77 | txtid.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N 78 | txtid.addActionListener(new java.awt.event.ActionListener() { 79 | public void actionPerformed(java.awt.event.ActionEvent evt) { 80 | txtidActionPerformed(evt); 81 | } 82 | }); 83 | 84 | lblCode1.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N 85 | lblCode1.setText("St ID :-"); 86 | 87 | txtid1.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N 88 | txtid1.addActionListener(new java.awt.event.ActionListener() { 89 | public void actionPerformed(java.awt.event.ActionEvent evt) { 90 | txtid1ActionPerformed(evt); 91 | } 92 | }); 93 | 94 | btnSearch.setText("Search"); 95 | btnSearch.addActionListener(new java.awt.event.ActionListener() { 96 | public void actionPerformed(java.awt.event.ActionEvent evt) { 97 | btnSearchActionPerformed(evt); 98 | } 99 | }); 100 | 101 | btnSearch1.setText("Search"); 102 | btnSearch1.addActionListener(new java.awt.event.ActionListener() { 103 | public void actionPerformed(java.awt.event.ActionEvent evt) { 104 | btnSearch1ActionPerformed(evt); 105 | } 106 | }); 107 | 108 | lblCode2.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N 109 | lblCode2.setText("Issued date:- "); 110 | 111 | lblCode3.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N 112 | lblCode3.setText("due date:- "); 113 | 114 | tblb.setModel(new javax.swing.table.DefaultTableModel( 115 | new Object [][] { 116 | {null, null, null, null}, 117 | {null, null, null, null}, 118 | {null, null, null, null}, 119 | {null, null, null, null} 120 | }, 121 | new String [] { 122 | "Title 1", "Title 2", "Title 3", "Title 4" 123 | } 124 | )); 125 | jScrollPane1.setViewportView(tblb); 126 | 127 | btnSearch2.setText("Issue"); 128 | btnSearch2.addActionListener(new java.awt.event.ActionListener() { 129 | public void actionPerformed(java.awt.event.ActionEvent evt) { 130 | btnSearch2ActionPerformed(evt); 131 | } 132 | }); 133 | 134 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); 135 | getContentPane().setLayout(layout); 136 | layout.setHorizontalGroup( 137 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 138 | .addGroup(layout.createSequentialGroup() 139 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) 140 | .addGroup(layout.createSequentialGroup() 141 | .addContainerGap() 142 | .addComponent(lblTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 423, javax.swing.GroupLayout.PREFERRED_SIZE)) 143 | .addGroup(layout.createSequentialGroup() 144 | .addGap(15, 15, 15) 145 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 146 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) 147 | .addGroup(layout.createSequentialGroup() 148 | .addComponent(lblCode, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE) 149 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 150 | .addGroup(layout.createSequentialGroup() 151 | .addGap(12, 12, 12) 152 | .addComponent(txtid, javax.swing.GroupLayout.PREFERRED_SIZE, 183, javax.swing.GroupLayout.PREFERRED_SIZE) 153 | .addGap(18, 18, 18) 154 | .addComponent(btnSearch)) 155 | .addGroup(layout.createSequentialGroup() 156 | .addGap(42, 42, 42) 157 | .addComponent(lblbinfo, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE)))) 158 | .addGroup(layout.createSequentialGroup() 159 | .addComponent(lblCode1, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE) 160 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 161 | .addGroup(layout.createSequentialGroup() 162 | .addGap(12, 12, 12) 163 | .addComponent(txtid1, javax.swing.GroupLayout.PREFERRED_SIZE, 183, javax.swing.GroupLayout.PREFERRED_SIZE) 164 | .addGap(18, 18, 18) 165 | .addComponent(btnSearch1)) 166 | .addGroup(layout.createSequentialGroup() 167 | .addGap(46, 46, 46) 168 | .addComponent(lblsinfo, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE))))) 169 | .addGroup(layout.createSequentialGroup() 170 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) 171 | .addGroup(layout.createSequentialGroup() 172 | .addComponent(lblCode3, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE) 173 | .addGap(18, 18, 18) 174 | .addComponent(dudate, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 175 | .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() 176 | .addComponent(lblCode2, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE) 177 | .addGap(18, 18, 18) 178 | .addComponent(isdate, javax.swing.GroupLayout.PREFERRED_SIZE, 167, javax.swing.GroupLayout.PREFERRED_SIZE))) 179 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 180 | .addComponent(btnSearch2))))) 181 | .addGap(39, 39, 39) 182 | .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 697, javax.swing.GroupLayout.PREFERRED_SIZE) 183 | .addGap(0, 0, Short.MAX_VALUE)) 184 | ); 185 | layout.setVerticalGroup( 186 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 187 | .addGroup(layout.createSequentialGroup() 188 | .addContainerGap() 189 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 190 | .addGroup(layout.createSequentialGroup() 191 | .addComponent(lblTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE) 192 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 193 | .addGroup(layout.createSequentialGroup() 194 | .addGap(5, 5, 5) 195 | .addComponent(lblCode)) 196 | .addGroup(layout.createSequentialGroup() 197 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 198 | .addComponent(txtid, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 199 | .addComponent(btnSearch)) 200 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 201 | .addComponent(lblbinfo, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))) 202 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 203 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 204 | .addGroup(layout.createSequentialGroup() 205 | .addGap(5, 5, 5) 206 | .addComponent(lblCode1)) 207 | .addGroup(layout.createSequentialGroup() 208 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 209 | .addComponent(txtid1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 210 | .addComponent(btnSearch1)) 211 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 212 | .addComponent(lblsinfo, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE))) 213 | .addGap(22, 22, 22) 214 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 215 | .addComponent(lblCode2) 216 | .addComponent(isdate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 217 | .addGap(36, 36, 36) 218 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 219 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) 220 | .addComponent(lblCode3) 221 | .addComponent(dudate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 222 | .addComponent(btnSearch2)) 223 | .addGap(43, 43, 43)) 224 | .addGroup(layout.createSequentialGroup() 225 | .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 339, javax.swing.GroupLayout.PREFERRED_SIZE) 226 | .addContainerGap(34, Short.MAX_VALUE)))) 227 | ); 228 | 229 | pack(); 230 | }// </editor-fold>//GEN-END:initComponents 231 | 232 | private void txtidActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtidActionPerformed 233 | // TODO add your handling code here: 234 | }//GEN-LAST:event_txtidActionPerformed 235 | 236 | private void txtid1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtid1ActionPerformed 237 | // TODO add your handling code here: 238 | }//GEN-LAST:event_txtid1ActionPerformed 239 | 240 | private void btnSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSearchActionPerformed 241 | searchBook(); 242 | }//GEN-LAST:event_btnSearchActionPerformed 243 | 244 | private void btnSearch1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSearch1ActionPerformed 245 | seacrhCustomer(); 246 | }//GEN-LAST:event_btnSearch1ActionPerformed 247 | 248 | private void btnSearch2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSearch2ActionPerformed 249 | // TODO add your handling code here: 250 | 251 | issuebook(); 252 | }//GEN-LAST:event_btnSearch2ActionPerformed 253 | 254 | /** 255 | * @param args the command line arguments 256 | */ 257 | // public static void main(String args[]) { 258 | // /* Set the Nimbus look and feel */ 259 | // //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> 260 | // /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. 261 | // * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 262 | // */ 263 | // try { 264 | // for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { 265 | // if ("Nimbus".equals(info.getName())) { 266 | // javax.swing.UIManager.setLookAndFeel(info.getClassName()); 267 | // break; 268 | // } 269 | // } 270 | // } catch (ClassNotFoundException ex) { 271 | // java.util.logging.Logger.getLogger(BookIssueView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 272 | // } catch (InstantiationException ex) { 273 | // java.util.logging.Logger.getLogger(BookIssueView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 274 | // } catch (IllegalAccessException ex) { 275 | // java.util.logging.Logger.getLogger(BookIssueView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 276 | // } catch (javax.swing.UnsupportedLookAndFeelException ex) { 277 | // java.util.logging.Logger.getLogger(BookIssueView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 278 | // } 279 | // //</editor-fold> 280 | // 281 | // /* Create and display the form */ 282 | // java.awt.EventQueue.invokeLater(new Runnable() { 283 | // public void run() { 284 | // new BookIssueView().setVisible(true); 285 | // } 286 | // }); 287 | // } 288 | 289 | // Variables declaration - do not modify//GEN-BEGIN:variables 290 | private javax.swing.JButton btnSearch; 291 | private javax.swing.JButton btnSearch1; 292 | private javax.swing.JButton btnSearch2; 293 | private com.toedter.calendar.JDateChooser dudate; 294 | private com.toedter.calendar.JDateChooser isdate; 295 | private javax.swing.JScrollPane jScrollPane1; 296 | private javax.swing.JLabel lblCode; 297 | private javax.swing.JLabel lblCode1; 298 | private javax.swing.JLabel lblCode2; 299 | private javax.swing.JLabel lblCode3; 300 | private javax.swing.JLabel lblTitle; 301 | private javax.swing.JLabel lblbinfo; 302 | private javax.swing.JLabel lblsinfo; 303 | private javax.swing.JTable tblb; 304 | private javax.swing.JTextField txtid; 305 | private javax.swing.JTextField txtid1; 306 | // End of variables declaration//GEN-END:variables 307 | private void seacrhCustomer() { 308 | try { 309 | String nic = txtid1.getText(); 310 | MemberDto memberDto = memberController.get(nic); 311 | if (memberDto != null) { 312 | lblsinfo.setText(memberDto.getNic() + " | " + memberDto.getName()); 313 | } else { 314 | JOptionPane.showMessageDialog(this, "Error at Search Student"); 315 | } 316 | } catch (Exception e) { 317 | e.printStackTrace(); 318 | JOptionPane.showMessageDialog(this, "Error at Search Student"); 319 | } 320 | } 321 | 322 | private void searchBook() { 323 | try { 324 | String bookid = txtid.getText(); 325 | BookDto bookDto = bookController.get(bookid); 326 | if (bookDto != null) { 327 | lblbinfo.setText( bookDto.getBtitle()); 328 | } else { 329 | JOptionPane.showMessageDialog(this, "Error at Search Book"); 330 | } 331 | } catch (Exception e) { 332 | e.printStackTrace(); 333 | JOptionPane.showMessageDialog(this, "Error at Search Book"); 334 | } 335 | } 336 | private void loadTable() { 337 | try { 338 | String columns[]={"NIC","bookid","IssueDate","DueDate","returnStatus"}; 339 | DefaultTableModel dta = new DefaultTableModel(columns,0){ 340 | @Override 341 | public boolean isCellEditable(int row,int column){ 342 | return false; 343 | } 344 | }; 345 | tblb.setModel(dta); 346 | ArrayList<IssueDto>issueDtos = issueController.getAll(); 347 | for(IssueDto dto : issueDtos){ 348 | Object[]rowData = {dto.getNic(),dto.getBookid(),dto.getIssuedate(),dto.getDuedate(),dto.getReturnBook()}; 349 | dta.addRow(rowData); 350 | } 351 | } catch (Exception e) { 352 | JOptionPane.showMessageDialog(this, "Error at Loading Data to Item Table"); 353 | } 354 | } 355 | 356 | private void issuebook() { 357 | SimpleDateFormat dfo = new SimpleDateFormat("dd-MM-yyyy"); 358 | String issu = dfo.format(isdate.getDate()); 359 | String due = dfo.format(dudate.getDate()); 360 | try { 361 | IssueDto dto = new IssueDto(txtid1.getText(),txtid.getText(),issu,due,"No"); 362 | String resp = issueController.save(dto); 363 | JOptionPane.showMessageDialog(this, resp); 364 | clearForm(); 365 | loadTable(); 366 | } catch (Exception e) { 367 | JOptionPane.showMessageDialog(this, "Error at save data"); 368 | } 369 | 370 | } 371 | 372 | private void clearForm() { 373 | txtid1.setText(""); 374 | txtid.setText(""); 375 | } 376 | } 377 | --------------------------------------------------------------------------------