Added the Check list in Activity Master APIs

This commit is contained in:
ashutosh.nehete 2025-04-14 12:28:25 +05:30
parent e4f8e507d5
commit a51c11389d
41 changed files with 3340 additions and 193 deletions

View File

@ -72,6 +72,7 @@ namespace Marco.Pms.DataAccess.Data
public DbSet<RolePermissionMappings> RolePermissionMappings { get; set; } public DbSet<RolePermissionMappings> RolePermissionMappings { get; set; }
public DbSet<Industry>Industries { get; set; } public DbSet<Industry>Industries { get; set; }
public DbSet<ActivityCheckList>ActivityCheckLists { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder) protected override void OnModelCreating(ModelBuilder modelBuilder)
{ {

View File

@ -79,7 +79,7 @@ namespace Marco.Pms.DataAccess.Initializer
ApplicationUserId = user.Id, ApplicationUserId = user.Id,
BirthDate = DateTime.MinValue, BirthDate = DateTime.MinValue,
PanNumber = "", PanNumber = "",
PeramnentAddress = "", PermanentAddress = "",
PhoneNumber = "", PhoneNumber = "",
TenantId = user.TenantId TenantId = user.TenantId
}; };

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,984 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Marco.Pms.DataAccess.Migrations
{
/// <inheritdoc />
public partial class Added_Check_List_Table : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "PeramnentAddress",
table: "Employees");
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "WorkShifts",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "Tenants",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "DomainName",
table: "Tenants",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Description",
table: "Tenants",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "ContactNumber",
table: "Tenants",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "ContactName",
table: "Tenants",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Status",
table: "StatusMasters",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "UserId",
table: "RefreshTokens",
type: "varchar(255)",
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(255)")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Token",
table: "RefreshTokens",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "ProjectAddress",
table: "Projects",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "ContactPerson",
table: "Projects",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Description",
table: "Modules",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "JobRoles",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "Industries",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "Features",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Description",
table: "Features",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "FeaturePermissions",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Description",
table: "FeaturePermissions",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "PhoneNumber",
table: "Employees",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "LastName",
table: "Employees",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Gender",
table: "Employees",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "FirstName",
table: "Employees",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "EmergencyPhoneNumber",
table: "Employees",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "EmergencyContactPerson",
table: "Employees",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "CurrentAddress",
table: "Employees",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "PermanentAddress",
table: "Employees",
type: "longtext",
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Role",
table: "ApplicationRoles",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "Description",
table: "ApplicationRoles",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "UnitOfMeasurement",
table: "ActivityMasters",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "ActivityName",
table: "ActivityMasters",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<bool>(
name: "IsActive",
table: "ActivityMasters",
type: "tinyint(1)",
nullable: false,
defaultValue: false);
migrationBuilder.CreateTable(
name: "ActivityCheckLists",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
ActivityMasterId = table.Column<int>(type: "int", nullable: false),
Check = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
IsChecked = table.Column<bool>(type: "tinyint(1)", nullable: false),
IsMandatory = table.Column<bool>(type: "tinyint(1)", nullable: false),
TenantId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ActivityCheckLists", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "ActivityMasters",
keyColumn: "Id",
keyValue: 1,
column: "IsActive",
value: true);
migrationBuilder.UpdateData(
table: "ActivityMasters",
keyColumn: "Id",
keyValue: 2,
column: "IsActive",
value: true);
migrationBuilder.UpdateData(
table: "ActivityMasters",
keyColumn: "Id",
keyValue: 3,
column: "IsActive",
value: true);
migrationBuilder.UpdateData(
table: "ActivityMasters",
keyColumn: "Id",
keyValue: 4,
column: "IsActive",
value: true);
migrationBuilder.UpdateData(
table: "ActivityMasters",
keyColumn: "Id",
keyValue: 5,
column: "IsActive",
value: true);
migrationBuilder.UpdateData(
table: "ActivityMasters",
keyColumn: "Id",
keyValue: 6,
column: "IsActive",
value: true);
migrationBuilder.UpdateData(
table: "ActivityMasters",
keyColumn: "Id",
keyValue: 7,
column: "IsActive",
value: true);
migrationBuilder.UpdateData(
table: "ActivityMasters",
keyColumn: "Id",
keyValue: 8,
column: "IsActive",
value: true);
migrationBuilder.UpdateData(
table: "ActivityMasters",
keyColumn: "Id",
keyValue: 9,
column: "IsActive",
value: true);
migrationBuilder.UpdateData(
table: "ActivityMasters",
keyColumn: "Id",
keyValue: 10,
column: "IsActive",
value: true);
migrationBuilder.UpdateData(
table: "ActivityMasters",
keyColumn: "Id",
keyValue: 11,
column: "IsActive",
value: true);
migrationBuilder.UpdateData(
table: "ActivityMasters",
keyColumn: "Id",
keyValue: 12,
column: "IsActive",
value: true);
migrationBuilder.UpdateData(
table: "ActivityMasters",
keyColumn: "Id",
keyValue: 13,
column: "IsActive",
value: true);
migrationBuilder.UpdateData(
table: "ActivityMasters",
keyColumn: "Id",
keyValue: 14,
column: "IsActive",
value: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ActivityCheckLists");
migrationBuilder.DropColumn(
name: "PermanentAddress",
table: "Employees");
migrationBuilder.DropColumn(
name: "IsActive",
table: "ActivityMasters");
migrationBuilder.UpdateData(
table: "WorkShifts",
keyColumn: "Name",
keyValue: null,
column: "Name",
value: "");
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "WorkShifts",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Tenants",
keyColumn: "Name",
keyValue: null,
column: "Name",
value: "");
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "Tenants",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Tenants",
keyColumn: "DomainName",
keyValue: null,
column: "DomainName",
value: "");
migrationBuilder.AlterColumn<string>(
name: "DomainName",
table: "Tenants",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Tenants",
keyColumn: "Description",
keyValue: null,
column: "Description",
value: "");
migrationBuilder.AlterColumn<string>(
name: "Description",
table: "Tenants",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Tenants",
keyColumn: "ContactNumber",
keyValue: null,
column: "ContactNumber",
value: "");
migrationBuilder.AlterColumn<string>(
name: "ContactNumber",
table: "Tenants",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Tenants",
keyColumn: "ContactName",
keyValue: null,
column: "ContactName",
value: "");
migrationBuilder.AlterColumn<string>(
name: "ContactName",
table: "Tenants",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "StatusMasters",
keyColumn: "Status",
keyValue: null,
column: "Status",
value: "");
migrationBuilder.AlterColumn<string>(
name: "Status",
table: "StatusMasters",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "RefreshTokens",
keyColumn: "UserId",
keyValue: null,
column: "UserId",
value: "");
migrationBuilder.AlterColumn<string>(
name: "UserId",
table: "RefreshTokens",
type: "varchar(255)",
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(255)",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "RefreshTokens",
keyColumn: "Token",
keyValue: null,
column: "Token",
value: "");
migrationBuilder.AlterColumn<string>(
name: "Token",
table: "RefreshTokens",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Projects",
keyColumn: "ProjectAddress",
keyValue: null,
column: "ProjectAddress",
value: "");
migrationBuilder.AlterColumn<string>(
name: "ProjectAddress",
table: "Projects",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Projects",
keyColumn: "ContactPerson",
keyValue: null,
column: "ContactPerson",
value: "");
migrationBuilder.AlterColumn<string>(
name: "ContactPerson",
table: "Projects",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Modules",
keyColumn: "Description",
keyValue: null,
column: "Description",
value: "");
migrationBuilder.AlterColumn<string>(
name: "Description",
table: "Modules",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "JobRoles",
keyColumn: "Name",
keyValue: null,
column: "Name",
value: "");
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "JobRoles",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Industries",
keyColumn: "Name",
keyValue: null,
column: "Name",
value: "");
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "Industries",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Features",
keyColumn: "Name",
keyValue: null,
column: "Name",
value: "");
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "Features",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Features",
keyColumn: "Description",
keyValue: null,
column: "Description",
value: "");
migrationBuilder.AlterColumn<string>(
name: "Description",
table: "Features",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "FeaturePermissions",
keyColumn: "Name",
keyValue: null,
column: "Name",
value: "");
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "FeaturePermissions",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "FeaturePermissions",
keyColumn: "Description",
keyValue: null,
column: "Description",
value: "");
migrationBuilder.AlterColumn<string>(
name: "Description",
table: "FeaturePermissions",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Employees",
keyColumn: "PhoneNumber",
keyValue: null,
column: "PhoneNumber",
value: "");
migrationBuilder.AlterColumn<string>(
name: "PhoneNumber",
table: "Employees",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Employees",
keyColumn: "LastName",
keyValue: null,
column: "LastName",
value: "");
migrationBuilder.AlterColumn<string>(
name: "LastName",
table: "Employees",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Employees",
keyColumn: "Gender",
keyValue: null,
column: "Gender",
value: "");
migrationBuilder.AlterColumn<string>(
name: "Gender",
table: "Employees",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Employees",
keyColumn: "FirstName",
keyValue: null,
column: "FirstName",
value: "");
migrationBuilder.AlterColumn<string>(
name: "FirstName",
table: "Employees",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Employees",
keyColumn: "EmergencyPhoneNumber",
keyValue: null,
column: "EmergencyPhoneNumber",
value: "");
migrationBuilder.AlterColumn<string>(
name: "EmergencyPhoneNumber",
table: "Employees",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Employees",
keyColumn: "EmergencyContactPerson",
keyValue: null,
column: "EmergencyContactPerson",
value: "");
migrationBuilder.AlterColumn<string>(
name: "EmergencyContactPerson",
table: "Employees",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Employees",
keyColumn: "CurrentAddress",
keyValue: null,
column: "CurrentAddress",
value: "");
migrationBuilder.AlterColumn<string>(
name: "CurrentAddress",
table: "Employees",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "PeramnentAddress",
table: "Employees",
type: "longtext",
nullable: false)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "ApplicationRoles",
keyColumn: "Role",
keyValue: null,
column: "Role",
value: "");
migrationBuilder.AlterColumn<string>(
name: "Role",
table: "ApplicationRoles",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "ApplicationRoles",
keyColumn: "Description",
keyValue: null,
column: "Description",
value: "");
migrationBuilder.AlterColumn<string>(
name: "Description",
table: "ApplicationRoles",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "ActivityMasters",
keyColumn: "UnitOfMeasurement",
keyValue: null,
column: "UnitOfMeasurement",
value: "");
migrationBuilder.AlterColumn<string>(
name: "UnitOfMeasurement",
table: "ActivityMasters",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "ActivityMasters",
keyColumn: "ActivityName",
keyValue: null,
column: "ActivityName",
value: "");
migrationBuilder.AlterColumn<string>(
name: "ActivityName",
table: "ActivityMasters",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
}
}

View File

@ -258,11 +258,9 @@ namespace Marco.Pms.DataAccess.Migrations
.HasColumnType("datetime(6)"); .HasColumnType("datetime(6)");
b.Property<string>("Token") b.Property<string>("Token")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<string>("UserId") b.Property<string>("UserId")
.IsRequired()
.HasColumnType("varchar(255)"); .HasColumnType("varchar(255)");
b.HasKey("Id"); b.HasKey("Id");
@ -290,26 +288,21 @@ namespace Marco.Pms.DataAccess.Migrations
.HasColumnType("datetime(6)"); .HasColumnType("datetime(6)");
b.Property<string>("CurrentAddress") b.Property<string>("CurrentAddress")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<string>("Email") b.Property<string>("Email")
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<string>("EmergencyContactPerson") b.Property<string>("EmergencyContactPerson")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<string>("EmergencyPhoneNumber") b.Property<string>("EmergencyPhoneNumber")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<string>("FirstName") b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<string>("Gender") b.Property<string>("Gender")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<bool>("IsActive") b.Property<bool>("IsActive")
@ -322,7 +315,6 @@ namespace Marco.Pms.DataAccess.Migrations
.HasColumnType("datetime(6)"); .HasColumnType("datetime(6)");
b.Property<string>("LastName") b.Property<string>("LastName")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<string>("MiddleName") b.Property<string>("MiddleName")
@ -331,12 +323,10 @@ namespace Marco.Pms.DataAccess.Migrations
b.Property<string>("PanNumber") b.Property<string>("PanNumber")
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<string>("PeramnentAddress") b.Property<string>("PermanentAddress")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<string>("PhoneNumber") b.Property<string>("PhoneNumber")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<byte[]>("Photo") b.Property<byte[]>("Photo")
@ -371,7 +361,6 @@ namespace Marco.Pms.DataAccess.Migrations
.HasColumnType("time(6)"); .HasColumnType("time(6)");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<TimeOnly>("StartTime") b.Property<TimeOnly>("StartTime")
@ -387,6 +376,34 @@ namespace Marco.Pms.DataAccess.Migrations
b.ToTable("WorkShifts"); b.ToTable("WorkShifts");
}); });
modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<int>("ActivityMasterId")
.HasColumnType("int");
b.Property<string>("Check")
.HasColumnType("longtext");
b.Property<bool>("IsChecked")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsMandatory")
.HasColumnType("tinyint(1)");
b.Property<int>("TenantId")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("ActivityCheckLists");
});
modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
@ -396,14 +413,15 @@ namespace Marco.Pms.DataAccess.Migrations
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id")); MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ActivityName") b.Property<string>("ActivityName")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<int>("TenantId") b.Property<int>("TenantId")
.HasColumnType("int"); .HasColumnType("int");
b.Property<string>("UnitOfMeasurement") b.Property<string>("UnitOfMeasurement")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.HasKey("Id"); b.HasKey("Id");
@ -417,6 +435,7 @@ namespace Marco.Pms.DataAccess.Migrations
{ {
Id = 1, Id = 1,
ActivityName = "Core Cutting", ActivityName = "Core Cutting",
IsActive = true,
TenantId = 1, TenantId = 1,
UnitOfMeasurement = "Number" UnitOfMeasurement = "Number"
}, },
@ -424,6 +443,7 @@ namespace Marco.Pms.DataAccess.Migrations
{ {
Id = 2, Id = 2,
ActivityName = "Fabrication", ActivityName = "Fabrication",
IsActive = true,
TenantId = 1, TenantId = 1,
UnitOfMeasurement = "Meter" UnitOfMeasurement = "Meter"
}, },
@ -431,6 +451,7 @@ namespace Marco.Pms.DataAccess.Migrations
{ {
Id = 3, Id = 3,
ActivityName = "Lifting", ActivityName = "Lifting",
IsActive = true,
TenantId = 1, TenantId = 1,
UnitOfMeasurement = "Meter" UnitOfMeasurement = "Meter"
}, },
@ -438,6 +459,7 @@ namespace Marco.Pms.DataAccess.Migrations
{ {
Id = 4, Id = 4,
ActivityName = "Hanging", ActivityName = "Hanging",
IsActive = true,
TenantId = 1, TenantId = 1,
UnitOfMeasurement = "Meter" UnitOfMeasurement = "Meter"
}, },
@ -445,6 +467,7 @@ namespace Marco.Pms.DataAccess.Migrations
{ {
Id = 5, Id = 5,
ActivityName = "Tapping", ActivityName = "Tapping",
IsActive = true,
TenantId = 1, TenantId = 1,
UnitOfMeasurement = "Meter" UnitOfMeasurement = "Meter"
}, },
@ -452,6 +475,7 @@ namespace Marco.Pms.DataAccess.Migrations
{ {
Id = 6, Id = 6,
ActivityName = "Welding", ActivityName = "Welding",
IsActive = true,
TenantId = 1, TenantId = 1,
UnitOfMeasurement = "Meter" UnitOfMeasurement = "Meter"
}, },
@ -459,6 +483,7 @@ namespace Marco.Pms.DataAccess.Migrations
{ {
Id = 7, Id = 7,
ActivityName = "Testing", ActivityName = "Testing",
IsActive = true,
TenantId = 1, TenantId = 1,
UnitOfMeasurement = "Area" UnitOfMeasurement = "Area"
}, },
@ -466,6 +491,7 @@ namespace Marco.Pms.DataAccess.Migrations
{ {
Id = 8, Id = 8,
ActivityName = "Painting", ActivityName = "Painting",
IsActive = true,
TenantId = 1, TenantId = 1,
UnitOfMeasurement = "Meter" UnitOfMeasurement = "Meter"
}, },
@ -473,6 +499,7 @@ namespace Marco.Pms.DataAccess.Migrations
{ {
Id = 9, Id = 9,
ActivityName = "Marking Area", ActivityName = "Marking Area",
IsActive = true,
TenantId = 1, TenantId = 1,
UnitOfMeasurement = "Meter" UnitOfMeasurement = "Meter"
}, },
@ -480,6 +507,7 @@ namespace Marco.Pms.DataAccess.Migrations
{ {
Id = 10, Id = 10,
ActivityName = "Drilling", ActivityName = "Drilling",
IsActive = true,
TenantId = 1, TenantId = 1,
UnitOfMeasurement = "Number" UnitOfMeasurement = "Number"
}, },
@ -487,6 +515,7 @@ namespace Marco.Pms.DataAccess.Migrations
{ {
Id = 11, Id = 11,
ActivityName = "MS Support Fabrication", ActivityName = "MS Support Fabrication",
IsActive = true,
TenantId = 1, TenantId = 1,
UnitOfMeasurement = "Number" UnitOfMeasurement = "Number"
}, },
@ -494,6 +523,7 @@ namespace Marco.Pms.DataAccess.Migrations
{ {
Id = 12, Id = 12,
ActivityName = "MS Support Hanging", ActivityName = "MS Support Hanging",
IsActive = true,
TenantId = 1, TenantId = 1,
UnitOfMeasurement = "Number" UnitOfMeasurement = "Number"
}, },
@ -501,6 +531,7 @@ namespace Marco.Pms.DataAccess.Migrations
{ {
Id = 13, Id = 13,
ActivityName = "Hydrant Volve", ActivityName = "Hydrant Volve",
IsActive = true,
TenantId = 1, TenantId = 1,
UnitOfMeasurement = "Number" UnitOfMeasurement = "Number"
}, },
@ -508,6 +539,7 @@ namespace Marco.Pms.DataAccess.Migrations
{ {
Id = 14, Id = 14,
ActivityName = "Sprinkler Installation", ActivityName = "Sprinkler Installation",
IsActive = true,
TenantId = 1, TenantId = 1,
UnitOfMeasurement = "Number" UnitOfMeasurement = "Number"
}); });
@ -520,11 +552,9 @@ namespace Marco.Pms.DataAccess.Migrations
.HasColumnType("char(36)"); .HasColumnType("char(36)");
b.Property<string>("Description") b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<string>("Role") b.Property<string>("Role")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<int>("TenantId") b.Property<int>("TenantId")
@ -610,7 +640,6 @@ namespace Marco.Pms.DataAccess.Migrations
.HasColumnType("char(36)"); .HasColumnType("char(36)");
b.Property<string>("Description") b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<bool>("IsActive") b.Property<bool>("IsActive")
@ -620,7 +649,6 @@ namespace Marco.Pms.DataAccess.Migrations
.HasColumnType("int"); .HasColumnType("int");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.HasKey("Id"); b.HasKey("Id");
@ -703,7 +731,6 @@ namespace Marco.Pms.DataAccess.Migrations
.HasColumnType("char(36)"); .HasColumnType("char(36)");
b.Property<string>("Description") b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<Guid>("FeatureId") b.Property<Guid>("FeatureId")
@ -713,7 +740,6 @@ namespace Marco.Pms.DataAccess.Migrations
.HasColumnType("tinyint(1)"); .HasColumnType("tinyint(1)");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.HasKey("Id"); b.HasKey("Id");
@ -881,7 +907,6 @@ namespace Marco.Pms.DataAccess.Migrations
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<int>("TenantId") b.Property<int>("TenantId")
@ -903,7 +928,6 @@ namespace Marco.Pms.DataAccess.Migrations
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id")); MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Description") b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<string>("Key") b.Property<string>("Key")
@ -966,7 +990,6 @@ namespace Marco.Pms.DataAccess.Migrations
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id")); MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Status") b.Property<string>("Status")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<int>("TenantId") b.Property<int>("TenantId")
@ -1014,19 +1037,15 @@ namespace Marco.Pms.DataAccess.Migrations
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id")); MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ContactName") b.Property<string>("ContactName")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<string>("ContactNumber") b.Property<string>("ContactNumber")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<string>("Description") b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<string>("DomainName") b.Property<string>("DomainName")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<int?>("IndustryId") b.Property<int?>("IndustryId")
@ -1036,7 +1055,6 @@ namespace Marco.Pms.DataAccess.Migrations
.HasColumnType("tinyint(1)"); .HasColumnType("tinyint(1)");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<DateTime>("OnBoardingDate") b.Property<DateTime>("OnBoardingDate")
@ -1075,7 +1093,6 @@ namespace Marco.Pms.DataAccess.Migrations
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id")); MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.HasKey("Id"); b.HasKey("Id");
@ -1194,7 +1211,6 @@ namespace Marco.Pms.DataAccess.Migrations
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id")); MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ContactPerson") b.Property<string>("ContactPerson")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<DateTime?>("EndDate") b.Property<DateTime?>("EndDate")
@ -1205,7 +1221,6 @@ namespace Marco.Pms.DataAccess.Migrations
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<string>("ProjectAddress") b.Property<string>("ProjectAddress")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<int>("ProjectStatusId") b.Property<int>("ProjectStatusId")
@ -1718,8 +1733,7 @@ namespace Marco.Pms.DataAccess.Migrations
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User")
.WithMany() .WithMany()
.HasForeignKey("UserId") .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade);
.IsRequired();
b.Navigation("User"); b.Navigation("User");
}); });

View File

@ -10,8 +10,8 @@ namespace Marco.Pms.Model.Activities
public long TaskAllocationId { get; set; } public long TaskAllocationId { get; set; }
[ValidateNever] [ValidateNever]
[ForeignKey(nameof(TaskAllocationId))] [ForeignKey(nameof(TaskAllocationId))]
public TaskAllocation TaskAllocation { get; set; } public TaskAllocation? TaskAllocation { get; set; }
public string ImagePath { get; set; } public string? ImagePath { get; set; }
} }
} }

View File

@ -12,17 +12,16 @@ namespace Marco.Pms.Model.Activities
public long TaskAllocationId { get; set; } public long TaskAllocationId { get; set; }
[ValidateNever] [ValidateNever]
[ForeignKey(nameof(TaskAllocationId))] [ForeignKey(nameof(TaskAllocationId))]
public TaskAllocation TaskAllocation { get; set; } public TaskAllocation? TaskAllocation { get; set; }
public int EmployeeId { get; set; } public int EmployeeId { get; set; }
[ForeignKey("EmployeeId")] [ForeignKey("EmployeeId")]
[ValidateNever] [ValidateNever]
public Employee Employee { get; set; } public Employee? Employee { get; set; }
public int TenantId { get; set; } public int TenantId { get; set; }
[ValidateNever] [ValidateNever]
[ForeignKey(nameof(TenantId))] [ForeignKey(nameof(TenantId))]
public Tenant Tenant { get; set; } public Tenant? Tenant { get; set; }
} }
} }

