scrematura iniziale
This commit is contained in:
parent
3f6efcbc7f
commit
d826d275fb
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
using ApiPolo.Interfaces;
|
using ApiPolo.Interfaces;
|
||||||
using ApiPolo.Models;
|
using ApiPolo.Models;
|
||||||
using ApiPolo.Models.Security_dbcontext;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace ApiPolo.Data
|
namespace ApiPolo.Data
|
||||||
@ -55,6 +55,10 @@ namespace ApiPolo.Data
|
|||||||
public DbSet<Timbratura>? Timbr { get; set; }
|
public DbSet<Timbratura>? Timbr { get; set; }
|
||||||
|
|
||||||
public DbSet<Commessa>? Commesse { get; set; }
|
public DbSet<Commessa>? Commesse { get; set; }
|
||||||
|
|
||||||
|
public DbSet<Prog2>? Prog { get; set; }
|
||||||
|
public DbSet<Prog>? Progressivi { get; set; }
|
||||||
|
public DbSet<Compo_Impia>? Compo { get; set; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary></summary>
|
/// <summary></summary>
|
||||||
|
|||||||
@ -3,6 +3,7 @@ using ApiPolo.Models;
|
|||||||
|
|
||||||
namespace ApiPolo.Interfaces
|
namespace ApiPolo.Interfaces
|
||||||
{
|
{
|
||||||
|
/// <summary></summary>
|
||||||
public interface ITenantDbContext
|
public interface ITenantDbContext
|
||||||
{
|
{
|
||||||
DbSet<Caus_Rapp>? Causali { get; set; }
|
DbSet<Caus_Rapp>? Causali { get; set; }
|
||||||
@ -28,5 +29,13 @@ namespace ApiPolo.Interfaces
|
|||||||
DbSet<Tecnici>? Tecnici { get; set; }
|
DbSet<Tecnici>? Tecnici { get; set; }
|
||||||
DbSet<Timbratura>? Timbr { get; set; }
|
DbSet<Timbratura>? Timbr { get; set; }
|
||||||
DbSet<Sto_Imp>? StoImp { get; set; }
|
DbSet<Sto_Imp>? StoImp { get; set; }
|
||||||
|
|
||||||
|
DbSet<Prog2>? Prog { get; set; }
|
||||||
|
DbSet<Prog>? Progressivi { get; set; }
|
||||||
|
DbSet<Compo_Impia>? Compo { get; set; }
|
||||||
|
|
||||||
|
void UpdateRapps(Rapp_New obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,14 @@
|
|||||||
using ApiPolo.Data;
|
using ApiPolo.Data;
|
||||||
using ApiPolo.Interfaces;
|
using ApiPolo.Interfaces;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using static ApiPolo.Controllers.PoloController;
|
using static ApiPolo.Controllers.PoloController;
|
||||||
|
|
||||||
|
/// <summary></summary>
|
||||||
public class TenantDbContextFactory : ITenantDbContextFactory
|
public class TenantDbContextFactory : ITenantDbContextFactory
|
||||||
{
|
{
|
||||||
private readonly IServiceProvider _serviceProvider;
|
private readonly IServiceProvider _serviceProvider;
|
||||||
|
|
||||||
|
/// <summary></summary>
|
||||||
public TenantDbContextFactory(IServiceProvider serviceProvider)
|
public TenantDbContextFactory(IServiceProvider serviceProvider)
|
||||||
{
|
{
|
||||||
_serviceProvider = serviceProvider;
|
_serviceProvider = serviceProvider;
|
||||||
@ -19,7 +22,7 @@ public class TenantDbContextFactory : ITenantDbContextFactory
|
|||||||
return tenant switch
|
return tenant switch
|
||||||
{
|
{
|
||||||
Clienti.Maras => scope.ServiceProvider.GetRequiredService<Maras_DbContext>(),
|
Clienti.Maras => scope.ServiceProvider.GetRequiredService<Maras_DbContext>(),
|
||||||
Clienti.Marrocco => scope.ServiceProvider.GetRequiredService<Marro_DbContext>(),
|
|
||||||
// Add other tenants as needed
|
// Add other tenants as needed
|
||||||
// Clienti.AnotherTenant => scope.ServiceProvider.GetRequiredService<AnotherTenant_DbContext>(),
|
// Clienti.AnotherTenant => scope.ServiceProvider.GetRequiredService<AnotherTenant_DbContext>(),
|
||||||
_ => throw new KeyNotFoundException($"No DbContext found for tenant: {tenant}")
|
_ => throw new KeyNotFoundException($"No DbContext found for tenant: {tenant}")
|
||||||
|
|||||||
@ -1,27 +0,0 @@
|
|||||||
using ApiPolo.Models.VT_dbcontext;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace ApiPolo.Models
|
|
||||||
{
|
|
||||||
/// <summary></summary>
|
|
||||||
public class VT_Buoni_DbContext : DbContext
|
|
||||||
{
|
|
||||||
/// <summary></summary>
|
|
||||||
public DbSet<Buoni>? buoni { get; set; }
|
|
||||||
|
|
||||||
/// <summary></summary>
|
|
||||||
public VT_Buoni_DbContext(DbContextOptions<VT_Buoni_DbContext> options) : base(options)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
/// <summary></summary>
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
modelBuilder.Entity<Buoni>().ToTable("BUONI");
|
|
||||||
modelBuilder.Entity<Buoni>().HasKey(table => new
|
|
||||||
{
|
|
||||||
table.azienda,
|
|
||||||
table.ser_buono
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -4,7 +4,7 @@ using Google.Apis.Auth.OAuth2;
|
|||||||
using static ApiPolo.Controllers.PoloController;
|
using static ApiPolo.Controllers.PoloController;
|
||||||
using static Google.Apis.Requests.BatchRequest;
|
using static Google.Apis.Requests.BatchRequest;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using ApiPolo.Models.Marrocco_dbcontext;
|
|
||||||
using ApiPolo.Models;
|
using ApiPolo.Models;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
@ -102,18 +102,18 @@ namespace ApiPolo.Services
|
|||||||
{
|
{
|
||||||
List<Notifiche> lst = new List<Notifiche>();
|
List<Notifiche> lst = new List<Notifiche>();
|
||||||
#region Marrocco
|
#region Marrocco
|
||||||
var optionsBuilder = new DbContextOptionsBuilder<MARRO_NOTIFICHEDbContext>();
|
//var optionsBuilder = new DbContextOptionsBuilder<MARRO_NOTIFICHEDbContext>();
|
||||||
optionsBuilder.UseSqlServer(Configuration.GetConnectionString("MARRO"));
|
//optionsBuilder.UseSqlServer(Configuration.GetConnectionString("MARRO"));
|
||||||
|
|
||||||
using (var dbContext = new MARRO_NOTIFICHEDbContext(optionsBuilder.Options))
|
//using (var dbContext = new MARRO_NOTIFICHEDbContext(optionsBuilder.Options))
|
||||||
{
|
//{
|
||||||
var listaNot = dbContext.Notif.Where(t => t.pidattim == null&& t.picodazi!=null && t.picodazi.Equals("MARRO") && t.picodtec!=null && t.picodtec.Equals("ZZZ")).OrderBy(t=>t.piserial).Take(1).ToList();
|
// var listaNot = dbContext.Notif.Where(t => t.pidattim == null&& t.picodazi!=null && t.picodazi.Equals("MARRO") && t.picodtec!=null && t.picodtec.Equals("ZZZ")).OrderBy(t=>t.piserial).Take(1).ToList();
|
||||||
|
|
||||||
foreach(Notifiche n in listaNot)
|
// foreach(Notifiche n in listaNot)
|
||||||
{
|
// {
|
||||||
lst.Add(n);
|
// lst.Add(n);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
return lst;
|
return lst;
|
||||||
@ -122,37 +122,37 @@ namespace ApiPolo.Services
|
|||||||
private void markNotify(List<MexPush> lst)
|
private void markNotify(List<MexPush> lst)
|
||||||
{
|
{
|
||||||
#region MARRO
|
#region MARRO
|
||||||
var optionsBuilder = new DbContextOptionsBuilder<MARRO_NOTIFICHEDbContext>();
|
//var optionsBuilder = new DbContextOptionsBuilder<MARRO_NOTIFICHEDbContext>();
|
||||||
optionsBuilder.UseSqlServer(Configuration.GetConnectionString("MARRO"));
|
//optionsBuilder.UseSqlServer(Configuration.GetConnectionString("MARRO"));
|
||||||
using (var dbContext = new MARRO_NOTIFICHEDbContext(optionsBuilder.Options))
|
//using (var dbContext = new MARRO_NOTIFICHEDbContext(optionsBuilder.Options))
|
||||||
{
|
//{
|
||||||
foreach (MexPush n in lst)
|
// foreach (MexPush n in lst)
|
||||||
{
|
// {
|
||||||
Notifiche r = n.notifi;
|
// Notifiche r = n.notifi;
|
||||||
r.pidattim = DateTime.Now;
|
// r.pidattim = DateTime.Now;
|
||||||
dbContext.Entry(r).State = EntityState.Modified;
|
// dbContext.Entry(r).State = EntityState.Modified;
|
||||||
dbContext.SaveChanges();
|
// dbContext.SaveChanges();
|
||||||
|
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
private void markNotify2(List<Notifiche> lst)
|
private void markNotify2(List<Notifiche> lst)
|
||||||
{
|
{
|
||||||
#region MARRO
|
#region MARRO
|
||||||
var optionsBuilder = new DbContextOptionsBuilder<MARRO_NOTIFICHEDbContext>();
|
//var optionsBuilder = new DbContextOptionsBuilder<MARRO_NOTIFICHEDbContext>();
|
||||||
optionsBuilder.UseSqlServer(Configuration.GetConnectionString("MARRO"));
|
//optionsBuilder.UseSqlServer(Configuration.GetConnectionString("MARRO"));
|
||||||
using (var dbContext = new MARRO_NOTIFICHEDbContext(optionsBuilder.Options))
|
//using (var dbContext = new MARRO_NOTIFICHEDbContext(optionsBuilder.Options))
|
||||||
{
|
//{
|
||||||
foreach (Notifiche n in lst)
|
// foreach (Notifiche n in lst)
|
||||||
{
|
// {
|
||||||
Notifiche r = n;
|
// Notifiche r = n;
|
||||||
r.pidattim = DateTime.Now;
|
// r.pidattim = DateTime.Now;
|
||||||
dbContext.Entry(r).State = EntityState.Modified;
|
// dbContext.Entry(r).State = EntityState.Modified;
|
||||||
dbContext.SaveChanges();
|
// dbContext.SaveChanges();
|
||||||
|
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,21 +1,7 @@
|
|||||||
using ApiPolo.Models;
|
using ApiPolo.Models;
|
||||||
using ApiPolo.Models.Discovery_dbcontext;
|
|
||||||
using ApiPolo.Models.Ferrari_dbcontext;
|
|
||||||
using ApiPolo.Models.Marrocco_dbcontext;
|
|
||||||
using ApiPolo.Models.Sicilia_dbcontext;
|
|
||||||
using ApiPolo.Models.Sarom_dbcontext;
|
|
||||||
using ApiPolo.Models.Gitoga_dbcontext;
|
|
||||||
using ApiPolo.Models.Lifta_dbcontext;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
using ApiPolo.Models.Sinergo_dbcontext;
|
|
||||||
using ApiPolo.Services;
|
using ApiPolo.Services;
|
||||||
using ApiPolo.Models.Siet_dbcontext;
|
|
||||||
using ApiPolo.Models.PMS_dbcontext;
|
|
||||||
using ApiPolo.Models.VT_dbcontext;
|
|
||||||
using ApiPolo.Models.Tedesco_dbcontext;
|
|
||||||
using ApiPolo.Models.Lift_web_dbcontext;
|
|
||||||
using ApiPolo.Models.Security_dbcontext;
|
|
||||||
using ApiPolo.Interfaces;
|
using ApiPolo.Interfaces;
|
||||||
using ApiPolo.Data;
|
using ApiPolo.Data;
|
||||||
|
|
||||||
@ -40,7 +26,7 @@ namespace ApiPolo
|
|||||||
services.AddControllers();
|
services.AddControllers();
|
||||||
services.AddDbContext<ConfigurazioniDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("ApiStr")));
|
services.AddDbContext<ConfigurazioniDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("ApiStr")));
|
||||||
services.AddDbContext<TokenDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("ApiStr")));
|
services.AddDbContext<TokenDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("ApiStr")));
|
||||||
|
/*
|
||||||
#region FERRARI
|
#region FERRARI
|
||||||
services.AddDbContext<FERRA_CHIAMATEDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("FERRA")
|
services.AddDbContext<FERRA_CHIAMATEDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("FERRA")
|
||||||
, options => { options.CommandTimeout(commandTimeoutInSeconds); }
|
, options => { options.CommandTimeout(commandTimeoutInSeconds); }
|
||||||
@ -1015,15 +1001,12 @@ namespace ApiPolo
|
|||||||
));
|
));
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
//TEST
|
|
||||||
|
|
||||||
services.AddDbContext<Maras_DbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("MARAS")
|
services.AddDbContext<Maras_DbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("MARAS")
|
||||||
, options => { options.CommandTimeout(commandTimeoutInSeconds); }
|
, options => { options.CommandTimeout(commandTimeoutInSeconds); }
|
||||||
));
|
));
|
||||||
services.AddDbContext<Marro_DbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("MARRO")
|
|
||||||
, options => { options.CommandTimeout(commandTimeoutInSeconds); }
|
|
||||||
));
|
|
||||||
|
|
||||||
|
|
||||||
// FACTORY MUTI-TENANT
|
// FACTORY MUTI-TENANT
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user