Gave the same project to a colleague and he ran it with no problem.
So I reinstalled my system and it worked.
Hello, thanks for your help.
I changed the job signature to this:
public class UpdateStatsVentesMoisJob : AsyncBackgroundJob<StatsVentesMoisJobArgs>, ITransientDependency
Then I created this under DocuPro.Application/DomainServices
using Abp.Domain.Repositories; using DocuPro.CommonBases; using Microsoft.Extensions.Logging; using Stripe; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;
namespace DocuPro.DomainServices { public class DomaineServiceDatabaseFunctions: IDomaineServiceDatabaseFunctions {
private readonly IRepository<Periode> _periodeRepository;
private readonly ILogger<DomaineServiceDatabaseFunctions> _logger;
public DomaineServiceDatabaseFunctions(IRepository<Periode> periodeRepository, ILogger<DomaineServiceDatabaseFunctions> logger)
{
_periodeRepository = periodeRepository;
_logger = logger;
}
public async Task UpdateStatsVentesMois(int periodeId)
{
var periode = await _periodeRepository.GetAsync(periodeId);
if (periode == null)
{
_logger.LogWarning($"UpdateStatsVentesMois. Periode with Id {periodeId} not found.");
return;
}
_logger.LogInformation($"UpdateStatsVentesMois. Periode with Id {periodeId} WAS found.");
// Other logic...
}
}
}
But when I execute I get:
WARN 2024-03-04 12:10:33,578 [38 ] .DomainServices.UpdateStatsVentesMoisJob - UpdateStatsVentesMoisJob. Job STARTED. ERROR 2024-03-04 12:10:33,756 [43 ] .DomainServices.UpdateStatsVentesMoisJob - An error occurred while executing UpdateStatsVentesMoisJob for PeriodeId 146. Abp.Domain.Entities.EntityNotFoundException: There is no such an entity. Entity type: DocuPro.CommonBases.Periode, id: 146 at Abp.Domain.Repositories.AbpRepositoryBase`2.GetAsync(TPrimaryKey id) at DocuPro.DomainServices.DomaineServiceDatabaseFunctions.UpdateStatsVentesMois(Int32 periodeId) in C:\Apps\MedicPro Fevrier\MedicPro.All\src\DocuPro.Application\DomainServices\DomaineServiceDatabaseFunctions.cs:line 28
Hello, sorry I am sending again the project because I had some lines commented out while debugging.
Hi, there
I have sent the project via email.
The issue is with https://localhost:44302/App/Visas
Hello, sorry was away for a while.
No ProduitLibelle is a regular model propertie.
public class Produit : AuditedEntity, IMayHaveTenant { public int? TenantId { get; set; }
[Required]
public virtual string Libelle { get; set; }
[Required]
public virtual string Code { get; set; }
public virtual bool Sommeil { get; set; }=false;
public virtual double PrixAchat { get; set; }
public virtual int? MoleculeId { get; set; }
[ForeignKey("MoleculeId")]
public Molecule MoleculeFk { get; set; }
public virtual int? ClasseTherapeutiqueId { get; set; }
[ForeignKey("ClasseTherapeutiqueId")]
public ClasseTherapeutique ClasseTherapeutiqueFk { get; set; }
public virtual int? CategoryId { get; set; }
[ForeignKey("CategoryId")]
public Category CategoryFk { get; set; }
}
public class Pays : AuditedEntity, IMayHaveTenant
{
public int? TenantId { get; set; }
[Required]
public virtual string Libelle { get; set; }
public virtual int ReseauId { get; set; }
[ForeignKey("ReseauId")]
public Reseau ReseauFk { get; set; }
}
public class Visa : FullAuditedEntity, IMayHaveTenant { public int? TenantId { get; set; }
[Required]
public virtual string Numero { get; set; }
public virtual DateTime DateObtention { get; set; }
public virtual DateTime DateValidite { get; set; }
//File
public virtual Guid? Fichier { get; set; } //File, (BinaryObjectId)
public virtual int ProduitId { get; set; }
[ForeignKey("ProduitId")]
public Produit ProduitFk { get; set; }
public virtual int PaysId { get; set; }
[ForeignKey("PaysId")]
public Pays PaysFk { get; set; }
}
Sample Produit values:
361 1 ARTEDIAM 400MG CPR B/12 ARTE154 False 40761 NULL NULL 2023-10-28 20:37:48.9148423 NULL NULL NULL 1,82 363 1 ARTEDIAM 75MG/5ML SP F/30ML ARTE156 False 40761 NULL NULL 2023-10-28 20:37:48.9148426 NULL NULL NULL 1,35 364 1 CEVIT VIT C 100MG CPR B/10 CEVI102 False 40766 NULL NULL 2023-10-28 20:37:48.9148427 NULL NULL NULL 0,53 367 1 OXAPEN 500MG CPR B/12 OXAP105 False 42041 NULL NULL 2023-10-28 20:37:48.9148428 NULL NULL NULL 1,6
Thanks for the clear and thorough answer. Chose option 1 and it worked.
Yes, that did it. Thanks