View File

@ -1,9 +1,9 @@
using Marco.Pms.Model.Dtos.Attendance; using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
using Marco.Pms.Model.Dtos.Attendance;
using Marco.Pms.Model.Employees; using Marco.Pms.Model.Employees;
using Marco.Pms.Model.Entitlements; using Marco.Pms.Model.Entitlements;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
namespace Marco.Pms.Model.AttendanceModule namespace Marco.Pms.Model.AttendanceModule
@ -46,6 +46,6 @@ namespace Marco.Pms.Model.AttendanceModule
public int TenantId { get; set; } public int TenantId { get; set; }
[ValidateNever] [ValidateNever]
[ForeignKey(nameof(TenantId))] [ForeignKey(nameof(TenantId))]
public Tenant Tenant { get; set; } public Tenant? Tenant { get; set; }
} }
} }

View File

@ -5,8 +5,8 @@ namespace Marco.Pms.Model.Authentication
public class RefreshToken public class RefreshToken
{ {
public int Id { get; set; } public int Id { get; set; }
public string Token { get; set; } public string? Token { get; set; }
public string UserId { get; set; } public string? UserId { get; set; }
public DateTime ExpiryDate { get; set; } public DateTime ExpiryDate { get; set; }
public bool IsRevoked { get; set; } public bool IsRevoked { get; set; }
public bool IsUsed { get; set; } public bool IsUsed { get; set; }
@ -15,6 +15,6 @@ namespace Marco.Pms.Model.Authentication
// Relationship with the User // Relationship with the User
public IdentityUser User { get; set; } public IdentityUser? User { get; set; }
} }
} }

View File

@ -4,6 +4,6 @@
{ {
public string? ActivityName { get; set; } public string? ActivityName { get; set; }
public string? UnitOfMeasurement { get; set; } public string? UnitOfMeasurement { get; set; }
public List<string>? CheckList { get; set; } public List<CreateCheckListDto>? CheckList { get; set; }
} }
} }

View File

@ -0,0 +1,9 @@
namespace Marco.Pms.Model.Dtos.Activities
{
public class CreateCheckListDto
{
public int Id { get; set; }
public string? Check { get; set; }
public bool IsMandatory { get; set; }
}
}

View File

