Compare commits

..

No commits in common. "832555d2b29e07029d1f330d19798d7ab4abea64" and "a25fa069de2df5f8e1992bbf1e9b2c0950bfca85" have entirely different histories.

39 changed files with 145 additions and 3366 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -46,6 +46,6 @@ namespace Marco.Pms.Model.AttendanceModule
public int TenantId { get; set; }
[ValidateNever]
[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 int Id { get; set; }
public string? Token { get; set; }
public string? UserId { 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; }
@ -15,6 +15,6 @@ namespace Marco.Pms.Model.Authentication
// Relationship with the User
public IdentityUser? User { get; set; }
public IdentityUser User { get; set; }
}
}

View File

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

View File

@ -1,9 +0,0 @@
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 int Id { get; set; }
public string? FirstName { get; set; }
public string? LastName { 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 Gender { get; set; }
public DateTime? BirthDate { get; set; }
public DateTime? JoiningDate { get; set; }
public string? PermanentAddress { get; set; }
public string? CurrentAddress { get; set; }
public string? PhoneNumber { 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 EmergencyPhoneNumber { get; set; }
public string EmergencyContactPerson { get; set; }
public string? AadharNumber { get; set; }
@ -42,7 +42,8 @@ namespace Marco.Pms.Model.Employees
[ValidateNever]
[ForeignKey(nameof(TenantId))]
public Tenant? Tenant { get; set; }
public Tenant Tenant { get; set; }
public Guid RoleId { get; set; }
//[ForeignKey(nameof(RoleId))]
//public EmployeeRole EmployeeRole { get; set; }

View File

@ -1,5 +1,5 @@
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System.ComponentModel.DataAnnotations.Schema;
namespace Marco.Pms.Model.Employees
{

View File

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

View File

@ -1,12 +0,0 @@
namespace Marco.Pms.Model.Entitlements
{
public class ActivityCheckList
{
public int Id { get; set; }
public int ActivityMasterId { get; set; }
public string? Check { get; set; }
public bool IsChecked { get; set; } = false;
public bool IsMandatory { get; set; }
public int TenantId { get; set; }
}
}

View File

@ -7,16 +7,15 @@ namespace Marco.Pms.Model.Entitlements
public class ActivityMaster
{
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")]
public int TenantId { get; set; }
[ValidateNever]
[ForeignKey(nameof(TenantId))]
public Tenant? Tenant { get; set; }
public bool IsActive { get; set; } = true;
public Tenant Tenant { get; set; }
}
}

View File

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

View File

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

View File

@ -10,19 +10,19 @@ namespace Marco.Pms.Model.Entitlements
public int EmployeeId { get; set; }
[ValidateNever]
[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; }
[ValidateNever]
[ForeignKey(nameof(RoleId))]
public ApplicationRole? Role { get; set; }
public ApplicationRole Role { get; set; }
public bool IsEnabled { get; set; }
public int TenantId { get; set; }
[ValidateNever]
[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; }
[ValidateNever]
[ForeignKey(nameof(ModuleId))]
public Module? Module { get; set; }
public string? Name { get; set; } // Feature name
public string? Description { get; set; } // Feature description
public Module Module { get; set; }
public string Name { get; set; } // Feature name
public string Description { get; set; } // Feature description
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,5 +1,12 @@
using System.ComponentModel.DataAnnotations.Schema;
using Marco.Pms.Model.Projects;
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
{
@ -10,10 +17,10 @@ namespace Marco.Pms.Model.Entitlements
public Guid FeatureId { get; set; } // Foreign key to Feature
[ForeignKey("FeatureId")]
[ValidateNever]
public Feature? Feature { get; set; }
public Feature Feature { get; set; }
public string? Name { get; set; } // Feature name
public string? Description { get; set; } // Feature description
public string Name { get; set; } // Feature name
public string Description { get; set; } // Feature description
public bool IsEnabled { get; set; } // Whether the feature is enabled for this role

View File

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

View File

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

View File

@ -122,37 +122,5 @@ namespace Marco.Pms.Model.Mapper
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,int tenantId)
{
return new ActivityCheckList
{
Id = checkListDto.Id,
Check = checkListDto.Check,
IsMandatory = checkListDto.IsMandatory,
TenantId = tenantId
};
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -12,7 +12,7 @@ namespace Marco.Pms.Model.Projects
public int EmployeeId { get; set; }
[ForeignKey("EmployeeId")]
[ValidateNever]
public Employee? Employee { get; set; }
public Employee Employee { get; set; }
public int? JobRoleId { get; set; }
//[ForeignKey("EmployeeRoleId")]
@ -24,7 +24,7 @@ namespace Marco.Pms.Model.Projects
public int ProjectId { get; set; }
[ForeignKey("ProjectId")]
[ValidateNever]
public Project? Project { get; set; }
public Project Project { get; set; }
public DateTime AllocationDate { get; set; }
@ -35,6 +35,6 @@ namespace Marco.Pms.Model.Projects
public int TenantId { get; set; }
[ValidateNever]
[ForeignKey(nameof(TenantId))]
public Tenant? Tenant { get; set; }
public Tenant Tenant { get; set; }
}
}

View File

@ -13,13 +13,13 @@ namespace Marco.Pms.Model.Projects
[Required]
[DisplayName("Area Name")]
public string? AreaName { get; set; }
public string AreaName { get; set; }
public int FloorId { get; set; }
[ForeignKey("FloorId")]
[ValidateNever]
public Floor? Floor { get; set; }
public Floor Floor { get; set; }
//[ValidateNever]
//public List<WorkItem> WorkItems { get; set; }
@ -29,7 +29,6 @@ namespace Marco.Pms.Model.Projects
[ValidateNever]
[ForeignKey(nameof(TenantId))]
public Tenant? Tenant { get; set; }
}
public Tenant Tenant { get; set; }
}
}

