Skip to content

Commit

Permalink
Merge pull request #246 from bcgov/feature/9229-Project-info-to-be-st…
Browse files Browse the repository at this point in the history
…ored-in-Unity

Feature/9229 project info to be stored in unity
  • Loading branch information
AndreGAot authored Dec 14, 2023
2 parents 773ece4 + 6c3bd9a commit e3ccd18
Show file tree
Hide file tree
Showing 36 changed files with 3,865 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@ public class CreateUpdateProjectInfoDto
public string? SubSector { get; set; }
public string? ElectoralDistrict { get; set; }
public string? EconomicRegion { get; set; }
public string? CensusSubdivision { get; set; }
public string? RegionalDistrict { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ public class GetSummaryDto
public decimal? RecommendedAmount { get; set; }
public decimal? ApprovedAmount { get; set; }
public string? Batch { get; set; }
public string? CensusSubdivision { get; set; }
public string? RegionalDistrict { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,6 @@ public class GrantApplicationDto : AuditedEntityDto<Guid>
public string? Forestry { get; set; }
public string? ForestryFocus { get; set; }
public string? ElectoralDistrict { get; set; }
public string? CensusSubdivision { get; set; }
public string? RegionalDistrict { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using Volo.Abp.Application.Dtos;

namespace Unity.GrantManager.Locality;

[Serializable]
public class CensusSubdivisionDto : EntityDto<Guid>
{
public string CensusSubdivisionName { get; set; } = string.Empty;
public string Type { get; set; } = string.Empty;
public string RegionalDistrictCode { get; set; } = string.Empty;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;

namespace Unity.GrantManager.Locality;

public interface ICensusSubdivisionService : IApplicationService
{
Task<IList<CensusSubdivisionDto>> GetListAsync();
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;

namespace Unity.GrantManager.Locality;

public interface IRegionalDistrictService : IApplicationService
{
Task<IList<RegionalDistrictDto>> GetListAsync();
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using Volo.Abp.Application.Dtos;

namespace Unity.GrantManager.Locality;

[Serializable]
public class RegionalDistrictDto : EntityDto<Guid>
{
public string RegionalDistrictName { get; set; } = string.Empty;

public string RegionalDistrictCode { get; set; } = string.Empty;

}
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,10 @@ join applicant in await _applicantRepository.GetQueryableAsync() on application.
AssessmentResult = application.AssessmentResultStatus != null && application.AssessmentResultStatus != "" ? AssessmentResultsOptionsList.AssessmentResultStatusList[application.AssessmentResultStatus] : "",
RecommendedAmount = application.RecommendedAmount,
ApprovedAmount = application.ApprovedAmount,
Batch = "" // to-do: ask BA for the implementation of Batch field
};
Batch = "", // to-do: ask BA for the implementation of Batch field,
CensusSubdivision = application.CensusSubdivision,
RegionalDistrict = application.RegionalDistrict,
};

var queryResult = await AsyncExecuter.FirstOrDefaultAsync(query);
if (queryResult != null)
Expand Down Expand Up @@ -248,8 +250,10 @@ public async Task<GrantApplicationDto> UpdateProjectInfoAsync(Guid id, CreateUpd
application.SubSector = input.SubSector;
application.EconomicRegion = input.EconomicRegion;
application.ElectoralDistrict = input.ElectoralDistrict;
application.CensusSubdivision = input.CensusSubdivision;
application.RegionalDistrict = input.RegionalDistrict;

await _applicationRepository.UpdateAsync(application, autoSave: true);
await _applicationRepository.UpdateAsync(application, autoSave: true);

return ObjectMapper.Map<Application, GrantApplicationDto>(application);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public GrantManagerApplicationAutoMapperProfile()
CreateMap<SubSector, SubSectorDto>();
CreateMap<EconomicRegion, EconomicRegionDto>();
CreateMap<ElectoralDistrict, ElectoralDistrictDto>();
CreateMap<CensusSubdivision, CensusSubdivisionDto>();
CreateMap<RegionalDistrict, RegionalDistrictDto>();
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Volo.Abp.Application.Services;
using Volo.Abp.DependencyInjection;
namespace Unity.GrantManager.Locality
{
[Authorize]
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(CensusSubdivisionAppService), typeof(ICensusSubdivisionService))]
public class CensusSubdivisionAppService : ApplicationService, ICensusSubdivisionService
{
private readonly ICensusSubdivisionRepository _censusSubdivisionRepository;
public CensusSubdivisionAppService(ICensusSubdivisionRepository censusSubdivisionRepository)
{
_censusSubdivisionRepository = censusSubdivisionRepository;
}

public async Task<IList<CensusSubdivisionDto>> GetListAsync()
{

var censusSubdivision = await _censusSubdivisionRepository.GetListAsync();

return ObjectMapper.Map<List<CensusSubdivision>, List<CensusSubdivisionDto>>(censusSubdivision.OrderBy(c => c.CensusSubdivisionName).ToList());
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Volo.Abp.Application.Services;
using Volo.Abp.DependencyInjection;

namespace Unity.GrantManager.Locality
{
[Authorize]
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(RegionalDistrictAppService), typeof(IRegionalDistrictService))]
public class RegionalDistrictAppService : ApplicationService, IRegionalDistrictService
{
private readonly IRegionalDistrictRepository _regionalDistrictRepository;
public RegionalDistrictAppService(IRegionalDistrictRepository regionalDistricRepository)
{
_regionalDistrictRepository = regionalDistricRepository;
}

public async Task<IList<RegionalDistrictDto>> GetListAsync()
{
var regionalDistrict = await _regionalDistrictRepository.GetListAsync();

return ObjectMapper.Map<List<RegionalDistrict>, List<RegionalDistrictDto>>(regionalDistrict.OrderBy(r => r.RegionalDistrictCode).ToList());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -212,24 +212,27 @@
"Summary:Assessment.ApprovedAmount": "Approved Amount",
"Summary:Assessment.Batch": "Batch #",

"ProjectInfoView:ProjectInfoTitle": "Project Info",
"ProjectInfoView:ProjectInfoTitle": "Project Summary",
"ProjectInfoView:ProjectInfo.ProjectName": "Project Name",
"ProjectInfoView:ProjectInfo.ProjectSummary": "Project Summary",
"ProjectInfoView:ProjectInfo.ProjectStartDate": "Project Start Date",
"ProjectInfoView:ProjectInfo.ProjectEndDate": "Project End Date",
"ProjectInfoView:ProjectInfo.RequestedAmount": "Requested Amount",
"ProjectInfoView:ProjectInfo.TotalProjectBudget": "Project Budget",
"ProjectInfoView:ProjectInfo.PercentageTotalProjectBudget": "% of Total Project Budget",
"ProjectInfoView:ProjectInfo.ProjectFundingTotal": "Project Funding Total",
"ProjectInfoView:ProjectInfo.ProjectFundingTotal": "Projected Funding Total",
"ProjectInfoView:ProjectInfo.Sector": "Sector",
"ProjectInfoView:ProjectInfo.SubSector": "Sub Sector",
"ProjectInfoView:ProjectInfo.Community": "Community",
"ProjectInfoView:ProjectInfo.EconomicRegion": "Economic Region",
"ProjectInfoView:ProjectInfo.ElectoralDistrict": "Electoral District",
"ProjectInfoView:ProjectInfo.CommunityPopulation": "2021 Community Census Population (Primary Community)",
"ProjectInfoView:ProjectInfo.CommunityPopulation": "Community Census Population",
"ProjectInfoView:ProjectInfo.Acquisition": "Acquisition",
"ProjectInfoView:ProjectInfo.Forestry": "Forestry/Non-Forestry",
"ProjectInfoView:ProjectInfo.ForestryFocus": "Forestry Focus"
"ProjectInfoView:ProjectInfo.ForestryFocus": "Forestry Focus",
"ProjectInfoView:ProjectInfo.CensusSubdivision": "Census Subdivision",
"ProjectInfoView:ProjectInfo.RegionalDistrict": "Regional District (Census Division)",
"ProjectInfoView:ProjectInfoLocation": "Project Location"
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ public class Applicant : AuditedAggregateRoot<Guid>
public string? Community { get; set; }
public string? IndigenousOrgInd { get; set; }
public string? ElectoralDistrict { get; set; }
public string? CensusSubdivision { get; set; }
public string? RegionalDistrict { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,6 @@ public virtual ApplicationStatus ApplicationStatus

public string? ElectoralDistrict { get; set; }

public string? CensusSubdivision { get; set; }
public string? RegionalDistrict { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,10 @@ private async Task<Applicant> CreateApplicantAsync(IntakeMapping intakeMap)
Community = intakeMap.Community ?? "{Community}",
IndigenousOrgInd = intakeMap.IndigenousOrgInd ?? "N",
ElectoralDistrict = intakeMap.ElectoralDistrict ?? "{ElectoralDistrict}",
EconomicRegion = intakeMap.EconomicRegion ?? "{Region}",
});
EconomicRegion = intakeMap.EconomicRegion ?? "{Region}",
CensusSubdivision = intakeMap.CensusSubdivision ?? "{CensusSubdivision}",
RegionalDistrict = intakeMap.RegionalDistrict ?? "{RegionalDistrict}",
});

await CreateApplicantAddressAsync(intakeMap, applicant);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,8 @@ public class IntakeMapping
public string? SubmissionId { get; set; }
public string? SubSector { get; set; }
public string? TotalProjectBudget { get; set; }
public string? CensusSubdivision { get; set; }
public string? RegionalDistrict { get; set; }

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using Volo.Abp.Domain.Entities.Auditing;

namespace Unity.GrantManager.Locality;

public class CensusSubdivision : AuditedAggregateRoot<Guid>
{
public string CensusSubdivisionName { get; set; } = string.Empty;
public string Type { get; set; } = string.Empty;
public string RegionalDistrictCode { get; set; } = string.Empty;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System;
using Volo.Abp.Domain.Repositories;

namespace Unity.GrantManager.Locality;

public interface ICensusSubdivisionRepository : IRepository<CensusSubdivision, Guid>
{
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System;
using Volo.Abp.Domain.Repositories;

namespace Unity.GrantManager.Locality;

public interface IRegionalDistrictRepository : IRepository<RegionalDistrict, Guid>
{
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using Volo.Abp.Domain.Entities.Auditing;

namespace Unity.GrantManager.Locality;

public class RegionalDistrict : AuditedAggregateRoot<Guid>
{
public string RegionalDistrictName { get; set; } = string.Empty;

public string RegionalDistrictCode { get; set; } = string.Empty;

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public class GrantManagerDbContext :
public DbSet<SubSector> SubSectors { get; set; }
public DbSet<EconomicRegion> EconomicRegion { get; set; }
public DbSet<ElectoralDistrict> ElectoralDistricts { get; set; }
public DbSet<RegionalDistrict> RegionalDistricts { get; set; }
public DbSet<CensusSubdivision> CensusSubdivisions { get; set; }

#region Entities from the modules

Expand Down Expand Up @@ -113,6 +115,20 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)

b.ConfigureByConvention();
});
modelBuilder.Entity<CensusSubdivision>(b =>
{
b.ToTable(GrantManagerConsts.DbTablePrefix + "CensusSubdivisions",
GrantManagerConsts.DbSchema);

b.ConfigureByConvention();
});
modelBuilder.Entity<RegionalDistrict>(b =>
{
b.ToTable(GrantManagerConsts.DbTablePrefix + "RegionalDistricts",
GrantManagerConsts.DbSchema);

b.ConfigureByConvention();
});

var allEntityTypes = modelBuilder.Model.GetEntityTypes();
foreach (var type in allEntityTypes.Where(t => t.ClrType != typeof(ExtraPropertyDictionary)).Select(t => t.ClrType))
Expand Down
Loading

0 comments on commit e3ccd18

Please sign in to comment.