# tahir979/e-voting-system architecture

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

- Interactive diagram: https://gitdiagram.com/tahir979/e-voting-system
- Repository: https://github.com/tahir979/e-voting-system

## Overview

##### Project type and purpose
- This is a Windows‐desktop, single‐exe, full‐stack election management application built on .NET Framework 4.7.2 using WinForms and MetroModernUI for the UI.
- It integrates with Microsoft Access (.accdb) for persistence, uses Microsoft.Office.Interop.Excel to import voter lists and votes, and a built‐in SMTP email sender to dispatch verification codes to `@hacettepe.edu.tr` addresses.

##### File structure
- Top‐level artifacts:
- e-voting.sln / e-voting.csproj – Solution and project files
- Program.cs – Application entry point
- *.Designer.cs & *.cs – WinForms UI classes (main form, loading screens, changing address, etc.)
- bin/Debug/*.accdb – Access databases (kod.accdb, tile3.accdb, veri.accdb)
- packages/ – Third‐party libraries (MetroModernUI, Excel interop)
- Resources & Properties – Localization and settings
- No separate service or data projects; everything lives inside one WinForms assembly following a layered (but in‐process) architecture.

##### Key insights from README
- Workflow:
1. Load Excel with voter emails → validate addresses → persist unique emails + generated codes in Access DB
2. Send codes via SMTP to validated addresses
3. Load Google Form results (Excel) → map codes to votes → persist unique votes
4. Tally votes by incrementing counters in DB
- Secure constraints: only one code per email, one vote per code; supports single/multi‐selection ballots.

- Services in another (e.g., green)
- Data stores in a third (e.g., orange)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Inputs
    VoterExcel["Voter List Excel"]:::external
    VotesExcel["Votes Excel"]:::external
    SMTP["SMTP Server"]:::external

    %% Monolithic EXE
    subgraph "Monolithic EXE"
        ProgramEntry["Program (Entry Point)"]:::service
        subgraph "Presentation Layer"
            MainForm["MainForm"]:::ui
            LoadingForm["LoadingForm"]:::ui
            LoadingScreen["LoadingScreen"]:::ui
            ChangingAddress["ChangingAddressForm"]:::ui
            ProgramInfo["ProgramInfoForm"]:::ui
            NotesForm["NotesForm"]:::ui
        end
        subgraph "Business Logic Layer"
            BL["Business Logic"]:::service
        end
        subgraph "Excel Import Service"
            ExcelInterop["Excel Import Service"]:::service
        end
        subgraph "Email Service"
            EmailService["Email Service"]:::service
        end
        subgraph "Data Access Layer"
            DAL["Data Access"]:::service
            subgraph "Access Databases"
                KodDB["kod.accdb"]:::datastore
                VeriDB["veri.accdb"]:::datastore
                TileDB["tile3.accdb"]:::datastore
            end
        end
    end

    %% Data Flows - Voter List
    VoterExcel -->|"Load Voter List"| MainForm
    MainForm -->|"Load Voter List"| BL
    BL -->|"Parse emails"| ExcelInterop
    ExcelInterop -->|"Clean & dedupe emails"| BL
    BL -->|"Save emails + codes"| DAL
    DAL -->|"Store"| KodDB
    DAL -->|"Store"| VeriDB
    DAL -->|"Store"| TileDB
    BL -->|"Send verification codes"| EmailService
    EmailService -->|"SMTP send"| SMTP

    %% Data Flows - Votes
    VotesExcel -->|"Load Votes"| MainForm
    MainForm -->|"Load Votes"| BL
    BL -->|"Parse codes & selections"| ExcelInterop
    BL -->|"Store votes"| DAL
    BL -->|"Tally results"| DAL
    DAL -->|"Read tally"| BL
    BL -->|"Display results"| MainForm

    %% Initialization Flow
    ProgramEntry --> MainForm

    %% Click Events
    click ProgramEntry "https://github.com/tahir979/e-voting-system/blob/main/e-voting/Program.cs"
    click MainForm "https://github.com/tahir979/e-voting-system/blob/main/e-voting/main.cs"
    click LoadingForm "https://github.com/tahir979/e-voting-system/blob/main/e-voting/loading.cs"
    click LoadingScreen "https://github.com/tahir979/e-voting-system/blob/main/e-voting/loadingscreen.cs"
    click ChangingAddress "https://github.com/tahir979/e-voting-system/blob/main/e-voting/changingaddress.cs"
    click ProgramInfo "https://github.com/tahir979/e-voting-system/blob/main/e-voting/programinfo.cs"
    click NotesForm "https://github.com/tahir979/e-voting-system/blob/main/e-voting/notes.cs"
    click KodDB "https://github.com/tahir979/e-voting-system/blob/main/e-voting/bin/Debug/kod.accdb"
    click VeriDB "https://github.com/tahir979/e-voting-system/blob/main/e-voting/bin/Debug/veri.accdb"
    click TileDB "https://github.com/tahir979/e-voting-system/blob/main/e-voting/bin/Debug/tile3.accdb"
    click ExcelInterop "https://github.com/tahir979/e-voting-system/tree/main/e-voting/packages/Microsoft.Office.Interop.Excel.15.0.4795.1001/"
    click VoterExcel "https://github.com/tahir979/e-voting-system/blob/main/e-voting/sample files folder/Sample Sending Code.xlsx"
    click VotesExcel "https://github.com/tahir979/e-voting-system/blob/main/e-voting/sample files folder/Sample Votes (mono selection).xlsx"

    %% Styles
    classDef ui fill:#AED6F1,stroke:#21618C,stroke-width:1px
    classDef service fill:#A9DFBF,stroke:#196F3D,stroke-width:1px
    classDef datastore fill:#F5B041,stroke:#B9770E,stroke-width:1px
    classDef external fill:#D5DBDB,stroke:#7F8C8D,stroke-width:1px
```
