Skip to content

Database — Core: Finance

Donor-funded projects, the master budget and its monthly detail, project budget lines, salary allocations, partner contributions and exchange rates.

Project and BudgetLine both carry global query filters on IsDeleted. Budget-line availability is calculated and displayed but not enforced at write time — see the Grant module.

23 entities in NKO_DB, context NKO_DBEntities1.

How to read this page

Generated from the EF Core model in NKO.Lib/NKO.DataAccess/DbModel/ — class names, property types, nullability, data annotations and the relationships configured in NKO_DBEntities1.OnModelCreating.

Each heading is the table name. Where the C# class is named differently — it is often singular where the table is plural (StockDetail the class, StockDetails the table) — the class name is stated under the heading. The file name is not authoritative: StockDetails.cs declares public class StockDetail.

A ✓ in Null means the column is nullable: a nullable value type, or a reference type with no [Required] — so a [Required] string is shown as not-null. Foreign keys are shown where the fluent configuration or the <Entity>Id naming convention identifies a target.

Entities

BudgetLine

DbSet BudgetLines · has a global query filter
NKO.Lib/NKO.DataAccess/DbModel/BudgetLine.cs

Global query filter

HasQueryFilter(x => !x.IsDeleted) — every query on BudgetLine is filtered unless it calls IgnoreQueryFilters().

