# lujainkhaled10/pharmacy-management_1 architecture

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

- Interactive diagram: https://gitdiagram.com/lujainkhaled10/pharmacy-management_1
- Repository: https://github.com/lujainkhaled10/pharmacy-management_1

## Overview

This is a Windows Forms pharmacy-management application. A user signs in through the login form; successful authentication opens the dashboard, where staff manage users, suppliers, and medicines, and use a point-of-sale flow to build carts and invoices. The managers implement CRUD, filtering, expiry handling, and password hashing over a shared in-memory store. The dashboard and login form are the visible UI layer; the model layer represents users, medicines, companies, and invoices. The excerpts show these main links, but not every dashboard event handler.

Main entry points: [`Models/DataStore.cs`](https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Models/DataStore.cs) (In-memory store), [`Form2.cs`](https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Form2.cs) (Management dashboard), [`Form1.cs`](https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Form1.cs) (Login form), [`Models/Medicines.cs`](https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Models/Medicines.cs) (Medicine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Windows Forms UI"]
  node_startup["Application startup<br/>[Program.cs]"]
  node_login["Login form<br/>[Form1.cs]"]
  node_dashboard["Management dashboard<br/>[Form2.cs]"]
end

subgraph group_operations["Pharmacy Operations"]
  node_users_mgr["User management<br/>[UsersManager.cs]"]
  node_companies_mgr["Company management<br/>[CompanyManager.cs]"]
  node_medicines_mgr["Medicine management"]
end

subgraph group_state["Shared State"]
  node_store[("In-memory store<br/>[DataStore.cs]")]
end

subgraph group_domain["Domain Models"]
  node_entity["Base entity<br/>[Entity.cs]"]
  node_user_model["User account<br/>[Users.cs]"]
  node_company_model["Company<br/>[Company.cs]"]
  node_medicine_model["Medicine<br/>[Medicines.cs]"]
  node_invoice_model["Invoice<br/>[Invoice.cs]"]
  node_item_model["Invoice item<br/>[InvoiceItem.cs]"]
end

node_operator(("Pharmacy user"))

node_operator -->|"enters credentials"| node_login
node_startup -->|"starts"| node_login
node_login -->|"authenticates"| node_users_mgr
node_login -->|"checks users"| node_store
node_login -->|"opens on success"| node_dashboard
node_dashboard -->|"manages accounts"| node_users_mgr
node_dashboard -->|"manages companies"| node_companies_mgr
node_dashboard -->|"manages medicines"| node_medicines_mgr
node_dashboard -->|"updates cart and invoices"| node_store
node_dashboard -->|"creates and displays"| node_invoice_model
node_dashboard -->|"adds cart items"| node_item_model
node_users_mgr -->|"reads and updates"| node_store
node_users_mgr -->|"creates and edits"| node_user_model
node_companies_mgr -->|"reads and updates"| node_store
node_companies_mgr -->|"creates and edits"| node_company_model
node_medicines_mgr -->|"reads and updates"| node_store
node_medicines_mgr -->|"filters and edits"| node_medicine_model
node_medicines_mgr -->|"filters by company"| node_company_model
node_store -->|"holds"| node_company_model
node_store -->|"holds"| node_invoice_model
node_store -->|"holds cart items"| node_item_model
node_store -->|"holds active and expired"| node_medicine_model
node_store -->|"holds accounts"| node_user_model
node_company_model -->|"inherits"| node_entity
node_medicine_model -->|"inherits"| node_entity
node_user_model -->|"inherits"| node_entity
node_medicine_model -->|"references supplier"| node_company_model
node_invoice_model -->|"contains items"| node_item_model
node_item_model -->|"references medicine"| node_medicine_model

click node_startup "https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Program.cs"
click node_login "https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Form1.cs"
click node_dashboard "https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Form2.cs"
click node_users_mgr "https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Managers/UsersManager.cs"
click node_companies_mgr "https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Managers/CompanyManager.cs"
click node_medicines_mgr "https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Managers/MedicinesManager.cs"
click node_store "https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Models/DataStore.cs"
click node_entity "https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Models/Entity.cs"
click node_user_model "https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Models/Users.cs"
click node_company_model "https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Models/Company.cs"
click node_medicine_model "https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Models/Medicines.cs"
click node_invoice_model "https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Models/Invoice.cs"
click node_item_model "https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Models/InvoiceItem.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_startup,node_login,node_dashboard,node_operator toneBlue
class node_users_mgr,node_companies_mgr,node_medicines_mgr toneAmber
class node_store toneMint
class node_entity,node_user_model,node_company_model,node_medicine_model,node_invoice_model,node_item_model toneRose
```

## Components

### Windows Forms UI

- [Application startup](https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Program.cs): `Program.cs`
- [Login form](https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Form1.cs): `Form1.cs`
- [Management dashboard](https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Form2.cs): `Form2.cs`

### Pharmacy Operations

- [User management](https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Managers/UsersManager.cs): `Managers/UsersManager.cs`
- [Company management](https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Managers/CompanyManager.cs): `Managers/CompanyManager.cs`
- [Medicine management](https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Managers/MedicinesManager.cs): `Managers/MedicinesManager.cs`

### Shared State

- [In-memory store](https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Models/DataStore.cs): `Models/DataStore.cs`

### Domain Models

- [Base entity](https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Models/Entity.cs): `Models/Entity.cs`
- [User account](https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Models/Users.cs): `Models/Users.cs`
- [Company](https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Models/Company.cs): `Models/Company.cs`
- [Medicine](https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Models/Medicines.cs): `Models/Medicines.cs`
- [Invoice](https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Models/Invoice.cs): `Models/Invoice.cs`
- [Invoice item](https://github.com/lujainkhaled10/pharmacy-management_1/blob/main/Models/InvoiceItem.cs): `Models/InvoiceItem.cs`

### Other components

- **Pharmacy user**

## Connections

- Pharmacy user → Login form: enters credentials (evidence: `Form1.cs`)
- Application startup → Login form: starts (evidence: `Program.cs`)
- Login form → User management: authenticates (evidence: `Form1.cs`)
- Login form → In-memory store: checks users (evidence: `Form1.cs`)
- Login form → Management dashboard: opens on success (evidence: `Form1.cs`)
- Management dashboard → User management: manages accounts (evidence: `Form2.cs`)
- Management dashboard → Company management: manages companies (evidence: `Form2.cs`)
- Management dashboard → Medicine management: manages medicines (evidence: `Form2.cs`)
- Management dashboard → In-memory store: updates cart and invoices (evidence: `Form2.cs`)
- Management dashboard → Invoice: creates and displays (evidence: `Form2.cs`)
- Management dashboard → Invoice item: adds cart items (evidence: `Form2.cs`)
- User management → In-memory store: reads and updates (evidence: `Managers/UsersManager.cs`)
- User management → User account: creates and edits (evidence: `Managers/UsersManager.cs`)
- Company management → In-memory store: reads and updates (evidence: `Managers/CompanyManager.cs`)
- Company management → Company: creates and edits (evidence: `Managers/CompanyManager.cs`)
- Medicine management → In-memory store: reads and updates (evidence: `Managers/MedicinesManager.cs`)
- Medicine management → Medicine: filters and edits (evidence: `Managers/MedicinesManager.cs`)
- Medicine management → Company: filters by company (evidence: `Managers/MedicinesManager.cs`)
- In-memory store → Company: holds (evidence: `Models/DataStore.cs`)
- In-memory store → Invoice: holds (evidence: `Models/DataStore.cs`)
- In-memory store → Invoice item: holds cart items (evidence: `Models/DataStore.cs`)
- In-memory store → Medicine: holds active and expired (evidence: `Models/DataStore.cs`)
- In-memory store → User account: holds accounts (evidence: `Models/DataStore.cs`)
- Company → Base entity: inherits (evidence: `Models/Company.cs`)
- Medicine → Base entity: inherits (evidence: `Models/Medicines.cs`)
- User account → Base entity: inherits (evidence: `Models/Users.cs`)
- Medicine → Company: references supplier (evidence: `Models/Medicines.cs`)
- Invoice → Invoice item: contains items (evidence: `Models/Invoice.cs`)
- Invoice item → Medicine: references medicine (evidence: `Models/InvoiceItem.cs`)
