A modern C# Windows Forms Application for managing a library's books, borrowers, and staff accounts — built with .NET Framework 4.7.2 and SQL Server.
- Create, edit, and delete staff accounts.
- Secure login with username and password.
- Role-based access (Admin / Librarian).
- Add, edit, delete, and search books.
- Auto-refresh data grid when new books are added.
- Real-time SQL dependency updates (via
SqlDependency).
- Manage borrowed books and return records.
- Tracks which staff handled transactions.
- Clean sidebar navigation (
Home,Books,Borrow/Return,Staff). - Role-based button visibility (Admin can manage staff).
- Resizable and draggable borderless form.
- Integrated icons and modern design.
LMS/
│ LMS.sln
│ Program.cs
│ App.config
│ README.md
│
├───Core/
│ ├───Connection.cs # Database connection class
│ └───App.cs # Main application entry logic
│
├───Forms/
│ ├───Login/ # Login form (authentication)
│ ├───Books/ # Manage book records
│ ├───BorrowReturn/ # Borrow & Return functionality
│ ├───Staff/ # Manage staff accounts
│ └───Welcome/ # Default welcome dashboard
│
├───images/ # All icons and UI resources
│
├───_db/
│ └───db_sqlserver.sql # SQL script for database creation
│
└───bin/Debug/SQL/
└───MAKE_DATABASE.TXT # Notes for enabling Service Broker
- Windows 10/11
- SQL Server (LocalDB, Express, or Full)
- Visual Studio 2019/2022
- .NET Framework 4.7.2
- Open SQL Server Management Studio (SSMS).
- Run the script:
_db/db_sqlserver.sql
- Make sure Service Broker is enabled:
ALTER DATABASE LMS_DB SET ENABLE_BROKER WITH ROLLBACK IMMEDIATE;-
Update your connection string in:
Core/Connection.csExample:
public static SqlConnection GetConn() { return new SqlConnection("Data Source=.;Initial Catalog=LMS_DB;Integrated Security=True"); }
- Open
LMS.slnin Visual Studio. - Set LMS as the startup project.
- Build the project (
Ctrl + Shift + B). - Run (
F5).
✅ Login with an existing user (from your SQL data) or manually insert one:
INSERT INTO Staff (FullName, Email, Phone, Role, Username, Password, CreatedAt)
VALUES ('Admin User', 'admin@lms.com', '012345678', 'Admin', 'admin', '123', GETDATE());| Role | Permissions |
|---|---|
| Admin | Full access (Books, Borrow/Return, Staff) |
| Librarian | Manage Books and Borrow/Return only |
| Category | Tool / Framework |
|---|---|
| Language | C# (.NET Framework 4.7.2) |
| Database | Microsoft SQL Server |
| UI | WinForms |
| ORM / DB Access | ADO.NET (SqlConnection, SqlCommand) |
| Notifications | SqlDependency for real-time updates |
| Design | Custom icons, image-based buttons |