erDiagram
    direction LR
    BudgetLine {
        int Id PK
        int PositionId FK
        int CategoryId FK
        int MasterBudgetDetailId FK
        int ProjectId FK
        int UnitId FK
    }
    AppUserPosition {
        int PositionId PK
    }
    BudgetLinesCategory {
        int CategoryId PK
    }
    MasterBudgetDetails {
        int MasterBudgetDetailsId PK
    }
    Project {
        int ProjectId PK
    }
    CommonUnit {
        int CommonUnitId PK
    }
    JobProjects {
        int JobProjectId PK
        int BudgetLineId FK
    }
    PurchaseOrderMat {
        int PurchaseOrderMatId PK
        int BudgetLine FK
    }
    Materials {
        int MaterialId PK
        int ProcBudgetLineId FK
    }
    BudgetLinePayment {
        int Id PK
        int BudgetLineId FK
    }
    BudgetLinesUser {
        int Id PK
        int BudgetLineId FK
    }
    BudgetLineBranch {
        int Id PK
        int BudgetLineId FK
    }
    AppUserAllocation {
        int Id PK
        int BudgetLineId FK
    }
    AppUserPosition |o--o{ BudgetLine : "PositionId"
    BudgetLinesCategory ||--o{ BudgetLine : "CategoryId"
    MasterBudgetDetails |o--o{ BudgetLine : "MasterBudgetDetailId"
    Project ||--o{ BudgetLine : "ProjectId"
    CommonUnit |o--o{ BudgetLine : "UnitId"
    BudgetLine ||--o{ JobProjects : "BudgetLineId"
    BudgetLine ||--o{ PurchaseOrderMat : "BudgetLine"
    BudgetLine ||--o{ Materials : "ProcBudgetLineId"
    BudgetLine ||--o{ BudgetLinePayment : "BudgetLineId"
    BudgetLine ||--o{ BudgetLinesUser : "BudgetLineId"
    BudgetLine ||--o{ BudgetLineBranch : "BudgetLineId"
    BudgetLine ||--o{ AppUserAllocation : "BudgetLineId"
Column Type Null Notes
Id int PK
Guid Guid [Required]
Title string ✓
Code string ✓
Qty decimal
Type int
UnitId int? ✓ FK → CommonUnit
InputType int? ✓
Duration double
Amount decimal
OtherDeductions decimal? ✓
PositionId int? ✓ FK → AppUserPosition
Description string ✓
LOE double
CreatedBy int
CreatedOn DateTime
StartDate DateTime [Column(TypeName = "date")]
EndDate DateTime [Column(TypeName = "date")]
IsDeleted bool
MonthCount double? ✓
USDTotalAmount decimal? ✓
ProjectId int FK → Project
CategoryId int FK → BudgetLinesCategory
MasterBudgetDetailId int? ✓ FK → MasterBudgetDetails

Navigation: AppUserPosition → AppUserPosition, BudgetLinesCategory → BudgetLinesCategory, MasterBudgetDetails → MasterBudgetDetails, Project → Project, CommonUnit → CommonUnit, Materials → ICollection<Materials>, PurchaseOrderMats → ICollection<PurchaseOrderMat>, AppUserAllocations → ICollection<AppUserAllocation>, BudgetLinesUsers → ICollection<BudgetLinesUser>, BudgetLineBranchs → ICollection<BudgetLineBranch>, BudgetLinePayments → ICollection<BudgetLinePayment>

BudgetLineBranch

[Table("BudgetLineBranch")] · DbSet BudgetLineBranchs
NKO.Lib/NKO.DataAccess/DbModel/BudgetLineBranch.cs

erDiagram
    BudgetLineBranch {
        int Id PK
        int CommonBranchId FK
        int BudgetLineId FK
    }
    CommonBranch {
        int BranchId PK
    }
    BudgetLine {
        int Id PK
    }
    CommonBranch ||--o{ BudgetLineBranch : "CommonBranchId"
    BudgetLine ||--o{ BudgetLineBranch : "BudgetLineId"
Column Type Null Notes
Id int PK
CommonBranchId int FK → CommonBranch
BudgetLineId int FK → BudgetLine

Navigation: CommonBranch → CommonBranch, BudgetLine → BudgetLine

BudgetLinePayment

[Table("BudgetLinePayments")] · DbSet BudgetLinePayments
NKO.Lib/NKO.DataAccess/DbModel/BudgetLinePayment.cs

erDiagram
    BudgetLinePayment {
        int Id PK
        int BudgetLineId FK
    }
    BudgetLine {
        int Id PK
    }
    BudgetLine ||--o{ BudgetLinePayment : "BudgetLineId"
Column Type Null Notes
Id int PK
BudgetLineId int FK → BudgetLine
StartDate DateTime
EndDate DateTime
Year int
Month int
Amount decimal

Navigation: BudgetLine → BudgetLine

BudgetLinesCategory

DbSet BudgetLinesCategories
NKO.Lib/NKO.DataAccess/DbModel/BudgetLinesCategory.cs

erDiagram
    BudgetLinesCategory {
        int CategoryId PK
    }
    BudgetLine {
        int Id PK
        int CategoryId FK
    }
    BudgetLinesCategory ||--o{ BudgetLine : "CategoryId"
Column Type Null Notes
CategoryId int PK
Description string [Required] · [StringLength(100)]

Navigation: ProcBudgetLines → ICollection<BudgetLine>

BudgetLinesUser

DbSet BudgetLinesUsers
NKO.Lib/NKO.DataAccess/DbModel/BudgetLinesUser.cs

erDiagram
    BudgetLinesUser {
        int Id PK
        int UserId FK
        int BudgetLineId FK
    }
    AppUser {
        int UserId PK
    }
    BudgetLine {
        int Id PK
    }
    AppUser ||--o{ BudgetLinesUser : "UserId"
    BudgetLine ||--o{ BudgetLinesUser : "BudgetLineId"
Column Type Null Notes
Id int PK
UserId int FK → AppUser
BudgetLineId int FK → BudgetLine

Navigation: AppUser → AppUser, BudgetLines → BudgetLine

CommitteeUser

[Table("CommitteeUser")]
NKO.Lib/NKO.DataAccess/DbModel/CommitteeUser.cs

erDiagram
    CommitteeUser {
        int CommitteeUserId PK
        int UserId FK
        int RFQId FK
    }
    AppUser {
        int UserId PK
    }
    RFQs {
        int RFQId PK
    }
    AppUser ||--o{ CommitteeUser : "UserId"
    RFQs ||--o{ CommitteeUser : "RFQId"
Column Type Null Notes
CommitteeUserId int PK
UserId int FK → AppUser
RFQId int FK → RFQs
IsManager bool
Type int
CreatedBy int
CreatedOn DateTime

Navigation: AppUser → AppUser, RFQ → RFQs

Donor

[Table("Donor")] · inherits BaseEntity
NKO.Lib/NKO.DataAccess/DbModel/Donor.cs

erDiagram
    direction LR
    Donor {
        int DonorId PK
    }
    DonorExchangeRate {
        int Id PK
        int DonorId FK
    }
    PartnersContribution {
        int PartnersContributionId PK
        int PartnerId FK
    }
    DonorPartners {
        int DonorPartnersId PK
        int DonorId FK
    }
    ProjectDonors {
        int ProjectDonorsId PK
        int DonorId FK
    }
    Donor ||--o{ DonorExchangeRate : "DonorId"
    Donor |o--o{ PartnersContribution : "PartnerId"
    Donor ||--o{ DonorPartners : "DonorId"
    Donor ||--o{ ProjectDonors : "DonorId"
Column Type Null Notes
DonorId int PK
DonorGuid Guid
DonorName string [Required]
Code string ✓ [StringLength(50)]
IsActive bool
CreatedBy int
CreatedOn DateTime

Navigation: DonorPartners → ICollection<DonorPartners>, PartnersContribution → ICollection<PartnersContribution>, ProjectDonors → ICollection<ProjectDonors>

DonorExchangeRate

DbSet DonorExchangeRates
NKO.Lib/NKO.DataAccess/DbModel/DonorExchangeRate.cs

erDiagram
    DonorExchangeRate {
        int Id PK
        int DonorId FK
    }
    Donor {
        int DonorId PK
    }
    Donor ||--o{ DonorExchangeRate : "DonorId"
Column Type Null Notes
Id int PK
DonorId int FK → Donor
Month int
Year int
ExchangeRateUsd decimal
ExchangeRateEuro decimal

Navigation: Donor → Donor

DonorPartners

inherits BaseEntity
NKO.Lib/NKO.DataAccess/DbModel/DonorPartners.cs

erDiagram
    DonorPartners {
        int DonorPartnersId PK
        int DonorId FK
        int MainDonorId FK
    }
    Donor {
        int DonorId PK
    }
    MainDonor {
        int MainDonorId PK
    }
    Donor ||--o{ DonorPartners : "DonorId"
    MainDonor ||--o{ DonorPartners : "MainDonorId"
Column Type Null Notes
DonorPartnersId int PK
DonorId int FK → Donor
MainDonorId int FK → MainDonor

Navigation: Donor → Donor, MainDonor → MainDonor

ExchangeRates

inherits BaseEntity
NKO.Lib/NKO.DataAccess/DbModel/ExchangeRates.cs

erDiagram
    ExchangeRates {
        int ExchangeRateId PK
    }
Column Type Null Notes
ExchangeRateId int PK
Year int
EURRate decimal? ✓
TRYRate decimal? ✓
SYPRate decimal? ✓
IsEnable bool
CreatedBy int
CreatedOn DateTime

MainDonor

[Table("MainDonor")] · inherits BaseEntity
NKO.Lib/NKO.DataAccess/DbModel/MainDonor.cs

erDiagram
    MainDonor {
        int MainDonorId PK
    }
    DonorPartners {
        int DonorPartnersId PK
        int MainDonorId FK
    }
    ProjectDonors {
        int ProjectDonorsId PK
        int MainDonorId FK
    }
    MainDonor ||--o{ DonorPartners : "MainDonorId"
    MainDonor |o--o{ ProjectDonors : "MainDonorId"
Column Type Null Notes
MainDonorId int PK
Name string [Required] · [StringLength(50)]
Code string ✓ [StringLength(50)]

Navigation: DonorPartners → ICollection<DonorPartners>, ProjectDonors → ICollection<ProjectDonors>

MasterBudget

DbSet MasterBudgets
NKO.Lib/NKO.DataAccess/DbModel/MasterBudget.cs

erDiagram
    MasterBudget {
        int MasterBudgetId PK
    }
    MasterBudgetDetails {
        int MasterBudgetDetailsId PK
        int MasterBudgetId FK
    }
    MasterBudget ||--o{ MasterBudgetDetails : "MasterBudgetId"
Column Type Null Notes
MasterBudgetId int PK
MasterBudgetGuid Guid
StartDate DateTime
EndDate DateTime
Notes string ✓
CreatedBy int
CreatedOn DateTime

Navigation: MasterBudgetDetails → ICollection<MasterBudgetDetails>

MasterBudgetDetails

class MasterBudgetDetail · DbSet MasterBudgetDetails
NKO.Lib/NKO.DataAccess/DbModel/MasterBudgetDetails.cs

erDiagram
    direction LR
    MasterBudgetDetails {
        int MasterBudgetDetailsId PK
        int MasterBudgetId FK
        int CategoryId FK
        int PlaceId FK
    }
    MasterBudget {
        int MasterBudgetId PK
    }
    CommonCategory {
        int CategoryId PK
    }
    CommonBranch {
        int BranchId PK
    }
    BudgetLine {
        int Id PK
        int MasterBudgetDetailId FK
    }
    MasterBudgetDetailsMonths {
        int MasterBudgetDetailsMonthsId PK
        int MasterBudgetDetailId FK
    }
    MasterBudget ||--o{ MasterBudgetDetails : "MasterBudgetId"
    CommonCategory ||--o{ MasterBudgetDetails : "CategoryId"
    CommonBranch ||--o{ MasterBudgetDetails : "PlaceId"
    MasterBudgetDetails |o--o{ BudgetLine : "MasterBudgetDetailId"
    MasterBudgetDetails ||--o{ MasterBudgetDetailsMonths : "MasterBudgetDetailId"
Column Type Null Notes
MasterBudgetDetailsId int PK
MasterBudgetDetailsGuid Guid
MasterBudgetId int FK → MasterBudget
CategoryId int FK → CommonCategory
PlaceId int FK → CommonBranch
Notes string ✓
Quantity int
BudgetAmount decimal
StartDate DateTime
EndDate DateTime
CreatedBy int
CreatedOn DateTime

Navigation: MasterBudget → MasterBudget, CommonCategory → CommonCategory, CommonBranch → CommonBranch, MasterBudgetDetailsMonths → ICollection<MasterBudgetDetailsMonths>, BudgetLines → ICollection<BudgetLine>

MasterBudgetDetailsMonths

class MasterBudgetDetailsMonth · DbSet MasterBudgetDetailsMonths
NKO.Lib/NKO.DataAccess/DbModel/MasterBudgetDetailsMonths.cs

erDiagram
    MasterBudgetDetailsMonths {
        int MasterBudgetDetailsMonthsId PK
        int MasterBudgetDetailId FK
    }
    MasterBudgetDetails {
        int MasterBudgetDetailsId PK
    }
    MasterBudgetDetails ||--o{ MasterBudgetDetailsMonths : "MasterBudgetDetailId"
Column Type Null Notes
MasterBudgetDetailsMonthsId int PK
MasterBudgetDetailsMonthsGuid Guid
MasterBudgetDetailId int FK → MasterBudgetDetails
Year int
Month int
BudgetAmount decimal
RealAmount decimal? ✓
Description string ✓
CreatedBy int
CreatedOn DateTime

Navigation: MasterBudgetDetails → MasterBudgetDetails

PartnersContribution

[Table("PartnersContribution")] · inherits BaseEntity
NKO.Lib/NKO.DataAccess/DbModel/PartnersContribution.cs

erDiagram
    direction LR
    PartnersContribution {
        int PartnersContributionId PK
        int UserId FK
        int PartnerId FK
        int PartnersContribustionMainId FK
        int ProjectId FK
    }
    AppUser {
        int UserId PK
    }
    Donor {
        int DonorId PK
    }
    PartnersContributionMain {
        int PartnersContributionMainId PK
    }
    Project {
        int ProjectId PK
    }
    AppUser ||--o{ PartnersContribution : "UserId"
    Donor |o--o{ PartnersContribution : "PartnerId"
    PartnersContributionMain ||--o{ PartnersContribution : "PartnersContribustionMainId"
    Project ||--o{ PartnersContribution : "ProjectId"
Column Type Null Notes
PartnersContributionId int PK
PartnersContribustionMainId int FK → PartnersContributionMain
UserId int FK → AppUser
ProjectId int FK → Project
PartnerId int? ✓ FK → Donor
PercentOfSalary decimal
CreatedBy int
CreatedOn DateTime
IsOverTime bool? ✓

Navigation: AppUser → AppUser, Donor → Donor, PartnersContributionMain → PartnersContributionMain, Project → Project

PartnersContributionMain

[Table("PartnersContributionMain")] · inherits BaseEntity
NKO.Lib/NKO.DataAccess/DbModel/PartnersContributionMain.cs

erDiagram
    PartnersContributionMain {
        int PartnersContributionMainId PK
    }
    PartnersContribution {
        int PartnersContributionId PK
        int PartnersContribustionMainId FK
    }
    PartnersContributionMain ||--o{ PartnersContribution : "PartnersContribustionMainId"
Column Type Null Notes
PartnersContributionMainId int PK
Year int
Month int
CreatedBy int
CreatedOn DateTime

Navigation: PartnersContribution → ICollection<PartnersContribution>

Project

[Table("Project")] · inherits BaseEntity · has a global query filter
NKO.Lib/NKO.DataAccess/DbModel/Project.cs

Global query filter

HasQueryFilter(x => !x.IsDeleted) — every query on Project is filtered unless it calls IgnoreQueryFilters().

erDiagram
    direction LR
    Project {
        int ProjectId PK
    }
    JobProjects {
        int JobProjectId PK
        int ProjectId FK
    }
    ProjectMonths {
        int ProjectMonthsId PK
        int ProjectId FK
    }
    ProjectFilterSettings {
        int ProjectFilterSettingId PK
        int ProjectId FK
    }
    AppUserContract {
        int ContractId PK
        int ProjectId FK
    }
    BudgetLine {
        int Id PK
        int ProjectId FK
    }
    PartnersContribution {
        int PartnersContributionId PK
        int ProjectId FK
    }
    ProjectProgram {
        int ProjectProgramId PK
        int ProjectId FK
    }
    TrainingRequest {
        int TrainingRequestId PK
        int ProjectId FK
    }
    PurchaseRequest {
        int PrId PK
        int ProjectId FK
    }
    ProjectDonors {
        int ProjectDonorsId PK
        int ProjectId FK
    }
    PayrollInfo {
        int PayrollInfoId PK
        int ProjectId FK
    }
    ProjectExtensions {
        int ProjectExtentionId PK
        int ProjectId FK
    }
    ProjectPlace {
        int ProjectPlaceId PK
        int ProjectId FK
    }
    Project ||--o{ JobProjects : "ProjectId"
    Project ||--o{ ProjectMonths : "ProjectId"
    Project ||--o{ ProjectFilterSettings : "ProjectId"
    Project |o--o{ AppUserContract : "ProjectId"
    Project ||--o{ BudgetLine : "ProjectId"
    Project ||--o{ PartnersContribution : "ProjectId"
    Project ||--o{ ProjectProgram : "ProjectId"
    Project ||--o{ TrainingRequest : "ProjectId"
    Project ||--o{ PurchaseRequest : "ProjectId"
    Project ||--o{ ProjectDonors : "ProjectId"
    Project |o--o{ PayrollInfo : "ProjectId"
    Project ||--o{ ProjectExtensions : "ProjectId"
    Project ||--o{ ProjectPlace : "ProjectId"
Column Type Null Notes
ProjectId int PK
ProjectGuid Guid
ProjectCode string [Required] · [StringLength(50)]
ReferenceNumber int
ProjectName string [Required]
Description string ✓ [Column(TypeName = "ntext")]
StartDate DateTime [Required] · [Column(TypeName = "date")]
EndDate DateTime [Required] · [Column(TypeName = "date")]
BudgetAmount decimal
Currency int [Required]
StatusId int [Required]
ProgramManager int
FinanceManager int
LogisticManager int
HRManager int? ✓
ComplianceManager int? ✓
ActivateInWarehouse bool
IsDeleted bool
CreatedBy int
CreatedOn DateTime
ContractNumber string ✓
ExchangeRate decimal? ✓
Sod1 int? ✓
Sod2 int? ✓
Sod3 int? ✓
Sod4 int? ✓
FinanceSod1 int? ✓

Navigation: ProjectPrograms → ICollection<ProjectProgram>, JobProjects → ICollection<JobProjects>, AppUserContracts → ICollection<AppUserContract>, PartnersContribution → ICollection<PartnersContribution>, ProjectDonors → ICollection<ProjectDonors>, ProjectExtensions → ICollection<ProjectExtensions>, ProjectFilterSettings → ICollection<ProjectFilterSettings>, ProjectMonths → ICollection<ProjectMonths>, ProjectPlace → ICollection<ProjectPlace>, PurchaseRequests → ICollection<PurchaseRequest>, TrainingRequests → ICollection<TrainingRequest>, BudgetLines → ICollection<BudgetLine>

ProjectDonors

inherits BaseEntity
NKO.Lib/NKO.DataAccess/DbModel/ProjectDonors.cs

erDiagram
    ProjectDonors {
        int ProjectDonorsId PK
        int DonorId FK
        int MainDonorId FK
        int ProjectId FK
    }
    Donor {
        int DonorId PK
    }
    MainDonor {
        int MainDonorId PK
    }
    Project {
        int ProjectId PK
    }
    Donor ||--o{ ProjectDonors : "DonorId"
    MainDonor |o--o{ ProjectDonors : "MainDonorId"
    Project ||--o{ ProjectDonors : "ProjectId"
Column Type Null Notes
ProjectDonorsId int PK
ProjectId int FK → Project
DonorId int FK → Donor
MainDonorId int? ✓ FK → MainDonor

Navigation: Donor → Donor, MainDonor → MainDonor, Project → Project

ProjectExtensions

inherits BaseEntity
NKO.Lib/NKO.DataAccess/DbModel/ProjectExtensions.cs

erDiagram
    ProjectExtensions {
        int ProjectExtentionId PK
        int ProjectId FK
    }
    Project {
        int ProjectId PK
    }
    Project ||--o{ ProjectExtensions : "ProjectId"
Column Type Null Notes
ProjectExtentionId int PK
ProjectId int FK → Project
StartDate DateTime
EndDate DateTime
Amount decimal? ✓
Description string ✓ [Column(TypeName = "ntext")]
CreatedBy int
CreatedOn DateTime
TypeId int
ProjectCode string ✓

Navigation: Project → Project

ProjectFilterSettings

inherits BaseEntity
NKO.Lib/NKO.DataAccess/DbModel/ProjectFilterSettings.cs

erDiagram
    ProjectFilterSettings {
        int ProjectFilterSettingId PK
        int ProjectId FK
    }
    Project {
        int ProjectId PK
    }
    Project ||--o{ ProjectFilterSettings : "ProjectId"
Column Type Null Notes
ProjectFilterSettingId int PK
ProjectId int FK → Project
FilterString string [Required] · [Column(TypeName = "ntext")]

Navigation: Project → Project

ProjectMonths

inherits BaseEntity
NKO.Lib/NKO.DataAccess/DbModel/ProjectMonths.cs

erDiagram
    ProjectMonths {
        int ProjectMonthsId PK
        int ProjectId FK
    }
    Project {
        int ProjectId PK
    }
    Project ||--o{ ProjectMonths : "ProjectId"
Column Type Null Notes
ProjectMonthsId int PK
MonthGuid Guid
ProjectId int FK → Project
Month int
Year int
Amount decimal

Navigation: Project → Project

ProjectPlace

[Table("ProjectPlace")] · inherits BaseEntity
NKO.Lib/NKO.DataAccess/DbModel/ProjectPlace.cs

erDiagram
    ProjectPlace {
        int ProjectPlaceId PK
        int BranchId FK
        int ProjectId FK
    }
    CommonBranch {
        int BranchId PK
    }
    Project {
        int ProjectId PK
    }
    CommonBranch ||--o{ ProjectPlace : "BranchId"
    Project ||--o{ ProjectPlace : "ProjectId"
Column Type Null Notes
ProjectPlaceId int PK
ProjectId int FK → Project
BranchId int FK → CommonBranch
IsActive bool
CreatedBy int
CreatedOn DateTime

Navigation: CommonBranch → CommonBranch, Project → Project

ProjectProgram

DbSet ProjectPrograms · inherits BaseEntity
NKO.Lib/NKO.DataAccess/DbModel/ProjectProgram.cs

erDiagram
    ProjectProgram {
        int ProjectProgramId PK
        int ProjectId FK
        int ProgramId FK
    }
    Project {
        int ProjectId PK
    }
    CommonProgram {
        int ProgramId PK
    }
    Project ||--o{ ProjectProgram : "ProjectId"
    CommonProgram ||--o{ ProjectProgram : "ProgramId"
Column Type Null Notes
ProjectProgramId int PK
ProjectId int FK → Project
ProgramId int FK → CommonProgram

Navigation: Project → Project, Program → CommonProgram