@ -8,21 +8,21 @@ namespace Marco.Pms.Model.Employees
public class Employee public class Employee
{ {
public int Id { get; set; } public int Id { get; set; }
public string FirstName { get; set; } public string? FirstName { get; set; }
public string LastName { get; set; } public string? LastName { get; set; }
public string? MiddleName { get; set; } public string? MiddleName { get; set; }
public string? Email { get; set; } public string? Email { get; set; }
public string Gender { get; set; } public string? Gender { get; set; }
public DateTime? BirthDate { get; set; } public DateTime? BirthDate { get; set; }
public DateTime? JoiningDate { get; set; } public DateTime? JoiningDate { get; set; }
public string PeramnentAddress { get; set; } public string? PermanentAddress { get; set; }
public string CurrentAddress { get; set; } public string? CurrentAddress { get; set; }
public string PhoneNumber { get; set; } public string? PhoneNumber { get; set; }
public string EmergencyPhoneNumber { get; set; } public string? EmergencyPhoneNumber { get; set; }
public string EmergencyContactPerson { get; set; } public string? EmergencyContactPerson { get; set; }
public string? AadharNumber { get; set; } public string? AadharNumber { get; set; }
@ -42,8 +42,7 @@ namespace Marco.Pms.Model.Employees
[ValidateNever] [ValidateNever]
[ForeignKey(nameof(TenantId))] [ForeignKey(nameof(TenantId))]
public Tenant Tenant { get; set; } public Tenant? Tenant { get; set; }
public Guid RoleId { get; set; } public Guid RoleId { get; set; }
//[ForeignKey(nameof(RoleId))] //[ForeignKey(nameof(RoleId))]
//public EmployeeRole EmployeeRole { get; set; } //public EmployeeRole EmployeeRole { get; set; }

View File

@ -1,10 +1,4 @@
using System; namespace Marco.Pms.Model.Employees
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Marco.Pms.Model.Employees
{ {
public class EmployeeDetails : Employee public class EmployeeDetails : Employee
{ {

View File

@ -1,21 +1,21 @@
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations.Schema; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
namespace Marco.Pms.Model.Employees namespace Marco.Pms.Model.Employees
{ {
public class EmployeeDocument public class EmployeeDocument
{ {
public Guid Id { get; set; } // Unique identifier for the document public Guid Id { get; set; } // Unique identifier for the document
public string FileName { get; set; } // Original file name public string? FileName { get; set; } // Original file name
public string FilePath { get; set; } // Path to the stored file public string? FilePath { get; set; } // Path to the stored file
public string FileType { get; set; } // Type of the document (e.g., PDF, JPG) public string? FileType { get; set; } // Type of the document (e.g., PDF, JPG)
public long FileSize { get; set; } // File size in bytes public long FileSize { get; set; } // File size in bytes
public DateTime UploadedAt { get; set; } // Timestamp of upload public DateTime UploadedAt { get; set; } // Timestamp of upload
public Guid EmployeeId { get; set; } // Foreign key to Employee public Guid EmployeeId { get; set; } // Foreign key to Employee
[ValidateNever] [ValidateNever]
[ForeignKey(nameof(EmployeeId))] [ForeignKey(nameof(EmployeeId))]
public Employee Employee { get; set; } // Navigation property to Employee public Employee? Employee { get; set; } // Navigation property to Employee
} }

View File

@ -9,7 +9,7 @@ namespace Marco.Pms.Model.Employees
{ {
public int Id { get; set; } public int Id { get; set; }
[DisplayName("Shift Name")] [DisplayName("Shift Name")]
public string Name { get; set; } public string? Name { get; set; }
public TimeOnly StartTime { get; set; } public TimeOnly StartTime { get; set; }
public TimeOnly EndTime { get; set; } public TimeOnly EndTime { get; set; }
@ -18,7 +18,7 @@ namespace Marco.Pms.Model.Employees
[ValidateNever] [ValidateNever]
[ForeignKey(nameof(TenantId))] [ForeignKey(nameof(TenantId))]
public Tenant Tenant { get; set; } public Tenant? Tenant { get; set; }
} }
} }

View File

@ -4,7 +4,9 @@
{ {
public int Id { get; set; } public int Id { get; set; }
public int ActivityMasterId { get; set; } public int ActivityMasterId { get; set; }
public string? CheckList { get; set; } public string? Check { get; set; }
public bool IsChecked { get; set; } = false;
public bool IsMandatory { get; set; }
public int TenantId { get; set; } public int TenantId { get; set; }
} }
} }

View File

@ -7,15 +7,16 @@ namespace Marco.Pms.Model.Entitlements
public class ActivityMaster public class ActivityMaster
{ {
public int Id { get; set; } public int Id { get; set; }
public string ActivityName { get; set; } public string? ActivityName { get; set; }
public string UnitOfMeasurement { get; set; } public string? UnitOfMeasurement { get; set; }
[DisplayName("TenantId")] [DisplayName("TenantId")]
public int TenantId { get; set; } public int TenantId { get; set; }
[ValidateNever] [ValidateNever]
[ForeignKey(nameof(TenantId))] [ForeignKey(nameof(TenantId))]
public Tenant Tenant { get; set; } public Tenant? Tenant { get; set; }
public bool IsActive { get; set; } = true;
} }
} }

View File

@ -1,14 +1,10 @@
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; namespace Marco.Pms.Model.Entitlements
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
namespace Marco.Pms.Model.Entitlements
{ {
public class ApplicationRole public class ApplicationRole
{ {
public Guid Id { get; set; } public Guid Id { get; set; }
public string Role { get; set; } public string? Role { get; set; }
public string Description { get; set; } public string? Description { get; set; }
public int TenantId { get; set; } public int TenantId { get; set; }

View File

@ -7,18 +7,18 @@ namespace Marco.Pms.Model.Entitlements
public class Tenant public class Tenant
{ {
public int Id { get; set; } public int Id { get; set; }
public string Name { get; set; } public string? Name { get; set; }
public string Description { get; set; } public string? Description { get; set; }
public string DomainName { get; set; } public string? DomainName { get; set; }
public string ContactName { get; set; } public string? ContactName { get; set; }
public string ContactNumber { get; set; } public string? ContactNumber { get; set; }
public DateTime OnBoardingDate { get; set; } public DateTime OnBoardingDate { get; set; }
public string? OragnizationSize { get; set; } public string? OragnizationSize { get; set; }
public int? IndustryId { get;set; } public int? IndustryId { get;set; }
[ForeignKey("IndustryId")] [ForeignKey("IndustryId")]
[ValidateNever] [ValidateNever]
public Industry Industry{ get; set; } public Industry? Industry{ get; set; }
public bool IsActive { get; set; } = true; public bool IsActive { get; set; } = true;
} }

View File

@ -1,7 +1,6 @@
using Marco.Pms.Model.Employees; using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.AspNetCore.Http; using Marco.Pms.Model.Employees;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System.ComponentModel.DataAnnotations.Schema;
namespace Marco.Pms.Model.Entitlements namespace Marco.Pms.Model.Entitlements
{ {
@ -11,19 +10,19 @@ namespace Marco.Pms.Model.Entitlements
public int EmployeeId { get; set; } public int EmployeeId { get; set; }
[ValidateNever] [ValidateNever]
[ForeignKey(nameof(EmployeeId))] [ForeignKey(nameof(EmployeeId))]
public Employee Employee { get; set; } // Navigation property to Employee public Employee? Employee { get; set; } // Navigation property to Employee
public Guid RoleId { get; set; } public Guid RoleId { get; set; }
[ValidateNever] [ValidateNever]
[ForeignKey(nameof(RoleId))] [ForeignKey(nameof(RoleId))]
public ApplicationRole Role { get; set; } public ApplicationRole? Role { get; set; }
public bool IsEnabled { get; set; } public bool IsEnabled { get; set; }
public int TenantId { get; set; } public int TenantId { get; set; }
[ValidateNever] [ValidateNever]
[ForeignKey(nameof(TenantId))] [ForeignKey(nameof(TenantId))]
public Tenant Tenant { get; set; } public Tenant? Tenant { get; set; }
} }
} }

View File

@ -9,12 +9,12 @@ namespace Marco.Pms.Model.Entitlements
public int ModuleId { get; set; } public int ModuleId { get; set; }
[ValidateNever] [ValidateNever]
[ForeignKey(nameof(ModuleId))] [ForeignKey(nameof(ModuleId))]
public Module Module { get; set; } public Module? Module { get; set; }
public string Name { get; set; } // Feature name public string? Name { get; set; } // Feature name
public string Description { get; set; } // Feature description public string? Description { get; set; } // Feature description
public bool IsActive { get; set; } public bool IsActive { get; set; }
public ICollection<FeaturePermission> FeaturePermissions { get; set; } // Features assigned to this role public ICollection<FeaturePermission>? FeaturePermissions { get; set; }// Features assigned to this role
} }
} }

View File

@ -1,12 +1,5 @@
using Marco.Pms.Model.Projects; using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Marco.Pms.Model.Entitlements namespace Marco.Pms.Model.Entitlements
{ {
@ -17,10 +10,10 @@ namespace Marco.Pms.Model.Entitlements
public Guid FeatureId { get; set; } // Foreign key to Feature public Guid FeatureId { get; set; } // Foreign key to Feature
[ForeignKey("FeatureId")] [ForeignKey("FeatureId")]
[ValidateNever] [ValidateNever]
public Feature Feature { get; set; } public Feature? Feature { get; set; }
public string Name { get; set; } // Feature name public string? Name { get; set; } // Feature name
public string Description { get; set; } // Feature description public string? Description { get; set; } // Feature description
public bool IsEnabled { get; set; } // Whether the feature is enabled for this role public bool IsEnabled { get; set; } // Whether the feature is enabled for this role

View File

@ -1,17 +1,17 @@
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations.Schema; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
namespace Marco.Pms.Model.Entitlements namespace Marco.Pms.Model.Entitlements
{ {
public class JobRole public class JobRole
{ {
public int Id { get; set; } public int Id { get; set; }
public string Name { get; set; } public string? Name { get; set; }
public string? Description { get; set; } public string? Description { get; set; }
public int TenantId { get; set; } public int TenantId { get; set; }
[ValidateNever] [ValidateNever]
[ForeignKey(nameof(TenantId))] [ForeignKey(nameof(TenantId))]
public Tenant Tenant { get; set; } public Tenant? Tenant { get; set; }
} }
} }

View File

@ -13,9 +13,9 @@ namespace Marco.Pms.Model.Entitlements
public int Id { get; set; } public int Id { get; set; }
[Required] [Required]
public string Name { get; set; } public string? Name { get; set; }
public string Description { get; set; } public string? Description { get; set; }

View File

@ -12,13 +12,13 @@ namespace Marco.Pms.Model.Entitlements
public class StatusMaster public class StatusMaster
{ {
public int Id { get; set; } public int Id { get; set; }
public string Status { get; set; } public string? Status { get; set; }
[DisplayName("TenantId")] [DisplayName("TenantId")]
public int TenantId { get; set; } public int TenantId { get; set; }
[ValidateNever] [ValidateNever]
[ForeignKey(nameof(TenantId))] [ForeignKey(nameof(TenantId))]
public Tenant Tenant { get; set; } public Tenant? Tenant { get; set; }
} }
} }

View File

@ -3,6 +3,6 @@
public class Industry public class Industry
{ {
public int Id { get; set; } public int Id { get; set; }
public string Name { get; set; } public string? Name { get; set; }
} }
} }

