Changed the data-type of ApprovedBy in attendes table
This commit is contained in:
parent
a318f69883
commit
aad7240c84
2430
Marco.Pms.DataAccess/Migrations/20250505121140_Changed_DataType_ApproverdBY.Designer.cs
generated
Normal file
2430
Marco.Pms.DataAccess/Migrations/20250505121140_Changed_DataType_ApproverdBY.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,109 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||||
|
|
||||||
|
namespace Marco.Pms.DataAccess.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class Changed_DataType_ApproverdBY : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "ActivityMasters",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: new Guid("1714f64d-7591-4419-bee5-118d21bb2855"));
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "ActivityMasters",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: new Guid("4117b7de-ef6c-461f-a2c2-64eaac5f9a11"));
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "ActivityMasters",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: new Guid("53eedf44-4076-445f-be93-fedef17117e7"));
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "ActivityMasters",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: new Guid("715b9ddb-d9e2-4afa-8987-d9918905cea4"));
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "ActivityMasters",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: new Guid("a3d191a7-a5aa-4dd8-a525-12c99263bbd6"));
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "ActivityMasters",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: new Guid("b3f51a93-dde6-45f9-8b22-f1bf017a640b"));
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "ActivityMasters",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: new Guid("c138a7de-713a-4bd4-8292-b0b265be77a3"));
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Projects",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: new Guid("3ef56a12-f5e5-4193-87d6-9e110ed10b86"));
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Projects",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: new Guid("54d013e3-0a2b-48be-85c7-5ef03492a18c"));
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<Guid>(
|
||||||
|
name: "ApprovedBy",
|
||||||
|
table: "Attendes",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: true,
|
||||||
|
collation: "ascii_general_ci",
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int",
|
||||||
|
oldNullable: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "ApprovedBy",
|
||||||
|
table: "Attendes",
|
||||||
|
type: "int",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(Guid),
|
||||||
|
oldType: "char(36)",
|
||||||
|
oldNullable: true)
|
||||||
|
.OldAnnotation("Relational:Collation", "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.InsertData(
|
||||||
|
table: "ActivityMasters",
|
||||||
|
columns: new[] { "Id", "ActivityName", "IsActive", "TenantId", "UnitOfMeasurement" },
|
||||||
|
values: new object[,]
|
||||||
|
{
|
||||||
|
{ new Guid("1714f64d-7591-4419-bee5-118d21bb2855"), "Fabrication", true, new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), "Meter" },
|
||||||
|
{ new Guid("4117b7de-ef6c-461f-a2c2-64eaac5f9a11"), "Core Cutting", true, new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), "Number" },
|
||||||
|
{ new Guid("53eedf44-4076-445f-be93-fedef17117e7"), "MS Support Fabrication", true, new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), "Number" },
|
||||||
|
{ new Guid("715b9ddb-d9e2-4afa-8987-d9918905cea4"), "MS Support Hanging", true, new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), "Number" },
|
||||||
|
{ new Guid("a3d191a7-a5aa-4dd8-a525-12c99263bbd6"), "Hydrant Volve", true, new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), "Number" },
|
||||||
|
{ new Guid("b3f51a93-dde6-45f9-8b22-f1bf017a640b"), "Welding", true, new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), "Meter" },
|
||||||
|
{ new Guid("c138a7de-713a-4bd4-8292-b0b265be77a3"), "Sprinkler Installation", true, new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), "Number" }
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.InsertData(
|
||||||
|
table: "Projects",
|
||||||
|
columns: new[] { "Id", "ContactPerson", "EndDate", "Name", "ProjectAddress", "ProjectStatusId", "StartDate", "TenantId" },
|
||||||
|
values: new object[,]
|
||||||
|
{
|
||||||
|
{ new Guid("3ef56a12-f5e5-4193-87d6-9e110ed10b86"), "Project 2 Contact Person", new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), "Project 2", "Project 2 Address", new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||||
|
{ new Guid("54d013e3-0a2b-48be-85c7-5ef03492a18c"), "Project 3 Contact Person", new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), "Project 3", "Project 3 Address", new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -131,8 +131,8 @@ namespace Marco.Pms.DataAccess.Migrations
|
|||||||
b.Property<int>("Activity")
|
b.Property<int>("Activity")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int?>("ApprovedBy")
|
b.Property<Guid?>("ApprovedBy")
|
||||||
.HasColumnType("int");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
b.Property<DateTime>("AttendanceDate")
|
b.Property<DateTime>("AttendanceDate")
|
||||||
.HasColumnType("datetime(6)");
|
.HasColumnType("datetime(6)");
|
||||||
@ -457,64 +457,6 @@ namespace Marco.Pms.DataAccess.Migrations
|
|||||||
b.HasIndex("TenantId");
|
b.HasIndex("TenantId");
|
||||||
|
|
||||||
b.ToTable("ActivityMasters");
|
b.ToTable("ActivityMasters");
|
||||||
|
|
||||||
b.HasData(
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = new Guid("4117b7de-ef6c-461f-a2c2-64eaac5f9a11"),
|
|
||||||
ActivityName = "Core Cutting",
|
|
||||||
IsActive = true,
|
|
||||||
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"),
|
|
||||||
UnitOfMeasurement = "Number"
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = new Guid("1714f64d-7591-4419-bee5-118d21bb2855"),
|
|
||||||
ActivityName = "Fabrication",
|
|
||||||
IsActive = true,
|
|
||||||
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"),
|
|
||||||
UnitOfMeasurement = "Meter"
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = new Guid("b3f51a93-dde6-45f9-8b22-f1bf017a640b"),
|
|
||||||
ActivityName = "Welding",
|
|
||||||
IsActive = true,
|
|
||||||
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"),
|
|
||||||
UnitOfMeasurement = "Meter"
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = new Guid("53eedf44-4076-445f-be93-fedef17117e7"),
|
|
||||||
ActivityName = "MS Support Fabrication",
|
|
||||||
IsActive = true,
|
|
||||||
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"),
|
|
||||||
UnitOfMeasurement = "Number"
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = new Guid("715b9ddb-d9e2-4afa-8987-d9918905cea4"),
|
|
||||||
ActivityName = "MS Support Hanging",
|
|
||||||
IsActive = true,
|
|
||||||
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"),
|
|
||||||
UnitOfMeasurement = "Number"
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = new Guid("a3d191a7-a5aa-4dd8-a525-12c99263bbd6"),
|
|
||||||
ActivityName = "Hydrant Volve",
|
|
||||||
IsActive = true,
|
|
||||||
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"),
|
|
||||||
UnitOfMeasurement = "Number"
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = new Guid("c138a7de-713a-4bd4-8292-b0b265be77a3"),
|
|
||||||
ActivityName = "Sprinkler Installation",
|
|
||||||
IsActive = true,
|
|
||||||
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"),
|
|
||||||
UnitOfMeasurement = "Number"
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationRole", b =>
|
modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationRole", b =>
|
||||||
@ -1552,28 +1494,6 @@ namespace Marco.Pms.DataAccess.Migrations
|
|||||||
ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"),
|
ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"),
|
||||||
StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified),
|
StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified),
|
||||||
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
|
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = new Guid("3ef56a12-f5e5-4193-87d6-9e110ed10b86"),
|
|
||||||
ContactPerson = "Project 2 Contact Person",
|
|
||||||
EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified),
|
|
||||||
Name = "Project 2",
|
|
||||||
ProjectAddress = "Project 2 Address",
|
|
||||||
ProjectStatusId = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"),
|
|
||||||
StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified),
|
|
||||||
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = new Guid("54d013e3-0a2b-48be-85c7-5ef03492a18c"),
|
|
||||||
ContactPerson = "Project 3 Contact Person",
|
|
||||||
EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified),
|
|
||||||
Name = "Project 3",
|
|
||||||
ProjectAddress = "Project 3 Address",
|
|
||||||
ProjectStatusId = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"),
|
|
||||||
StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified),
|
|
||||||
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ namespace Marco.Pms.Model.AttendanceModule
|
|||||||
public bool IsApproved { get; set; }
|
public bool IsApproved { get; set; }
|
||||||
public ATTENDANCE_MARK_TYPE Activity { get; set; }
|
public ATTENDANCE_MARK_TYPE Activity { get; set; }
|
||||||
|
|
||||||
public int? ApprovedBy { get; set; }
|
public Guid? ApprovedBy { get; set; }
|
||||||
[ForeignKey("EmployeeID")]
|
[ForeignKey("EmployeeID")]
|
||||||
[ValidateNever]
|
[ValidateNever]
|
||||||
public Employee? Approver { get; set; }
|
public Employee? Approver { get; set; }
|
||||||
|
@ -294,6 +294,7 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
Guid TenantId = GetTenantId();
|
Guid TenantId = GetTenantId();
|
||||||
|
var currentEmployee = await _userHelper.GetCurrentEmployeeAsync();
|
||||||
|
|
||||||
using var transaction = await _context.Database.BeginTransactionAsync();
|
using var transaction = await _context.Database.BeginTransactionAsync();
|
||||||
try
|
try
|
||||||
@ -352,6 +353,7 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
{
|
{
|
||||||
attendance.IsApproved = true;
|
attendance.IsApproved = true;
|
||||||
attendance.Activity = ATTENDANCE_MARK_TYPE.REGULARIZE;
|
attendance.Activity = ATTENDANCE_MARK_TYPE.REGULARIZE;
|
||||||
|
attendance.ApprovedBy = currentEmployee.Id;
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
else if (recordAttendanceDot.Action == ATTENDANCE_MARK_TYPE.REGULARIZE_REJECT)
|
else if (recordAttendanceDot.Action == ATTENDANCE_MARK_TYPE.REGULARIZE_REJECT)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user