# saimahmt03/buyingtool-v2 architecture

> Architecture diagram of the GitHub repository saimahmt03/buyingtool-v2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/saimahmt03/buyingtool-v2
- Repository: https://github.com/saimahmt03/buyingtool-v2

## Overview

BuyingTool is an ASP.NET buying and allocation application. Its visible API workflow accepts a user identifier, routes filter requests through controllers and Service, caches filter results, then queries stored procedures through DBContext and a provider-backed database connection. The UI tree and stored-procedure catalog indicate broader workflows for planning, option selection, calculation, distribution review, site breakdown, size curves, export and allocation monitoring. Those UI-to-service links are not established by the sampled excerpts, so they are shown as unverified rather than asserted calls.

Main entry points: [`BuyingTool/Pages/Component/Main.cshtml`](https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Pages/Component/Main.cshtml) (Buying screens), [`BuyingTool/Repository/DBContext.cs`](https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Repository/DBContext.cs) (Buying data operations), [`BuyingTool/Services/Service.cs`](https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Services/Service.cs) (Workflow service), [`BuyingTool/Data/DatabaseConnection.cs`](https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Data/DatabaseConnection.cs) (Database connection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_ui["Buying screens<br/>[Main.cshtml]"]
  node_ui_scripts["Browser interactions<br/>[Index.js]"]
  node_filter_dialog["Filter selection"]
  node_review["Distribution review"]
  node_site_detail["Site details"]
  node_size_curve["Size curve<br/>[SizeCurve.cshtml]"]
  node_export_ui["Export and monitoring<br/>[Export.cshtml]"]
end

subgraph group_api["API and services"]
  node_filter_api["Filter endpoints"]
  node_service["Workflow service<br/>[Service.cs]"]
  node_formatting["Table and export helpers<br/>[ServiceHelper.cs]"]
end

subgraph group_data["Data access"]
  node_dbcontext["Buying data operations<br/>[DBContext.cs]"]
  node_db_interface["Data operation contract<br/>[IDBContext.cs]"]
  node_connection["Database connection"]
  node_provider["Provider selection"]
  node_parameters["DB parameters"]
end

subgraph group_ops["Supporting capabilities"]
  node_procedure_catalog["Stored procedure catalog"]
  node_logging["Database activity logging<br/>[Log.cs]"]
  node_errors["Error handling<br/>[ErrorMessage.cs]"]
end

node_user(("Buying user"))
node_database[("Configured database")]

node_user -.->|"uses"| node_ui
node_ui -.->|"loads interactions"| node_ui_scripts
node_ui -.->|"opens filters"| node_filter_dialog
node_ui -.->|"reviews results"| node_review
node_ui -.->|"views sites"| node_site_detail
node_ui -.->|"views curve"| node_size_curve
node_ui -.->|"exports data"| node_export_ui
node_filter_api -->|"calls"| node_service
node_service -->|"queries"| node_dbcontext
node_service -->|"formats tables"| node_formatting
node_dbcontext -->|"implements"| node_db_interface
node_dbcontext -->|"opens connections"| node_connection
node_connection -->|"selects factory"| node_provider
node_dbcontext -->|"creates parameters"| node_parameters
node_dbcontext -->|"executes procedures"| node_procedure_catalog
node_connection -->|"connects to"| node_database
node_dbcontext -->|"records activity"| node_logging
node_dbcontext -->|"uses messages"| node_errors
node_service -->|"caches filters"| node_database

click node_ui "https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Pages/Component/Main.cshtml"
click node_ui_scripts "https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Pages/Scripts/Index.js"
click node_filter_dialog "https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Pages/Component/SetFiltersWindow.cshtml"
click node_review "https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Pages/Component/ReviewSummary.cshtml"
click node_site_detail "https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Pages/Component/ReviewSiteDetails.cshtml"
click node_size_curve "https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Pages/Component/SizeCurve.cshtml"
click node_export_ui "https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Pages/Component/Export.cshtml"
click node_filter_api "https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Controllers/OrganizationFiltersController.cs"
click node_service "https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Services/Service.cs"
click node_formatting "https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Services/ServiceHelper.cs"
click node_dbcontext "https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Repository/DBContext.cs"
click node_db_interface "https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Repository/IDBContext.cs"
click node_connection "https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Data/DatabaseConnection.cs"
click node_provider "https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Data/DatabaseProviderFactory.cs"
click node_parameters "https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Data/DatabaseParameterHelper.cs"
click node_procedure_catalog "https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Shared/StoredProcedures.cs"
click node_logging "https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Shared/Log.cs"
click node_errors "https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Logs/ErrorMessage.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ui,node_ui_scripts,node_filter_dialog,node_review,node_site_detail,node_size_curve,node_export_ui,node_user toneBlue
class node_filter_api,node_service,node_formatting,node_database toneAmber
class node_dbcontext,node_db_interface,node_connection,node_provider,node_parameters toneMint
class node_procedure_catalog,node_logging,node_errors toneRose
```

## Components

### Web interface

- [Buying screens](https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Pages/Component/Main.cshtml): `BuyingTool/Pages/Component/Main.cshtml`
- [Browser interactions](https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Pages/Scripts/Index.js): `BuyingTool/Pages/Scripts/Index.js`
- [Filter selection](https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Pages/Component/SetFiltersWindow.cshtml): `BuyingTool/Pages/Component/SetFiltersWindow.cshtml`
- [Distribution review](https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Pages/Component/ReviewSummary.cshtml): `BuyingTool/Pages/Component/ReviewSummary.cshtml`
- [Site details](https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Pages/Component/ReviewSiteDetails.cshtml): `BuyingTool/Pages/Component/ReviewSiteDetails.cshtml`
- [Size curve](https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Pages/Component/SizeCurve.cshtml): `BuyingTool/Pages/Component/SizeCurve.cshtml`
- [Export and monitoring](https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Pages/Component/Export.cshtml): `BuyingTool/Pages/Component/Export.cshtml`

### API and services

- [Filter endpoints](https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Controllers/OrganizationFiltersController.cs): `BuyingTool/Controllers/OrganizationFiltersController.cs`
- [Workflow service](https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Services/Service.cs): `BuyingTool/Services/Service.cs`
- [Table and export helpers](https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Services/ServiceHelper.cs): `BuyingTool/Services/ServiceHelper.cs`

### Data access

- [Buying data operations](https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Repository/DBContext.cs): `BuyingTool/Repository/DBContext.cs`
- [Data operation contract](https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Repository/IDBContext.cs): `BuyingTool/Repository/IDBContext.cs`
- [Database connection](https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Data/DatabaseConnection.cs): `BuyingTool/Data/DatabaseConnection.cs`
- [Provider selection](https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Data/DatabaseProviderFactory.cs): `BuyingTool/Data/DatabaseProviderFactory.cs`
- [DB parameters](https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Data/DatabaseParameterHelper.cs): `BuyingTool/Data/DatabaseParameterHelper.cs`

### Supporting capabilities

- [Stored procedure catalog](https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Shared/StoredProcedures.cs): `BuyingTool/Shared/StoredProcedures.cs`
- [Database activity logging](https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Shared/Log.cs): `BuyingTool/Shared/Log.cs`
- [Error handling](https://github.com/saimahmt03/buyingtool-v2/blob/main/BuyingTool/Logs/ErrorMessage.cs): `BuyingTool/Logs/ErrorMessage.cs`

### Other components

- **Buying user**
- **Configured database**

## Connections

- Buying user → Buying screens: uses
- Buying screens → Browser interactions: loads interactions
- Buying screens → Filter selection: opens filters
- Buying screens → Distribution review: reviews results
- Buying screens → Site details: views sites
- Buying screens → Size curve: views curve
- Buying screens → Export and monitoring: exports data
- Filter endpoints → Workflow service: calls (evidence: `BuyingTool/Controllers/OrganizationFiltersController.cs`)
- Workflow service → Buying data operations: queries (evidence: `BuyingTool/Services/Service.cs`)
- Workflow service → Table and export helpers: formats tables (evidence: `BuyingTool/Services/Service.cs`)
- Buying data operations → Data operation contract: implements (evidence: `BuyingTool/Repository/DBContext.cs`)
- Buying data operations → Database connection: opens connections (evidence: `BuyingTool/Repository/DBContext.cs`)
- Database connection → Provider selection: selects factory (evidence: `BuyingTool/Data/DatabaseConnection.cs`)
- Buying data operations → DB parameters: creates parameters (evidence: `BuyingTool/Repository/DBContext.cs`)
- Buying data operations → Stored procedure catalog: executes procedures (evidence: `BuyingTool/Repository/DBContext.cs`)
- Database connection → Configured database: connects to (evidence: `BuyingTool/Data/DatabaseConnection.cs`)
- Buying data operations → Database activity logging: records activity (evidence: `BuyingTool/Repository/DBContext.cs`)
- Buying data operations → Error handling: uses messages (evidence: `BuyingTool/Repository/DBContext.cs`)
- Workflow service → Configured database: caches filters (evidence: `BuyingTool/Services/Service.cs`)
