Skip to content

Three-tier enterprise application built with C# .NET and SQL Server, implementing Repository pattern, Service Layer architecture, and Dependency Injection. Features role-based authentication, medicine inventory management, shopping cart system, and bill generation with 100% SQL injection prevention.

Notifications You must be signed in to change notification settings

MostafaElsehy/Pharmacy-Management-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pharmacy Management System

A comprehensive Windows Forms application built with C# and .NET Framework 4.7.2, implementing a modern three-tier architecture for efficient pharmacy operations management.

🏗️ Architecture Overview

This project demonstrates enterprise-level software architecture principles with a clean separation of concerns:

Three-Tier Architecture

  • Presentation Layer: Windows Forms UI components
  • Business Logic Layer: Service classes handling business rules and validation
  • Data Access Layer: Repository pattern with SQL Server integration

Key Design Patterns

  • Repository Pattern: Abstracted data access with generic base repository
  • Service Layer Pattern: Business logic encapsulation
  • Dependency Injection: Service container for loose coupling
  • Result Pattern: Consistent error handling and return values

🚀 Features

User Management

  • Role-based authentication (Administrator/Pharmacist)
  • Secure user registration and management
  • Session management with Windows Registry integration

Medicine Management

  • Complete CRUD operations for medicine inventory
  • Expiration date tracking and validation
  • Stock level monitoring with low-stock alerts
  • Medicine search and filtering capabilities

Sales & Inventory

  • Point-of-sale functionality with cart system
  • Real-time stock updates
  • Purchase history tracking
  • Bill generation and printing

Analytics & Reporting

  • Interactive dashboard with charts
  • Medicine validity statistics
  • Stock level analytics
  • User activity monitoring

🛠️ Technical Stack

  • Framework: .NET Framework 4.7.2
  • Database: SQL Server with Entity Framework patterns
  • UI: Windows Forms with Guna UI2 components
  • Architecture: Three-tier with Repository and Service patterns
  • Design Patterns: Repository, Service Layer, Dependency Injection

📁 Project Structure

Pharmacy Management System/
├── Models/                 # Data models and entities
│   ├── User.cs
│   ├── Medicine.cs
│   ├── Purchase.cs
│   └── UserRole.cs
├── DataAccess/            # Data access layer
│   ├── IRepository.cs
│   ├── BaseRepository.cs
│   ├── IUserRepository.cs
│   ├── UserRepository.cs
│   ├── IMedicineRepository.cs
│   └── MedicineRepository.cs
├── BusinessLogic/         # Business logic layer
│   ├── IUserService.cs
│   ├── UserService.cs
│   ├── IMedicineService.cs
│   └── MedicineService.cs
├── Services/              # Service container
│   ├── IServiceContainer.cs
│   └── ServiceContainer.cs
├── Common/                # Shared utilities
│   ├── Configuration.cs
│   └── Result.cs
└── UI Forms/              # Presentation layer
    ├── signInForm.cs
    ├── adminstratorForm.cs
    ├── PharmacistForm.cs
    └── User Controls/

🔧 Key Improvements Made

Code Quality Enhancements

  • Eliminated SQL Injection: Parameterized queries throughout
  • Proper Error Handling: Comprehensive exception management
  • Input Validation: Business rule validation at service layer
  • Code Documentation: XML documentation for all public members
  • Consistent Naming: PascalCase conventions and meaningful names

Architecture Improvements

  • Separation of Concerns: Clear layer boundaries
  • Dependency Injection: Loose coupling between components
  • Generic Repository: Reusable data access patterns
  • Result Pattern: Consistent error handling
  • Configuration Management: Centralized settings

Security Enhancements

  • Parameterized Queries: SQL injection prevention
  • Input Validation: Comprehensive data validation
  • Error Handling: Secure error messages
  • Role-based Access: Proper authorization

🎯 Google-Ready Features

Software Engineering Best Practices

  • Clean Architecture: SOLID principles implementation
  • Design Patterns: Repository, Service Layer, Dependency Injection
  • Error Handling: Comprehensive exception management
  • Code Documentation: Professional XML documentation
  • Configuration Management: Environment-specific settings

Scalability & Maintainability

  • Modular Design: Easy to extend and modify
  • Interface-based Design: Testable and mockable components
  • Generic Patterns: Reusable code components
  • Separation of Concerns: Clear responsibility boundaries

Performance Considerations

  • Efficient Data Access: Optimized database queries
  • Connection Management: Proper resource disposal
  • Async Patterns: Ready for async/await implementation
  • Caching Ready: Service layer supports caching strategies

🚀 Getting Started

Prerequisites

  • Visual Studio 2019 or later
  • .NET Framework 4.7.2
  • SQL Server (LocalDB or full instance)
  • Guna UI2 components

Installation

  1. Clone the repository
  2. Open Pharmacy Management System.sln in Visual Studio
  3. Restore NuGet packages
  4. Update connection string in App.config
  5. Build and run the application

Default Credentials

  • Username: Mostafa
  • Password: Mostafa

📊 Database Schema

The application uses the following main tables:

  • users: User authentication and role management
  • medicine: Medicine inventory and details
  • Purchases: Sales transaction records

🔮 Future Enhancements

  • Web API Integration: RESTful API for mobile/web clients
  • Cloud Deployment: Azure/AWS integration
  • Advanced Analytics: Machine learning for demand forecasting
  • Mobile App: Cross-platform mobile application
  • Real-time Notifications: SignalR integration
  • Audit Logging: Comprehensive activity tracking

👨‍💻 Developer Notes

This project demonstrates:

  • Enterprise-level C# development
  • Modern software architecture patterns
  • Database design and optimization
  • User interface design principles
  • Security best practices
  • Code organization and documentation

Perfect for showcasing full-stack development skills and understanding of enterprise software development practices.

📄 License

This project is created for educational and portfolio purposes.


Built with ❤️ for Google Internship Application

About

Three-tier enterprise application built with C# .NET and SQL Server, implementing Repository pattern, Service Layer architecture, and Dependency Injection. Features role-based authentication, medicine inventory management, shopping cart system, and bill generation with 100% SQL injection prevention.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages