# noor-rehman/inventory-management-system---windows-application-with-integrated-database architecture

> Architecture diagram of the GitHub repository noor-rehman/inventory-management-system---windows-application-with-integrated-database, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/noor-rehman/inventory-management-system---windows-application-with-integrated-database
- Repository: https://github.com/noor-rehman/inventory-management-system---windows-application-with-integrated-database

## Overview

##### Project Type and Purpose
- Desktop “thick‐client” WinForms application
- Purpose: inventory tracking, billing/receipt printing, expense & refund management

##### Main Architectural Components
a. User Interface Layer (WinForms)
– All “*.cs” and “*.Designer.cs” files under root (Form1, Attendants, Category, Expense, SellingForm, Refunds, History, ResetPasswordForm, Loading, Splash, etc.)
– Responsible for user interactions, form events, data entry, bill printing UI
b. Business Logic Layer
– Embedded in form code‐behind (validation, computing totals, business rules)
– Could be pulled out later into separate classes if needed
c. Data Access Layer
– db.cs (connection management, raw SQL execution)
– star_platinumDataSet.* (Typed DataSet, TableAdapters, schema definitions)
– Bridges business logic and SQL Server database
d. Database
– SQL Server (local or remote) storing inventory, sales, refunds, history tables
– Accessed via ADO.NET Typed DataSets & TableAdapters
e. Reporting/Bill Printing Component
– Printing logic invoked by SellingForm or other sales forms
– Uses .NET PrintDocument/PrintPreview controls

##### Relationships and Data Flows
1) User interacts with WinForm → triggers event handler
2) Event handler invokes Business Logic (calculations, validations)
3) Business Logic calls Data Access Layer (db.cs or TableAdapter)
4) Data Access Layer opens SQL connection → runs queries or stored procedures → returns DataSet or scalar result
5) Business Logic processes results → updates UI or triggers printing
6) For bill printing: UI passes sale details to Reporting component → PrintDocument → Printer

##### Architectural Patterns & Design Principles
- Layered architecture (UI → BLL → DAL → Database)
- Separation of concerns (forms for UI, db.cs for data access, DataSet for schema)
- Event‐driven programming (WinForms)
- Typed DataSets as simple ORM alternative

