https://github.com/chhengz/lms
Library Management System build with C# .NET and MS.SQL Server 2022
https://github.com/chhengz/lms
csharp dotnet library-management-system lms sql-server
Last synced: 4 months ago
JSON representation
Library Management System build with C# .NET and MS.SQL Server 2022
- Host: GitHub
- URL: https://github.com/chhengz/lms
- Owner: chhengz
- Created: 2025-10-17T14:12:00.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-12-17T08:04:09.000Z (6 months ago)
- Last Synced: 2025-12-20T21:30:54.551Z (6 months ago)
- Topics: csharp, dotnet, library-management-system, lms, sql-server
- Language: C#
- Homepage:
- Size: 22.4 MB
- Stars: 0
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# π Library Management System (LMS)
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**.
## π Features
### π¨βπΌ Staff Management
- Create, edit, and delete staff accounts.
- Secure login with username and password.
- Role-based access (Admin / Librarian).
### π Book Management
- Add, edit, delete, and search books.
- Auto-refresh data grid when new books are added.
- Real-time SQL dependency updates (via `SqlDependency`).
### π Borrow & Return
- Manage borrowed books and return records.
- Tracks which staff handled transactions.
### π Dashboard & UI
- 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.
---
## π§± Project Structure
```
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
```
---
## βοΈ Setup Instructions
### π§© Prerequisites
- **Windows 10/11**
- **SQL Server** (LocalDB, Express, or Full)
- **Visual Studio 2019/2022**
- **.NET Framework 4.7.2**
---
### π§ Step 1 β Database Setup
1. Open SQL Server Management Studio (SSMS).
2. Run the script:
```
_db/db_sqlserver.sql
````
3. Make sure **Service Broker** is enabled:
```sql
ALTER DATABASE LMS_DB SET ENABLE_BROKER WITH ROLLBACK IMMEDIATE;
````
4. Update your connection string in:
```
Core/Connection.cs
```
Example:
```csharp
public static SqlConnection GetConn()
{
return new SqlConnection("Data Source=.;Initial Catalog=LMS_DB;Integrated Security=True");
}
```
---
### π₯οΈ Step 2 β Run the Application
1. Open `LMS.sln` in Visual Studio.
2. Set **LMS** as the startup project.
3. Build the project (`Ctrl + Shift + B`).
4. Run (`F5`).
β
Login with an existing user (from your SQL data) or manually insert one:
```sql
INSERT INTO Staff (FullName, Email, Phone, Role, Username, Password, CreatedAt)
VALUES ('Admin User', 'admin@lms.com', '012345678', 'Admin', 'admin', '123', GETDATE());
```
---
### π§ Step 3 β Default Roles
| Role | Permissions |
| ------------- | ----------------------------------------- |
| **Admin** | Full access (Books, Borrow/Return, Staff) |
| **Librarian** | Manage Books and Borrow/Return only |
---
## π§© Technologies Used
| 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 |
---
## πΈ Screenshots
```


```
---