Added the Project branch related tables

This commit is contained in:
ashutosh.nehete 2025-11-19 15:10:40 +05:30
parent 0277303c54
commit 5a402925b1
10 changed files with 9208 additions and 2 deletions

View File

@ -213,9 +213,15 @@ namespace Marco.Pms.DataAccess.Data
public DbSet<ServiceProjectServiceMapping> ServiceProjectServiceMapping { get; set; } public DbSet<ServiceProjectServiceMapping> ServiceProjectServiceMapping { get; set; }
public DbSet<TeamRoleMaster> TeamRoleMasters { get; set; } public DbSet<TeamRoleMaster> TeamRoleMasters { get; set; }
public DbSet<ServiceProjectTag> ServiceProjectTags { get; set; } public DbSet<ServiceProjectTag> ServiceProjectTags { get; set; }
//public DbSet<TalkingPoint> TalkingPoints { get; set; }
//public DbSet<TalkingPointAttachment> TalkingPointAttachments { get; set; }
public DbSet<ServiceProjectTagMapping> ServiceProjectTagMappings { get; set; } public DbSet<ServiceProjectTagMapping> ServiceProjectTagMappings { get; set; }
public DbSet<ServiceProjectAllocation> ServiceProjectAllocations { get; set; } public DbSet<ServiceProjectAllocation> ServiceProjectAllocations { get; set; }
#region ======================================================= Project Branch =======================================================
public DbSet<ProjectBranch> ProjectBranches { get; set; }
#endregion
#region ======================================================= Job ======================================================= #region ======================================================= Job =======================================================
public DbSet<JobTicket> JobTickets { get; set; } public DbSet<JobTicket> JobTickets { get; set; }
public DbSet<JobStatus> JobStatus { get; set; } public DbSet<JobStatus> JobStatus { get; set; }

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,122 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Marco.Pms.DataAccess.Migrations
{
/// <inheritdoc />
public partial class Added_ProjectBranches_Table : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
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.CreateTable(
name: "ProjectBranches",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
BranchName = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ProjectId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
ContactInformation = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Address = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
BranchType = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
GoogleMapUrl = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false),
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
CreatedById = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
UpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true),
UpdatedById = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_ProjectBranches", x => x.Id);
table.ForeignKey(
name: "FK_ProjectBranches_Employees_CreatedById",
column: x => x.CreatedById,
principalTable: "Employees",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ProjectBranches_Employees_UpdatedById",
column: x => x.UpdatedById,
principalTable: "Employees",
principalColumn: "Id");
table.ForeignKey(
name: "FK_ProjectBranches_ServiceProjects_ProjectId",
column: x => x.ProjectId,
principalTable: "ServiceProjects",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ProjectBranches_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_ProjectBranches_CreatedById",
table: "ProjectBranches",
column: "CreatedById");
migrationBuilder.CreateIndex(
name: "IX_ProjectBranches_ProjectId",
table: "ProjectBranches",
column: "ProjectId");
migrationBuilder.CreateIndex(
name: "IX_ProjectBranches_TenantId",
table: "ProjectBranches",
column: "TenantId");
migrationBuilder.CreateIndex(
name: "IX_ProjectBranches_UpdatedById",
table: "ProjectBranches",
column: "UpdatedById");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ProjectBranches");
migrationBuilder.AlterColumn<string>(
name: "ContactPerson",
table: "Projects",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
}
}

View File