##### Technologies & Frameworks
- .NET Framework WinForms
- ADO.NET Typed DataSets (star_platinumDataSet.xsd/.xsc/.xss)
- SQL Server (Express or full edition)
- C# language
- .resx resource files for localization

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User Interface Layer
    subgraph "User Interface Layer"
        direction TB
        Form1["Form1"]:::ui
        Attendants["Attendants"]:::ui
        Category["Category"]:::ui
        Expense["Expense"]:::ui
        Expenses["Expenses"]:::ui
        SellingForm["SellingForm"]:::ui
        Refunds["Refunds"]:::ui
        History["History"]:::ui
        ResetPasswordForm["ResetPasswordForm"]:::ui
        Loading["Loading"]:::ui
        Splash["Splash"]:::ui
        FormsHelper["Forms Helper"]:::ui
    end

    %% Business Logic Layer
    BusinessLogic["Business Logic"]:::bll

    %% Data Access Layer
    subgraph "Data Access Layer"
        direction TB
        DBHelper["db.cs"]:::dal
        DataSet["star_platinumDataSet"]:::dal
    end

    %% Core Components
    AppConfig["App.config"]:::config
    Program["Program.cs"]:::config
    Solution["Shop.sln"]:::config
    Project["Shop.csproj"]:::config

    %% Database and Reporting
    Database[(SQL Server Database)]:::db
    Reporting["Reporting / PrintDocument"]:::report
    Printer["Printer"]:::external

    %% Connections
    Form1 -->|triggers event| BusinessLogic
    Attendants -->|triggers event| BusinessLogic
    Category -->|triggers event| BusinessLogic
    Expense -->|triggers event| BusinessLogic
    Expenses -->|triggers event| BusinessLogic
    SellingForm -->|triggers event| BusinessLogic
    Refunds -->|triggers event| BusinessLogic
    History -->|triggers event| BusinessLogic
    ResetPasswordForm -->|triggers event| BusinessLogic
    Loading -->|triggers event| BusinessLogic
    Splash -->|triggers event| BusinessLogic
    FormsHelper -->|utility calls| BusinessLogic

    BusinessLogic -->|SELECT/UPDATE| DBHelper
    BusinessLogic -->|Typed DataSet| DataSet
    DBHelper -->|queries| Database
    DataSet -->|schema mapping| Database

    SellingForm -->|PrintDocument| Reporting
    Reporting -->|to| Printer

    ApplicationStart["Startup"]:::config
    ApplicationStart -->|reads settings| AppConfig
    ApplicationStart -->|launches| Program

    Program -->|initializes UI| Form1

    %% Click Events
    click Form1 "https://github.com/noor-rehman/inventory-management-system---windows-application-with-integrated-database/blob/main/Form1.cs"
    click Attendants "https://github.com/noor-rehman/inventory-management-system---windows-application-with-integrated-database/blob/main/Attendants.cs"
    click Category "https://github.com/noor-rehman/inventory-management-system---windows-application-with-integrated-database/blob/main/Category.cs"
    click Expense "https://github.com/noor-rehman/inventory-management-system---windows-application-with-integrated-database/blob/main/Expense.cs"
    click Expenses "https://github.com/noor-rehman/inventory-management-system---windows-application-with-integrated-database/blob/main/Expenses.cs"
    click SellingForm "https://github.com/noor-rehman/inventory-management-system---windows-application-with-integrated-database/blob/main/SellingForm.cs"
    click Refunds "https://github.com/noor-rehman/inventory-management-system---windows-application-with-integrated-database/blob/main/Refunds.cs"
    click History "https://github.com/noor-rehman/inventory-management-system---windows-application-with-integrated-database/blob/main/History.cs"
    click ResetPasswordForm "https://github.com/noor-rehman/inventory-management-system---windows-application-with-integrated-database/blob/main/ResetPasswordForm.cs"
    click Loading "https://github.com/noor-rehman/inventory-management-system---windows-application-with-integrated-database/blob/main/Loading.cs"
    click Splash "https://github.com/noor-rehman/inventory-management-system---windows-application-with-integrated-database/blob/main/Splash.cs"
    click FormsHelper "https://github.com/noor-rehman/inventory-management-system---windows-application-with-integrated-database/blob/main/Forms.cs"
    click DBHelper "https://github.com/noor-rehman/inventory-management-system---windows-application-with-integrated-database/blob/main/db.cs"
    click DataSet "https://github.com/noor-rehman/inventory-management-system---windows-application-with-integrated-database/blob/main/star_platinumDataSet.Designer.cs"
    click AppConfig "https://github.com/noor-rehman/inventory-management-system---windows-application-with-integrated-database/blob/main/App.config"
    click Program "https://github.com/noor-rehman/inventory-management-system---windows-application-with-integrated-database/blob/main/Program.cs"
    click Solution "https://github.com/noor-rehman/inventory-management-system---windows-application-with-integrated-database/blob/main/Shop.sln"
    click Project "https://github.com/noor-rehman/inventory-management-system---windows-application-with-integrated-database/blob/main/Shop.csproj"

    %% Styles
    classDef ui fill:#bbdefb,stroke:#0d47a1,color:#0d47a1
    classDef bll fill:#c8e6c9,stroke:#1b5e20,color:#1b5e20
    classDef dal fill:#ffe0b2,stroke:#e65100,color:#e65100
    classDef db fill:#d1c4e9,stroke:#4a148c,color:#4a148c
    classDef report fill:#fff9c4,stroke:#f57f17,color:#f57f17
    classDef config fill:#eceff1,stroke:#37474f,color:#37474f
    classDef external fill:#cfd8dc,stroke:#455a64,color:#455a64
```
