Skip to content

A desktop application for managing a store, and structured according to the 3-layer architecture: DAL, BL, UI. Data is stored locally using XML files.

Notifications You must be signed in to change notification settings

rivka14/inventory-management-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸͺ Inventory Management System

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.

πŸ“‹ Table of Contents

πŸ—οΈ Architecture Overview

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)         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Layer Details:

  • πŸ“Š 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

✨ Features

πŸ“¦ Product Management

  • 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 Management

  • 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

🏷️ Sales & Promotions

  • 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

πŸ“ˆ Advanced Features

  • 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

πŸ› οΈ Technology Stack

  • 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

πŸ“ Project Structure

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

βš™οΈ Setup & Installation

Prerequisites

  • .NET 8.0 SDK or later
  • IDE: Visual Studio 2022, VS Code, or JetBrains Rider

Installation Steps

  1. Clone the repository:

    git clone https://github.com/rivka14/inventory-management-system.git
    cd inventory-management-system
  2. Restore dependencies:

    dotnet restore
  3. Build the solution:

    dotnet build
  4. Run the test application:

    dotnet run --project DalTest

Configuration

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>

πŸš€ Usage

Running the Console Application

The DalTest project provides an interactive console interface:

dotnet run --project DalTest

Menu System

Main 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

Example Operations

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)

πŸ§ͺ Testing

Console Testing

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

Integration Testing

  • Test all CRUD operations for each entity
  • Validate business rules and constraints
  • Test error handling and edge cases
  • Verify logging functionality

πŸ“Š Logging

The system includes a comprehensive logging mechanism:

Features

  • 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

Log Location

bin/Log/
β”œβ”€β”€ [Month]/
β”‚   β”œβ”€β”€ 1.txt      # Day 1 logs
β”‚   β”œβ”€β”€ 2.txt      # Day 2 logs
β”‚   └── ...

Log Format

2024-09-14 15:30:45    DalList.CreateProduct:    Product created successfully with ID: 1001

🀝 Contributing

Development Guidelines

  1. Follow the 3-layer architecture - maintain clear separation of concerns
  2. Implement proper error handling - use try-catch blocks and meaningful exceptions
  3. Add logging - log all significant operations
  4. Maintain consistency - follow existing coding patterns and naming conventions
  5. Test thoroughly - test all CRUD operations and edge cases

Code Style

  • 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

Adding New Features

  1. Define interfaces first in the appropriate API layer
  2. Implement business objects in the BO layer if needed
  3. Add business logic implementation in the BL layer
  4. Implement data access in the DAL layer
  5. Add tests in the console application
  6. Update documentation

πŸ“ž Support & Contact

For questions, suggestions, or issues, please create an issue in the GitHub repository.

Happy Inventory Managing! πŸš€

About

A desktop application for managing a store, and structured according to the 3-layer architecture: DAL, BL, UI. Data is stored locally using XML files.

Resources

Stars

Watchers

Forks

Releases

No releases published

Contributors 2

  •  
  •  

Languages