@ -4799,6 +4799,7 @@ namespace Marco.Pms.DataAccess.Migrations
.HasColumnType("char(36)"); .HasColumnType("char(36)");
b.Property<string>("ContactPerson") b.Property<string>("ContactPerson")
.IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<DateTime?>("EndDate") b.Property<DateTime?>("EndDate")
@ -5537,6 +5538,65 @@ namespace Marco.Pms.DataAccess.Migrations
b.ToTable("JobTickets"); b.ToTable("JobTickets");
}); });
modelBuilder.Entity("Marco.Pms.Model.ServiceProject.ProjectBranch", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Address")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("BranchName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("BranchType")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("ContactInformation")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)");
b.Property<Guid>("CreatedById")
.HasColumnType("char(36)");
b.Property<string>("GoogleMapUrl")
.HasColumnType("longtext");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<Guid>("ProjectId")
.HasColumnType("char(36)");
b.Property<Guid>("TenantId")
.HasColumnType("char(36)");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("datetime(6)");
b.Property<Guid?>("UpdatedById")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("ProjectId");
b.HasIndex("TenantId");
b.HasIndex("UpdatedById");
b.ToTable("ProjectBranches");
});
modelBuilder.Entity("Marco.Pms.Model.ServiceProject.ServiceProject", b => modelBuilder.Entity("Marco.Pms.Model.ServiceProject.ServiceProject", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -8451,6 +8511,39 @@ namespace Marco.Pms.DataAccess.Migrations
b.Navigation("UpdatedBy"); b.Navigation("UpdatedBy");
}); });
modelBuilder.Entity("Marco.Pms.Model.ServiceProject.ProjectBranch", b =>
{
b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Marco.Pms.Model.ServiceProject.ServiceProject", "Project")
.WithMany()
.HasForeignKey("ProjectId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Marco.Pms.Model.TenantModels.Tenant", "Tenant")
.WithMany()
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Marco.Pms.Model.Employees.Employee", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById");
b.Navigation("CreatedBy");
b.Navigation("Project");
b.Navigation("Tenant");
b.Navigation("UpdatedBy");
});
modelBuilder.Entity("Marco.Pms.Model.ServiceProject.ServiceProject", b => modelBuilder.Entity("Marco.Pms.Model.ServiceProject.ServiceProject", b =>
{ {
b.HasOne("Marco.Pms.Model.OrganizationModel.Organization", "Client") b.HasOne("Marco.Pms.Model.OrganizationModel.Organization", "Client")

View File

@ -0,0 +1,13 @@
namespace Marco.Pms.Model.Dtos.ServiceProject
{
public class ProjectBranchDto
{
public Guid? Id { get; set; }
public required string BranchName { get; set; }
public required Guid ProjectId { get; set; }
public required string ContactInformation { get; set; }
public required string Address { get; set; }
public required string BranchType { get; set; } // HQ, ATMs, Bank Branches, Overcounter desk
public string? GoogleMapUrl { get; set; }
}
}

View File

@ -14,7 +14,7 @@ namespace Marco.Pms.Model.Projects
public Guid Id { get; set; } public Guid Id { get; set; }
[Required] [Required]
[DisplayName("Project Name")] [DisplayName("Project Name")]
public string? Name { get; set; } public string Name { get; set; } = string.Empty;
public string? ShortName { get; set; } public string? ShortName { get; set; }
[DisplayName("Project Address")] [DisplayName("Project Address")]
@ -22,7 +22,7 @@ namespace Marco.Pms.Model.Projects
[DisplayName("Contact Person")] [DisplayName("Contact Person")]
public string? ContactPerson { get; set; } public string ContactPerson { get; set; } = string.Empty;
public DateTime? StartDate { get; set; } public DateTime? StartDate { get; set; }
public DateTime? EndDate { get; set; } public DateTime? EndDate { get; set; }

View File

@ -0,0 +1,35 @@
using Marco.Pms.Model.Employees;
using Marco.Pms.Model.Utilities;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System.ComponentModel.DataAnnotations.Schema;
namespace Marco.Pms.Model.ServiceProject
{
public class ProjectBranch : TenantRelation
{
public Guid Id { get; set; }
public string BranchName { get; set; } = string.Empty;
public Guid ProjectId { get; set; }
[ValidateNever]
[ForeignKey("ProjectId")]
public ServiceProject? Project { get; set; }
public string ContactInformation { get; set; } = string.Empty; // Json string
public string Address { get; set; } = string.Empty;
public string BranchType { get; set; } = string.Empty; // HQ, ATMs, Bank Branches, Overcounter desk
public string? GoogleMapUrl { get; set; }
public bool IsActive { get; set; } = true;
public DateTime CreatedAt { get; set; }
public Guid CreatedById { get; set; }
[ValidateNever]
[ForeignKey("CreatedById")]
public Employee? CreatedBy { get; set; }
public DateTime? UpdatedAt { get; set; }
public Guid? UpdatedById { get; set; }
[ValidateNever]
[ForeignKey("UpdatedById")]
public Employee? UpdatedBy { get; set; }
}
}

View File

@ -0,0 +1,20 @@
using Marco.Pms.Model.ViewModels.Activities;
namespace Marco.Pms.Model.ViewModels.ServiceProject
{
public class ProjectBranchDetailsVM
{
public Guid Id { get; set; }
public string? BranchName { get; set; }
public BasicServiceProjectVM? Project { get; set; }
public string? ContactInformation { get; set; } // Json string
public string? Address { get; set; }
public string? BranchType { get; set; } // HQ, ATMs, Bank Branches, Overcounter desk
public string? GoogleMapUrl { get; set; }
public bool IsActive { get; set; } = true;
public DateTime CreatedAt { get; set; }
public BasicEmployeeVM? CreatedBy { get; set; }
public DateTime? UpdatedAt { get; set; }
public BasicEmployeeVM? UpdatedBy { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using Marco.Pms.Model.ViewModels.Activities;
namespace Marco.Pms.Model.ViewModels.ServiceProject
{
public class ProjectBranchVM
{
public Guid Id { get; set; }
public string? BranchName { get; set; }
public BasicServiceProjectVM? Project { get; set; }
public string? ContactInformation { get; set; } // Json string
public string? Address { get; set; }
public string? BranchType { get; set; } // HQ, ATMs, Bank Branches, Overcounter desk
public DateTime CreatedAt { get; set; }
public BasicEmployeeVM? CreatedBy { get; set; }
}
}

View File

@ -200,6 +200,12 @@ namespace Marco.Pms.Services.MappingProfiles
CreateMap<ServiceProject, ServiceProjectDetailsVM>(); CreateMap<ServiceProject, ServiceProjectDetailsVM>();
CreateMap<ServiceProjectAllocation, ServiceProjectAllocationVM>(); CreateMap<ServiceProjectAllocation, ServiceProjectAllocationVM>();
#region ======================================================= Project Branch =======================================================
CreateMap<ProjectBranchDto, ProjectBranch>();
CreateMap<ProjectBranch, ProjectBranchVM>();
CreateMap<ProjectBranch, ProjectBranchDetailsVM>();
#endregion
//#region ======================================================= Talking Points ======================================================= //#region ======================================================= Talking Points =======================================================
//CreateMap<TalkingPointDto, TalkingPoint>(); //CreateMap<TalkingPointDto, TalkingPoint>();
//CreateMap<TalkingPoint, TalkingPointVM>(); //CreateMap<TalkingPoint, TalkingPointVM>();