MailQueue

This commit is contained in:
2026-01-12 08:49:18 +01:00
parent 941e24551c
commit 936a08cc76
15 changed files with 1571 additions and 2 deletions

View File

@ -0,0 +1,18 @@
using StandManager.Service.Interfaces;
public class MailProcessor
{
private readonly IManagerService _managerService;
public MailProcessor(IManagerService managerService)
{
_managerService = managerService;
}
public async Task Process()
{
var list = await _managerService.MailQueueService.RicercaQueryable(x =>
x.Eliminato == false && x.Sent == false);
var a = list;
}
}

View File

@ -0,0 +1,38 @@
using System.Reflection;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using StandManager.Infrastructure.DAL.Context;
using StandManager.Service;
using StandManager.Service.Interfaces;
using StandManager.Service.Repository;
var host = Host.CreateDefaultBuilder(args)
.ConfigureServices((context, services) =>
{
//DI
var types = Assembly.Load("StandManager.Service").GetTypes();
var allProviderTypes = types.Where(t => t.Namespace != null && (t.FullName?.EndsWith("Service") ?? false)).ToList();
foreach (var intfc in allProviderTypes.Where(t => t.IsInterface))
{
var impl = allProviderTypes.FirstOrDefault(c => c.IsClass && intfc.Name[1..] == c.Name);
if (impl != null) services.AddScoped(intfc, impl);
}
//Database
var connectionString = context.Configuration.GetConnectionString("ConnectionString");
services.AddDbContext<StandManagerDbContext>(options =>
options.UseSqlServer(connectionString)
);
services.AddScoped(typeof(IStandManagerGenericRepository<>), typeof(StandManagerGenericRepository<>));
services.AddScoped<IStandManagerUnitOfWork, StandManagerUnitOfWork>();
services.AddScoped<IManagerService, ManagerService>();
services.AddScoped<MailProcessor>();
})
.Build();
using var scope = host.Services.CreateScope();
var processor = scope.ServiceProvider.GetRequiredService<MailProcessor>();
processor.Process();

View File

@ -0,0 +1,40 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\StandManager.Infrastructure\StandManager.Infrastructure.csproj" />
<ProjectReference Include="..\StandManager.Service\StandManager.Service.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="OAService.Domain">
<HintPath>..\Libs\OAService.Domain.dll</HintPath>
</Reference>
<Reference Include="OAService.Infrastructure">
<HintPath>..\Libs\OAService.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="OAService.Service">
<HintPath>..\Libs\OAService.Service.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.1.3" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.11" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.11" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.11" />
</ItemGroup>
<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@ -0,0 +1,12 @@
{
"ConnectionStrings": {
"ConnectionString": "Data Source=192.168.0.233\\SQL2019;Initial Catalog=DAC_StandManager;Persist Security Info=True;User ID=dac_user;Password=KZ4ZrUPzJV;TrustServerCertificate=True"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}