Add main version branch
This commit is contained in:
commit
17d42f2cdf
63
.gitattributes
vendored
Normal file
63
.gitattributes
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
###############################################################################
|
||||
# Set default behavior to automatically normalize line endings.
|
||||
###############################################################################
|
||||
* text=auto
|
||||
|
||||
###############################################################################
|
||||
# Set default behavior for command prompt diff.
|
||||
#
|
||||
# This is need for earlier builds of msysgit that does not have it on by
|
||||
# default for csharp files.
|
||||
# Note: This is only used by command line
|
||||
###############################################################################
|
||||
#*.cs diff=csharp
|
||||
|
||||
###############################################################################
|
||||
# Set the merge driver for project and solution files
|
||||
#
|
||||
# Merging from the command prompt will add diff markers to the files if there
|
||||
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
||||
# the diff markers are never inserted). Diff markers may cause the following
|
||||
# file extensions to fail to load in VS. An alternative would be to treat
|
||||
# these files as binary and thus will always conflict and require user
|
||||
# intervention with every merge. To do so, just uncomment the entries below
|
||||
###############################################################################
|
||||
#*.sln merge=binary
|
||||
#*.csproj merge=binary
|
||||
#*.vbproj merge=binary
|
||||
#*.vcxproj merge=binary
|
||||
#*.vcproj merge=binary
|
||||
#*.dbproj merge=binary
|
||||
#*.fsproj merge=binary
|
||||
#*.lsproj merge=binary
|
||||
#*.wixproj merge=binary
|
||||
#*.modelproj merge=binary
|
||||
#*.sqlproj merge=binary
|
||||
#*.wwaproj merge=binary
|
||||
|
||||
###############################################################################
|
||||
# behavior for image files
|
||||
#
|
||||
# image files are treated as binary by default.
|
||||
###############################################################################
|
||||
#*.jpg binary
|
||||
#*.png binary
|
||||
#*.gif binary
|
||||
|
||||
###############################################################################
|
||||
# diff behavior for common document formats
|
||||
#
|
||||
# Convert binary document formats to text before diffing them. This feature
|
||||
# is only available from the command line. Turn it on by uncommenting the
|
||||
# entries below.
|
||||
###############################################################################
|
||||
#*.doc diff=astextplain
|
||||
#*.DOC diff=astextplain
|
||||
#*.docx diff=astextplain
|
||||
#*.DOCX diff=astextplain
|
||||
#*.dot diff=astextplain
|
||||
#*.DOT diff=astextplain
|
||||
#*.pdf diff=astextplain
|
||||
#*.PDF diff=astextplain
|
||||
#*.rtf diff=astextplain
|
||||
#*.RTF diff=astextplain
|
363
.gitignore
vendored
Normal file
363
.gitignore
vendored
Normal file
@ -0,0 +1,363 @@
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Ww][Ii][Nn]32/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Oo]ut/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUnit
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
nunit-*.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# ASP.NET Scaffolding
|
||||
ScaffoldingReadMe.txt
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Coverlet is a free, cross platform Code Coverage Tool
|
||||
coverage*.json
|
||||
coverage*.xml
|
||||
coverage*.info
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# NuGet Symbol Packages
|
||||
*.snupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
*.appxbundle
|
||||
*.appxupload
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!?*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- [Bb]ackup.rdl
|
||||
*- [Bb]ackup ([0-9]).rdl
|
||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
369
Marco.Pms.DataAccess/Data/ApplicationDbContext.cs
Normal file
369
Marco.Pms.DataAccess/Data/ApplicationDbContext.cs
Normal file
@ -0,0 +1,369 @@
|
||||
using Marco.Pms.Model.Activities;
|
||||
using Marco.Pms.Model.AttendanceModule;
|
||||
using Marco.Pms.Model.Authentication;
|
||||
using Marco.Pms.Model.Employees;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Marco.Pms.Model.Projects;
|
||||
using MarcoBMS.Utility;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Marco.Pms.DataAccess.Data
|
||||
{
|
||||
public class ApplicationDbContext : IdentityDbContext<IdentityUser>
|
||||
{
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options, IHttpContextAccessor httpContextAccessor) : base(options)
|
||||
{
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
|
||||
}
|
||||
|
||||
public DbSet<RefreshToken> RefreshTokens { get; set; }
|
||||
|
||||
public DbSet<Tenant> Tenants { get; set; }
|
||||
public DbSet<ApplicationUser> ApplicationUsers { get; set; }
|
||||
|
||||
public DbSet<ActivityMaster> ActivityMasters { get; set; }
|
||||
public DbSet<Project> Projects { get; set; }
|
||||
public DbSet<ProjectAllocation> ProjectAllocations { get; set; }
|
||||
|
||||
public DbSet<StatusMaster> StatusMasters { get; set; }
|
||||
|
||||
public DbSet<Building> Buildings { get; set; }
|
||||
public DbSet<Floor> Floor { get; set; }
|
||||
|
||||
public DbSet<WorkArea> WorkAreas { get; set; }
|
||||
public DbSet<WorkItem> WorkItems { get; set; }
|
||||
public DbSet<WorkItemMapping> WorkItemMapping { get; set; }
|
||||
|
||||
public DbSet<WorkShift> WorkShifts { get; set; }
|
||||
|
||||
public DbSet<TaskAllocation> TaskAllocations { get; set; }
|
||||
// public DbSet<Attendance> Attendances { get; set; }
|
||||
public DbSet<Attendance> Attendes { get; set; }
|
||||
|
||||
public DbSet<AttendanceLog> AttendanceLogs { get; set; }
|
||||
// public DbSet<AttendLog> AttendLogs { get; set; }
|
||||
|
||||
|
||||
|
||||
public DbSet<Employee> Employees { get; set; }
|
||||
public DbSet<EmployeeRoleMapping> EmployeeRoleMappings { get; set; }
|
||||
|
||||
public DbSet<Module> Modules { get; set; }
|
||||
public DbSet<Feature> Features { get; set; }
|
||||
public DbSet<FeaturePermission> FeaturePermissions { get; set; }
|
||||
|
||||
public DbSet<ApplicationRole> ApplicationRoles { get; set; }
|
||||
public DbSet<JobRole> JobRoles { get; set; }
|
||||
public DbSet<RolePermissionMappings> RolePermissionMappings { get; set; }
|
||||
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
ManageApplicationStructure(modelBuilder);
|
||||
|
||||
modelBuilder.Entity<ApplicationRole>().HasData(
|
||||
new ApplicationRole
|
||||
{
|
||||
Id = new Guid("2c8d0808-c421-11ef-9b93-0242ac110002"),
|
||||
Role = "Admin",
|
||||
Description = "",
|
||||
TenantId = 1
|
||||
},
|
||||
new ApplicationRole
|
||||
{
|
||||
Id = new Guid("62e0918d-c421-11ef-9b93-0242ac110002"),
|
||||
Role = "Welder",
|
||||
Description = "",
|
||||
|
||||
TenantId = 1
|
||||
},
|
||||
new ApplicationRole
|
||||
{
|
||||
Id = new Guid("68823f1f-c421-11ef-9b93-0242ac110002"),
|
||||
Role = "Helper",
|
||||
Description = "",
|
||||
|
||||
TenantId = 1
|
||||
},
|
||||
new ApplicationRole
|
||||
{
|
||||
Id = new Guid("6d3a7c72-c421-11ef-9b93-0242ac110002"),
|
||||
Role = "Site Engineer",
|
||||
Description = "",
|
||||
|
||||
TenantId = 1
|
||||
}
|
||||
,
|
||||
new ApplicationRole
|
||||
{
|
||||
Id = new Guid("6d3aad72-c421-11ef-9b93-0242ac110002"),
|
||||
Role = "Project Manager",
|
||||
Description = "",
|
||||
|
||||
TenantId = 1
|
||||
}
|
||||
);
|
||||
|
||||
modelBuilder.Entity<RefreshToken>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id);
|
||||
entity.HasOne(e => e.User)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.UserId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Tenant>().HasData(
|
||||
new Tenant { Id = 1, Name = "MarcoBMS", ContactName = "Admin", ContactNumber = "123456789", Description = "", DomainName = "www.marcobms.org", OnBoardingDate = DateTime.MinValue }
|
||||
);
|
||||
|
||||
modelBuilder.Entity<StatusMaster>().HasData(
|
||||
new StatusMaster
|
||||
{
|
||||
Id = 1,
|
||||
Status = "Active",
|
||||
TenantId = 1
|
||||
},
|
||||
new StatusMaster
|
||||
{
|
||||
Id = 2,
|
||||
Status = "In Progress",
|
||||
TenantId = 1
|
||||
},
|
||||
new StatusMaster
|
||||
{
|
||||
Id = 3,
|
||||
Status = "On Hold",
|
||||
TenantId = 1
|
||||
},
|
||||
new StatusMaster
|
||||
{
|
||||
Id = 4,
|
||||
Status = "Completed",
|
||||
TenantId = 1
|
||||
}
|
||||
);
|
||||
modelBuilder.Entity<Project>().HasData(
|
||||
new Project
|
||||
{
|
||||
Id = 1,
|
||||
Name = "Project 1",
|
||||
ProjectAddress = "Project 1 Address",
|
||||
ContactPerson = "Project 1 Contact Person",
|
||||
ProjectStatusId = 1,
|
||||
TenantId = 1
|
||||
}, new Project
|
||||
{
|
||||
Id = 2,
|
||||
Name = "Project 2",
|
||||
ProjectAddress = "Project 2 Address",
|
||||
ContactPerson = "Project 2 Contact Person",
|
||||
ProjectStatusId = 2,
|
||||
TenantId = 1
|
||||
}, new Project
|
||||
{
|
||||
Id = 3,
|
||||
Name = "Project 3",
|
||||
ProjectAddress = "Project 3 Address",
|
||||
ContactPerson = "Project 3 Contact Person",
|
||||
ProjectStatusId = 3,
|
||||
TenantId = 1
|
||||
});
|
||||
|
||||
|
||||
var tenantId = _httpContextAccessor.HttpContext?.Items["TenantId"]?.ToString();
|
||||
|
||||
modelBuilder.Entity<ActivityMaster>()
|
||||
.HasData(
|
||||
new ActivityMaster
|
||||
{
|
||||
Id = 1,
|
||||
ActivityName = "Core Cutting",
|
||||
UnitOfMeasurement = UnitOfMeasurement.Number.ToString(),
|
||||
TenantId = 1
|
||||
}, new ActivityMaster
|
||||
{
|
||||
Id = 2,
|
||||
ActivityName = "Fabrication",
|
||||
UnitOfMeasurement = UnitOfMeasurement.Meter.ToString(),
|
||||
TenantId = 1
|
||||
}, new ActivityMaster
|
||||
{
|
||||
Id = 3,
|
||||
ActivityName = "Lifting",
|
||||
UnitOfMeasurement = UnitOfMeasurement.Meter.ToString(),
|
||||
TenantId = 1
|
||||
}, new ActivityMaster
|
||||
{
|
||||
Id = 4,
|
||||
ActivityName = "Hanging",
|
||||
UnitOfMeasurement = UnitOfMeasurement.Meter.ToString(),
|
||||
TenantId = 1
|
||||
}, new ActivityMaster
|
||||
{
|
||||
Id = 5,
|
||||
ActivityName = "Tapping",
|
||||
UnitOfMeasurement = UnitOfMeasurement.Meter.ToString(),
|
||||
TenantId = 1
|
||||
}, new ActivityMaster
|
||||
{
|
||||
Id = 6,
|
||||
ActivityName = "Welding",
|
||||
UnitOfMeasurement = UnitOfMeasurement.Meter.ToString(),
|
||||
TenantId = 1
|
||||
}, new ActivityMaster
|
||||
{
|
||||
Id = 7,
|
||||
ActivityName = "Testing",
|
||||
UnitOfMeasurement = UnitOfMeasurement.Area.ToString(),
|
||||
TenantId = 1
|
||||
}, new ActivityMaster
|
||||
{
|
||||
Id = 8,
|
||||
ActivityName = "Painting",
|
||||
UnitOfMeasurement = UnitOfMeasurement.Meter.ToString(),
|
||||
TenantId = 1
|
||||
}, new ActivityMaster
|
||||
{
|
||||
Id = 9,
|
||||
ActivityName = "Marking Area",
|
||||
UnitOfMeasurement = UnitOfMeasurement.Meter.ToString(),
|
||||
TenantId = 1
|
||||
}, new ActivityMaster
|
||||
{
|
||||
Id = 10,
|
||||
ActivityName = "Drilling",
|
||||
UnitOfMeasurement = UnitOfMeasurement.Number.ToString(),
|
||||
TenantId = 1
|
||||
}, new ActivityMaster
|
||||
{
|
||||
Id = 11,
|
||||
ActivityName = "MS Support Fabrication",
|
||||
UnitOfMeasurement = UnitOfMeasurement.Number.ToString(),
|
||||
TenantId = 1
|
||||
}, new ActivityMaster
|
||||
{
|
||||
Id = 12,
|
||||
ActivityName = "MS Support Hanging",
|
||||
UnitOfMeasurement = UnitOfMeasurement.Number.ToString(),
|
||||
TenantId = 1
|
||||
}, new ActivityMaster
|
||||
{
|
||||
Id = 13,
|
||||
ActivityName = "Hydrant Volve",
|
||||
UnitOfMeasurement = UnitOfMeasurement.Number.ToString(),
|
||||
TenantId = 1
|
||||
}, new ActivityMaster
|
||||
{
|
||||
Id = 14,
|
||||
ActivityName = "Sprinkler Installation",
|
||||
UnitOfMeasurement = UnitOfMeasurement.Number.ToString(),
|
||||
TenantId = 1
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private static void ManageApplicationStructure(ModelBuilder modelBuilder)
|
||||
{
|
||||
// Configure ApplicationRole to Tenant relationship (if Tenant exists)
|
||||
modelBuilder.Entity<ApplicationRole>()
|
||||
.HasOne<Tenant>() // No navigation property in ApplicationRole
|
||||
.WithMany()
|
||||
.HasForeignKey(ar => ar.TenantId);
|
||||
// Configure the relationship between ApplicationRole and FeaturePermission via a join table
|
||||
modelBuilder.Entity<RolePermissionMappings>(entity =>
|
||||
{
|
||||
entity.HasKey(rfp => new { rfp.ApplicationRoleId, rfp.FeaturePermissionId });
|
||||
|
||||
entity.HasOne<ApplicationRole>()
|
||||
.WithMany()
|
||||
.HasForeignKey(rfp => rfp.ApplicationRoleId);
|
||||
|
||||
entity.HasOne<FeaturePermission>()
|
||||
.WithMany()
|
||||
.HasForeignKey(rfp => rfp.FeaturePermissionId);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
modelBuilder.Entity<Module>().HasData(new Module
|
||||
{
|
||||
Id = 1,
|
||||
Name = "Project",
|
||||
Description = "Project Module",
|
||||
Key = Guid.NewGuid().ToString()
|
||||
}, new Module
|
||||
{
|
||||
Id = 2,
|
||||
Name = "Employee",
|
||||
Description = "Employee Module",
|
||||
Key = Guid.NewGuid().ToString()
|
||||
}, new Module
|
||||
{
|
||||
Id = 3,
|
||||
Name = "Masters",
|
||||
Description = "Masters Module",
|
||||
Key = Guid.NewGuid().ToString()
|
||||
});
|
||||
|
||||
|
||||
|
||||
modelBuilder.Entity<Feature>().HasData(
|
||||
new Feature { Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), Description = "Manage Project", Name = "Manage Project", ModuleId = 1, IsActive = true },
|
||||
new Feature { Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), Description = "Manage Infra", Name = "Manage Infra", ModuleId = 1, IsActive = true },
|
||||
|
||||
new Feature { Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), Description = "Manage Tasks", Name = "Manage Tasks", ModuleId = 1, IsActive = true },
|
||||
|
||||
new Feature { Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), Description = "Assign and Update Tasks Progress", Name = "Assign and Update Tasks Progress", ModuleId = 1, IsActive = true },
|
||||
|
||||
|
||||
new Feature { Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), Description = "Manage Employee", Name = "Manage Employee", ModuleId = 2, IsActive = true },
|
||||
new Feature { Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), Description = "Attendance", Name = "Attendance", ModuleId = 2, IsActive = true },
|
||||
|
||||
new Feature { Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), Description = "Global Masters", Name = "Global Masters", ModuleId = 3, IsActive = true },
|
||||
new Feature { Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), Description = "Tenant Masters", Name = "Tenant Masters", ModuleId = 3, IsActive = true }
|
||||
);
|
||||
|
||||
modelBuilder.Entity<FeaturePermission>().HasData(
|
||||
new FeaturePermission { Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), IsEnabled = true, Name = "View Project" , Description=""},
|
||||
new FeaturePermission { Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), IsEnabled = true, Name = "Manage Project", Description = "" },
|
||||
new FeaturePermission { Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), IsEnabled = true, Name = "Manage Team", Description = "" },
|
||||
|
||||
new FeaturePermission { Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), IsEnabled = true, Name = "View Project Infra", Description = "" },
|
||||
new FeaturePermission { Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), IsEnabled = true, Name = "Manage Project Infra", Description = "" },
|
||||
|
||||
|
||||
new FeaturePermission { Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), IsEnabled = true, Name = "View Task", Description = "" },
|
||||
new FeaturePermission { Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), IsEnabled = true, Name = "Manage Task", Description = "" },
|
||||
|
||||
|
||||
new FeaturePermission { Id = new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee"), FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), IsEnabled = true, Name = "Assign Task and Report Progress", Description = "" },
|
||||
new FeaturePermission { Id = new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823"), FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), IsEnabled = true, Name = "Approve Task", Description = "" },
|
||||
|
||||
|
||||
new FeaturePermission { Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), IsEnabled = true, Name = "View Employee", Description = "" },
|
||||
new FeaturePermission { Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), IsEnabled = true, Name = "Manage Employee", Description = "" },
|
||||
new FeaturePermission { Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), IsEnabled = true, Name = "Assign To Project", Description = "" },
|
||||
|
||||
|
||||
new FeaturePermission { Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), IsEnabled = true, Name = "Perform Attendance ", Description = "" },
|
||||
new FeaturePermission { Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), IsEnabled = true, Name = "Regularize Attendance", Description = "" },
|
||||
|
||||
new FeaturePermission { Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), IsEnabled = true, Name = "View Masters", Description = "" },
|
||||
new FeaturePermission { Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), IsEnabled = true, Name = "Manage Masters", Description = "" },
|
||||
new FeaturePermission { Id = new Guid("cb8ec407-46d4-4467-930c-69127cda6dec"), FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), IsEnabled = true, Name = "View Masters", Description = "" },
|
||||
new FeaturePermission { Id = new Guid("6b1a6d97-a951-4de5-9b19-709bac7c4f18"), FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), IsEnabled = true, Name = "Manage Masters", Description = "" }
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
27
Marco.Pms.DataAccess/Data/docker setup.txt
Normal file
27
Marco.Pms.DataAccess/Data/docker setup.txt
Normal file
@ -0,0 +1,27 @@
|
||||
$ docker pull mysql:latest
|
||||
|
||||
$ docker run --hostname=8b98a48ce3a0
|
||||
--mac-address=02:42:ac:11:00:02
|
||||
--env=MYSQL_ROOT_PASSWORD=root
|
||||
--env=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
--env=GOSU_VERSION=1.17
|
||||
--env=MYSQL_MAJOR=innovation
|
||||
--env=MYSQL_VERSION=9.0.1-1.el9
|
||||
--env=MYSQL_SHELL_VERSION=9.0.1-1.el9
|
||||
--volume=/var/lib/mysql
|
||||
--workdir=/
|
||||
-p 3333:3306
|
||||
--restart=no
|
||||
--runtime=runc
|
||||
-d mysql:latest
|
||||
|
||||
|
||||
To access the terminal inside your container, you can use the following command:
|
||||
|
||||
$ docker exec -it mysql-db bash
|
||||
|
||||
connect to mysql
|
||||
> mysql -u root -p
|
||||
> create database MarcoBMS;
|
||||
|
||||
|
131
Marco.Pms.DataAccess/Initializer/DBInitializer.cs
Normal file
131
Marco.Pms.DataAccess/Initializer/DBInitializer.cs
Normal file
@ -0,0 +1,131 @@
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using Marco.Pms.DataAccess.Repository;
|
||||
using Marco.Pms.DataAccess.Repository.IRepository;
|
||||
using Marco.Pms.Model.Activities;
|
||||
using Marco.Pms.Model.Employees;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Marco.Pms.Model.Projects;
|
||||
using Marco.Pms.Model.ViewModels;
|
||||
using MarcoBMS.Utility;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Marco.Pms.DataAccess.Initializer
|
||||
{
|
||||
public class DBInitializer : IDBInitializer
|
||||
{
|
||||
|
||||
private readonly ApplicationDbContext _db;
|
||||
private readonly UserManager<IdentityUser> _userManager;
|
||||
private readonly RoleManager<IdentityRole> _roleManager;
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
|
||||
public DBInitializer(UserManager<IdentityUser> userManager, RoleManager<IdentityRole> roleManager, ApplicationDbContext db, IUnitOfWork unitOfWork)
|
||||
{
|
||||
_userManager = userManager;
|
||||
_roleManager = roleManager;
|
||||
_db = db;
|
||||
_unitOfWork = unitOfWork;
|
||||
|
||||
}
|
||||
public void Initialize()
|
||||
{
|
||||
// Migration those are not applied
|
||||
try
|
||||
{
|
||||
if (_db.Database.GetPendingMigrations().Count() > 0)
|
||||
{
|
||||
_db.Database.Migrate();
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { }
|
||||
|
||||
// Create roes if not created
|
||||
|
||||
CreateProjectInfra();
|
||||
|
||||
if (!_roleManager.RoleExistsAsync(APP_ROLES.Admin.ToString()).GetAwaiter().GetResult())
|
||||
{
|
||||
_roleManager.CreateAsync(new IdentityRole(APP_ROLES.Admin.ToString())).GetAwaiter().GetResult();
|
||||
_roleManager.CreateAsync(new IdentityRole(APP_ROLES.Management.ToString())).GetAwaiter().GetResult();
|
||||
_roleManager.CreateAsync(new IdentityRole(APP_ROLES.SiteEngineer.ToString())).GetAwaiter().GetResult();
|
||||
_roleManager.CreateAsync(new IdentityRole(APP_ROLES.SkilledWorker.ToString())).GetAwaiter().GetResult();
|
||||
_roleManager.CreateAsync(new IdentityRole(APP_ROLES.UnskilledWorker.ToString())).GetAwaiter().GetResult();
|
||||
|
||||
|
||||
// Create admin user if roles are not created
|
||||
_userManager.CreateAsync(new ApplicationUser
|
||||
{
|
||||
UserName = "admin@marcobms.com",
|
||||
Email = "admin@marcobms.com",
|
||||
PhoneNumber = "1234567890",
|
||||
// Street = "Street 1",
|
||||
// State = "State",
|
||||
// Postalcode = "1234567890",
|
||||
// City = "City",
|
||||
TenantId = 1,
|
||||
IsRootUser = true,
|
||||
|
||||
}, "User@123").GetAwaiter().GetResult();
|
||||
|
||||
ApplicationUser user = _db.ApplicationUsers.FirstOrDefault(u => u.Email == "admin@marcobms.com");
|
||||
_userManager.AddToRoleAsync(user, APP_ROLES.Admin.ToString()).GetAwaiter().GetResult();
|
||||
|
||||
Employee emp = new Employee()
|
||||
{
|
||||
FirstName = "Administrator",
|
||||
LastName = "",
|
||||
MiddleName = "",
|
||||
Gender = "",
|
||||
EmergencyPhoneNumber = "1234567890",
|
||||
CurrentAddress = "",
|
||||
AadharNumber = "1234567890",
|
||||
ApplicationUserId = user.Id,
|
||||
BirthDate = DateTime.MinValue,
|
||||
PanNumber = "",
|
||||
PeramnentAddress = "",
|
||||
PhoneNumber = "",
|
||||
TenantId = user.TenantId
|
||||
};
|
||||
_db.Employees.Add(emp);
|
||||
|
||||
_db.SaveChanges();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static void CreateProjectInfra()
|
||||
{
|
||||
var jsonData = File.ReadAllText("wwwroot/assets/data/buildings.json");
|
||||
|
||||
var entities1 = Newtonsoft.Json.JsonConvert.DeserializeObject<ProjectDetailsVM>(jsonData);
|
||||
|
||||
//foreach (Building item in entities1.buildings)
|
||||
//{
|
||||
// _unitOfWork.Building.Add(item);
|
||||
//}
|
||||
//_unitOfWork.Save();
|
||||
|
||||
|
||||
//foreach (Floor item in entities1.floors)
|
||||
//{
|
||||
// _unitOfWork.Floor.Add(item);
|
||||
//}
|
||||
//_unitOfWork.Save();
|
||||
|
||||
//foreach (WorkArea item in entities1.workAreas)
|
||||
//{
|
||||
// _unitOfWork.WorkArea.Add(item);
|
||||
//}
|
||||
//_unitOfWork.Save();
|
||||
|
||||
//foreach (WorkItem item in entities1.workItems)
|
||||
//{
|
||||
// _unitOfWork.WorkItem.Add(item);
|
||||
//}
|
||||
//_unitOfWork.Save();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
7
Marco.Pms.DataAccess/Initializer/IDBInitializer.cs
Normal file
7
Marco.Pms.DataAccess/Initializer/IDBInitializer.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace Marco.Pms.DataAccess.Initializer
|
||||
{
|
||||
public interface IDBInitializer
|
||||
{
|
||||
void Initialize();
|
||||
}
|
||||
}
|
55
Marco.Pms.DataAccess/Marco.Pms.DataAccess.csproj
Normal file
55
Marco.Pms.DataAccess/Marco.Pms.DataAccess.csproj
Normal file
@ -0,0 +1,55 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Repository\IRepository\**" />
|
||||
<EmbeddedResource Remove="Repository\IRepository\**" />
|
||||
<None Remove="Repository\IRepository\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Migrations\20240926175604_identitySetup.cs" />
|
||||
<Compile Remove="Migrations\20240926175604_identitySetup.Designer.cs" />
|
||||
<Compile Remove="Migrations\20240927100058_AddModels.cs" />
|
||||
<Compile Remove="Migrations\20240927100058_AddModels.Designer.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="Repository\IRepository\IApplicationUserRepository.cs" />
|
||||
<Compile Include="Repository\IRepository\IApplicationRolesRepository.cs" />
|
||||
<Compile Include="Repository\IRepository\IFeatureRepository.cs" />
|
||||
<Compile Include="Repository\IRepository\ITaskAllocationRepository.cs" />
|
||||
<Compile Include="Repository\IRepository\IAttendenceRepository.cs" />
|
||||
<Compile Include="Repository\IRepository\IEmployeeRepository.cs" />
|
||||
<Compile Include="Repository\IRepository\IBuildingRepository.cs" />
|
||||
<Compile Include="Repository\IRepository\IFloorRepository.cs" />
|
||||
<Compile Include="Repository\IRepository\IActivityMasterRepository.cs" />
|
||||
<Compile Include="Repository\IRepository\IProjectAllocationRepository.cs" />
|
||||
<Compile Include="Repository\IRepository\IStatusRepository.cs" />
|
||||
<Compile Include="Repository\IRepository\IWorkAreaRepository.cs" />
|
||||
<Compile Include="Repository\IRepository\IWorkItemMappingReposiotry.cs" />
|
||||
<Compile Include="Repository\IRepository\IWorkItemRepository.cs" />
|
||||
<Compile Include="Repository\IRepository\IProjectRepository.cs" />
|
||||
<Compile Include="Repository\IRepository\IRepository.cs" />
|
||||
<Compile Include="Repository\IRepository\IUnitOfWork.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Marco.Pms.Model\Marco.Pms.Model.csproj" />
|
||||
<ProjectReference Include="..\Marco.Pms.Utility\Marco.Pms.Utility.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.20">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
1541
Marco.Pms.DataAccess/Migrations/20250124111814_initiateapp.Designer.cs
generated
Normal file
1541
Marco.Pms.DataAccess/Migrations/20250124111814_initiateapp.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
1210
Marco.Pms.DataAccess/Migrations/20250124111814_initiateapp.cs
Normal file
1210
Marco.Pms.DataAccess/Migrations/20250124111814_initiateapp.cs
Normal file
File diff suppressed because it is too large
Load Diff
1553
Marco.Pms.DataAccess/Migrations/20250204133319_role.Designer.cs
generated
Normal file
1553
Marco.Pms.DataAccess/Migrations/20250204133319_role.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
278
Marco.Pms.DataAccess/Migrations/20250204133319_role.cs
Normal file
278
Marco.Pms.DataAccess/Migrations/20250204133319_role.cs
Normal file
@ -0,0 +1,278 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class role : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Feature_Tenants_TenantId",
|
||||
table: "Feature");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_FeaturePermission_EmployeeRoles_RoleId",
|
||||
table: "FeaturePermission");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_FeaturePermission_Feature_FeatureId",
|
||||
table: "FeaturePermission");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_FeaturePermission_Tenants_TenantId",
|
||||
table: "FeaturePermission");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_FeaturePermission_RoleId",
|
||||
table: "FeaturePermission");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_FeaturePermission_TenantId",
|
||||
table: "FeaturePermission");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Feature",
|
||||
table: "Feature");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RoleId",
|
||||
table: "FeaturePermission");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "Feature",
|
||||
newName: "Features");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_Feature_TenantId",
|
||||
table: "Features",
|
||||
newName: "IX_Features_TenantId");
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "AllowCreate",
|
||||
table: "FeaturePermission",
|
||||
type: "tinyint(1)",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "AllowDelete",
|
||||
table: "FeaturePermission",
|
||||
type: "tinyint(1)",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "AllowModify",
|
||||
table: "FeaturePermission",
|
||||
type: "tinyint(1)",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "AllowView",
|
||||
table: "FeaturePermission",
|
||||
type: "tinyint(1)",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Description",
|
||||
table: "EmployeeRoles",
|
||||
type: "longtext",
|
||||
nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "EmployeeRoleId",
|
||||
table: "Features",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_Features",
|
||||
table: "Features",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "EmployeeRoles",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("2c8d0808-c421-11ef-9b93-0242ac110002"),
|
||||
column: "Description",
|
||||
value: "");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "EmployeeRoles",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("62e0918d-c421-11ef-9b93-0242ac110002"),
|
||||
column: "Description",
|
||||
value: "");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "EmployeeRoles",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("68823f1f-c421-11ef-9b93-0242ac110002"),
|
||||
column: "Description",
|
||||
value: "");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "EmployeeRoles",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("6d3a7c72-c421-11ef-9b93-0242ac110002"),
|
||||
column: "Description",
|
||||
value: "");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "EmployeeRoles",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("6d3aad72-c421-11ef-9b93-0242ac110002"),
|
||||
column: "Description",
|
||||
value: "");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Features_EmployeeRoleId",
|
||||
table: "Features",
|
||||
column: "EmployeeRoleId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_FeaturePermission_Features_FeatureId",
|
||||
table: "FeaturePermission",
|
||||
column: "FeatureId",
|
||||
principalTable: "Features",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Features_EmployeeRoles_EmployeeRoleId",
|
||||
table: "Features",
|
||||
column: "EmployeeRoleId",
|
||||
principalTable: "EmployeeRoles",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Features_Tenants_TenantId",
|
||||
table: "Features",
|
||||
column: "TenantId",
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_FeaturePermission_Features_FeatureId",
|
||||
table: "FeaturePermission");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Features_EmployeeRoles_EmployeeRoleId",
|
||||
table: "Features");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Features_Tenants_TenantId",
|
||||
table: "Features");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Features",
|
||||
table: "Features");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Features_EmployeeRoleId",
|
||||
table: "Features");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AllowCreate",
|
||||
table: "FeaturePermission");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AllowDelete",
|
||||
table: "FeaturePermission");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AllowModify",
|
||||
table: "FeaturePermission");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AllowView",
|
||||
table: "FeaturePermission");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Description",
|
||||
table: "EmployeeRoles");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "EmployeeRoleId",
|
||||
table: "Features");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "Features",
|
||||
newName: "Feature");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_Features_TenantId",
|
||||
table: "Feature",
|
||||
newName: "IX_Feature_TenantId");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "RoleId",
|
||||
table: "FeaturePermission",
|
||||
type: "char(36)",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_Feature",
|
||||
table: "Feature",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_FeaturePermission_RoleId",
|
||||
table: "FeaturePermission",
|
||||
column: "RoleId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_FeaturePermission_TenantId",
|
||||
table: "FeaturePermission",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Feature_Tenants_TenantId",
|
||||
table: "Feature",
|
||||
column: "TenantId",
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_FeaturePermission_EmployeeRoles_RoleId",
|
||||
table: "FeaturePermission",
|
||||
column: "RoleId",
|
||||
principalTable: "EmployeeRoles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_FeaturePermission_Feature_FeatureId",
|
||||
table: "FeaturePermission",
|
||||
column: "FeatureId",
|
||||
principalTable: "Feature",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_FeaturePermission_Tenants_TenantId",
|
||||
table: "FeaturePermission",
|
||||
column: "TenantId",
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
1807
Marco.Pms.DataAccess/Migrations/20250205081523_addFeatures.Designer.cs
generated
Normal file
1807
Marco.Pms.DataAccess/Migrations/20250205081523_addFeatures.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
416
Marco.Pms.DataAccess/Migrations/20250205081523_addFeatures.cs
Normal file
416
Marco.Pms.DataAccess/Migrations/20250205081523_addFeatures.cs
Normal file
@ -0,0 +1,416 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addFeatures : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_FeaturePermission_Features_FeatureId",
|
||||
table: "FeaturePermission");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Features_Tenants_TenantId",
|
||||
table: "Features");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_FeaturePermission",
|
||||
table: "FeaturePermission");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AllowCreate",
|
||||
table: "FeaturePermission");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AllowDelete",
|
||||
table: "FeaturePermission");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AllowModify",
|
||||
table: "FeaturePermission");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AllowView",
|
||||
table: "FeaturePermission");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TenantId",
|
||||
table: "FeaturePermission");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "FeaturePermission",
|
||||
newName: "FeaturePermissions");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "TenantId",
|
||||
table: "Features",
|
||||
newName: "ModuleId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_Features_TenantId",
|
||||
table: "Features",
|
||||
newName: "IX_Features_ModuleId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_FeaturePermission_FeatureId",
|
||||
table: "FeaturePermissions",
|
||||
newName: "IX_FeaturePermissions_FeatureId");
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsActive",
|
||||
table: "Features",
|
||||
type: "tinyint(1)",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Description",
|
||||
table: "FeaturePermissions",
|
||||
type: "longtext",
|
||||
nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Name",
|
||||
table: "FeaturePermissions",
|
||||
type: "longtext",
|
||||
nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_FeaturePermissions",
|
||||
table: "FeaturePermissions",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Modules",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Description = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Key = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Modules", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Modules",
|
||||
columns: new[] { "Id", "Description", "Key", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 1, "Project Module", "9a7ed07c-f7dd-4831-bf64-d5278fa9e38c", "Project" },
|
||||
{ 2, "Employee Module", "a9fb08bf-7dae-4282-9b02-f63d94d7a9dc", "Employee" },
|
||||
{ 3, "Masters Module", "e6423995-d7bf-452e-8bcc-780a655b015c", "Masters" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Features",
|
||||
columns: new[] { "Id", "Description", "EmployeeRoleId", "IsActive", "ModuleId", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), "Assign and Update Tasks Progress", null, true, 1, "Assign and Update Tasks Progress" },
|
||||
{ new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), "Attendance", null, true, 2, "Attendance" },
|
||||
{ new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), "Manage Project", null, true, 1, "Manage Project" },
|
||||
{ new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), "Tenant Masters", null, true, 3, "Tenant Masters" },
|
||||
{ new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), "Manage Employee", null, true, 2, "Manage Employee" },
|
||||
{ new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), "Manage Infra", null, true, 1, "Manage Infra" },
|
||||
{ new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), "Manage Tasks", null, true, 1, "Manage Tasks" },
|
||||
{ new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), "Global Masters", null, true, 3, "Global Masters" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "FeaturePermissions",
|
||||
columns: new[] { "Id", "Description", "FeatureId", "IsEnabled", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), "", new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), true, "Manage Task" },
|
||||
{ new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), "", new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), true, "Manage Project" },
|
||||
{ new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), "", new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), true, "Regularize Attendance" },
|
||||
{ new Guid("588a8824-f924-4955-82d8-fc51956cf323"), "", new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), true, "Manage Masters" },
|
||||
{ new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), "", new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), true, "View Masters" },
|
||||
{ new Guid("6b1a6d97-a951-4de5-9b19-709bac7c4f18"), "", new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), true, "Manage Masters" },
|
||||
{ new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), "", new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), true, "View Project" },
|
||||
{ new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), "", new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), true, "Perform Attendance " },
|
||||
{ new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), "", new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), true, "View Task" },
|
||||
{ new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), "", new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), true, "Manage Employee" },
|
||||
{ new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), "", new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), true, "View Employee" },
|
||||
{ new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), "", new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), true, "Manage Team" },
|
||||
{ new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), "", new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), true, "View Project Infra" },
|
||||
{ new Guid("cb8ec407-46d4-4467-930c-69127cda6dec"), "", new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), true, "View Masters" },
|
||||
{ new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee"), "", new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), true, "Assign Task and Report Progress" },
|
||||
{ new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823"), "", new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), true, "Approve Task" },
|
||||
{ new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), "", new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), true, "Manage Project Infra" },
|
||||
{ new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), "", new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), true, "Assign To Project" }
|
||||
});
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_FeaturePermissions_Features_FeatureId",
|
||||
table: "FeaturePermissions",
|
||||
column: "FeatureId",
|
||||
principalTable: "Features",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Features_Modules_ModuleId",
|
||||
table: "Features",
|
||||
column: "ModuleId",
|
||||
principalTable: "Modules",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_FeaturePermissions_Features_FeatureId",
|
||||
table: "FeaturePermissions");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Features_Modules_ModuleId",
|
||||
table: "Features");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Modules");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_FeaturePermissions",
|
||||
table: "FeaturePermissions");
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("588a8824-f924-4955-82d8-fc51956cf323"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("6b1a6d97-a951-4de5-9b19-709bac7c4f18"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("a97d366a-c2bb-448d-be93-402bd2324566"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("cb8ec407-46d4-4467-930c-69127cda6dec"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("f2aee20a-b754-4537-8166-f9507b44585b"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Features",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Features",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Features",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Features",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Features",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Features",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Features",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Features",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"));
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsActive",
|
||||
table: "Features");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Description",
|
||||
table: "FeaturePermissions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Name",
|
||||
table: "FeaturePermissions");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "FeaturePermissions",
|
||||
newName: "FeaturePermission");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "ModuleId",
|
||||
table: "Features",
|
||||
newName: "TenantId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_Features_ModuleId",
|
||||
table: "Features",
|
||||
newName: "IX_Features_TenantId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_FeaturePermissions_FeatureId",
|
||||
table: "FeaturePermission",
|
||||
newName: "IX_FeaturePermission_FeatureId");
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "AllowCreate",
|
||||
table: "FeaturePermission",
|
||||
type: "tinyint(1)",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "AllowDelete",
|
||||
table: "FeaturePermission",
|
||||
type: "tinyint(1)",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "AllowModify",
|
||||
table: "FeaturePermission",
|
||||
type: "tinyint(1)",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "AllowView",
|
||||
table: "FeaturePermission",
|
||||
type: "tinyint(1)",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "TenantId",
|
||||
table: "FeaturePermission",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_FeaturePermission",
|
||||
table: "FeaturePermission",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_FeaturePermission_Features_FeatureId",
|
||||
table: "FeaturePermission",
|
||||
column: "FeatureId",
|
||||
principalTable: "Features",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Features_Tenants_TenantId",
|
||||
table: "Features",
|
||||
column: "TenantId",
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
1809
Marco.Pms.DataAccess/Migrations/20250205082324_featuremapping.Designer.cs
generated
Normal file
1809
Marco.Pms.DataAccess/Migrations/20250205082324_featuremapping.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,60 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class featuremapping : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "Key",
|
||||
value: "73f5248b-c0d7-49de-a045-3617339c94cd");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Key",
|
||||
value: "35fd0032-dfb1-44a4-931c-b9417ec406e7");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
column: "Key",
|
||||
value: "adccb225-5824-4b96-96f8-d28143c42475");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "Key",
|
||||
value: "9a7ed07c-f7dd-4831-bf64-d5278fa9e38c");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Key",
|
||||
value: "a9fb08bf-7dae-4282-9b02-f63d94d7a9dc");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
column: "Key",
|
||||
value: "e6423995-d7bf-452e-8bcc-780a655b015c");
|
||||
}
|
||||
}
|
||||
}
|
1716
Marco.Pms.DataAccess/Migrations/20250206083015_NoNavigationMigration.Designer.cs
generated
Normal file
1716
Marco.Pms.DataAccess/Migrations/20250206083015_NoNavigationMigration.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class NoNavigationMigration : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
//migrationBuilder.AddColumn<Guid>(
|
||||
// name: "RoleId",
|
||||
// table: "Employees",
|
||||
// type: "char(36)",
|
||||
// nullable: false,
|
||||
// defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
// collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "Key",
|
||||
value: "b29e3352-d83f-42eb-9c57-6e2cbf1b7c9b");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Key",
|
||||
value: "d522bcb3-6965-4c2f-be14-dd18b3181a34");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
column: "Key",
|
||||
value: "77302f42-93ec-49eb-9e05-80b80939639a");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
//migrationBuilder.DropColumn(
|
||||
// name: "RoleId",
|
||||
// table: "Employees");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "Key",
|
||||
value: "03f97e79-e7ff-412b-91b4-19b71325f00c");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Key",
|
||||
value: "2351d591-bdd5-4eb5-a375-125c8cfdcf29");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
column: "Key",
|
||||
value: "bedbed6b-8ea5-4bd2-a37c-d5454d0dd280");
|
||||
}
|
||||
}
|
||||
}
|
1717
Marco.Pms.DataAccess/Migrations/20250206101247_updatefeaturesmaster.Designer.cs
generated
Normal file
1717
Marco.Pms.DataAccess/Migrations/20250206101247_updatefeaturesmaster.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,89 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class updatefeaturesmaster : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.UpdateData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee"),
|
||||
column: "FeatureId",
|
||||
value: new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823"),
|
||||
column: "FeatureId",
|
||||
value: new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "Key",
|
||||
value: "b0aa1d10-7b8a-40f1-96b3-219e8de89ccb");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Key",
|
||||
value: "19101abd-012e-4809-b153-da6bdbca0d7a");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
column: "Key",
|
||||
value: "0cb9a301-edf2-4a15-8eeb-5bfea0ad4d90");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.UpdateData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee"),
|
||||
column: "FeatureId",
|
||||
value: new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823"),
|
||||
column: "FeatureId",
|
||||
value: new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "Key",
|
||||
value: "b29e3352-d83f-42eb-9c57-6e2cbf1b7c9b");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Key",
|
||||
value: "d522bcb3-6965-4c2f-be14-dd18b3181a34");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
column: "Key",
|
||||
value: "77302f42-93ec-49eb-9e05-80b80939639a");
|
||||
}
|
||||
}
|
||||
}
|
1706
Marco.Pms.DataAccess/Migrations/20250206114122_mapping.Designer.cs
generated
Normal file
1706
Marco.Pms.DataAccess/Migrations/20250206114122_mapping.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
65
Marco.Pms.DataAccess/Migrations/20250206114122_mapping.cs
Normal file
65
Marco.Pms.DataAccess/Migrations/20250206114122_mapping.cs
Normal file
@ -0,0 +1,65 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class mapping : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "Key",
|
||||
value: "eec3cf92-01c2-41a2-bfc1-f3c2af318848");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Key",
|
||||
value: "6a22bf2f-e8f0-4164-aedc-307b370b4ef6");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
column: "Key",
|
||||
value: "69a68bf1-30e7-45fc-ab75-0c11ea10bfc3");
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "Key",
|
||||
value: "b0aa1d10-7b8a-40f1-96b3-219e8de89ccb");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Key",
|
||||
value: "19101abd-012e-4809-b153-da6bdbca0d7a");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
column: "Key",
|
||||
value: "0cb9a301-edf2-4a15-8eeb-5bfea0ad4d90");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
1813
Marco.Pms.DataAccess/Migrations/20250207070319_RolePermissionMappings.Designer.cs
generated
Normal file
1813
Marco.Pms.DataAccess/Migrations/20250207070319_RolePermissionMappings.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,139 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class RolePermissionMappings : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ApplicationRoles",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
Role = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Description = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
TenantId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ApplicationRoles", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ApplicationRoles_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RolePermissionMappings",
|
||||
columns: table => new
|
||||
{
|
||||
ApplicationRoleId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
FeaturePermissionId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RolePermissionMappings", x => new { x.ApplicationRoleId, x.FeaturePermissionId });
|
||||
table.ForeignKey(
|
||||
name: "FK_RolePermissionMappings_ApplicationRoles_ApplicationRoleId",
|
||||
column: x => x.ApplicationRoleId,
|
||||
principalTable: "ApplicationRoles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_RolePermissionMappings_FeaturePermissions_FeaturePermissionId",
|
||||
column: x => x.FeaturePermissionId,
|
||||
principalTable: "FeaturePermissions",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "ApplicationRoles",
|
||||
columns: new[] { "Id", "Description", "Role", "TenantId" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("2c8d0808-c421-11ef-9b93-0242ac110002"), "", "Admin", 1 },
|
||||
{ new Guid("62e0918d-c421-11ef-9b93-0242ac110002"), "", "Welder", 1 },
|
||||
{ new Guid("68823f1f-c421-11ef-9b93-0242ac110002"), "", "Helper", 1 },
|
||||
{ new Guid("6d3a7c72-c421-11ef-9b93-0242ac110002"), "", "Site Engineer", 1 },
|
||||
{ new Guid("6d3aad72-c421-11ef-9b93-0242ac110002"), "", "Project Manager", 1 }
|
||||
});
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "Key",
|
||||
value: "286516c2-0d55-439c-a8fa-b6858735ef65");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Key",
|
||||
value: "6a84b9c0-1478-4d87-9ef6-34c00f0fca4a");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
column: "Key",
|
||||
value: "c38971e1-491e-479f-9d02-54634c0b4908");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ApplicationRoles_TenantId",
|
||||
table: "ApplicationRoles",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RolePermissionMappings_FeaturePermissionId",
|
||||
table: "RolePermissionMappings",
|
||||
column: "FeaturePermissionId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "RolePermissionMappings");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ApplicationRoles");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "Key",
|
||||
value: "235d7bb6-9fae-4cdc-bc62-2426059cd49e");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Key",
|
||||
value: "e60119bf-48b1-4534-82ae-88d23ae46f15");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
column: "Key",
|
||||
value: "9090b0dd-7a3c-46f7-82e5-816eb6c416d2");
|
||||
}
|
||||
}
|
||||
}
|
1869
Marco.Pms.DataAccess/Migrations/20250208050500_EmployeeRolesMapping.Designer.cs
generated
Normal file
1869
Marco.Pms.DataAccess/Migrations/20250208050500_EmployeeRolesMapping.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,113 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class EmployeeRolesMapping : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "EmployeeRoleMappings",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
EmployeeId = table.Column<int>(type: "int", nullable: false),
|
||||
RoleId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
IsEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
TenantId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_EmployeeRoleMappings", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_EmployeeRoleMappings_ApplicationRoles_RoleId",
|
||||
column: x => x.RoleId,
|
||||
principalTable: "ApplicationRoles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_EmployeeRoleMappings_Employees_EmployeeId",
|
||||
column: x => x.EmployeeId,
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_EmployeeRoleMappings_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "Key",
|
||||
value: "05db8d60-e977-40f6-b944-8602d0d4cb98");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Key",
|
||||
value: "456ddbbe-0963-406d-8874-589a546c3670");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
column: "Key",
|
||||
value: "19eca67f-c3b1-4e5c-8d95-c8341cf058ae");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EmployeeRoleMappings_EmployeeId",
|
||||
table: "EmployeeRoleMappings",
|
||||
column: "EmployeeId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EmployeeRoleMappings_RoleId",
|
||||
table: "EmployeeRoleMappings",
|
||||
column: "RoleId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EmployeeRoleMappings_TenantId",
|
||||
table: "EmployeeRoleMappings",
|
||||
column: "TenantId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "EmployeeRoleMappings");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "Key",
|
||||
value: "286516c2-0d55-439c-a8fa-b6858735ef65");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Key",
|
||||
value: "6a84b9c0-1478-4d87-9ef6-34c00f0fca4a");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
column: "Key",
|
||||
value: "c38971e1-491e-479f-9d02-54634c0b4908");
|
||||
}
|
||||
}
|
||||
}
|
1913
Marco.Pms.DataAccess/Migrations/20250217065507_addjobrole.Designer.cs
generated
Normal file
1913
Marco.Pms.DataAccess/Migrations/20250217065507_addjobrole.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
136
Marco.Pms.DataAccess/Migrations/20250217065507_addjobrole.cs
Normal file
136
Marco.Pms.DataAccess/Migrations/20250217065507_addjobrole.cs
Normal file
@ -0,0 +1,136 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addjobrole : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RoleId",
|
||||
table: "Employees");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "JobRoleId",
|
||||
table: "Employees",
|
||||
type: "int",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "JobRoles",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Description = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
TenantId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_JobRoles", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_JobRoles_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "Key",
|
||||
value: "ad9fb730-b80a-446c-bf49-bf41f90e0c0b");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Key",
|
||||
value: "bc153ba8-7f38-4b91-97d5-1deb230250a9");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
column: "Key",
|
||||
value: "44e296ca-5597-44c9-9159-b481c941f902");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Employees_JobRoleId",
|
||||
table: "Employees",
|
||||
column: "JobRoleId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_JobRoles_TenantId",
|
||||
table: "JobRoles",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Employees_JobRoles_JobRoleId",
|
||||
table: "Employees",
|
||||
column: "JobRoleId",
|
||||
principalTable: "JobRoles",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Employees_JobRoles_JobRoleId",
|
||||
table: "Employees");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "JobRoles");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Employees_JobRoleId",
|
||||
table: "Employees");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "JobRoleId",
|
||||
table: "Employees");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "RoleId",
|
||||
table: "Employees",
|
||||
type: "char(36)",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "Key",
|
||||
value: "05db8d60-e977-40f6-b944-8602d0d4cb98");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Key",
|
||||
value: "456ddbbe-0963-406d-8874-589a546c3670");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
column: "Key",
|
||||
value: "19eca67f-c3b1-4e5c-8d95-c8341cf058ae");
|
||||
}
|
||||
}
|
||||
}
|
1913
Marco.Pms.DataAccess/Migrations/20250302060812_CreateJobRoles.Designer.cs
generated
Normal file
1913
Marco.Pms.DataAccess/Migrations/20250302060812_CreateJobRoles.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
136
Marco.Pms.DataAccess/Migrations/20250302060812_CreateJobRoles.cs
Normal file
136
Marco.Pms.DataAccess/Migrations/20250302060812_CreateJobRoles.cs
Normal file
@ -0,0 +1,136 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class CreateJobRoles : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
//migrationBuilder.DropColumn(
|
||||
// name: "RoleId",
|
||||
// table: "Employees");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "JobRoleId",
|
||||
table: "Employees",
|
||||
type: "int",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "JobRoles",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Description = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
TenantId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_JobRoles", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_JobRoles_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "Key",
|
||||
value: "331a7bea-688e-4f27-8dba-697d9cd29870");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Key",
|
||||
value: "ba873fd2-277b-4baa-88b9-22b69010ffa8");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
column: "Key",
|
||||
value: "aa481e97-9a9b-4b1e-b9dd-0a6ce26dab47");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Employees_JobRoleId",
|
||||
table: "Employees",
|
||||
column: "JobRoleId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_JobRoles_TenantId",
|
||||
table: "JobRoles",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Employees_JobRoles_JobRoleId",
|
||||
table: "Employees",
|
||||
column: "JobRoleId",
|
||||
principalTable: "JobRoles",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Employees_JobRoles_JobRoleId",
|
||||
table: "Employees");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "JobRoles");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Employees_JobRoleId",
|
||||
table: "Employees");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "JobRoleId",
|
||||
table: "Employees");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "RoleId",
|
||||
table: "Employees",
|
||||
type: "char(36)",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "Key",
|
||||
value: "05db8d60-e977-40f6-b944-8602d0d4cb98");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Key",
|
||||
value: "456ddbbe-0963-406d-8874-589a546c3670");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
column: "Key",
|
||||
value: "19eca67f-c3b1-4e5c-8d95-c8341cf058ae");
|
||||
}
|
||||
}
|
||||
}
|
1933
Marco.Pms.DataAccess/Migrations/20250303045849_attendancemodule.Designer.cs
generated
Normal file
1933
Marco.Pms.DataAccess/Migrations/20250303045849_attendancemodule.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,208 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class attendancemodule : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AttendanceLogs");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AttendLogs",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Comment = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
AttendanceId = table.Column<int>(type: "int", nullable: false),
|
||||
EmployeeID = table.Column<int>(type: "int", nullable: false),
|
||||
ActivityTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
Activity = table.Column<int>(type: "int", nullable: false),
|
||||
Photo = table.Column<byte[]>(type: "longblob", nullable: true),
|
||||
Latitude = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Longitude = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
UpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
UpdatedBy = table.Column<int>(type: "int", nullable: true),
|
||||
TenantId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AttendLogs", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AttendLogs_Attendances_AttendanceId",
|
||||
column: x => x.AttendanceId,
|
||||
principalTable: "Attendances",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AttendLogs_Employees_EmployeeID",
|
||||
column: x => x.EmployeeID,
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AttendLogs_Employees_UpdatedBy",
|
||||
column: x => x.UpdatedBy,
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_AttendLogs_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "Key",
|
||||
value: "04db13e4-201a-44ba-9d9a-6c07f91d3cd0");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Key",
|
||||
value: "72e2c008-c3f1-4dd8-a6ed-19c9eec3d892");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
column: "Key",
|
||||
value: "0a8eda0f-39b8-4efe-98af-5c6f2a7cd5cf");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AttendLogs_AttendanceId",
|
||||
table: "AttendLogs",
|
||||
column: "AttendanceId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AttendLogs_EmployeeID",
|
||||
table: "AttendLogs",
|
||||
column: "EmployeeID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AttendLogs_TenantId",
|
||||
table: "AttendLogs",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AttendLogs_UpdatedBy",
|
||||
table: "AttendLogs",
|
||||
column: "UpdatedBy");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AttendLogs");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AttendanceLogs",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
AttendanceId = table.Column<int>(type: "int", nullable: false),
|
||||
EmployeeID = table.Column<int>(type: "int", nullable: false),
|
||||
TenantId = table.Column<int>(type: "int", nullable: false),
|
||||
UpdatedBy = table.Column<int>(type: "int", nullable: true),
|
||||
Activity = table.Column<int>(type: "int", nullable: false),
|
||||
ActivityTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
Comment = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Latitude = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Longitude = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Photo = table.Column<byte[]>(type: "longblob", nullable: true),
|
||||
UpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AttendanceLogs", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AttendanceLogs_Attendances_AttendanceId",
|
||||
column: x => x.AttendanceId,
|
||||
principalTable: "Attendances",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AttendanceLogs_Employees_EmployeeID",
|
||||
column: x => x.EmployeeID,
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AttendanceLogs_Employees_UpdatedBy",
|
||||
column: x => x.UpdatedBy,
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_AttendanceLogs_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "Key",
|
||||
value: "9a70d253-1f44-411c-899a-718c344c1aea");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Key",
|
||||
value: "aff7e2a1-8b98-49ca-a73e-b342a4d7ef90");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
column: "Key",
|
||||
value: "dc33f0de-5730-40b0-b52b-c61ea0176c03");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AttendanceLogs_AttendanceId",
|
||||
table: "AttendanceLogs",
|
||||
column: "AttendanceId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AttendanceLogs_EmployeeID",
|
||||
table: "AttendanceLogs",
|
||||
column: "EmployeeID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AttendanceLogs_TenantId",
|
||||
table: "AttendanceLogs",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AttendanceLogs_UpdatedBy",
|
||||
table: "AttendanceLogs",
|
||||
column: "UpdatedBy");
|
||||
}
|
||||
}
|
||||
}
|
1933
Marco.Pms.DataAccess/Migrations/20250303050349_renameattendancelogs.Designer.cs
generated
Normal file
1933
Marco.Pms.DataAccess/Migrations/20250303050349_renameattendancelogs.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,208 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class renameattendancelogs : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AttendLogs");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AttendanceLogs",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Comment = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
AttendanceId = table.Column<int>(type: "int", nullable: false),
|
||||
EmployeeID = table.Column<int>(type: "int", nullable: false),
|
||||
ActivityTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
Activity = table.Column<int>(type: "int", nullable: false),
|
||||
Photo = table.Column<byte[]>(type: "longblob", nullable: true),
|
||||
Latitude = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Longitude = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
UpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
UpdatedBy = table.Column<int>(type: "int", nullable: true),
|
||||
TenantId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AttendanceLogs", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AttendanceLogs_Attendances_AttendanceId",
|
||||
column: x => x.AttendanceId,
|
||||
principalTable: "Attendances",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AttendanceLogs_Employees_EmployeeID",
|
||||
column: x => x.EmployeeID,
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AttendanceLogs_Employees_UpdatedBy",
|
||||
column: x => x.UpdatedBy,
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_AttendanceLogs_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "Key",
|
||||
value: "e20751cc-a482-499e-98de-ccc88689fcc6");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Key",
|
||||
value: "589ba09f-e176-4c90-9502-707799d33e94");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
column: "Key",
|
||||
value: "f1c5886a-474c-4b71-bda8-f278b78b0a4d");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AttendanceLogs_AttendanceId",
|
||||
table: "AttendanceLogs",
|
||||
column: "AttendanceId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AttendanceLogs_EmployeeID",
|
||||
table: "AttendanceLogs",
|
||||
column: "EmployeeID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AttendanceLogs_TenantId",
|
||||
table: "AttendanceLogs",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AttendanceLogs_UpdatedBy",
|
||||
table: "AttendanceLogs",
|
||||
column: "UpdatedBy");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AttendanceLogs");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AttendLogs",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
AttendanceId = table.Column<int>(type: "int", nullable: false),
|
||||
EmployeeID = table.Column<int>(type: "int", nullable: false),
|
||||
TenantId = table.Column<int>(type: "int", nullable: false),
|
||||
UpdatedBy = table.Column<int>(type: "int", nullable: true),
|
||||
Activity = table.Column<int>(type: "int", nullable: false),
|
||||
ActivityTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
Comment = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Latitude = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Longitude = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Photo = table.Column<byte[]>(type: "longblob", nullable: true),
|
||||
UpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AttendLogs", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AttendLogs_Attendances_AttendanceId",
|
||||
column: x => x.AttendanceId,
|
||||
principalTable: "Attendances",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AttendLogs_Employees_EmployeeID",
|
||||
column: x => x.EmployeeID,
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AttendLogs_Employees_UpdatedBy",
|
||||
column: x => x.UpdatedBy,
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_AttendLogs_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "Key",
|
||||
value: "04db13e4-201a-44ba-9d9a-6c07f91d3cd0");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Key",
|
||||
value: "72e2c008-c3f1-4dd8-a6ed-19c9eec3d892");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
column: "Key",
|
||||
value: "0a8eda0f-39b8-4efe-98af-5c6f2a7cd5cf");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AttendLogs_AttendanceId",
|
||||
table: "AttendLogs",
|
||||
column: "AttendanceId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AttendLogs_EmployeeID",
|
||||
table: "AttendLogs",
|
||||
column: "EmployeeID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AttendLogs_TenantId",
|
||||
table: "AttendLogs",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AttendLogs_UpdatedBy",
|
||||
table: "AttendLogs",
|
||||
column: "UpdatedBy");
|
||||
}
|
||||
}
|
||||
}
|
2003
Marco.Pms.DataAccess/Migrations/20250303083329_attend.Designer.cs
generated
Normal file
2003
Marco.Pms.DataAccess/Migrations/20250303083329_attend.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
242
Marco.Pms.DataAccess/Migrations/20250303083329_attend.cs
Normal file
242
Marco.Pms.DataAccess/Migrations/20250303083329_attend.cs
Normal file
@ -0,0 +1,242 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class attend : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_AttendanceLogs_Attendances_AttendanceId",
|
||||
table: "AttendanceLogs");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Attendances_Employees_EmployeeID",
|
||||
table: "Attendances");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Attendances_Tenants_TenantId",
|
||||
table: "Attendances");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Attendances",
|
||||
table: "Attendances");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "Attendances",
|
||||
newName: "Attendance");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_Attendances_TenantId",
|
||||
table: "Attendance",
|
||||
newName: "IX_Attendance_TenantId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_Attendances_EmployeeID",
|
||||
table: "Attendance",
|
||||
newName: "IX_Attendance_EmployeeID");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "RoleId",
|
||||
table: "Employees",
|
||||
type: "char(36)",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_Attendance",
|
||||
table: "Attendance",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Attendes",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Comment = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
EmployeeID = table.Column<int>(type: "int", nullable: false),
|
||||
Date = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
ProjectID = table.Column<int>(type: "int", nullable: false),
|
||||
AttendanceDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
InTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
OutTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
IsApproved = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
Activity = table.Column<int>(type: "int", nullable: false),
|
||||
ApprovedBy = table.Column<int>(type: "int", nullable: true),
|
||||
TenantId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Attendes", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Attendes_Employees_EmployeeID",
|
||||
column: x => x.EmployeeID,
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Attendes_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "Key",
|
||||
value: "c66df186-3191-4286-b5ef-c6a4adc3a65b");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Key",
|
||||
value: "5efb0b4b-03ab-480c-a2fd-d5a8be9e5f96");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
column: "Key",
|
||||
value: "43e0fb8a-3d42-451c-9899-24bb033b4e70");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Attendes_EmployeeID",
|
||||
table: "Attendes",
|
||||
column: "EmployeeID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Attendes_TenantId",
|
||||
table: "Attendes",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Attendance_Employees_EmployeeID",
|
||||
table: "Attendance",
|
||||
column: "EmployeeID",
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Attendance_Tenants_TenantId",
|
||||
table: "Attendance",
|
||||
column: "TenantId",
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_AttendanceLogs_Attendance_AttendanceId",
|
||||
table: "AttendanceLogs",
|
||||
column: "AttendanceId",
|
||||
principalTable: "Attendance",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Attendance_Employees_EmployeeID",
|
||||
table: "Attendance");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Attendance_Tenants_TenantId",
|
||||
table: "Attendance");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_AttendanceLogs_Attendance_AttendanceId",
|
||||
table: "AttendanceLogs");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Attendes");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Attendance",
|
||||
table: "Attendance");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RoleId",
|
||||
table: "Employees");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "Attendance",
|
||||
newName: "Attendances");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_Attendance_TenantId",
|
||||
table: "Attendances",
|
||||
newName: "IX_Attendances_TenantId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_Attendance_EmployeeID",
|
||||
table: "Attendances",
|
||||
newName: "IX_Attendances_EmployeeID");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_Attendances",
|
||||
table: "Attendances",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "Key",
|
||||
value: "331a7bea-688e-4f27-8dba-697d9cd29870");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Key",
|
||||
value: "ba873fd2-277b-4baa-88b9-22b69010ffa8");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
column: "Key",
|
||||
value: "aa481e97-9a9b-4b1e-b9dd-0a6ce26dab47");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_AttendanceLogs_Attendances_AttendanceId",
|
||||
table: "AttendanceLogs",
|
||||
column: "AttendanceId",
|
||||
principalTable: "Attendances",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Attendances_Employees_EmployeeID",
|
||||
table: "Attendances",
|
||||
column: "EmployeeID",
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Attendances_Tenants_TenantId",
|
||||
table: "Attendances",
|
||||
column: "TenantId",
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
1933
Marco.Pms.DataAccess/Migrations/20250303085119_attendrename.Designer.cs
generated
Normal file
1933
Marco.Pms.DataAccess/Migrations/20250303085119_attendrename.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
117
Marco.Pms.DataAccess/Migrations/20250303085119_attendrename.cs
Normal file
117
Marco.Pms.DataAccess/Migrations/20250303085119_attendrename.cs
Normal file
@ -0,0 +1,117 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class attendrename : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_AttendanceLogs_Attendance_AttendanceId",
|
||||
table: "AttendanceLogs");
|
||||
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Attendance");
|
||||
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_AttendanceLogs_Attendes_AttendanceId",
|
||||
table: "AttendanceLogs",
|
||||
column: "AttendanceId",
|
||||
principalTable: "Attendes",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_AttendanceLogs_Attendes_AttendanceId",
|
||||
table: "AttendanceLogs");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Attendes_Employees_EmployeeID",
|
||||
table: "Attendes");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Attendes_Tenants_TenantId",
|
||||
table: "Attendes");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Attendes",
|
||||
table: "Attendes");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "Attendes",
|
||||
newName: "Attendances");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_Attendes_TenantId",
|
||||
table: "Attendances",
|
||||
newName: "IX_Attendances_TenantId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_Attendes_EmployeeID",
|
||||
table: "Attendances",
|
||||
newName: "IX_Attendances_EmployeeID");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_Attendances",
|
||||
table: "Attendances",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "Key",
|
||||
value: "02f1b9b7-9cc5-4822-8090-362ca9b61a8e");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Key",
|
||||
value: "b9005cdc-0d10-4110-9e42-1d7117b68cd3");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
column: "Key",
|
||||
value: "6df40548-5543-4066-aab4-5f340015b731");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_AttendanceLogs_Attendances_AttendanceId",
|
||||
table: "AttendanceLogs",
|
||||
column: "AttendanceId",
|
||||
principalTable: "Attendances",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Attendances_Employees_EmployeeID",
|
||||
table: "Attendances",
|
||||
column: "EmployeeID",
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Attendances_Tenants_TenantId",
|
||||
table: "Attendances",
|
||||
column: "TenantId",
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
1936
Marco.Pms.DataAccess/Migrations/20250311072410_addIsActiveToProjectAllocation.Designer.cs
generated
Normal file
1936
Marco.Pms.DataAccess/Migrations/20250311072410_addIsActiveToProjectAllocation.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,71 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addIsActiveToProjectAllocation : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsActive",
|
||||
table: "ProjectAllocations",
|
||||
type: "tinyint(1)",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "Key",
|
||||
value: "b04da7e9-0406-409c-ac7f-b97256e6ea02");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Key",
|
||||
value: "0971c7fb-6ce1-458a-ae3f-8d3205893637");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
column: "Key",
|
||||
value: "504ec132-e6a9-422f-8f85-050602cfce05");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsActive",
|
||||
table: "ProjectAllocations");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
column: "Key",
|
||||
value: "6962167a-70de-4e3d-961d-14cfe676ef22");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
column: "Key",
|
||||
value: "d8d0ed22-ce17-4a73-b507-307c43c08b57");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Modules",
|
||||
keyColumn: "Id",
|
||||
keyValue: 3,
|
||||
column: "Key",
|
||||
value: "3c0463c6-2842-43ac-b7d3-ca74b26c74a6");
|
||||
}
|
||||
}
|
||||
}
|
1933
Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs
Normal file
1933
Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs
Normal file
File diff suppressed because it is too large
Load Diff
47
Marco.Pms.DataAccess/Repository/ActivityMasterRepository.cs
Normal file
47
Marco.Pms.DataAccess/Repository/ActivityMasterRepository.cs
Normal file
@ -0,0 +1,47 @@
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using Marco.Pms.DataAccess.Repository;
|
||||
using Marco.Pms.DataAccess.Repository.IRepository;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Marco.Pms.Model.Projects;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Linq.Expressions;
|
||||
using System.Linq;
|
||||
|
||||
namespace BulkyBook.DataAccess.Repository
|
||||
{
|
||||
public class ActivityMasterRepository : Repository<ActivityMaster>, IActivityMasterRepository
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
public ActivityMasterRepository(ApplicationDbContext context) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
|
||||
public void Update(ActivityMaster status)
|
||||
{
|
||||
_context.ActivityMasters.Update(status);
|
||||
}
|
||||
|
||||
public Task<List<ActivityMaster>> GetAllAsync(Expression<Func<ActivityMaster, bool>>? filter = null, string? includeProperties = null)
|
||||
{
|
||||
|
||||
IQueryable<ActivityMaster> query = _context.ActivityMasters;
|
||||
if (filter != null)
|
||||
{
|
||||
query.Where(filter);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(includeProperties))
|
||||
{
|
||||
foreach (var includeProp in includeProperties.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
query = query.Include(includeProp);
|
||||
}
|
||||
}
|
||||
return query.ToListAsync();
|
||||
|
||||
|
||||
// return await _context.Projects.ToListAsync(); ;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using Marco.Pms.DataAccess.Repository;
|
||||
using Marco.Pms.DataAccess.Repository.IRepository;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Marco.Pms.Model.Projects;
|
||||
|
||||
namespace BulkyBook.DataAccess.Repository
|
||||
{
|
||||
public class ApplicationRolesRepository : Repository<ApplicationRole>, IApplicationRolesRepository
|
||||
{
|
||||
private readonly ApplicationDbContext _db;
|
||||
public ApplicationRolesRepository(ApplicationDbContext db) : base(db)
|
||||
{
|
||||
_db = db;
|
||||
}
|
||||
|
||||
|
||||
public void Update(ApplicationRole status)
|
||||
{
|
||||
_db.ApplicationRoles.Update(status);
|
||||
}
|
||||
}
|
||||
}
|
21
Marco.Pms.DataAccess/Repository/ApplicationUserRepository.cs
Normal file
21
Marco.Pms.DataAccess/Repository/ApplicationUserRepository.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using Marco.Pms.DataAccess.Repository.IRepository;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.DataAccess.Repository
|
||||
{
|
||||
public class ApplicationUserRepository : Repository<ApplicationUser>, IApplicationUserRepository
|
||||
{
|
||||
private readonly ApplicationDbContext _db;
|
||||
public ApplicationUserRepository(ApplicationDbContext db) : base(db)
|
||||
{
|
||||
_db = db;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
22
Marco.Pms.DataAccess/Repository/AttendenceRepository.cs
Normal file
22
Marco.Pms.DataAccess/Repository/AttendenceRepository.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using Marco.Pms.DataAccess.Repository;
|
||||
using Marco.Pms.DataAccess.Repository.IRepository;
|
||||
using Marco.Pms.Model.AttendanceModule;
|
||||
|
||||
namespace BulkyBook.DataAccess.Repository
|
||||
{
|
||||
public class AttendenceRepository : Repository<Attendance>, IAttendenceRepository
|
||||
{
|
||||
private readonly ApplicationDbContext _db;
|
||||
public AttendenceRepository(ApplicationDbContext db) : base(db)
|
||||
{
|
||||
_db = db;
|
||||
}
|
||||
|
||||
|
||||
public void Update(Attendance attendance)
|
||||
{
|
||||
_db.Attendes.Update(attendance);
|
||||
}
|
||||
}
|
||||
}
|
22
Marco.Pms.DataAccess/Repository/BuildingRepository.cs
Normal file
22
Marco.Pms.DataAccess/Repository/BuildingRepository.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using Marco.Pms.DataAccess.Repository;
|
||||
using Marco.Pms.DataAccess.Repository.IRepository;
|
||||
using Marco.Pms.Model.Projects;
|
||||
|
||||
namespace BulkyBook.DataAccess.Repository
|
||||
{
|
||||
public class BuildingRepository : Repository<Building>, IBuildingRepository
|
||||
{
|
||||
private readonly ApplicationDbContext _db;
|
||||
public BuildingRepository(ApplicationDbContext db) : base(db)
|
||||
{
|
||||
_db = db;
|
||||
}
|
||||
|
||||
|
||||
public void Update(Building building)
|
||||
{
|
||||
_db.Buildings.Update(building);
|
||||
}
|
||||
}
|
||||
}
|
47
Marco.Pms.DataAccess/Repository/EmployeeRepository.cs
Normal file
47
Marco.Pms.DataAccess/Repository/EmployeeRepository.cs
Normal file
@ -0,0 +1,47 @@
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using Marco.Pms.DataAccess.Repository;
|
||||
using Marco.Pms.DataAccess.Repository.IRepository;
|
||||
using Marco.Pms.Model.Employees;
|
||||
using Marco.Pms.Model.Projects;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Linq.Expressions;
|
||||
using System.Linq;
|
||||
|
||||
namespace BulkyBook.DataAccess.Repository
|
||||
{
|
||||
public class EmployeeRepository : Repository<Employee>, IEmployeeRepository
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
public EmployeeRepository(ApplicationDbContext db) : base(db)
|
||||
{
|
||||
_context = db;
|
||||
}
|
||||
|
||||
|
||||
public void Update(Employee employee)
|
||||
{
|
||||
_context.Employees.Update(employee);
|
||||
}
|
||||
|
||||
public Task<List<Employee>> GetAsync(Expression<Func<Employee, bool>>? filter = null, string? includeProperties = null)
|
||||
{
|
||||
|
||||
IQueryable<Employee> query = _context.Employees;
|
||||
if (filter != null)
|
||||
{
|
||||
query.Where(filter);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(includeProperties))
|
||||
{
|
||||
foreach (var includeProp in includeProperties.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
query = query.Include(includeProp);
|
||||
}
|
||||
}
|
||||
return query.ToListAsync();
|
||||
|
||||
|
||||
// return await _context.Projects.ToListAsync(); ;
|
||||
}
|
||||
}
|
||||
}
|
119
Marco.Pms.DataAccess/Repository/FeaturesRepository.cs
Normal file
119
Marco.Pms.DataAccess/Repository/FeaturesRepository.cs
Normal file
@ -0,0 +1,119 @@
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using Marco.Pms.DataAccess.Repository;
|
||||
using Marco.Pms.DataAccess.Repository.IRepository;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Marco.Pms.Model.Projects;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace BulkyBook.DataAccess.Repository
|
||||
{
|
||||
public class FeaturesRepository : Repository<Feature>, IFeatureRepository
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
internal DbSet<Feature> dbSet;
|
||||
|
||||
public FeaturesRepository(ApplicationDbContext db): base(db)
|
||||
{
|
||||
_context = db;
|
||||
this.dbSet = _context.Set<Feature>();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void Update(Feature project)
|
||||
{
|
||||
_context.Features.Update(project);
|
||||
}
|
||||
|
||||
|
||||
public Task<List<Feature>> GetAllAsync(Expression<Func<Feature, bool>>? filter = null, string? includeProperties = null)
|
||||
{
|
||||
|
||||
IQueryable<Feature> query = _context.Features;
|
||||
if (filter != null)
|
||||
{
|
||||
query.Where(filter);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(includeProperties))
|
||||
{
|
||||
foreach (var includeProp in includeProperties.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
query = query.Include(includeProp);
|
||||
}
|
||||
}
|
||||
return query.ToListAsync();
|
||||
|
||||
|
||||
// return await _context.Projects.ToListAsync(); ;
|
||||
}
|
||||
public Task<List<Feature>> GetAsync(Expression<Func<Feature, bool>>? filter = null, string? includeProperties = null)
|
||||
{
|
||||
|
||||
IQueryable<Feature> query = _context.Features;
|
||||
|
||||
if (filter != null)
|
||||
{
|
||||
query.Where(filter);
|
||||
//var projects1= query2.Where(filter).ToListAsync();
|
||||
}
|
||||
if (!string.IsNullOrEmpty(includeProperties))
|
||||
{
|
||||
foreach (var includeProp in includeProperties.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
query = query.Include(includeProp);
|
||||
}
|
||||
}
|
||||
|
||||
return query.ToListAsync();
|
||||
|
||||
|
||||
// return await _context.Projects.ToListAsync(); ;
|
||||
}
|
||||
|
||||
public async Task<Feature> CreateAsync(Feature projectModel)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _context.Features.AddAsync(projectModel);
|
||||
await _context.SaveChangesAsync();
|
||||
return projectModel;
|
||||
}
|
||||
catch (Exception ex) { throw ex; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//public async Task<Feature> UpdateAsync(int id, UpdateFeatureDto projectDto)
|
||||
//{
|
||||
|
||||
// var projectModel = await _context.Features.FirstOrDefaultAsync(item => item.Id == id);
|
||||
|
||||
// if (projectModel == null)
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
// projectModel.ContactPerson = projectDto.ContactPerson;
|
||||
// projectModel.ProjectAddress = projectDto.ProjectAddress;
|
||||
// projectModel.Name = projectDto.Name;
|
||||
// projectModel.EndDate = projectDto.EndDate;
|
||||
// projectModel.StartDate = projectDto.StartDate;
|
||||
// //projectModel.TenantId = projectDto.TenantId;
|
||||
// try
|
||||
// {
|
||||
// await _context.SaveChangesAsync();
|
||||
// }catch(Exception ex )
|
||||
// {
|
||||
// throw ex;
|
||||
// }
|
||||
|
||||
// return projectModel;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
22
Marco.Pms.DataAccess/Repository/FloorRepository.cs
Normal file
22
Marco.Pms.DataAccess/Repository/FloorRepository.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using Marco.Pms.DataAccess.Repository;
|
||||
using Marco.Pms.DataAccess.Repository.IRepository;
|
||||
using Marco.Pms.Model.Projects;
|
||||
|
||||
namespace BulkyBook.DataAccess.Repository
|
||||
{
|
||||
public class FloorRepository : Repository<Floor>, IFloorRepository
|
||||
{
|
||||
private readonly ApplicationDbContext _db;
|
||||
public FloorRepository(ApplicationDbContext db) : base(db)
|
||||
{
|
||||
_db = db;
|
||||
}
|
||||
|
||||
|
||||
public void Update(Floor floor)
|
||||
{
|
||||
_db.Floor.Update(floor);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace Marco.Pms.DataAccess.Repository.IRepository
|
||||
{
|
||||
public interface IActivityMasterRepository : IRepository<ActivityMaster>
|
||||
{
|
||||
void Update(ActivityMaster activity);
|
||||
Task<List<ActivityMaster>> GetAllAsync(Expression<Func<ActivityMaster, bool>>? filter = null, string? includeProperties = null);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
|
||||
namespace Marco.Pms.DataAccess.Repository.IRepository
|
||||
{
|
||||
public interface IApplicationRolesRepository : IRepository<ApplicationRole>
|
||||
{
|
||||
void Update(ApplicationRole role);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
|
||||
namespace Marco.Pms.DataAccess.Repository.IRepository
|
||||
{
|
||||
public interface IApplicationUserRepository : IRepository<ApplicationUser>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
using Marco.Pms.Model.AttendanceModule;
|
||||
|
||||
namespace Marco.Pms.DataAccess.Repository.IRepository
|
||||
{
|
||||
|
||||
public interface IAttendenceRepository : IRepository<Attendance>
|
||||
{
|
||||
void Update(Attendance employee);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
using Marco.Pms.Model.Projects;
|
||||
|
||||
namespace Marco.Pms.DataAccess.Repository.IRepository
|
||||
{
|
||||
public interface IBuildingRepository : IRepository<Building>
|
||||
{
|
||||
void Update(Building building);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
using Marco.Pms.Model.Employees;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace Marco.Pms.DataAccess.Repository.IRepository
|
||||
{
|
||||
|
||||
public interface IEmployeeRepository : IRepository<Employee>
|
||||
{
|
||||
void Update(Employee employee);
|
||||
Task<List<Employee>> GetAsync(Expression<Func<Employee, bool>>? filter = null, string? includeProperties = null);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using Marco.Pms.Model.Dtos.Project;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace Marco.Pms.DataAccess.Repository.IRepository
|
||||
{
|
||||
public interface IFeatureRepository : IRepository<Feature>
|
||||
{
|
||||
void Update(Feature Feature);
|
||||
Task<List<Feature>> GetAsync(Expression<Func<Feature, bool>>? filter = null, string? includeProperties = null);
|
||||
Task<List<Feature>> GetAllAsync(Expression<Func<Feature, bool>>? filter = null, string? includeProperties = null);
|
||||
Task<Feature> CreateAsync(Feature feature);
|
||||
// Task<Feature> UpdateAsync(int id, UpdateFeatureDto Feature);
|
||||
|
||||
// Task<List<Project>> GetAsync(int id, string? includeProperties = null);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
using Marco.Pms.Model.Projects;
|
||||
|
||||
namespace Marco.Pms.DataAccess.Repository.IRepository
|
||||
{
|
||||
public interface IFloorRepository : IRepository<Floor>
|
||||
{
|
||||
void Update(Floor floor);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using Marco.Pms.Model.Dtos.Project;
|
||||
using Marco.Pms.Model.Projects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.DataAccess.Repository.IRepository
|
||||
{
|
||||
public interface IProjectAllocationRepository
|
||||
{
|
||||
void Update(ProjectAllocation project);
|
||||
Task<List<ProjectAllocation>> GetAsync(Expression<Func<ProjectAllocation, bool>>? filter = null, string? includeProperties = null);
|
||||
Task<List<ProjectAllocation>> GetAllAsync(Expression<Func<ProjectAllocation, bool>>? filter = null, string? includeProperties = null);
|
||||
Task<ProjectAllocation> CreateAsync(ProjectAllocation project);
|
||||
Task<ProjectAllocation> UpdateAsync(int id, ProjectAllocation project);
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using Marco.Pms.Model.Dtos.Project;
|
||||
using Marco.Pms.Model.Projects;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace Marco.Pms.DataAccess.Repository.IRepository
|
||||
{
|
||||
public interface IProjectRepository : IRepository<Project>
|
||||
{
|
||||
void Update(Project project);
|
||||
Task<List<Project>> GetAsync(Expression<Func<Project, bool>>? filter = null, string? includeProperties = null);
|
||||
Task<List<Project>> GetAllAsync(Expression<Func<Project, bool>>? filter = null, string? includeProperties = null);
|
||||
Task<Project> CreateAsync(Project project);
|
||||
Task<Project> UpdateAsync(int id, UpdateProjectDto project);
|
||||
|
||||
// Task<List<Project>> GetAsync(int id, string? includeProperties = null);
|
||||
}
|
||||
|
||||
}
|
16
Marco.Pms.DataAccess/Repository/IRepository/IRepository.cs
Normal file
16
Marco.Pms.DataAccess/Repository/IRepository/IRepository.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace Marco.Pms.DataAccess.Repository.IRepository
|
||||
{
|
||||
public interface IRepository<T> where T : class
|
||||
{
|
||||
// T - Category
|
||||
IEnumerable<T> GetAll(Expression<Func<T, bool>>? filter, string? includeProperties = null);
|
||||
//T GetFirstOrDefault();
|
||||
T Get(Expression<Func<T, bool>> filter, string? includeProperties = null, bool tracked = false);
|
||||
Task<T> GetAsync(Expression<Func<T, bool>> filter, bool tracked = false, params Expression<Func<T, object>>[] includeProperties);
|
||||
void Add(T entity);
|
||||
void Remove(T entity);
|
||||
void RemoveRange(IEnumerable<T> entity);
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Marco.Pms.Model.Projects;
|
||||
|
||||
namespace Marco.Pms.DataAccess.Repository.IRepository
|
||||
{
|
||||
public interface IStatusRepository : IRepository<StatusMaster>
|
||||
{
|
||||
void Update(StatusMaster status);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
using Marco.Pms.Model.Activities;
|
||||
|
||||
namespace Marco.Pms.DataAccess.Repository.IRepository
|
||||
{
|
||||
|
||||
public interface ITaskAllocationRepository : IRepository<TaskAllocation>
|
||||
{
|
||||
void Update(TaskAllocation employeeAllocation);
|
||||
}
|
||||
|
||||
}
|
28
Marco.Pms.DataAccess/Repository/IRepository/IUnitOfWork.cs
Normal file
28
Marco.Pms.DataAccess/Repository/IRepository/IUnitOfWork.cs
Normal file
@ -0,0 +1,28 @@
|
||||
namespace Marco.Pms.DataAccess.Repository.IRepository
|
||||
{
|
||||
public interface IUnitOfWork
|
||||
{
|
||||
IApplicationUserRepository ApplicationUser { get; }
|
||||
|
||||
IEmployeeRepository Employee { get; }
|
||||
ITaskAllocationRepository EmployeeAllocation
|
||||
{ get; }
|
||||
IProjectRepository Project { get; }
|
||||
IProjectAllocationRepository ProjectAllocation { get; }
|
||||
|
||||
IBuildingRepository Building { get; }
|
||||
IFloorRepository Floor { get; }
|
||||
|
||||
IWorkAreaRepository WorkArea { get; }
|
||||
IWorkItemRepository WorkItem { get; }
|
||||
IWorkItemMappingReposiotry WorkItemMapping { get;}
|
||||
|
||||
|
||||
IAttendenceRepository Attendence { get; }
|
||||
IStatusRepository StatusMaster { get; }
|
||||
IActivityMasterRepository ActivityMaster { get; }
|
||||
IApplicationRolesRepository EmployeeRoles { get; }
|
||||
IFeatureRepository Features { get; }
|
||||
void Save();
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
using Marco.Pms.Model.Projects;
|
||||
|
||||
namespace Marco.Pms.DataAccess.Repository.IRepository
|
||||
{
|
||||
public interface IWorkAreaRepository : IRepository<WorkArea>
|
||||
{
|
||||
void Update(WorkArea workArea);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
using Marco.Pms.Model.Activities;
|
||||
|
||||
namespace Marco.Pms.DataAccess.Repository.IRepository
|
||||
{
|
||||
public interface IWorkItemMappingReposiotry : IRepository<WorkItemMapping>
|
||||
{
|
||||
void Update(WorkItemMapping mapping);
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
using Marco.Pms.Model.Activities;
|
||||
using Marco.Pms.Model.Projects;
|
||||
|
||||
namespace Marco.Pms.DataAccess.Repository.IRepository
|
||||
{
|
||||
public interface IWorkItemRepository : IRepository<WorkItem>
|
||||
{
|
||||
void Update(WorkItem workItem);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using Marco.Pms.DataAccess.Repository.IRepository;
|
||||
using Marco.Pms.Model.Dtos.Project;
|
||||
using Marco.Pms.Model.Projects;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.DataAccess.Repository
|
||||
{
|
||||
public class ProjectAllocationRepository : Repository<ProjectAllocation>, IProjectAllocationRepository
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
internal DbSet<ProjectAllocation> dbSet;
|
||||
|
||||
public ProjectAllocationRepository(ApplicationDbContext db) : base(db)
|
||||
{
|
||||
_context = db;
|
||||
this.dbSet = _context.Set<ProjectAllocation>();
|
||||
}
|
||||
|
||||
|
||||
public void Update(ProjectAllocation project)
|
||||
{
|
||||
_context.ProjectAllocations.Update(project);
|
||||
}
|
||||
|
||||
public async Task<ProjectAllocation> CreateAsync(ProjectAllocation project)
|
||||
{
|
||||
await _context.ProjectAllocations.AddAsync(project);
|
||||
await _context.SaveChangesAsync();
|
||||
return project;
|
||||
}
|
||||
|
||||
public Task<List<ProjectAllocation>> GetAllAsync(Expression<Func<ProjectAllocation, bool>>? filter = null, string? includeProperties = null)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<List<ProjectAllocation>> GetAsync(Expression<Func<ProjectAllocation, bool>>? filter = null, string? includeProperties = null)
|
||||
{
|
||||
IQueryable<ProjectAllocation> query = _context.ProjectAllocations;
|
||||
if (filter != null)
|
||||
{
|
||||
query.Where(filter);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(includeProperties))
|
||||
{
|
||||
foreach (var includeProp in includeProperties.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
query = query.Include(includeProp);
|
||||
}
|
||||
}
|
||||
return query.ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
public async Task<ProjectAllocation> UpdateAsync(int id, ProjectAllocation project)
|
||||
{
|
||||
var allocation = await _context.ProjectAllocations.FirstOrDefaultAsync(item => item.Id == id);
|
||||
|
||||
if (allocation == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
allocation.ProjectId = project.ProjectId;
|
||||
allocation.EmployeeId = project.EmployeeId;
|
||||
allocation.AllocationDate = project.AllocationDate;
|
||||
allocation.ReAllocationDate = project.ReAllocationDate;
|
||||
allocation.TenantId = project.TenantId;
|
||||
|
||||
|
||||
_context.ProjectAllocations.Update(allocation);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return allocation;
|
||||
}
|
||||
}
|
||||
}
|
146
Marco.Pms.DataAccess/Repository/ProjectRepository.cs
Normal file
146
Marco.Pms.DataAccess/Repository/ProjectRepository.cs
Normal file
@ -0,0 +1,146 @@
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using Marco.Pms.DataAccess.Repository;
|
||||
using Marco.Pms.DataAccess.Repository.IRepository;
|
||||
using Marco.Pms.Model.Dtos.Project;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Marco.Pms.Model.Projects;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
|
||||
|
||||
namespace BulkyBook.DataAccess.Repository
|
||||
{
|
||||
public class ProjectRepository : Repository<Project>, IProjectRepository
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
internal DbSet<Project> dbSet;
|
||||
|
||||
public ProjectRepository(ApplicationDbContext db) : base(db)
|
||||
{
|
||||
_context = db;
|
||||
this.dbSet = _context.Set<Project>();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void Update(Project project)
|
||||
{
|
||||
_context.Projects.Update(project);
|
||||
}
|
||||
|
||||
|
||||
public Task<List<Project>> GetAllAsync(Expression<Func<Project, bool>>? filter = null, string? includeProperties = null)
|
||||
{
|
||||
|
||||
IQueryable<Project> query = _context.Projects;
|
||||
if (filter != null)
|
||||
{
|
||||
query.Where(filter);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(includeProperties))
|
||||
{
|
||||
foreach (var includeProp in includeProperties.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
query = query.Include(includeProp);
|
||||
}
|
||||
}
|
||||
return query.ToListAsync();
|
||||
|
||||
|
||||
// return await _context.Projects.ToListAsync(); ;
|
||||
}
|
||||
public Task<List<Project>> GetAsync(Expression<Func<Project, bool>>? filter = null, string? includeProperties = null)
|
||||
{
|
||||
|
||||
IQueryable<Project> query = _context.Projects;
|
||||
//IQueryable<Project> query2 = _context.Projects;
|
||||
|
||||
Expression<Func<Project, bool>> filter1 = x => x.Id == 2;
|
||||
if (filter != null)
|
||||
{
|
||||
query.Where(filter);
|
||||
//var projects1= query2.Where(filter).ToListAsync();
|
||||
}
|
||||
if (!string.IsNullOrEmpty(includeProperties))
|
||||
{
|
||||
foreach (var includeProp in includeProperties.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
query = query.Include(includeProp);
|
||||
}
|
||||
}
|
||||
|
||||
return query.ToListAsync();
|
||||
|
||||
|
||||
// return await _context.Projects.ToListAsync(); ;
|
||||
}
|
||||
|
||||
public async Task<Project> CreateAsync(Project projectModel)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _context.Projects.AddAsync(projectModel);
|
||||
await _context.SaveChangesAsync();
|
||||
return projectModel;
|
||||
}
|
||||
catch (Exception ex) { throw ex; }
|
||||
|
||||
}
|
||||
|
||||
public async Task<Project> UpdateAsync(int id, UpdateProjectDto projectDto)
|
||||
{
|
||||
|
||||
var projectModel = await _context.Projects.FirstOrDefaultAsync(item => item.Id == id);
|
||||
|
||||
if (projectModel == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
projectModel.ContactPerson = projectDto.ContactPerson;
|
||||
projectModel.ProjectAddress = projectDto.ProjectAddress;
|
||||
projectModel.Name = projectDto.Name;
|
||||
projectModel.EndDate = projectDto.EndDate;
|
||||
projectModel.StartDate = projectDto.StartDate;
|
||||
//projectModel.TenantId = projectDto.TenantId;
|
||||
try
|
||||
{
|
||||
await _context.SaveChangesAsync();
|
||||
}catch(Exception ex )
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
|
||||
return projectModel;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//public Task<List<Project>> GetAsync(int id, string? includeProperties = null)
|
||||
//{
|
||||
|
||||
// IQueryable<Project> query = _context.Projects;
|
||||
// query.Where(c=>c.Id == id);
|
||||
// // Task<Project> project = _context.Projects.Where(c=>c.Id == id).SingleOrDefaultAsync();
|
||||
// //if (filter != null)
|
||||
// //{
|
||||
// // query.Where(filter);
|
||||
// //}
|
||||
// //if (!string.IsNullOrEmpty(includeProperties))
|
||||
// //{
|
||||
// // foreach (var includeProp in includeProperties.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
// // {
|
||||
// // query = query.Include(includeProp);
|
||||
// // }
|
||||
// //}
|
||||
// return query.ToListAsync();
|
||||
|
||||
|
||||
// // return await _context.Projects.ToListAsync(); ;
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
102
Marco.Pms.DataAccess/Repository/Repository.cs
Normal file
102
Marco.Pms.DataAccess/Repository/Repository.cs
Normal file
@ -0,0 +1,102 @@
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using Marco.Pms.DataAccess.Repository.IRepository;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace Marco.Pms.DataAccess.Repository
|
||||
{
|
||||
public class Repository<T> : IRepository<T> where T : class
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
internal DbSet<T> dbSet;
|
||||
public Repository(ApplicationDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
this.dbSet = _context.Set<T>();
|
||||
|
||||
//_db.Products.Include(u => u.Category);
|
||||
}
|
||||
public void Add(T entity)
|
||||
{
|
||||
dbSet.Add(entity);
|
||||
}
|
||||
|
||||
public T Get(Expression<Func<T, bool>> filter, string? includeProperties = null, bool tracked = false)
|
||||
{
|
||||
IQueryable<T> query = dbSet;
|
||||
if (tracked)
|
||||
{
|
||||
query = query.Where(filter);
|
||||
}
|
||||
else
|
||||
{
|
||||
query = query.AsNoTracking().Where(filter);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(includeProperties))
|
||||
{
|
||||
foreach (var includeProp in includeProperties.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
query = query.Include(includeProp);
|
||||
}
|
||||
}
|
||||
|
||||
return query.FirstOrDefault();
|
||||
|
||||
}
|
||||
|
||||
public async Task<T> GetAsync(Expression<Func<T, bool>> filter, bool tracked = false, params Expression<Func<T, object>>[] includeProperties)
|
||||
{
|
||||
IQueryable<T> query = dbSet;
|
||||
if (tracked)
|
||||
{
|
||||
query = query.Where(filter);
|
||||
}
|
||||
else
|
||||
{
|
||||
query = query.AsNoTracking().Where(filter);
|
||||
}
|
||||
|
||||
if (includeProperties != null)
|
||||
{
|
||||
foreach (var includeProp in includeProperties)
|
||||
{
|
||||
query = query.Include(includeProp);
|
||||
}
|
||||
}
|
||||
|
||||
return await query.SingleOrDefaultAsync();
|
||||
|
||||
}
|
||||
|
||||
public IEnumerable<T> GetAll(Expression<Func<T, bool>>? filter = null, string? includeProperties = null)
|
||||
{
|
||||
IQueryable<T> query = dbSet;
|
||||
if(filter != null)
|
||||
{
|
||||
query.Where(filter);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(includeProperties))
|
||||
{
|
||||
foreach (var includeProp in includeProperties.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
query = query.Include(includeProp);
|
||||
}
|
||||
}
|
||||
return query.ToList();
|
||||
|
||||
}
|
||||
|
||||
public void Remove(T entity)
|
||||
{
|
||||
dbSet.Remove(entity);
|
||||
}
|
||||
|
||||
public void RemoveRange(IEnumerable<T> entity)
|
||||
{
|
||||
dbSet.RemoveRange(entity);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
23
Marco.Pms.DataAccess/Repository/StatusRepository.cs
Normal file
23
Marco.Pms.DataAccess/Repository/StatusRepository.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using Marco.Pms.DataAccess.Repository;
|
||||
using Marco.Pms.DataAccess.Repository.IRepository;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Marco.Pms.Model.Projects;
|
||||
|
||||
namespace BulkyBook.DataAccess.Repository
|
||||
{
|
||||
public class StatusRepository : Repository<StatusMaster>, IStatusRepository
|
||||
{
|
||||
private readonly ApplicationDbContext _db;
|
||||
public StatusRepository(ApplicationDbContext db) : base(db)
|
||||
{
|
||||
_db = db;
|
||||
}
|
||||
|
||||
|
||||
public void Update(StatusMaster status)
|
||||
{
|
||||
_db.StatusMasters.Update(status);
|
||||
}
|
||||
}
|
||||
}
|
21
Marco.Pms.DataAccess/Repository/TaskAllocationRepository.cs
Normal file
21
Marco.Pms.DataAccess/Repository/TaskAllocationRepository.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using Marco.Pms.DataAccess.Repository;
|
||||
using Marco.Pms.DataAccess.Repository.IRepository;
|
||||
using Marco.Pms.Model.Activities;
|
||||
|
||||
namespace BulkyBook.DataAccess.Repository
|
||||
{
|
||||
public class TaskAllocationRepository : Repository<TaskAllocation>, ITaskAllocationRepository
|
||||
{
|
||||
private readonly ApplicationDbContext _db;
|
||||
public TaskAllocationRepository(ApplicationDbContext db) : base(db)
|
||||
{
|
||||
_db = db;
|
||||
}
|
||||
|
||||
public void Update(TaskAllocation employeeAllocation)
|
||||
{
|
||||
_db.TaskAllocations.Update(employeeAllocation);
|
||||
}
|
||||
}
|
||||
}
|
64
Marco.Pms.DataAccess/Repository/UnitOfWork.cs
Normal file
64
Marco.Pms.DataAccess/Repository/UnitOfWork.cs
Normal file
@ -0,0 +1,64 @@
|
||||
using BulkyBook.DataAccess.Repository;
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using Marco.Pms.DataAccess.Repository.IRepository;
|
||||
|
||||
namespace Marco.Pms.DataAccess.Repository
|
||||
{
|
||||
public class UnitOfWork : IUnitOfWork
|
||||
{
|
||||
private readonly ApplicationDbContext _db;
|
||||
|
||||
public IApplicationUserRepository ApplicationUser { get; private set; }
|
||||
|
||||
public IEmployeeRepository Employee { get; private set; }
|
||||
public ITaskAllocationRepository EmployeeAllocation { get; private set; }
|
||||
|
||||
public IProjectRepository Project { get; private set; }
|
||||
public IProjectAllocationRepository ProjectAllocation { get; private set; }
|
||||
|
||||
public IBuildingRepository Building { get; private set; }
|
||||
public IFloorRepository Floor { get; private set; }
|
||||
public IAttendenceRepository Attendence { get; private set; }
|
||||
|
||||
public IWorkAreaRepository WorkArea { get; private set; }
|
||||
|
||||
public IWorkItemRepository WorkItem { get; private set; }
|
||||
|
||||
public IWorkItemMappingReposiotry WorkItemMapping { get; private set; }
|
||||
|
||||
public IStatusRepository StatusMaster { get; private set; }
|
||||
public IActivityMasterRepository ActivityMaster { get; private set; }
|
||||
public IApplicationRolesRepository EmployeeRoles { get; private set; }
|
||||
public IFeatureRepository Features { get; private set; }
|
||||
|
||||
|
||||
public UnitOfWork(ApplicationDbContext db)
|
||||
{
|
||||
_db = db;
|
||||
Employee = new EmployeeRepository(_db);
|
||||
Project = new ProjectRepository(_db);
|
||||
ProjectAllocation = new ProjectAllocationRepository(_db);
|
||||
|
||||
Building = new BuildingRepository(_db);
|
||||
Floor = new FloorRepository(_db);
|
||||
WorkArea = new WorkAreaRepository(_db);
|
||||
WorkItem = new WorkItemRepository(_db);
|
||||
WorkItemMapping = new WorkItemMappingReporitury(_db);
|
||||
|
||||
ApplicationUser = new ApplicationUserRepository(_db);
|
||||
Attendence = new AttendenceRepository(_db);
|
||||
EmployeeAllocation = new TaskAllocationRepository(_db);
|
||||
|
||||
StatusMaster = new StatusRepository(_db);
|
||||
ActivityMaster = new ActivityMasterRepository(_db);
|
||||
EmployeeRoles = new ApplicationRolesRepository(_db);
|
||||
Features = new FeaturesRepository(_db);
|
||||
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
_db.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
22
Marco.Pms.DataAccess/Repository/WorkAreaRepository.cs
Normal file
22
Marco.Pms.DataAccess/Repository/WorkAreaRepository.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using Marco.Pms.DataAccess.Repository;
|
||||
using Marco.Pms.DataAccess.Repository.IRepository;
|
||||
using Marco.Pms.Model.Projects;
|
||||
|
||||
namespace BulkyBook.DataAccess.Repository
|
||||
{
|
||||
public class WorkAreaRepository : Repository<WorkArea>, IWorkAreaRepository
|
||||
{
|
||||
private readonly ApplicationDbContext _db;
|
||||
public WorkAreaRepository(ApplicationDbContext db) : base(db)
|
||||
{
|
||||
_db = db;
|
||||
}
|
||||
|
||||
|
||||
public void Update(WorkArea workArea)
|
||||
{
|
||||
_db.WorkAreas.Update(workArea);
|
||||
}
|
||||
}
|
||||
}
|
22
Marco.Pms.DataAccess/Repository/WorkItemMappingReporitury.cs
Normal file
22
Marco.Pms.DataAccess/Repository/WorkItemMappingReporitury.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using Marco.Pms.DataAccess.Repository;
|
||||
using Marco.Pms.DataAccess.Repository.IRepository;
|
||||
using Marco.Pms.Model.Activities;
|
||||
|
||||
namespace BulkyBook.DataAccess.Repository
|
||||
{
|
||||
public class WorkItemMappingReporitury : Repository<WorkItemMapping>, IWorkItemMappingReposiotry
|
||||
{
|
||||
private readonly ApplicationDbContext _db;
|
||||
public WorkItemMappingReporitury(ApplicationDbContext db) : base(db)
|
||||
{
|
||||
_db = db;
|
||||
}
|
||||
|
||||
|
||||
public void Update(WorkItemMapping workItem)
|
||||
{
|
||||
_db.WorkItemMapping.Update(workItem);
|
||||
}
|
||||
}
|
||||
}
|
22
Marco.Pms.DataAccess/Repository/WorkItemRepository.cs
Normal file
22
Marco.Pms.DataAccess/Repository/WorkItemRepository.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using Marco.Pms.DataAccess.Repository;
|
||||
using Marco.Pms.DataAccess.Repository.IRepository;
|
||||
using Marco.Pms.Model.Activities;
|
||||
|
||||
namespace BulkyBook.DataAccess.Repository
|
||||
{
|
||||
public class WorkItemRepository : Repository<WorkItem>, IWorkItemRepository
|
||||
{
|
||||
private readonly ApplicationDbContext _db;
|
||||
public WorkItemRepository(ApplicationDbContext db) : base(db)
|
||||
{
|
||||
_db = db;
|
||||
}
|
||||
|
||||
|
||||
public void Update(WorkItem workItem)
|
||||
{
|
||||
_db.WorkItems.Update(workItem);
|
||||
}
|
||||
}
|
||||
}
|
52
Marco.Pms.Model/Activities/TaskAllocation.cs
Normal file
52
Marco.Pms.Model/Activities/TaskAllocation.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using Marco.Pms.Model.Employees;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Marco.Pms.Model.Projects;
|
||||
using MarcoBMS.Utility;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
|
||||
namespace Marco.Pms.Model.Activities
|
||||
{
|
||||
public class TaskAllocation
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int EmployeeId { get; set; }
|
||||
[ForeignKey("EmployeeId")]
|
||||
[ValidateNever]
|
||||
public Employee Employee { get; set; }
|
||||
public EMP_ROLES EmployeeRole { get; set; }
|
||||
|
||||
public int ProjectId { get; set; }
|
||||
[ForeignKey("ProjectId")]
|
||||
[ValidateNever]
|
||||
public Project Project { get; set; }
|
||||
|
||||
public int BuildingId { get; set; }
|
||||
|
||||
[ForeignKey("BuildingId")]
|
||||
[ValidateNever]
|
||||
public Building Building { get; set; }
|
||||
|
||||
public DateTime AllocationDate { get; set; }
|
||||
public DateTime ReAllocationDate { get; set; }
|
||||
|
||||
public int WorkAreaId { get; set; }
|
||||
|
||||
[ForeignKey("WorkAreaId")]
|
||||
[ValidateNever]
|
||||
public WorkArea WorkArea { get; set; }
|
||||
|
||||
public List<ActivityMaster> AllotedTask { get; set; }
|
||||
|
||||
[DisplayName("TenantId")]
|
||||
public int TenantId { get; set; }
|
||||
|
||||
[ValidateNever]
|
||||
[ForeignKey(nameof(TenantId))]
|
||||
public Tenant Tenant { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
35
Marco.Pms.Model/Activities/WorkItem.cs
Normal file
35
Marco.Pms.Model/Activities/WorkItem.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Marco.Pms.Model.Projects;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Marco.Pms.Model.Activities
|
||||
{
|
||||
public class WorkItem
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int ActivityId { get; set; }
|
||||
|
||||
public int WorkAreaId { get; set; }
|
||||
[ForeignKey("WorkAreaId")]
|
||||
[ValidateNever]
|
||||
public WorkArea WorkArea { get; set; }
|
||||
|
||||
|
||||
[ForeignKey("ActivityId")]
|
||||
[ValidateNever]
|
||||
public ActivityMaster ActivityMaster { get; set; }
|
||||
|
||||
public int PlannedWork { get; set; }
|
||||
public int CompletedWork { get; set; }
|
||||
public DateTime TaskDate { get; set; }
|
||||
|
||||
[DisplayName("TenantId")]
|
||||
public int TenantId { get; set; }
|
||||
|
||||
[ValidateNever]
|
||||
[ForeignKey(nameof(TenantId))]
|
||||
public Tenant Tenant { get; set; }
|
||||
}
|
||||
}
|
29
Marco.Pms.Model/Activities/WorkItemMapping.cs
Normal file
29
Marco.Pms.Model/Activities/WorkItemMapping.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Marco.Pms.Model.Projects;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Marco.Pms.Model.Activities
|
||||
{
|
||||
public class WorkItemMapping
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int WorkAreaId { get; set; }
|
||||
[ForeignKey("WorkAreaId")]
|
||||
[ValidateNever]
|
||||
public WorkArea WorkArea { get; set; }
|
||||
public int WorkItemId { get; set; }
|
||||
[ForeignKey("WorkItemId")]
|
||||
[ValidateNever]
|
||||
public WorkItem WorkItem { get; set; }
|
||||
|
||||
[DisplayName("TenantId")]
|
||||
public int TenantId { get; set; }
|
||||
|
||||
[ValidateNever]
|
||||
[ForeignKey(nameof(TenantId))]
|
||||
public Tenant Tenant { get; set; }
|
||||
|
||||
}
|
||||
}
|
40
Marco.Pms.Model/AttendanceModule/Attendance.cs
Normal file
40
Marco.Pms.Model/AttendanceModule/Attendance.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using Marco.Pms.Model.Dtos.Attendance;
|
||||
using Marco.Pms.Model.Employees;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Marco.Pms.Model.AttendanceModule
|
||||
{
|
||||
public class Attendance
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Comment { get; set; } = string.Empty;
|
||||
public int EmployeeID { get; set; }
|
||||
|
||||
|
||||
public DateTime Date { get; set; }
|
||||
public int ProjectID { get; set; }
|
||||
|
||||
public DateTime AttendanceDate { get; set; }
|
||||
public DateTime? InTime { get; set; }
|
||||
public DateTime? OutTime { get; set; }
|
||||
public bool IsApproved { get; set; }
|
||||
public ATTENDANCE_MARK_TYPE Activity { get; set; }
|
||||
|
||||
public int? ApprovedBy { get; set; }
|
||||
[ForeignKey("EmployeeID")]
|
||||
[ValidateNever]
|
||||
public Employee Approver { get; set; }
|
||||
|
||||
|
||||
[DisplayName("TenantId")]
|
||||
public int TenantId { get; set; }
|
||||
[ValidateNever]
|
||||
[ForeignKey(nameof(TenantId))]
|
||||
public Tenant Tenant { get; set; }
|
||||
|
||||
}
|
||||
}
|
51
Marco.Pms.Model/AttendanceModule/AttendanceLog.cs
Normal file
51
Marco.Pms.Model/AttendanceModule/AttendanceLog.cs
Normal file
@ -0,0 +1,51 @@
|
||||
using Marco.Pms.Model.Dtos.Attendance;
|
||||
using Marco.Pms.Model.Employees;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
|
||||
namespace Marco.Pms.Model.AttendanceModule
|
||||
{
|
||||
public class AttendanceLog
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Comment { get; set; } = string.Empty;
|
||||
public int AttendanceId { get; set; }
|
||||
[ForeignKey("AttendanceId")]
|
||||
[ValidateNever]
|
||||
public Attendance? Attendance { get; set; }
|
||||
|
||||
public int EmployeeID { get; set; }
|
||||
[ForeignKey("EmployeeID")]
|
||||
[ValidateNever]
|
||||
public Employee? Employee { get; set; }
|
||||
|
||||
public DateTime? ActivityTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// CheckIn, CheckOut, RequestRegularize, Regularize, Reject
|
||||
/// </summary>
|
||||
public ATTENDANCE_MARK_TYPE Activity { get; set; }
|
||||
|
||||
|
||||
public byte[]? Photo { get; set; } // To store the captured photo
|
||||
public string? Latitude { get; set; }
|
||||
public string? Longitude { get; set; }
|
||||
|
||||
public DateTime UpdatedOn { get; set; }
|
||||
|
||||
public int? UpdatedBy { get; set; }
|
||||
[ForeignKey("UpdatedBy")]
|
||||
[ValidateNever]
|
||||
public Employee? UpdatedByEmployee { get; set; }
|
||||
|
||||
|
||||
[DisplayName("TenantId")]
|
||||
public int TenantId { get; set; }
|
||||
[ValidateNever]
|
||||
[ForeignKey(nameof(TenantId))]
|
||||
public Tenant Tenant { get; set; }
|
||||
}
|
||||
}
|
11
Marco.Pms.Model/Authentication/JwtSettings.cs
Normal file
11
Marco.Pms.Model/Authentication/JwtSettings.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace Marco.Pms.Model.Authentication
|
||||
{
|
||||
public class JwtSettings
|
||||
{
|
||||
public string Key { get; set; }
|
||||
public string Issuer { get; set; }
|
||||
public string Audience { get; set; }
|
||||
public int ExpiresInMinutes { get; set; }
|
||||
public int RefreshTokenExpiresInDays { get; set; }
|
||||
}
|
||||
}
|
20
Marco.Pms.Model/Authentication/RefreshToken.cs
Normal file
20
Marco.Pms.Model/Authentication/RefreshToken.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace Marco.Pms.Model.Authentication
|
||||
{
|
||||
public class RefreshToken
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Token { get; set; }
|
||||
public string UserId { get; set; }
|
||||
public DateTime ExpiryDate { get; set; }
|
||||
public bool IsRevoked { get; set; }
|
||||
public bool IsUsed { get; set; }
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime? RevokedAt { get; set; }
|
||||
|
||||
|
||||
// Relationship with the User
|
||||
public IdentityUser User { get; set; }
|
||||
}
|
||||
}
|
28
Marco.Pms.Model/Dtos/Attendance/RecordAttendanceDot.cs
Normal file
28
Marco.Pms.Model/Dtos/Attendance/RecordAttendanceDot.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using Marco.Pms.Model.Utilities;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Attendance
|
||||
{
|
||||
public class RecordAttendanceDot
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string Comment { get; set; }
|
||||
public int EmployeeID { get; set; }
|
||||
public int ProjectID { get; set; }
|
||||
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
public string? MarkTime { get; set; }
|
||||
public string Latitude { get; set; }
|
||||
public string Longitude { get; set; }
|
||||
|
||||
|
||||
public ATTENDANCE_MARK_TYPE Action { get; set; }
|
||||
|
||||
public List<FileUploadModel>? Image { get; set; }
|
||||
}
|
||||
|
||||
public enum ATTENDANCE_MARK_TYPE
|
||||
{
|
||||
CHECK_IN = 0, CHECK_OUT = 1, REQUEST_REGULARIZE = 2, REQUEST_DELETE = 3, REGULARIZE = 4, REGULARIZE_REJECT = 5
|
||||
}
|
||||
}
|
38
Marco.Pms.Model/Dtos/Employees/ApplicationUserDto.cs
Normal file
38
Marco.Pms.Model/Dtos/Employees/ApplicationUserDto.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using Marco.Pms.Model.Employees;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Employees
|
||||
{
|
||||
public class ApplicationUserDto
|
||||
{
|
||||
public ApplicationUserDto() { }
|
||||
public int? Id { get; set; }
|
||||
public string FirstName { get; set; }
|
||||
public string LastName { get; set; }
|
||||
public string? MiddleName { get; set; }
|
||||
public string? Email { get; set; }
|
||||
|
||||
public string Gender { get; set; }
|
||||
public DateTime? BirthDate { get; set; }
|
||||
public DateTime? JoiningDate { get; set; }
|
||||
|
||||
public string PeramnentAddress { get; set; }
|
||||
public string CurrentAddress { get; set; }
|
||||
public string PhoneNumber { get; set; }
|
||||
|
||||
public string EmergencyPhoneNumber { get; set; }
|
||||
|
||||
public string? AadharNumber { get; set; }
|
||||
|
||||
public string? PanNumber { get; set; }
|
||||
|
||||
public IFormFile? Photo { get; set; } // To store the captured photo
|
||||
public List<IFormFile> Documents { get; set; }
|
||||
public string? ApplicationUserId { get; set; }
|
||||
|
||||
public Guid RoleId { get; set; }
|
||||
|
||||
public int TenantId { get; set; }
|
||||
|
||||
}
|
||||
}
|
26
Marco.Pms.Model/Dtos/Employees/AttendanceDto.cs
Normal file
26
Marco.Pms.Model/Dtos/Employees/AttendanceDto.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using Marco.Pms.Model.Employees;
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Employees
|
||||
{
|
||||
public class AttendanceDto
|
||||
{
|
||||
public string Comment { get; set; }
|
||||
public int EmployeeID { get; set; }
|
||||
public DateTime? InTime { get; set; }
|
||||
public DateTime? OutTime { get; set; }
|
||||
public int ShiftId { get; set; }
|
||||
public decimal? Latitude { get; set; }
|
||||
public decimal? Longitude { get; set; }
|
||||
public bool IsApproved { get; set; }
|
||||
}
|
||||
|
||||
}
|
57
Marco.Pms.Model/Dtos/Employees/CreateUserDto.cs
Normal file
57
Marco.Pms.Model/Dtos/Employees/CreateUserDto.cs
Normal file
@ -0,0 +1,57 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Employees
|
||||
{
|
||||
public class CreateUserDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string FirstName { get; set; }
|
||||
public string LastName { get; set; }
|
||||
public string? MiddleName { get; set; }
|
||||
public string? Email { get; set; }
|
||||
|
||||
public string Gender { get; set; }
|
||||
public string? BirthDate { get; set; }
|
||||
public string JoiningDate { get; set; }
|
||||
|
||||
public string? PeramnentAddress { get; set; }
|
||||
public string? CurrentAddress { get; set; }
|
||||
public string PhoneNumber { get; set; }
|
||||
|
||||
public string EmergencyPhoneNumber { get; set; }
|
||||
public string EmergencyContactPerson { get; set; }
|
||||
|
||||
public string? AadharNumber { get; set; }
|
||||
|
||||
public string? PanNumber { get; set; }
|
||||
|
||||
public IFormFile? Photo { get; set; } // To store the captured photo
|
||||
public List<IFormFile>? Documents { get; set; }
|
||||
|
||||
public string JobRoleId { get; set; }
|
||||
|
||||
// public int TenantId { get; set; }
|
||||
}
|
||||
public class CreateQuickUserDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string FirstName { get; set; }
|
||||
public string LastName { get; set; }
|
||||
|
||||
public string Gender { get; set; }
|
||||
|
||||
public string? CurrentAddress { get; set; }
|
||||
public string PhoneNumber { get; set; }
|
||||
|
||||
public string EmergencyPhoneNumber { get; set; }
|
||||
public string EmergencyContactPerson { get; set; }
|
||||
|
||||
public string JobRoleId { get; set; }
|
||||
}
|
||||
|
||||
}
|
11
Marco.Pms.Model/Dtos/Employees/EmployeeRoleDot.cs
Normal file
11
Marco.Pms.Model/Dtos/Employees/EmployeeRoleDot.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace Marco.Pms.Model.Dtos.Employees
|
||||
{
|
||||
public class EmployeeRoleDot
|
||||
{
|
||||
|
||||
public string Id { get; set; } = string.Empty;
|
||||
public int EmployeeId { get; set; }
|
||||
public Guid RoleId { get; set; }
|
||||
public bool IsEnabled { get; set; }
|
||||
}
|
||||
}
|
16
Marco.Pms.Model/Dtos/ForgotPasswordDto.cs
Normal file
16
Marco.Pms.Model/Dtos/ForgotPasswordDto.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos
|
||||
{
|
||||
public class ForgotPasswordDto
|
||||
{
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
public string Email { get; set; }
|
||||
}
|
||||
}
|
14
Marco.Pms.Model/Dtos/LoginDto.cs
Normal file
14
Marco.Pms.Model/Dtos/LoginDto.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos
|
||||
{
|
||||
public class LoginDto
|
||||
{
|
||||
public string Username { get; set; }
|
||||
public string Password { get; set; }
|
||||
}
|
||||
}
|
7
Marco.Pms.Model/Dtos/LogoutDto.cs
Normal file
7
Marco.Pms.Model/Dtos/LogoutDto.cs
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
namespace Marco.Pms.Model.Dtos
|
||||
{
|
||||
public class LogoutDto
|
||||
{ public string RefreshToken { get; set; }
|
||||
}
|
||||
}
|
27
Marco.Pms.Model/Dtos/Project/BuildingDot.cs
Normal file
27
Marco.Pms.Model/Dtos/Project/BuildingDot.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Project
|
||||
{
|
||||
public class BuildingDot
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
[DisplayName("Building Name")]
|
||||
public string Name { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public int ProjectId { get; set; }
|
||||
|
||||
[DisplayName("TenantId")]
|
||||
public int TenantId { get; set; }
|
||||
}
|
||||
}
|
14
Marco.Pms.Model/Dtos/Project/BuildingVM.cs
Normal file
14
Marco.Pms.Model/Dtos/Project/BuildingVM.cs
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Project
|
||||
{
|
||||
public class BuildingVM
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string? Description { get; set; }
|
||||
|
||||
public List<FloorsVM> Floors { get; set; }
|
||||
|
||||
}
|
||||
}
|
31
Marco.Pms.Model/Dtos/Project/CreateProjectDto.cs
Normal file
31
Marco.Pms.Model/Dtos/Project/CreateProjectDto.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Project
|
||||
{
|
||||
public class CreateProjectDto
|
||||
{
|
||||
//public int Id { get; set; }
|
||||
[Required(ErrorMessage = "Project Name is required!")]
|
||||
[DisplayName("Project Name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[DisplayName("Project Address")]
|
||||
[Required(ErrorMessage = "Project Address is required!")]
|
||||
public string ProjectAddress { get; set; }
|
||||
|
||||
|
||||
[DisplayName("Contact Person")]
|
||||
public string ContactPerson { get; set; }
|
||||
|
||||
|
||||
public DateTime? StartDate { get; set; }
|
||||
public DateTime? EndDate { get; set; }
|
||||
|
||||
[DisplayName("Project Status")]
|
||||
[Required(ErrorMessage = "Project Status is required!")]
|
||||
public int ProjectStatusId { get; set; }
|
||||
|
||||
public int TenantId { get; set; }
|
||||
}
|
||||
}
|
30
Marco.Pms.Model/Dtos/Project/FloorDot.cs
Normal file
30
Marco.Pms.Model/Dtos/Project/FloorDot.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Marco.Pms.Model.Projects;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Project
|
||||
{
|
||||
public class FloorDot
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[DisplayName("Floor Name")]
|
||||
public string FloorName { get; set; }
|
||||
|
||||
|
||||
public int BuildingId { get; set; }
|
||||
|
||||
|
||||
[DisplayName("TenantId")]
|
||||
public int TenantId { get; set; }
|
||||
}
|
||||
}
|
22
Marco.Pms.Model/Dtos/Project/FloorsVM.cs
Normal file
22
Marco.Pms.Model/Dtos/Project/FloorsVM.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Project
|
||||
{
|
||||
public class FloorsVM
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[DisplayName("Floor Name")]
|
||||
public string FloorName { get; set; }
|
||||
|
||||
public List<WorkAreaVM> WorkAreas { get; set; }
|
||||
|
||||
}
|
||||
}
|
16
Marco.Pms.Model/Dtos/Project/InfraDot.cs
Normal file
16
Marco.Pms.Model/Dtos/Project/InfraDot.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using Marco.Pms.Model.Projects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Project
|
||||
{
|
||||
public class InfraDot
|
||||
{
|
||||
public BuildingDot? Building { get; set; }
|
||||
public FloorDot? Floor { get; set; }
|
||||
public WorkAreaDot? WorkArea { get; set; }
|
||||
}
|
||||
}
|
11
Marco.Pms.Model/Dtos/Project/ProjectAllocationDot.cs
Normal file
11
Marco.Pms.Model/Dtos/Project/ProjectAllocationDot.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace Marco.Pms.Model.Dtos.Project
|
||||
{
|
||||
public class ProjectAllocationDot
|
||||
{
|
||||
public int EmpID { get; set; }
|
||||
public Guid RoleID { get; set; }
|
||||
public int ProjectId { get; set; }
|
||||
|
||||
public bool Status { get; set; }
|
||||
}
|
||||
}
|
41
Marco.Pms.Model/Dtos/Project/ProjectDto.cs
Normal file
41
Marco.Pms.Model/Dtos/Project/ProjectDto.cs
Normal file
@ -0,0 +1,41 @@
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Marco.Pms.Model.Projects;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Project
|
||||
{
|
||||
public class ProjectDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required(ErrorMessage = "Project Name is required!")]
|
||||
[DisplayName("Project Name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[DisplayName("Project Address")]
|
||||
[Required(ErrorMessage = "Project Address is required!")]
|
||||
public string ProjectAddress { get; set; }
|
||||
|
||||
|
||||
[DisplayName("Contact Person")]
|
||||
public string ContactPerson { get; set; }
|
||||
|
||||
|
||||
public DateTime? StartDate { get; set; }
|
||||
public DateTime? EndDate { get; set; }
|
||||
|
||||
[DisplayName("Project Status")]
|
||||
[Required(ErrorMessage = "Project Status is required!")]
|
||||
public int ProjectStatusId { get; set; }
|
||||
public int TenantId { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
15
Marco.Pms.Model/Dtos/Project/ProjectVM.cs
Normal file
15
Marco.Pms.Model/Dtos/Project/ProjectVM.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using Marco.Pms.Model.Projects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Project
|
||||
{
|
||||
public class ProjectVM : ProjectDto
|
||||
{
|
||||
public List<BuildingVM> Buildings { get; set; }
|
||||
|
||||
}
|
||||
}
|
31
Marco.Pms.Model/Dtos/Project/UpdateProjectDto.cs
Normal file
31
Marco.Pms.Model/Dtos/Project/UpdateProjectDto.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Project
|
||||
{
|
||||
public class UpdateProjectDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required(ErrorMessage = "Project Name is required!")]
|
||||
[DisplayName("Project Name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[DisplayName("Project Address")]
|
||||
[Required(ErrorMessage = "Project Address is required!")]
|
||||
public string ProjectAddress { get; set; }
|
||||
|
||||
|
||||
[DisplayName("Contact Person")]
|
||||
public string ContactPerson { get; set; }
|
||||
|
||||
|
||||
public DateTime? StartDate { get; set; }
|
||||
public DateTime? EndDate { get; set; }
|
||||
|
||||
[DisplayName("Project Status")]
|
||||
[Required(ErrorMessage = "Project Status is required!")]
|
||||
public int ProjectStatusId { get; set; }
|
||||
|
||||
public int TenantId { get; set; }
|
||||
}
|
||||
}
|
30
Marco.Pms.Model/Dtos/Project/WorkAreaDot.cs
Normal file
30
Marco.Pms.Model/Dtos/Project/WorkAreaDot.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using Marco.Pms.Model.Entitlements;
|
||||
using Marco.Pms.Model.Projects;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Project
|
||||
{
|
||||
public class WorkAreaDot
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[DisplayName("Area Name")]
|
||||
public string AreaName { get; set; }
|
||||
|
||||
public int FloorId { get; set; }
|
||||
|
||||
[DisplayName("TenantId")]
|
||||
public int TenantId { get; set; }
|
||||
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user