# solo-developer/cricketacademy architecture

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

- Interactive diagram: https://gitdiagram.com/solo-developer/cricketacademy
- Repository: https://github.com/solo-developer/cricketacademy

## Overview

##### Project Type and Purpose
- Project Type: A desktop WinForms application.
- Purpose: To record and manage various operations within a cricket academy, including billing, inventory, student records, match information, tournaments, and user management.
- Key Insights: The presence of forms (e.g., Login, MainForm, etc.), designer files, and the SQL script ("cric_academy.sql") indicate that data persistence (likely through a SQL database) is an integral aspect of the system while the user interface is built with WinForms.

##### File Structure
- Main Solution and Projects: At the top, CricketAcademy.sln indicates your project solution and the main project directory "CricketAcademy" holds all source code.
- Module Folders:
- Account: Contains forms and reporting for billing operations (with BillGeneration subfolder). It also integrates with data sources (see the .rdlc and datasets defined).
- Inventory: Contains forms managing stock and inventory operations.
- Student: Manages student records, applications, and reports.
- Tournament: Handles tournament operations such as team additions, match details, rankings, and performance reports.
- Match Info and User: For match-specific operations and user administration.
- Library and Utility: Include support files (like DataAccessLayer.cs, DateConverter, NumberToWords) which hint at business logic or helper functionalities.
- Enums and Settings: Define application-wide constants and configurable aspects like date insertion specific to Nepali dates.
- Configuration and Deployment Files:
- App.config holds system configuration, and cric_academy.sql likely defines the database schema.
- packages.config indicates dependency management for the project.

##### Key Components
a. Presentation Layer (UI/WinForms):
- Components: MainForm, Login, and various forms under modules (Account, Inventory, Student, Tournament, Match Info, User).
- Relationships such as navigation flow (Login to MainForm) and module-specific interfaces (forms for creating, editing, viewing data).
b. Business Logic Layer:
- Core Elements: Custom classes in forms, methods embedded within the module forms or helper libraries.
- Library and Utility folders represent common functionalities or business logic utilities.
c. Data Access Layer:
- Components like Library/DataAccessLayer.cs that facilitate interaction with the database.
- Integration with the SQL database (as defined by cric_academy.sql) showing CRUD operations and report generation.
d. Reporting Components:
- Forms and report files (.rdlc, dataset definitions under Account and Student folders) that indicate how reports (bill details, student applications, team performance, etc.) are generated.
e. Configuration & Supporting Services:
- App.config, Settings, and the SQL schema file act as configuration and setup modules.

##### Relationships and Interactions
- That the WinForms (Presentation Layer) interacts directly with modules like Account, Inventory, etc.
- External interaction where necessary (e.g., report generation feeding back into the UI).
- Data flow (e.g., user input in UI → processing in Business Logic → data update in Database → refreshed view in UI).