View File

@ -123,5 +123,36 @@ namespace Marco.Pms.Model.Mapper
Employee = comment.Employee.ToEmployeeVMFromEmployee() Employee = comment.Employee.ToEmployeeVMFromEmployee()
}; };
} }
public static ActivityVM ToActivityVMFromActivityMaster(this ActivityMaster activity,List<CheckListVM> checkList)
{
return new ActivityVM
{
Id = activity.Id,
ActivityName = activity.ActivityName,
UnitOfMeasurement = activity.UnitOfMeasurement,
CheckLists = checkList,
};
}
public static CheckListVM ToCheckListVMFromActivityCheckList(this ActivityCheckList checkList,int activityId)
{
return new CheckListVM
{
Id = checkList.Id,
Check = checkList.Check,
ActivityMasterId = activityId,
IsChecked = checkList.IsChecked,
IsMandatory = checkList.IsMandatory,
};
}
public static ActivityCheckList ToActivityCheckListFromCreateCheckListDto(this CreateCheckListDto checkListDto)
{
return new ActivityCheckList
{
Id = checkListDto.Id,
Check = checkListDto.Check,
IsMandatory = checkListDto.IsMandatory
};
}
} }
} }

View File

@ -24,7 +24,7 @@ namespace Marco.Pms.Model.Mapper
JobRole = (model.JobRole != null ? model.JobRole.Name : null), JobRole = (model.JobRole != null ? model.JobRole.Name : null),
JobRoleId = model.JobRoleId, JobRoleId = model.JobRoleId,
PanNumber = model.PanNumber, PanNumber = model.PanNumber,
PermanentAddress = model.PeramnentAddress, PermanentAddress = model.PermanentAddress,
PhoneNumber = model.PhoneNumber, PhoneNumber = model.PhoneNumber,
Photo = model.Photo, Photo = model.Photo,
IsActive = model.IsActive, IsActive = model.IsActive,

View File

@ -12,7 +12,7 @@ namespace Marco.Pms.Model.Projects
public int Id { get; set; } public int Id { get; set; }
[Required] [Required]
[DisplayName("Building Name")] [DisplayName("Building Name")]
public string Name { get; set; } public string? Name { get; set; }
public string? Description { get; set; } public string? Description { get; set; }
public int ProjectId { get; set; } public int ProjectId { get; set; }
@ -23,6 +23,6 @@ namespace Marco.Pms.Model.Projects
[ValidateNever] [ValidateNever]
[ForeignKey(nameof(TenantId))] [ForeignKey(nameof(TenantId))]
public Tenant Tenant { get; set; } public Tenant? Tenant { get; set; }
} }
} }

View File

@ -12,14 +12,14 @@ namespace Marco.Pms.Model.Projects
[Required] [Required]
[DisplayName("Floor Name")] [DisplayName("Floor Name")]
public string FloorName { get; set; } public string? FloorName { get; set; }
public int BuildingId { get; set; } public int BuildingId { get; set; }
[ForeignKey("BuildingId")] [ForeignKey("BuildingId")]
[ValidateNever] [ValidateNever]
public Building Building { get; set; } public Building? Building { get; set; }
[DisplayName("TenantId")] [DisplayName("TenantId")]
@ -27,6 +27,6 @@ namespace Marco.Pms.Model.Projects
[ValidateNever] [ValidateNever]
[ForeignKey(nameof(TenantId))] [ForeignKey(nameof(TenantId))]
public Tenant Tenant { get; set; } public Tenant? Tenant { get; set; }
} }
} }

View File

@ -7,15 +7,15 @@ namespace Marco.Pms.Model.Projects
public class PhotoGallary public class PhotoGallary
{ {
public int Id { get; set; } public int Id { get; set; }
public string Description { get; set; } public string? Description { get; set; }
public int ProjectId { get; set; } public int ProjectId { get; set; }
[ValidateNever] [ValidateNever]
[ForeignKey(nameof(ProjectId))] [ForeignKey(nameof(ProjectId))]
public Project? Project { get; set; } public Project? Project { get; set; }
public string AddedBy { get; set; } public string? AddedBy { get; set; }
[ValidateNever] [ValidateNever]
[ForeignKey(nameof(AddedBy))] [ForeignKey(nameof(AddedBy))]
public ApplicationUser? ApplicationUser { get; set; } public ApplicationUser? ApplicationUser { get; set; }
public DateTime AddedOn { get; set; } public DateTime AddedOn { get; set; }
public required string Imagebase64 { get; set; } public required string Imagebase64 { get; set; }
} }

View File

@ -12,14 +12,14 @@ namespace Marco.Pms.Model.Projects
public int Id { get; set; } public int Id { get; set; }
[Required] [Required]
[DisplayName("Project Name")] [DisplayName("Project Name")]
public string Name { get; set; } public string? Name { get; set; }
[DisplayName("Project Address")] [DisplayName("Project Address")]
public string ProjectAddress { get; set; } public string? ProjectAddress { get; set; }
[DisplayName("Contact Person")] [DisplayName("Contact Person")]
public string ContactPerson { get; set; } public string? ContactPerson { get; set; }
public DateTime? StartDate { get; set; } public DateTime? StartDate { get; set; }
public DateTime? EndDate { get; set; } public DateTime? EndDate { get; set; }
@ -29,13 +29,13 @@ namespace Marco.Pms.Model.Projects
[ValidateNever] [ValidateNever]
[ForeignKey(nameof(ProjectStatusId))] [ForeignKey(nameof(ProjectStatusId))]
public StatusMaster ProjectStatus { get; set; } public StatusMaster? ProjectStatus { get; set; }
[DisplayName("TenantId")] [DisplayName("TenantId")]
public int TenantId { get; set; } public int TenantId { get; set; }
[ValidateNever] [ValidateNever]
[ForeignKey(nameof(TenantId))] [ForeignKey(nameof(TenantId))]
public Tenant Tenant { get; set; } public Tenant? Tenant { get; set; }
} }
} }

View File

@ -1,8 +1,8 @@
using Marco.Pms.Model.Employees; using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
using Marco.Pms.Model.Employees;
using Marco.Pms.Model.Entitlements; using Marco.Pms.Model.Entitlements;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
namespace Marco.Pms.Model.Projects namespace Marco.Pms.Model.Projects
{ {
@ -12,7 +12,7 @@ namespace Marco.Pms.Model.Projects
public int EmployeeId { get; set; } public int EmployeeId { get; set; }
[ForeignKey("EmployeeId")] [ForeignKey("EmployeeId")]
[ValidateNever] [ValidateNever]
public Employee Employee { get; set; } public Employee? Employee { get; set; }
public int? JobRoleId { get; set; } public int? JobRoleId { get; set; }
//[ForeignKey("EmployeeRoleId")] //[ForeignKey("EmployeeRoleId")]
@ -24,7 +24,7 @@ namespace Marco.Pms.Model.Projects
public int ProjectId { get; set; } public int ProjectId { get; set; }
[ForeignKey("ProjectId")] [ForeignKey("ProjectId")]
[ValidateNever] [ValidateNever]
public Project Project { get; set; } public Project? Project { get; set; }
public DateTime AllocationDate { get; set; } public DateTime AllocationDate { get; set; }
@ -35,6 +35,6 @@ namespace Marco.Pms.Model.Projects
public int TenantId { get; set; } public int TenantId { get; set; }
[ValidateNever] [ValidateNever]
[ForeignKey(nameof(TenantId))] [ForeignKey(nameof(TenantId))]
public Tenant Tenant { get; set; } public Tenant? Tenant { get; set; }
} }
} }