View File

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

View File

@ -1,11 +0,0 @@
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

@ -1,11 +0,0 @@
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,
MiddleName = model.MiddleName,
PanNumber = model.PanNumber,
PermanentAddress = model.PermanentAddress,
PeramnentAddress = model.PermanentAddress,
PhoneNumber = model.PhoneNumber,
Photo = null, // GetFileDetails(model.Photo).Result.FileData,
JobRoleId = Convert.ToInt32(model.JobRoleId),
@ -321,7 +321,7 @@ namespace MarcoBMS.Services.Controllers
existingEmployee.Gender = model.Gender;
existingEmployee.MiddleName = model.MiddleName;
existingEmployee.PanNumber = model.PanNumber;
existingEmployee.PermanentAddress = model.PermanentAddress;
existingEmployee.PeramnentAddress = model.PermanentAddress;
existingEmployee.PhoneNumber = model.PhoneNumber;
existingEmployee.Photo = null; // GetFileDetails(model.Photo).Result.FileData,
existingEmployee.JobRoleId = Convert.ToInt32(model.JobRoleId);

View File

@ -1,14 +1,10 @@
using System.Diagnostics;
using Marco.Pms.DataAccess.Data;
using Marco.Pms.DataAccess.Data;
using Marco.Pms.Model.Dtos.Activities;
using Marco.Pms.Model.Entitlements;
using Marco.Pms.Model.Mapper;
using Marco.Pms.Model.Utilities;
using Marco.Pms.Model.ViewModels.Activities;
using MarcoBMS.Services.Helpers;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace Marco.Pms.Services.Controllers
{
@ -19,118 +15,24 @@ namespace Marco.Pms.Services.Controllers
{
private readonly ApplicationDbContext _context;
private readonly UserHelper _userHelper;
public MasterController(ApplicationDbContext context, UserHelper userHelper)
public MasterController(ApplicationDbContext context,UserHelper userHelper)
{
_context = context;
_userHelper = userHelper;
}
[HttpGet]
[Route("activities")]
public async Task<IActionResult> GetActivitiesMaster()
{
var tenantId = _userHelper.GetTenantId();
var activities = await _context.ActivityMasters.Where(c => c.TenantId == tenantId && c.IsActive == true).ToListAsync();
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")]
public async Task<IActionResult> CreateActivity([FromBody] CreateActivityMasterDto createActivity)
{
var tenantId = _userHelper.GetTenantId();
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);
_context.ActivityMasters.Add(activityMaster);
await _context.SaveChangesAsync();
if (createActivity.CheckList != null) {
List<ActivityCheckList> activityCheckList = new List<ActivityCheckList>();
foreach (var check in createActivity.CheckList)
{
ActivityCheckList checkList = check.ToActivityCheckListFromCreateCheckListDto(tenantId);
activityCheckList.Add(checkList);
}
_context.ActivityCheckLists.AddRange(activityCheckList);
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 BadRequest(ApiResponse<object>.ErrorResponse("Check List is Empty", "Check List is Empty", 400));
}
[HttpPost("edit/{id}")]
public async Task<IActionResult> UpdateActivity(int id, [FromBody] CreateActivityMasterDto createActivity)
{
var tenantId = _userHelper.GetTenantId();
var employee = await _userHelper.GetCurrentEmployeeAsync();
ActivityMaster? activity = await _context.ActivityMasters.FirstOrDefaultAsync(x => x.Id == id && x.IsActive == true && x.TenantId == tenantId);
if (activity != null && createActivity.UnitOfMeasurement != null && createActivity.ActivityName != null) {
activity.ActivityName = createActivity.ActivityName;
activity.UnitOfMeasurement = createActivity.UnitOfMeasurement;
if (createActivity.CheckList != null)
{
List<ActivityCheckList> activityCheckList = new List<ActivityCheckList>();
foreach (var check in createActivity.CheckList)
{
ActivityCheckList checkList = check.ToActivityCheckListFromCreateCheckListDto(tenantId);
activityCheckList.Add(checkList);
}
_context.ActivityCheckLists.UpdateRange(activityCheckList);
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 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));
return Ok(ApiResponse<object>.SuccessResponse(activityMaster, "Activity created successfully", 200));
}
}
}

View File

@ -35,6 +35,17 @@ namespace MarcoBMS.Services.Controllers
return _userHelper.GetTenantId();
}
[HttpGet]
[Route("activities")]
public async Task<IActionResult> GetActivitiesMaster()
{
var tenantId = GetTenantId();
var activities = await _context.ActivityMasters.Where(c => c.TenantId == tenantId).ToListAsync();
return Ok(ApiResponse<object>.SuccessResponse(activities, "Success.", 200));
}
[HttpPost("assign")]
public async Task<IActionResult> AssignTask([FromBody] AssignTaskDto assignTask)
{

View File

@ -23,6 +23,9 @@ builder.Host.UseSerilog((context, config) =>
})
;
#region CORS Settings
// Add services
//builder.Services.AddCors(options =>
//{