A comprehensive retail inventory management system built with C# .NET, featuring a clean 3-layer architecture designed for small to medium retail stores. The system provides robust inventory tracking, customer management, and sales promotion capabilities with XML-based data persistence and extensive logging.
- ποΈ Architecture Overview
- β¨ Features
- π οΈ Technology Stack
- π Project Structure
- βοΈ Setup & Installation
- π Usage
- π§ͺ Testing
- π Logging
- π€ Contributing
The system follows a clean 3-layer architecture pattern ensuring separation of concerns, maintainability, and testability:
βββββββββββββββββββββββββββββββββββββββββββ
β Presentation Layer β
β (Console Test App) β
βββββββββββββββββββββββββββββββββββββββββββ€
β Business Logic Layer β
β (BL - Business Rules & Logic) β
βββββββββββββββββββββββββββββββββββββββββββ€
β Data Access Layer β
β (DAL - Configurable Storage) β
βββββββββββββββββββββββββββββββββββββββββββ
-
π Data Access Layer (DAL):
- Configurable data persistence (currently XML-based)
- Generic CRUD operations with filtering capabilities
- Factory pattern for DAL provider selection
- Extensible design for future database implementations
-
πΌ Business Logic Layer (BL):
- Domain-specific business rules and validations
- Entity management and relationships
- Business object transformations
- Exception handling and logging integration
-
π₯οΈ Presentation Layer:
- Console-based testing and demonstration application
- Interactive menus for all system operations
- User-friendly input validation and error handling
- CRUD Operations: Create, Read, Update, Delete products
- Categories: Organize products by categories (Plants, Boxes, KnickKnack, Pictures, Pillows)
- Inventory Tracking: Monitor stock levels and pricing
- Product Relationships: Link products with sales and promotions
- Customer Profiles: Comprehensive customer information management
- Contact Details: Name, address, phone number tracking
- Customer History: Link customers with their purchase history
- Customer Segmentation: Support for preferred customer status
- Flexible Sales: Create and manage product sales/promotions
- Discount Management: Configure percentage-based or fixed-amount discounts
- Time-based Promotions: Set start and end dates for sales
- Club Member Specials: Exclusive promotions for club members
- Inventory Integration: Automatic stock level adjustments
- Configurable Data Storage: XML-based with extensible architecture
- Comprehensive Logging: Detailed operation logging with monthly organization
- Error Handling: Robust exception management throughout all layers
- Generic CRUD Interface: Consistent data operations across all entities
- Factory Pattern: Flexible component instantiation and configuration
- Framework: .NET 8.0
- Language: C# 12.0
- Architecture: 3-Layer Clean Architecture
- Data Storage: XML files (configurable via dal-config.xml)
- Logging: Custom file-based logging system
- Testing: Console-based integration testing
- Build System: MSBuild/.NET CLI
inventory-management-system/
βββ π BL/ # Business Logic Layer
β βββ π BlApi/ # BL Interfaces
β β βββ IBl.cs # Main BL interface
β β βββ ICustomer.cs # Customer operations
β β βββ IOrder.cs # Order management
β β βββ IProduct.cs # Product operations
β β βββ ISale.cs # Sales operations
β βββ π BO/ # Business Objects
β β βββ Customer.cs # Customer entity
β β βββ Product.cs # Product entity
β β βββ Order.cs # Order entity
β β βββ Sale.cs # Sale entity
β β βββ Enums.cs # Domain enumerations
β βββ π BlImplementation/ # BL Implementations
βββ π DalFacade/ # Data Access Layer
β βββ π DalApi/ # DAL Interfaces
β β βββ IDal.cs # Main DAL interface
β β βββ ICrud.cs # Generic CRUD operations
β β βββ Factory.cs # DAL factory
β βββ π DO/ # Data Objects
βββ π DalList/ # DAL Implementation (In-Memory Lists)
βββ π Tools/ # Utilities & Logging
β βββ LogManager.cs # Logging system
βββ π DalTest/ # Console Test Application
βββ π BlTest/ # Business Logic Tests
βββ π xml/ # Configuration Files
β βββ dal-config.xml # DAL configuration
βββ π README.md # This file
- .NET 8.0 SDK or later
- IDE: Visual Studio 2022, VS Code, or JetBrains Rider
-
Clone the repository:
git clone https://github.com/rivka14/inventory-management-system.git cd inventory-management-system -
Restore dependencies:
dotnet restore
-
Build the solution:
dotnet build
-
Run the test application:
dotnet run --project DalTest
The system uses xml/dal-config.xml to configure the data access layer:
<?xml version="1.0" encoding="utf-8"?>
<config>
<dal>list</dal> <!-- Current: in-memory lists -->
<dal-packages>
<list>DalList</list>
<xml>DalXml</xml> <!-- Future: XML file storage -->
</dal-packages>
</config>The DalTest project provides an interactive console interface:
dotnet run --project DalTestMain Menu:
βββ 1. Product Management
β βββ Create new product
β βββ Read product details
β βββ List all products (with filtering)
β βββ Update product information
β βββ Delete product
βββ 2. Customer Management
β βββ Create new customer
β βββ Read customer details
β βββ List all customers
β βββ Update customer information
β βββ Delete customer
βββ 3. Sales Management
βββ Create new sale/promotion
βββ Read sale details
βββ List all sales
βββ Update sale information
βββ Delete sale
Creating a Product:
Enter ProductId, ProductName, CategoryProduct, Price, Amount
> 1001
> Decorative Plant
> 0 (Plants category)
> 25
> 50
Creating a Sale:
Enter ProductId, AmountForSale, UniqueIdAuto, PriceForSale, IsForClab, StartDate, EndDate
> 1001
> 10
> 2001
> 20
> true
> 1 9 2024 (Sept 1, 2024)
> 30 9 2024 (Sept 30, 2024)
The primary testing approach uses the interactive console application in DalTest:
# Run the test application
dotnet run --project DalTest
# Or run the business logic tests
dotnet run --project BlTest- Test all CRUD operations for each entity
- Validate business rules and constraints
- Test error handling and edge cases
- Verify logging functionality
The system includes a comprehensive logging mechanism:
- Monthly Organization: Logs organized by month
- Daily Files: Separate log file for each day
- Automatic Cleanup: Old logs automatically deleted
- Structured Format: Timestamp, project, function, and message
- Operation Tracking: All CRUD operations are logged
bin/Log/
βββ [Month]/
β βββ 1.txt # Day 1 logs
β βββ 2.txt # Day 2 logs
β βββ ...
2024-09-14 15:30:45 DalList.CreateProduct: Product created successfully with ID: 1001
- Follow the 3-layer architecture - maintain clear separation of concerns
- Implement proper error handling - use try-catch blocks and meaningful exceptions
- Add logging - log all significant operations
- Maintain consistency - follow existing coding patterns and naming conventions
- Test thoroughly - test all CRUD operations and edge cases
- Use meaningful variable and method names
- Follow C# naming conventions (PascalCase for public members, camelCase for private)
- Add XML documentation comments for public APIs
- Keep methods focused and single-purpose
- Define interfaces first in the appropriate API layer
- Implement business objects in the BO layer if needed
- Add business logic implementation in the BL layer
- Implement data access in the DAL layer
- Add tests in the console application
- Update documentation
For questions, suggestions, or issues, please create an issue in the GitHub repository.
Happy Inventory Managing! π