View File

@ -1,14 +1,8 @@
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; using System.ComponentModel;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Marco.Pms.Model.Entitlements; using Marco.Pms.Model.Entitlements;
using Marco.Pms.Model.Activities; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
namespace Marco.Pms.Model.Projects namespace Marco.Pms.Model.Projects
{ {
@ -19,13 +13,13 @@ namespace Marco.Pms.Model.Projects
[Required] [Required]
[DisplayName("Area Name")] [DisplayName("Area Name")]
public string AreaName { get; set; } public string? AreaName { get; set; }
public int FloorId { get; set; } public int FloorId { get; set; }
[ForeignKey("FloorId")] [ForeignKey("FloorId")]
[ValidateNever] [ValidateNever]
public Floor Floor { get; set; } public Floor? Floor { get; set; }
//[ValidateNever] //[ValidateNever]
//public List<WorkItem> WorkItems { get; set; } //public List<WorkItem> WorkItems { get; set; }
@ -35,6 +29,7 @@ namespace Marco.Pms.Model.Projects
[ValidateNever] [ValidateNever]
[ForeignKey(nameof(TenantId))] [ForeignKey(nameof(TenantId))]
public Tenant Tenant { get; set; } public Tenant? Tenant { get; set; }
}
} }
}

View File

@ -1,7 +1,7 @@
using Marco.Pms.Model.Entitlements; using System.ComponentModel;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using Marco.Pms.Model.Entitlements;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
namespace Marco.Pms.Model.Projects namespace Marco.Pms.Model.Projects
{ {
@ -13,12 +13,12 @@ namespace Marco.Pms.Model.Projects
public int WorkAreaId { get; set; } public int WorkAreaId { get; set; }
[ForeignKey("WorkAreaId")] [ForeignKey("WorkAreaId")]
[ValidateNever] [ValidateNever]
public WorkArea WorkArea { get; set; } public WorkArea? WorkArea { get; set; }
[ForeignKey("ActivityId")] [ForeignKey("ActivityId")]
[ValidateNever] [ValidateNever]
public ActivityMaster ActivityMaster { get; set; } public ActivityMaster? ActivityMaster { get; set; }
public double PlannedWork { get; set; } public double PlannedWork { get; set; }
public double CompletedWork { get; set; } public double CompletedWork { get; set; }
@ -29,6 +29,6 @@ namespace Marco.Pms.Model.Projects
[ValidateNever] [ValidateNever]
[ForeignKey(nameof(TenantId))] [ForeignKey(nameof(TenantId))]
public Tenant Tenant { get; set; } public Tenant? Tenant { get; set; }
} }
} }

View File

@ -11,18 +11,18 @@ namespace Marco.Pms.Model.Projects
public int WorkAreaId { get; set; } public int WorkAreaId { get; set; }
[ForeignKey("WorkAreaId")] [ForeignKey("WorkAreaId")]
[ValidateNever] [ValidateNever]
public WorkArea WorkArea { get; set; } public WorkArea? WorkArea { get; set; }
public int WorkItemId { get; set; } public int WorkItemId { get; set; }
[ForeignKey("WorkItemId")] [ForeignKey("WorkItemId")]
[ValidateNever] [ValidateNever]
public WorkItem WorkItem { get; set; } public WorkItem? WorkItem { get; set; }
[DisplayName("TenantId")] [DisplayName("TenantId")]
public int TenantId { get; set; } public int TenantId { get; set; }
[ValidateNever] [ValidateNever]
[ForeignKey(nameof(TenantId))] [ForeignKey(nameof(TenantId))]
public Tenant Tenant { get; set; } public Tenant? Tenant { get; set; }
} }
} }

View File

@ -0,0 +1,11 @@
namespace Marco.Pms.Model.ViewModels.Activities
{
public class ActivityVM
{
public int Id { get; set; }
public string? ActivityName { get; set; }
public string? UnitOfMeasurement { get; set; }
public List<CheckListVM>? CheckLists { get; set; }
}
}

View File

@ -0,0 +1,11 @@
namespace Marco.Pms.Model.ViewModels.Activities
{
public class CheckListVM
{
public int Id { get; set; }
public int ActivityMasterId { get; set; }
public string? Check { get; set; }
public bool IsChecked { get; set; }
public bool IsMandatory { get; set; }
}
}

View File

@ -294,7 +294,7 @@ namespace MarcoBMS.Services.Controllers
Gender = model.Gender, Gender = model.Gender,
MiddleName = model.MiddleName, MiddleName = model.MiddleName,
PanNumber = model.PanNumber, PanNumber = model.PanNumber,
PeramnentAddress = model.PermanentAddress, PermanentAddress = model.PermanentAddress,
PhoneNumber = model.PhoneNumber, PhoneNumber = model.PhoneNumber,
Photo = null, // GetFileDetails(model.Photo).Result.FileData, Photo = null, // GetFileDetails(model.Photo).Result.FileData,
JobRoleId = Convert.ToInt32(model.JobRoleId), JobRoleId = Convert.ToInt32(model.JobRoleId),
@ -321,7 +321,7 @@ namespace MarcoBMS.Services.Controllers
existingEmployee.Gender = model.Gender; existingEmployee.Gender = model.Gender;
existingEmployee.MiddleName = model.MiddleName; existingEmployee.MiddleName = model.MiddleName;
existingEmployee.PanNumber = model.PanNumber; existingEmployee.PanNumber = model.PanNumber;
existingEmployee.PeramnentAddress = model.PermanentAddress; existingEmployee.PermanentAddress = model.PermanentAddress;
existingEmployee.PhoneNumber = model.PhoneNumber; existingEmployee.PhoneNumber = model.PhoneNumber;
existingEmployee.Photo = null; // GetFileDetails(model.Photo).Result.FileData, existingEmployee.Photo = null; // GetFileDetails(model.Photo).Result.FileData,
existingEmployee.JobRoleId = Convert.ToInt32(model.JobRoleId); existingEmployee.JobRoleId = Convert.ToInt32(model.JobRoleId);

View File