##### Architectural Patterns and Design Principles
- Despite being a WinForms application, the project is organized in a modular way. This partially reflects a layered architecture:
- Presentation (UI Forms)
- Business Logic (code-behind in forms, helper libraries)
- Data Access (DataAccessLayer and datasets)
- The project might also be following a form of separation of concerns by isolating specific functionalities into distinct directories (e.g., Inventory vs. Account vs. Tournament).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer (UI)"
        PL1["Login Form"]:::ui
        PL2["Main Application Form"]:::ui

        subgraph "Account Module"
            A1["Account Forms"]:::ui
            A2["Bill Details"]:::ui
            A3["Bills"]:::ui
            A4["Billing Report"]:::ui
        end

        subgraph "Inventory Module"
            I1["Stock Manipulation"]:::ui
            I2["Stock"]:::ui
            I3["View Operations"]:::ui
        end

        subgraph "Student Module"
            S1["NewStudent"]:::ui
            S2["EditStudent"]:::ui
            S3["Application Form"]:::ui
            S4["dsApplicationForm"]:::ui
        end

        subgraph "Tournament Module"
            T1["TournamentSetup"]:::ui
            T2["EditTournament"]:::ui
            T3["Add Team"]:::ui
            T4["MatchSummary"]:::ui
        end

        subgraph "Match Info Module"
            M1["Add Scores"]:::ui
            M2["Info"]:::ui
            M3["Player Profile Report"]:::ui
        end

        subgraph "User Administration"
            U1["AddUser"]:::ui
            U2["EditUser"]:::ui
            U3["View Users"]:::ui
        end
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        BL1["DataAccessLayer"]:::business
        BL2["Date Converter"]:::business
        BL3["Number To Words"]:::business
        BL4["Utility Date Converter"]:::business
    end

    %% Data Access & Persistence
    subgraph "Data Access & Persistence"
        DB["SQL Database (cric_academy.sql)"]:::db
    end

    %% Configuration & Deployment
    subgraph "Configuration & Deployment"
        C1["App.config"]:::config
        C2["Nepali Date Insertion"]:::config
        C3["packages.config"]:::config
        C4["Database Schema"]:::config
    end

    %% Connections within Presentation Layer
    PL1 -->|"success"| PL2
    PL2 -->|"navigates to"| A1
    PL2 -->|"navigates to"| I1
    PL2 -->|"navigates to"| S1
    PL2 -->|"navigates to"| T1
    PL2 -->|"navigates to"| M1
    PL2 -->|"navigates to"| U1

    %% UI Modules calling Business Logic
    A1 -->|"calls"| BL1
    I1 -->|"calls"| BL1
    S1 -->|"calls"| BL1
    T1 -->|"calls"| BL1
    M1 -->|"calls"| BL1
    U1 -->|"calls"| BL1

    %% Business Logic supporting functions
    BL2 ---|"supports"| BL1
    BL3 ---|"supports"| BL1
    BL4 ---|"supports"| BL1

    %% Business Logic interacting with Data Access
    BL1 -->|"CRUD operations"| DB

    %% Configuration influencing Business Logic
    C1 -->|"configures"| BL1
    C2 -->|"configures"| BL1
    C3 -->|"manages dependencies"| BL1
    C4 -->|"defines schema"| BL1

    %% Additional intra-module connections for detailed reporting (Account)
    A2 -->|"processes"| BL1
    A3 -->|"processes"| BL1
    A4 -->|"generates report"| BL1

    %% Inventory module additional forms
    I2 -->|"updates"| BL1
    I3 -->|"displays"| BL1

    %% Student module additional forms
    S2 -->|"updates"| BL1
    S3 -->|"captures"| BL1
    S4 -->|"defines dataset"| BL1

    %% Tournament module additional forms
    T2 -->|"updates"| BL1
    T3 -->|"adds teams"| BL1
    T4 -->|"summarizes"| BL1

    %% Match Info module additional forms
    M2 -->|"updates"| BL1
    M3 -->|"generates report"| BL1

    %% User Administration additional forms
    U2 -->|"updates"| BL1
    U3 -->|"views data"| BL1

    %% Click Events for Presentation Layer
    click PL1 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/Login.cs"
    click PL2 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/MainForm.cs"

    %% Click Events for Account Module
    click A1 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/Account/Account.cs"
    click A2 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/Account/BillGeneration/BillDetails.cs"
    click A3 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/Account/BillGeneration/Bills.cs"
    click A4 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/Account/BillGeneration/Bills.rdlc"

    %% Click Events for Inventory Module
    click I1 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/Inventory/Stock Manipulation.cs"
    click I2 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/Inventory/Stock.cs"
    click I3 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/Inventory/View Operations.cs"

    %% Click Events for Student Module
    click S1 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/Student/NewStudent.cs"
    click S2 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/Student/EditStudent.cs"
    click S3 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/Student/application form.cs"
    click S4 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/Student/dsApplicationForm.Designer.cs"

    %% Click Events for Tournament Module
    click T1 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/Tournament/TournamentSetup.cs"
    click T2 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/Tournament/EditTournament.cs"
    click T3 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/Tournament/Add Team.cs"
    click T4 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/Tournament/MatchSummary.cs"

    %% Click Events for Match Info Module
    click M1 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/Match Info/Add Scores.cs"
    click M2 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/Match Info/Info.cs"
    click M3 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/Match Info/Print/PlayerProfile.cs"

    %% Click Events for User Administration
    click U1 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/User/AddUser.cs"
    click U2 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/User/EditUser.cs"
    click U3 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/User/View Users.cs"

    %% Click Events for Business Logic / Helper Libraries
    click BL1 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/Library/DataAccessLayer.cs"
    click BL2 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/Library/DateConverter.cs"
    click BL3 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/Library/NumberToWords.cs"
    click BL4 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/Utility/DateConverter.cs"

    %% Click Events for Configuration & Deployment
    click C1 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/App.config"
    click C2 "https://github.com/solo-developer/cricketacademy/blob/main/CricketAcademy/Settings/Nepali Date Insertion.cs"
    click C3 "https://github.com/solo-developer/cricketacademy/blob/main/packages.config"
    click C4 "https://github.com/solo-developer/cricketacademy/blob/main/cric_academy.sql"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef business fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef db fill:#FFDAB9,stroke:#000,stroke-width:2px;
    classDef config fill:#D3D3D3,stroke:#000,stroke-width:2px;
```
