diff --git a/ServiceHost/Areas/AdminNew/Pages/Company/AndroidApk/Index.cshtml.cs b/ServiceHost/Areas/AdminNew/Pages/Company/AndroidApk/Index.cshtml.cs index 0939b03c..9d04e631 100644 --- a/ServiceHost/Areas/AdminNew/Pages/Company/AndroidApk/Index.cshtml.cs +++ b/ServiceHost/Areas/AdminNew/Pages/Company/AndroidApk/Index.cshtml.cs @@ -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 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 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 OnPostPaymentGateWay(CancellationToken cancellationToken) { var command = new CreatePaymentGatewayRequest()