@ -1,8 +1,10 @@
using Marco.Pms.DataAccess.Data; using System.Diagnostics;
using Marco.Pms.DataAccess.Data;
using Marco.Pms.Model.Dtos.Activities; using Marco.Pms.Model.Dtos.Activities;
using Marco.Pms.Model.Entitlements; using Marco.Pms.Model.Entitlements;
using Marco.Pms.Model.Mapper; using Marco.Pms.Model.Mapper;
using Marco.Pms.Model.Utilities; using Marco.Pms.Model.Utilities;
using Marco.Pms.Model.ViewModels.Activities;
using MarcoBMS.Services.Helpers; using MarcoBMS.Services.Helpers;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
@ -17,7 +19,7 @@ namespace Marco.Pms.Services.Controllers
{ {
private readonly ApplicationDbContext _context; private readonly ApplicationDbContext _context;
private readonly UserHelper _userHelper; private readonly UserHelper _userHelper;
public MasterController(ApplicationDbContext context,UserHelper userHelper) public MasterController(ApplicationDbContext context, UserHelper userHelper)
{ {
_context = context; _context = context;
_userHelper = userHelper; _userHelper = userHelper;
@ -27,8 +29,24 @@ namespace Marco.Pms.Services.Controllers
public async Task<IActionResult> GetActivitiesMaster() public async Task<IActionResult> GetActivitiesMaster()
{ {
var tenantId = _userHelper.GetTenantId(); var tenantId = _userHelper.GetTenantId();
var activities = await _context.ActivityMasters.Where(c => c.TenantId == tenantId).ToListAsync(); var activities = await _context.ActivityMasters.Where(c => c.TenantId == tenantId && c.IsActive == true).ToListAsync();
return Ok(ApiResponse<object>.SuccessResponse(activities, "Success.", 200)); List<ActivityVM> activitiesVM = new List<ActivityVM>();
foreach (var activity in activities) {
var checkList = await _context.ActivityCheckLists.Where(c => c.TenantId == tenantId && c.ActivityMasterId == activity.Id).ToListAsync();
List<CheckListVM> checkListVM = new List<CheckListVM>();
if(checkList != null)
{
foreach (ActivityCheckList check in checkList)
{
var checkVM = check.ToCheckListVMFromActivityCheckList(activity.Id);
checkListVM.Add(checkVM);
}
}
ActivityVM activityVM = activity.ToActivityVMFromActivityMaster(checkListVM);
activitiesVM.Add(activityVM);
}
return Ok(ApiResponse<object>.SuccessResponse(activitiesVM, "Success.", 200));
} }
[HttpPost("activity")] [HttpPost("activity")]
@ -36,9 +54,9 @@ namespace Marco.Pms.Services.Controllers
{ {
var tenantId = _userHelper.GetTenantId(); var tenantId = _userHelper.GetTenantId();
var employee = await _userHelper.GetCurrentEmployeeAsync(); var employee = await _userHelper.GetCurrentEmployeeAsync();
if(employee.TenantId != tenantId) if (employee.TenantId != tenantId)
{ {
return Unauthorized(ApiResponse<object>.ErrorResponse("Current tenant did not match with user's tenant", "Current tenant did not match with user's tenant",401)); return Unauthorized(ApiResponse<object>.ErrorResponse("Current tenant did not match with user's tenant", "Current tenant did not match with user's tenant", 401));
} }
var activityMaster = createActivity.ToActivityMasterFromCreateActivityMasterDto(tenantId); var activityMaster = createActivity.ToActivityMasterFromCreateActivityMasterDto(tenantId);
_context.ActivityMasters.Add(activityMaster); _context.ActivityMasters.Add(activityMaster);
@ -48,18 +66,22 @@ namespace Marco.Pms.Services.Controllers
List<ActivityCheckList> activityCheckList = new List<ActivityCheckList>(); List<ActivityCheckList> activityCheckList = new List<ActivityCheckList>();
foreach (var check in createActivity.CheckList) foreach (var check in createActivity.CheckList)
{ {
ActivityCheckList checkList = new ActivityCheckList ActivityCheckList checkList = check.ToActivityCheckListFromCreateCheckListDto();
{
ActivityMasterId = activityMaster.Id,
TenantId = tenantId,
CheckList = check
};
activityCheckList.Add(checkList); activityCheckList.Add(checkList);
} }
//_context.ActivityCheckList.AddRange(activityCheckList); _context.ActivityCheckLists.AddRange(activityCheckList);
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
List<CheckListVM> checkListVM = new List<CheckListVM>();
foreach (ActivityCheckList check in activityCheckList)
{
var checkVM = check.ToCheckListVMFromActivityCheckList(activityMaster.Id);
checkListVM.Add(checkVM);
}
ActivityVM activityVM = activityMaster.ToActivityVMFromActivityMaster(checkListVM);
return Ok(ApiResponse<object>.SuccessResponse(activityVM, "Activity created successfully", 200));
} }
return Ok(ApiResponse<object>.SuccessResponse(activityMaster, "Activity created successfully", 200)); return BadRequest(ApiResponse<object>.ErrorResponse("Check List is Empty", "Check List is Empty", 400));
} }
[HttpPost("edit/{id}")] [HttpPost("edit/{id}")]
@ -67,33 +89,48 @@ namespace Marco.Pms.Services.Controllers
{ {
var tenantId = _userHelper.GetTenantId(); var tenantId = _userHelper.GetTenantId();
var employee = await _userHelper.GetCurrentEmployeeAsync(); var employee = await _userHelper.GetCurrentEmployeeAsync();
ActivityMaster? activity = await _context.ActivityMasters.FirstOrDefaultAsync(x => x.Id == id); ActivityMaster? activity = await _context.ActivityMasters.FirstOrDefaultAsync(x => x.Id == id && x.IsActive == true);
if (activity != null && createActivity.UnitOfMeasurement != null && createActivity.ActivityName != null) { if (activity != null && createActivity.UnitOfMeasurement != null && createActivity.ActivityName != null) {
activity.ActivityName = createActivity.ActivityName; activity.ActivityName = createActivity.ActivityName;
activity.UnitOfMeasurement = createActivity.UnitOfMeasurement; activity.UnitOfMeasurement = createActivity.UnitOfMeasurement;
activity.TenantId = tenantId;
await _context.SaveChangesAsync();
if (createActivity.CheckList != null) if (createActivity.CheckList != null)
{ {
List<ActivityCheckList> activityCheckList = new List<ActivityCheckList>(); List<ActivityCheckList> activityCheckList = new List<ActivityCheckList>();
foreach (var check in createActivity.CheckList) foreach (var check in createActivity.CheckList)
{ {
ActivityCheckList checkList = new ActivityCheckList ActivityCheckList checkList = check.ToActivityCheckListFromCreateCheckListDto();
{
ActivityMasterId = activity.Id,
TenantId = tenantId,
CheckList = check
};
activityCheckList.Add(checkList); activityCheckList.Add(checkList);
} }
//_context.ActivityCheckList.UpdateRange(activityCheckList); _context.ActivityCheckLists.UpdateRange(activityCheckList);
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
List<CheckListVM> checkListVM = new List<CheckListVM>();
foreach (ActivityCheckList check in activityCheckList)
{
var checkVM = check.ToCheckListVMFromActivityCheckList(activity.Id);
checkListVM.Add(checkVM);
}
ActivityVM activityVM = activity.ToActivityVMFromActivityMaster(checkListVM);
return Ok(ApiResponse<object>.SuccessResponse(activityVM, "Activity created successfully", 200));
} }
return Ok(ApiResponse<object>.SuccessResponse(activity, "Activity updated successfully", 200));
} }
return NotFound(ApiResponse<object>.ErrorResponse("Activity no found", "Activity no found", 404)); return NotFound(ApiResponse<object>.ErrorResponse("Activity no found", "Activity no found", 404));
} }
#nullable disable
[HttpDelete("delete/{id}")]
public async Task<IActionResult> DeleteActivity(int Id)
{
int tenantId = _userHelper.GetTenantId();
var activity = await _context.ActivityMasters.FirstOrDefaultAsync(a => a.Id == Id && a.TenantId == tenantId);
if(activity != null)
{
activity.IsActive = false;
}
await _context.SaveChangesAsync();
return Ok(ApiResponse<object>.SuccessResponse(null, "Activity Deleted Successfully", 200));
}
} }
} }

View File

@ -4,8 +4,6 @@ using Marco.Pms.Model.Employees;
using Marco.Pms.Model.Mapper; using Marco.Pms.Model.Mapper;
using Marco.Pms.Model.ViewModels.Employee; using Marco.Pms.Model.ViewModels.Employee;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Runtime.Intrinsics.Arm;
namespace MarcoBMS.Services.Helpers namespace MarcoBMS.Services.Helpers
{ {