# saineshwar/webtimesheetmanagement architecture

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

- Interactive diagram: https://gitdiagram.com/saineshwar/webtimesheetmanagement
- Repository: https://github.com/saineshwar/webtimesheetmanagement

## Overview

##### Main Components
- Presentation Layer – Represented primarily by the “WebTimeSheetManagement” project that holds controllers (e.g., AdminController, ExpenseController, LoginController, etc.), Views, Scripts, and Content. This layer handles user interactions, routing, and view rendering.
- Business / Service Layer – Although not explicitly defined as a separate project, the “WebTimeSheetManagement.Concrete” project includes concrete implementations of business logic and repository methods (e.g., DatabaseContext.cs, TimeSheetConcrete.cs, ProjectConcrete.cs). It orchestrates data validation, role assignments, notifications, and other business processes.
- Interface / Abstraction Layer – The “WebTimeSheetManagement.Interface” project provides the contract definitions (like IAssignRoles, IAudit, ILogin) that decouple the business logic from the UI and facilitate dependency injection.
- Data Model Definitions – The “WebTimeSheetManagement.Models” project contains the entity definitions or data transfer objects (DTOs) that represent the domain (such as TimeSheetMaster, AuditTB, etc.).
- Data Access / Repository Pattern – Using the repository pattern in conjunction with ORMs (Entity Framework and Dapper), the system interacts with a SQL Server 2008 R2 database (as evidenced by the included TimesheetDB.sql file and TimesheetDB.rar). This should be clearly depicted as the backend database component.
- External Services and Libraries – External packages like ELMAH for logging, CaptchaMvc for security, ClosedXML for Excel export, Toastr for notifications, DateTimePicker, and Datatables (for UI tables) are also part of the architecture. Additionally, the Encryption Library (using AES 256) and SignalR Hub (MyNotificationHub.cs) for real-time notifications should be represented as supporting components.

##### Relationships and Data Flow
- The business logic then uses the repository pattern to interact with the SQL Server database.
- The data model project acts as the data contract that is used across these layers.
- Integration with external JavaScript libraries (Toastr, DateTimePicker, Datatables) that enhance the UI and user experience.

##### Architectural Patterns Noted
- MVC (Model View Controller) – The project clearly splits concerns between controllers, views, and models.
- Layered Architecture – With separate projects for concrete implementations, interfaces, and models.
- Repository and ORM Pattern – Enabled by the use of Dapper and Entity Framework within the data access/repository layer.
- Real-Time Notification – Usage of SignalR (via hubs) points to a hybrid push-notification pattern.

- Finally, include annotations for external dependencies (NuGet packages, external libraries) that are critical for understanding the project’s infrastructure.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        P["WebTimeSheetManagement"]:::presentation
    end

    %% Interface Layer
    subgraph "Interface Layer"
        I["WebTimeSheetManagement.Interface"]:::interface
    end

    %% Data Model Layer
    subgraph "Data Model Layer"
        M["WebTimeSheetManagement.Models"]:::model
        TM["TimeSheetMaster.cs"]:::model
        AT["AuditTB.cs"]:::model
        M --> TM
        M --> AT
    end

    %% Business/Service Layer
    subgraph "Business/Service Layer"
        B["WebTimeSheetManagement.Concrete"]:::business
        DC["DatabaseContext.cs"]:::business
        TS["TimeSheetConcrete.cs"]:::business
        PC["ProjectConcrete.cs"]:::business
        B --> DC
        B --> TS
        B --> PC
    end

    %% Backend SQL Server Database
    subgraph "SQL Server Database"
        SQL1["TimesheetDB.sql"]:::database
        SQL2["TimesheetDB.rar"]:::database
    end

    %% External Services
    subgraph "External Services"
        S["MyNotificationHub.cs"]:::external
        E["Encryption Library"]:::external
        subgraph "UI Libraries"
            UIContent["UI Assets"]:::external
            UIScripts["UI Scripts"]:::external
        end
    end

    %% Relationships / Data Flow
    P -->|"calls"| I
    I -->|"triggers"| B
    B -->|"uses"| M
    B -->|"accesses"| SQL1
    B -->|"accesses"| SQL2
    B -->|"notifies"| S
    B -->|"secures"| E
    P -->|"loads"| UIContent
    P -->|"loads"| UIScripts

    %% Click Events
    click P "https://github.com/saineshwar/webtimesheetmanagement/tree/master/WebTimeSheetManagement"
    click I "https://github.com/saineshwar/webtimesheetmanagement/blob/master/WebTimeSheetManagement.Interface"
    click B "https://github.com/saineshwar/webtimesheetmanagement/blob/master/WebTimeSheetManagement.Concrete"
    click DC "https://github.com/saineshwar/webtimesheetmanagement/blob/master/WebTimeSheetManagement.Concrete/DatabaseContext.cs"
    click TS "https://github.com/saineshwar/webtimesheetmanagement/blob/master/WebTimeSheetManagement.Concrete/TimeSheetConcrete.cs"
    click PC "https://github.com/saineshwar/webtimesheetmanagement/blob/master/WebTimeSheetManagement.Concrete/ProjectConcrete.cs"
    click M "https://github.com/saineshwar/webtimesheetmanagement/blob/master/WebTimeSheetManagement.Models"
    click TM "https://github.com/saineshwar/webtimesheetmanagement/blob/master/WebTimeSheetManagement.Models/TimeSheetMaster.cs"
    click AT "https://github.com/saineshwar/webtimesheetmanagement/blob/master/WebTimeSheetManagement.Models/AuditTB.cs"
    click SQL1 "https://github.com/saineshwar/webtimesheetmanagement/blob/master/TimesheetDB.sql"
    click SQL2 "https://github.com/saineshwar/webtimesheetmanagement/blob/master/TimesheetDB.rar"
    click S "https://github.com/saineshwar/webtimesheetmanagement/blob/master/WebTimeSheetManagement/Hubs/MyNotificationHub.cs"
    click E "https://github.com/saineshwar/webtimesheetmanagement/blob/master/WebTimeSheetManagement/Library/EncryptionLibrary.cs"
    click UIContent "https://github.com/saineshwar/webtimesheetmanagement/tree/master/WebTimeSheetManagement/Content"
    click UIScripts "https://github.com/saineshwar/webtimesheetmanagement/tree/master/WebTimeSheetManagement/Scripts"

    %% Styles
    classDef presentation fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef interface fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef model fill:#F5CBA7,stroke:#CA6F1E,stroke-width:2px;
    classDef business fill:#ABEBC6,stroke:#229954,stroke-width:2px;
    classDef database fill:#F7DC6F,stroke:#B9770E,stroke-width:2px;
    classDef external fill:#D7BDE2,stroke:#884EA0,stroke-width:2px;
```
