# softcodenet/studentmanagementsystem architecture

> Architecture diagram of the GitHub repository softcodenet/studentmanagementsystem, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/softcodenet/studentmanagementsystem
- Repository: https://github.com/softcodenet/studentmanagementsystem

## Overview

##### Project type and purpose
- This is a monolithic console application written in C#/.NET that connects directly to a SQL Server database.
- It implements basic CRUD operations, course assignment, GPA calculation, and lookup features.

##### File structure
- Top level
– StudentManagementSystem.sln (solution file)
– StudentManagementSystem (C# project)
– Database/Database.sql (DB schema script)
- No separate “frontend” or “backend” folders—everything lives in one executable.

##### README for insights
- Technology stack: .NET 7, C#, Microsoft.Data.SqlClient, SQL Server Express
- Key flows: user input → SQL commands → data retrieval or mutation → console output
- Connection string is configured in Program.cs.

##### Main components
a. Console UI Layer
– Displays menus, reads user input, shows results/errors.
b. Application / Business Logic Layer
– Methods in Program.cs that interpret user actions (CreateStudent, UpdateStudent, CalculateGPA, etc.).
c. Data Access Layer
– Uses Microsoft.Data.SqlClient to send SQL queries/commands.
d. Database
– SQL Server Express instance hosting the StudentManagementSystem database (tables: Students, Courses, Departments, Enrollments, Marks).
e. Optional: Database Initialization
– Database.sql script used to create schema.

##### Relationships and interactions
- User types command in Console → Console UI calls Business Logic → Business Logic calls Data Access → Data Access issues SQL to Database → Database returns result → propagate back up to Console UI → display to user.
- Single-directional flow (UI → Logic → Data → DB) and the return path for data/results.

##### Architectural patterns and principles
- Layered architecture (UI, Service/Logic, Data) within a single process.
- Separation of concerns:
– Keep SQL code in Data Access methods, not mixed with UI code.
– Business logic methods orchestrate use-case steps.
- Basic error handling: catch DB exceptions, return success/failure messages.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Solution Container
    SLN["Solution: StudentManagementSystem.sln"]:::solution
    click SLN "https://github.com/softcodenet/studentmanagementsystem/blob/main/StudentManagementSystem.sln"

    %% Monolithic Application
    subgraph "Monolithic Application"
        direction TB
        UI["Console UI Layer"]:::ui
        BL["Business Logic Layer"]:::logic
        DA["Data Access Layer"]:::data
        CSPROJ["Project Config / Entry Point"]:::project

        click UI "https://github.com/softcodenet/studentmanagementsystem/blob/main/StudentManagementSystem/Program.cs"
        click BL "https://github.com/softcodenet/studentmanagementsystem/blob/main/StudentManagementSystem/Program.cs"
        click DA "https://github.com/softcodenet/studentmanagementsystem/blob/main/StudentManagementSystem/Program.cs"
        click CSPROJ "https://github.com/softcodenet/studentmanagementsystem/blob/main/StudentManagementSystem/StudentManagementSystem.csproj"
    end

    %% Database and scripts
    DBSCRIPT["Database Init Script\n(Database/Database.sql)"]:::script
    click DBSCRIPT "https://github.com/softcodenet/studentmanagementsystem/blob/main/Database/Database.sql"

    DB["SQL Server Express\n(StudentManagementSystem DB)"]:::db

    %% Relationships
    SLN -->|"contains"| CSPROJ
    CSPROJ -->|"builds into"| UI
    UI -->|"calls"| BL
    BL -->|"invokes"| DA
    DA -->|"Executes SQL"| DB
    DB -->|"Returns Data/Status"| DA
    DA -->|"Returns Result"| BL
    BL -->|"Returns Outcome"| UI

    %% Script relation
    DBSCRIPT -.->|"used to init"| DB

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#0366D6,color:#0366D6;
    classDef logic fill:#E2F0D9,stroke:#2E7D32,color:#2E7D32;
    classDef data fill:#FFE7C2,stroke:#EF6C00,color:#E65100;
    classDef db fill:#E0E0E0,stroke:#424242,color:#424242;
    classDef script fill:#F3E5F5,stroke:#8E24AA,color:#6A1B9A;
    classDef project fill:#FFF3E0,stroke:#FB8C00,color:#E65100;
    classDef solution fill:#F1F8E9,stroke:#558B2F,color:#33691E;
```
