feat: implement method to update face embedding names for employees with changed names

This commit is contained in:
2025-12-16 11:05:22 +03:30
parent b64d0e5ffd
commit f7351454f3

View File

@@ -29,6 +29,7 @@ using Parbad.AspNetCore;
using Parbad.Gateway.Sepehr;
using System.ComponentModel.DataAnnotations;
using _0_Framework.Application.Enums;
using _0_Framework.Application.FaceEmbedding;
using CompanyManagement.Infrastructure.Excel.WorkshopsRollCall;
using static ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk.IndexModel2;
@@ -45,6 +46,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
private readonly ITemporaryClientRegistrationApplication _clientRegistrationApplication;
private readonly IHttpClientFactory _httpClientFactory;
private readonly IOnlinePayment _onlinePayment;
private readonly IFaceEmbeddingService _faceEmbeddingService;
[BindProperty] public IFormFile File { get; set; }
@@ -65,7 +67,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
public IndexModel(IAndroidApkVersionApplication application, IRollCallDomainService rollCallDomainService,
CompanyContext context, AccountContext accountContext, IHttpClientFactory httpClientFactory,
IOptions<AppSettingConfiguration> appSetting,
ITemporaryClientRegistrationApplication clientRegistrationApplication, IOnlinePayment onlinePayment)
ITemporaryClientRegistrationApplication clientRegistrationApplication, IOnlinePayment onlinePayment, IFaceEmbeddingService faceEmbeddingService)
{
_application = application;
_rollCallDomainService = rollCallDomainService;
@@ -74,6 +76,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
_httpClientFactory = httpClientFactory;
_clientRegistrationApplication = clientRegistrationApplication;
_onlinePayment = onlinePayment;
_faceEmbeddingService = faceEmbeddingService;
_paymentGateway = new SepehrPaymentGateway(httpClientFactory);
}
@@ -136,7 +139,8 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
public async Task<IActionResult> OnPostShiftDateNew()
{
await UpdateInstitutionContract();
//await UpdateInstitutionContract();
await UpdateFaceEmbeddingNames();
ViewData["message"] = "تومام یک";
return Page();
}
@@ -256,6 +260,18 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
}
}
private async System.Threading.Tasks.Task UpdateFaceEmbeddingNames()
{
var rollCallEmployees = await _context.RollCallEmployees
.Where(x => x.HasChangedName)
.ToListAsync();
foreach (var rollCallEmployee in rollCallEmployees)
{
await _faceEmbeddingService.UpdateEmbeddingFullNameAsync(rollCallEmployee.EmployeeId,
rollCallEmployee.WorkshopId, rollCallEmployee.EmployeeFullName);
}
}
public async Task<IActionResult> OnPostPaymentGateWay(CancellationToken cancellationToken)
{
var command = new CreatePaymentGatewayRequest()