This commit is contained in:
zaccaria.majid
2023-06-05 16:21:40 +02:00
21 changed files with 2649 additions and 39 deletions
@@ -28,7 +28,7 @@ namespace WebDoorCreator.API.Controllers
}
/// <summary>
/// GET: api/Order/GetCurrent
/// Recupera ordini degli ultimi 6 mesi dato cliente e stato
/// Recupera ordini dato id cliente + stato ordini (limitato a ultimi 6 mesi)
/// </summary>
/// <returns></returns>
[HttpGet("GetCurrent")]
@@ -36,7 +36,7 @@ namespace WebDoorCreator.API.Controllers
{
List<int> answ = new List<int>();
DateTime dtEnd = DateTime.Now;
DateTime dtStart = dtEnd.AddMonths(-1);
DateTime dtStart = dtEnd.AddMonths(-6);
var rawData = await WDCService.OrderStatusGetFilt(id, ordStatus, dtStart, dtEnd);
if (rawData != null)
{
@@ -49,8 +49,8 @@ namespace WebDoorCreator.API.Controllers
/// </summary>
/// <param name="OrderId"></param>
/// <returns></returns>
[HttpGet("OrderDetail")]
public async Task<OrderDetailsDTO> OrderDetail(int OrderId)
[HttpGet("GetDetail")]
public async Task<OrderDetailsDTO> GetDetail(int OrderId)
{
OrderDetailsDTO answ = new OrderDetailsDTO()
{
@@ -58,19 +58,81 @@ namespace WebDoorCreator.API.Controllers
};
// recupero info ordine
var rawOrder = await WDCService.OrderGetByKey(OrderId);
if (rawOrder != null)
if (rawOrder != null && rawOrder.CompanyNav != null)
{
answ.OrderDescript = rawOrder.OrderDescript;
answ.OrderExtCode = rawOrder.OrderExtCode;
// recupero info customer
// recupero info customer
CustomerDTO customer = new CustomerDTO()
{
Address = rawOrder.CompanyNav.Address,
City = rawOrder.CompanyNav.City,
CompanyExtCode = rawOrder.CompanyNav.CompanyExtCode,
CompanyId = rawOrder.CompanyNav.CompanyId,
CompanyName = rawOrder.CompanyNav.CompanyName,
State = rawOrder.CompanyNav.State,
VAT = rawOrder.CompanyNav.VAT,
ZipCode = rawOrder.CompanyNav.ZipCode
};
answ.CustomerInfo = customer;
// recuper elenco porte...
List<DoorCostingDTO> dcDTO = new List<DoorCostingDTO>();
var doorsList = await WDCService.DoorGetByOrderId(OrderId);
foreach (var door in doorsList)
{
// recupero i dato DoorOp
var doorOpList = await WDCService.DoorOpGetByDoorId(door.DoorId);
Dictionary<string, List<string>> currBOMList = new Dictionary<string, List<string>>();
// ciclo su tutte le DoorOp
foreach (var doorOp in doorOpList)
{
// cerco se ci sia già o meno nella BOM l'item corrente
if (currBOMList.ContainsKey(doorOp.ObjectId))
{
currBOMList[doorOp.ObjectId].Add(doorOp.JsoncActVal);
}
else
{
List<string> currOp = new List<string>();
currOp.Add(doorOp.JsoncActVal);
currBOMList.Add(doorOp.ObjectId, currOp);
}
}
// creo oggetto DTO finale della porta
var doorDto = new DoorCostingDTO()
{
DoorId = door.DoorId,
Quantity = door.Quantity,
EstimatedWorkTime = 0,
BOMList = currBOMList
};
dcDTO.Add(doorDto);
}
//answ. = rawOrder.OrderDescript;
answ.DoorsList = dcDTO;
}
// popolo con dati specifica...
return answ;
}
/// <summary>
/// Door price update for order's cost evaluation
/// </summary>
/// <param name="EvalResults">list of DoorPriceDTO with UnitPrices</param>
/// <returns></returns>
[HttpPost("DoorPriceUpdate")]
public async Task<string> DoorPriceUpdate(List<DoorPriceDTO> EvalResults)
{
string answ = "NA";
var updateSet = EvalResults
.Where(x => x.Valid)
.ToDictionary(x => x.DoorId, x => x.UnitCost);
bool fatto = await WDCService.DoorUpdateCosts(updateSet);
answ = fatto ? "OK" : "NO";
return answ;
}
private static IConfiguration _configuration = null!;
private static Logger Log = LogManager.GetCurrentClassLogger();
@@ -639,6 +639,43 @@ namespace WebDoorCreator.Data.Controllers
return dbResult;
}
/// <summary>
/// Update costing for dictionary of doors
/// </summary>
/// <param name="DoorUnitCosts"></param>
/// <returns></returns>
public async Task<bool> DoorUpdateCosts(Dictionary<int, decimal> DoorUnitCosts)
{
bool fatto = false;
using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
{
try
{
// ciclo x ogni porta...
foreach (var item in DoorUnitCosts)
{
var currRec = localDbCtx
.DbSetDoor
.Where(x => x.DoorId == item.Key)
.FirstOrDefault();
if (currRec != null) //if is not null edit the record found
{
currRec.UnitCost = item.Value;
localDbCtx.Entry(currRec).State = EntityState.Modified;
}
}
await localDbCtx.SaveChangesAsync();
fatto = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione durante DoorUpdateCosts: {Environment.NewLine}{exc}");
}
}
return fatto;
}
/// <summary>
/// Modifying or adding a new door
/// </summary>
@@ -659,8 +696,8 @@ namespace WebDoorCreator.Data.Controllers
if (currRec != null) //if is not null edit the record found
{
currRec.Quantity = addEditRec.Quantity;
currRec.DoorExtCode= addEditRec.DoorExtCode;
currRec.DoorDescript= addEditRec.DoorDescript;
currRec.DoorExtCode = addEditRec.DoorExtCode;
currRec.DoorDescript = addEditRec.DoorDescript;
currRec.DoorIdParent = addEditRec.DoorIdParent;
localDbCtx.Entry(currRec).State = EntityState.Modified;
}
@@ -706,7 +743,7 @@ namespace WebDoorCreator.Data.Controllers
}
/// <summary>
/// Adding a new list value
/// Adding new list value set
/// </summary>
/// <param name="addRec">Record to add</param>
/// <returns></returns>
@@ -729,14 +766,12 @@ namespace WebDoorCreator.Data.Controllers
.AddRange(addList);
await localDbCtx.SaveChangesAsync();
// stored di merge dati in vocabolario
// stored di merge dati in ListVal
storedRes = localDbCtx
.Database
.ExecuteSqlRaw("exec dbo.stp_ListVal_Import");
fatto = true;
fatto = true;
}
catch (Exception exc)
{
@@ -746,6 +781,45 @@ namespace WebDoorCreator.Data.Controllers
return fatto;
}
/// <summary>
/// Adding new DoorOpType data
/// </summary>
/// <param name="addRec">Record to add</param>
/// <returns></returns>
public async Task<bool> DoorOpTypeAdd(List<DoorOpTypeTempModel> addList)
{
bool fatto = false;
using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
{
try
{
// stored di reset ListValues
var storedRes = localDbCtx
.Database
.ExecuteSqlRaw("exec dbo.stp_DoorOpType_Prepare");
await localDbCtx.SaveChangesAsync();
// import massivo dati in tab temp
localDbCtx
.DbSetDoorOpTypeTemp
.AddRange(addList);
await localDbCtx.SaveChangesAsync();
// stored di merge dati in DoorOpType
storedRes = localDbCtx
.Database
.ExecuteSqlRaw("exec dbo.stp_DoorOpType_Import");
fatto = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione durante DoorOpTypeAdd: {Environment.NewLine}{exc}");
}
}
return fatto;
}
/// <summary>
/// ListValues list (All)
/// </summary>
@@ -887,6 +961,7 @@ namespace WebDoorCreator.Data.Controllers
var rawData = dbCtx
.DbSetOrders
.Where(x => x.OrderId == orderId)
.Include(c => c.CompanyNav)
.AsNoTracking()
.FirstOrDefault();
if (rawData != null)
+1 -1
View File
@@ -28,7 +28,7 @@ namespace WebDoorCreator.Data.DTO
/// </summary>
public string SvgGen { get; set; } = "";
/// <summary>
/// Articat path (ex 3d zip/pack)
/// Artifats path (ex 3d zip/pack)
/// </summary>
public string artifactPath { get; set; } = "";
}
+2 -5
View File
@@ -13,13 +13,10 @@ namespace WebDoorCreator.Data.DTO
public class DoorCostingDTO
{
public int DoorId { get; set; } = 0;
public double SizeX { get; set; } = 0;
public double SizeY { get; set; } = 0;
public double SizeZ { get; set; } = 0;
public int Quantity { get; set; } = 1;
public double EstimatedWorkTime { get; set; } = 0;
public Dictionary<string, double> BOMList { get; set; }= new Dictionary<string, double>();
public Dictionary<string, List<string>> BOMList { get; set; }= new Dictionary<string, List<string>>();
}
}
+35
View File
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WebDoorCreator.Data.DTO
{
/// <summary>
/// Door cost data DTO
/// </summary>
public class DoorPriceDTO
{
/// <summary>
/// Door UID
/// </summary>
public int OrderId { get; set; } = 0;
/// <summary>
/// Door UID
/// </summary>
public int DoorId { get; set; } = 0;
/// <summary>
/// Articat path (ex 3d zip/pack)
/// </summary>
public decimal UnitCost { get; set; } = 0;
/// <summary>
/// Valid = true / cannot deliver = false
/// </summary>
public bool Valid { get; set; } = true;
/// <summary>
/// Error message (optional)
/// </summary>
public string ErrorMsg { get; set; } = "";
}
}
@@ -72,16 +72,20 @@ namespace WebDoorCreator.Data.DbModels
/// </summary>
public int ParentDoorOpId { get; set; } = 0;
/// <summary>
/// Idx univoco dell'elemento parent (se 0 = root)
/// </summary>
public HierarchyId? DoorOpIdPathFromPatriarch { get; set; }
///// <summary>
///// Idx univoco dell'elemento parent (se 0 = root)
///// </summary>
//public HierarchyId? DoorOpIdPathFromPatriarch { get; set; }
/// <summary>
/// Oggetto Json per specifica configurazione (template)
/// Unit cost for the door
/// </summary>
public string JsoncConfig { get; set; } = "";
public decimal UnitCost { get; set; } = 0;
///// <summary>
///// Oggetto Json per specifica configurazione (template)
///// </summary>
//public string JsoncConfig { get; set; } = "";
/// <summary>
/// Codice esterno (opzionale)
@@ -0,0 +1,129 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace WebDoorCreator.Data.DbModels
{
/// <summary>
/// Tabella dati Door Operation Type (astratte) TEMP
/// </summary>
[Table("DoorOpTypeTemp")]
public class DoorOpTypeTempModel
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int DoorOpTypId { get; set; }
/// <summary>
/// Codice univoco dell'operazione da svolgere (calcolato, idealmente 4 char da 36 val 0..Z)
/// </summary>
public string OpCode { get; set; } = "";
/// <summary>
/// Descrizione
/// </summary>
public string Description { get; set; } = "";
/// <summary>
/// Indica se sia da creare sempre
/// </summary>
public bool IsDefault { get; set; } = false;
/// <summary>
/// Indica se ci sia un hardware correlato all'operazione
/// </summary>
public bool HasHw { get; set; } = true;
/// <summary>
/// Indica se sia un oggetto concreto (= con un file, che si può produrre) o abstract (ha figli, è un gruppo logico)
/// </summary>
public bool IsConcrete { get; set; } = true;
/// <summary>
/// Codice dell'HW collegato
/// </summary>
public string HwCode { get; set; } = "";
/// <summary>
/// Descrizione dell'HW collegato
/// </summary>
public string HwDescription { get; set; } = "";
/// <summary>
/// URL dell'immagine/link di riferimento
/// </summary>
public string DisplayUrl { get; set; } = "";
/// <summary>
/// Path folder/file di riferimento
/// </summary>
public string FPath { get; set; } = "";
/// <summary>
/// Idx univoco dell'elemento parent (se 0 = root)
/// </summary>
public int ParentDoorOpId { get; set; } = 0;
///// <summary>
///// Idx univoco dell'elemento parent (se 0 = root)
///// </summary>
//public HierarchyId? DoorOpIdPathFromPatriarch { get; set; }
/// <summary>
/// Unit cost for the door
/// </summary>
public decimal UnitCost { get; set; } = 0;
///// <summary>
///// Oggetto Json per specifica configurazione (template)
///// </summary>
//public string JsoncConfig { get; set; } = "";
/// <summary>
/// Codice esterno (opzionale)
/// </summary>
public string ExtOpCode { get; set; } = "";
/// <summary>
/// Descrizione esterna (opzionale)
/// </summary>
public string ExtDescript { get; set; } = "";
/// <summary>
/// Revisione dell'item
/// </summary>
public string Rev { get; set; } = "";
/// <summary>
/// Inizio validità item
/// </summary>
public DateTime ValidFrom { get; set; } = new DateTime(2000, 1, 1);
/// <summary>
/// Fine validità item
/// </summary>
public DateTime ValidUntil { get; set; } = new DateTime(3000, 1, 1);
/// <summary>
/// Check validità item
/// </summary>
[NotMapped]
public bool IsActive
{
get => DateTime.Today >= ValidFrom && DateTime.Today <= ValidUntil;
}
/// <summary>
/// Numero massimo associabile a singola Door
/// </summary>
public int MaxAllowed { get; set; } = 1;
}
}
@@ -0,0 +1,982 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using WebDoorCreator.Data;
#nullable disable
namespace WebDoorCreator.Data.Migrations.WDCData
{
[DbContext(typeof(WDCDataContext))]
[Migration("20230605134244_DoorOpTypeUpdate")]
partial class DoorOpTypeUpdate
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.UseCollation("Latin1_General_CI_AS")
.HasAnnotation("ProductVersion", "6.0.14")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("WebDoorCreator.Data.DbModels.AspNetRoles", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("nvarchar(450)");
b.Property<string>("ConcurrencyStamp")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("NormalizedName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("AspNetRoles", null, t => t.ExcludeFromMigrations());
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.AspNetUserRoles", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("RoleId")
.HasColumnType("nvarchar(450)");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", null, t => t.ExcludeFromMigrations());
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.AspNetUsers", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("nvarchar(450)");
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");
b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("NormalizedEmail")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("NormalizedUserName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("PasswordHash")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");
b.Property<string>("SecurityStamp")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");
b.Property<string>("UserName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("AspNetUsers", null, t => t.ExcludeFromMigrations());
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.CompanyModel", b =>
{
b.Property<int>("CompanyId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("CompanyId"), 1L, 1);
b.Property<string>("Address")
.IsRequired()
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("City")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("CompanyExtCode")
.IsRequired()
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("CompanyName")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("CompanyToken")
.IsRequired()
.HasMaxLength(150)
.HasColumnType("nvarchar(150)");
b.Property<string>("PrivateNote")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("State")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("VAT")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("ZipCode")
.HasColumnType("int");
b.HasKey("CompanyId");
b.ToTable("Company");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.ConfigModel", b =>
{
b.Property<string>("chiave")
.HasColumnType("nvarchar(450)");
b.Property<string>("note")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("valore")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("valoreStd")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("chiave");
b.ToTable("Config");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.DoorModel", b =>
{
b.Property<int>("DoorId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("DoorId"), 1L, 1);
b.Property<DateTime>("DateIns")
.HasColumnType("datetime2");
b.Property<DateTime>("DateLockExpiry")
.HasColumnType("datetime2");
b.Property<DateTime>("DateMod")
.HasColumnType("datetime2");
b.Property<string>("DoorDescript")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("DoorExtCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("DoorIdParent")
.HasColumnType("int");
b.Property<string>("MeasureUnit")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("OrderId")
.HasColumnType("int");
b.Property<int>("Quantity")
.HasColumnType("int");
b.Property<decimal>("UnitCost")
.HasColumnType("decimal(18,2)");
b.Property<string>("UserIdIns")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("UserIdLock")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("UserIdMod")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("DoorId");
b.HasIndex("OrderId");
b.ToTable("Door");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.DoorOpModel", b =>
{
b.Property<int>("DoorOpId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("DoorOpId"), 1L, 1);
b.Property<DateTime>("DateIns")
.HasColumnType("datetime2");
b.Property<DateTime>("DateMod")
.HasColumnType("datetime2");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("DoorId")
.HasColumnType("int");
b.Property<DateTime?>("DtConfirm")
.HasColumnType("datetime2");
b.Property<string>("JsoncActVal")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("JsoncConfigVal")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("ObjectId")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("UserIdIns")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("UserIdMod")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("userConfirm")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("DoorOpId");
b.HasIndex("DoorId");
b.ToTable("DoorOp");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.DoorOpTypeModel", b =>
{
b.Property<int>("DoorOpTypId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("DoorOpTypId"), 1L, 1);
b.Property<string>("Description")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("DisplayUrl")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("ExtDescript")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("ExtOpCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("FPath")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("HasHw")
.HasColumnType("bit");
b.Property<string>("HwCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("HwDescription")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsConcrete")
.HasColumnType("bit");
b.Property<bool>("IsDefault")
.HasColumnType("bit");
b.Property<int>("MaxAllowed")
.HasColumnType("int");
b.Property<string>("OpCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("ParentDoorOpId")
.HasColumnType("int");
b.Property<string>("Rev")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<decimal>("UnitCost")
.HasColumnType("decimal(18,2)");
b.Property<DateTime>("ValidFrom")
.HasColumnType("datetime2");
b.Property<DateTime>("ValidUntil")
.HasColumnType("datetime2");
b.HasKey("DoorOpTypId");
b.ToTable("DoorOpType");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.GraphicParamsModel", b =>
{
b.Property<int>("GraphicParamId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("GraphicParamId"), 1L, 1);
b.Property<int>("compoId")
.HasColumnType("int");
b.Property<string>("graphicParamAlias")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("graphicParamDefaultVal")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("graphicParamKey")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("graphicParamName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("graphicParamType")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("graphicParamsN")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("GraphicParamId");
b.ToTable("GraphicParams");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.HardwareModel", b =>
{
b.Property<int>("HardwareId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("HardwareId"), 1L, 1);
b.Property<string>("compoAlias")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("compoLayerName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("compoName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("compoTemplateIsActive")
.HasColumnType("bit");
b.HasKey("HardwareId");
b.ToTable("Hardware");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.LanguageModel", b =>
{
b.Property<string>("CodLingua")
.HasMaxLength(5)
.HasColumnType("nvarchar(5)");
b.Property<string>("DescrizioneLingua")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("CodLingua");
b.ToTable("Languages");
b.HasData(
new
{
CodLingua = "EN",
DescrizioneLingua = "English"
},
new
{
CodLingua = "IT",
DescrizioneLingua = "Italiano"
});
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.ListValuesModel", b =>
{
b.Property<string>("TableName")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("FieldName")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Value")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("DefaultVal")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("InputType")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Label")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("Ordinal")
.HasColumnType("int");
b.Property<bool>("isSerializable")
.HasMaxLength(5)
.HasColumnType("bit");
b.HasKey("TableName", "FieldName", "Value");
b.ToTable("ListValues");
b.HasData(
new
{
TableName = "Opening",
FieldName = "Swing",
Value = "LH",
Label = "Left Handed",
Ordinal = 1,
isSerializable = false
},
new
{
TableName = "Opening",
FieldName = "Swing",
Value = "RH",
Label = "Right Handed",
Ordinal = 2,
isSerializable = false
},
new
{
TableName = "Opening",
FieldName = "Swing",
Value = "LHR",
Label = "Left Handed Reverse",
Ordinal = 3,
isSerializable = false
},
new
{
TableName = "Opening",
FieldName = "Swing",
Value = "RHR",
Label = "Right Handed Reverse",
Ordinal = 4,
isSerializable = false
},
new
{
TableName = "Edges",
FieldName = "EdgeType",
Value = "BV",
Label = "Bevel",
Ordinal = 1,
isSerializable = false
},
new
{
TableName = "Edges",
FieldName = "EdgeType",
Value = "SQ",
Label = "Squared",
Ordinal = 2,
isSerializable = false
},
new
{
TableName = "Edges",
FieldName = "EdgeType",
Value = "1B",
Label = "Bull Nose 1",
Ordinal = 3,
isSerializable = false
});
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.ListValuesTempModel", b =>
{
b.Property<string>("TableName")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("FieldName")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Value")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("DefaultVal")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("InputType")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Label")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("Ordinal")
.HasColumnType("int");
b.Property<bool>("isSerializable")
.HasMaxLength(5)
.HasColumnType("bit");
b.HasKey("TableName", "FieldName", "Value");
b.ToTable("ListValuesTemp");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.OrderModel", b =>
{
b.Property<int>("OrderId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("OrderId"), 1L, 1);
b.Property<int>("CompanyId")
.HasColumnType("int");
b.Property<DateTime>("DateDelivery")
.HasColumnType("datetime2");
b.Property<DateTime>("DateIns")
.HasColumnType("datetime2");
b.Property<DateTime>("DateMod")
.HasColumnType("datetime2");
b.Property<double>("Discount")
.HasColumnType("float");
b.Property<string>("OrderDescript")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("OrderExtCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<string>("UserIdIns")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("UserIdMod")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("OrderId");
b.HasIndex("CompanyId");
b.ToTable("Order");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.OrderStatusViewModel", b =>
{
b.Property<int>("OrderId")
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("OrderId"), 1L, 1);
b.Property<int>("CompanyId")
.HasColumnType("int");
b.Property<DateTime>("DateDelivery")
.HasColumnType("datetime2");
b.Property<DateTime>("DateIns")
.HasColumnType("datetime2");
b.Property<double>("Discount")
.HasColumnType("float");
b.Property<int>("NumDoors")
.HasColumnType("int");
b.Property<int>("NumType")
.HasColumnType("int");
b.Property<string>("OrderDescript")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("OrderExtCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("OrderStatus")
.HasColumnType("int");
b.Property<decimal>("TotCost")
.HasColumnType("decimal(18,2)");
b.Property<string>("UserIdIns")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("UserIdMod")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("OrderId");
b.ToView("v_OrderStatus");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.PrtRepOrderModel", b =>
{
b.Property<int>("OrderId")
.HasColumnType("int");
b.Property<int>("DoorId")
.HasColumnType("int");
b.Property<string>("ObjectKey")
.HasColumnType("nvarchar(450)");
b.Property<string>("Address")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("City")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("CompanyExtCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("CompanyId")
.HasColumnType("int");
b.Property<string>("CompanyName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DateIns")
.HasColumnType("datetime2");
b.Property<DateTime>("DateMod")
.HasColumnType("datetime2");
b.Property<string>("DoorDescript")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("DoorExtCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("MeasureUnit")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("ObjectQty")
.HasColumnType("int");
b.Property<string>("ObjectType")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("ObjectVal")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("OrderDescript")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("OrderExtCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Quantity")
.HasColumnType("int");
b.Property<string>("State")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<int>("TypeId")
.HasColumnType("int");
b.Property<decimal>("UnitCost")
.HasColumnType("decimal(18,2)");
b.Property<string>("UserIdIns")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("UserIdMod")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("VAT")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("ZipCode")
.HasColumnType("int");
b.HasKey("OrderId", "DoorId", "ObjectKey");
b.ToTable("DbSetPrtRepOrder");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.SerializedDoorsModel", b =>
{
b.Property<int>("DoorTmpId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("DoorTmpId"), 1L, 1);
b.Property<string>("DoorSerVal")
.HasColumnType("nvarchar(max)");
b.Property<bool>("Lock")
.HasColumnType("bit");
b.HasKey("DoorTmpId");
b.ToTable("SerializedDoors");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.UsersViewModel", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("RoleId")
.HasColumnType("nvarchar(450)");
b.Property<int>("ClaimId")
.HasColumnType("int");
b.Property<string>("ClaimType")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("RoleName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("UserName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "RoleId", "ClaimId");
b.ToView("v_UserRolesClaims");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.VocabularyModel", b =>
{
b.Property<string>("Lingua")
.HasMaxLength(5)
.HasColumnType("nvarchar(5)");
b.Property<string>("Lemma")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Traduzione")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.HasKey("Lingua", "Lemma");
b.ToTable("Vocabulary");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.VocabularyTempModel", b =>
{
b.Property<string>("Lingua")
.HasMaxLength(5)
.HasColumnType("nvarchar(5)");
b.Property<string>("Lemma")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Traduzione")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.HasKey("Lingua", "Lemma");
b.ToTable("VocabularyTemp");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.AspNetUserRoles", b =>
{
b.HasOne("WebDoorCreator.Data.DbModels.AspNetRoles", "RolesNav")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("WebDoorCreator.Data.DbModels.AspNetUsers", "UsersNav")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("RolesNav");
b.Navigation("UsersNav");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.DoorModel", b =>
{
b.HasOne("WebDoorCreator.Data.DbModels.OrderModel", "OrderNav")
.WithMany()
.HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("OrderNav");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.DoorOpModel", b =>
{
b.HasOne("WebDoorCreator.Data.DbModels.DoorModel", "DoorNav")
.WithMany()
.HasForeignKey("DoorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("DoorNav");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.OrderModel", b =>
{
b.HasOne("WebDoorCreator.Data.DbModels.CompanyModel", "CompanyNav")
.WithMany()
.HasForeignKey("CompanyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CompanyNav");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,48 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WebDoorCreator.Data.Migrations.WDCData
{
public partial class DoorOpTypeUpdate : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DoorOpIdPathFromPatriarch",
table: "DoorOpType");
migrationBuilder.DropColumn(
name: "JsoncConfig",
table: "DoorOpType");
migrationBuilder.AddColumn<decimal>(
name: "UnitCost",
table: "DoorOpType",
type: "decimal(18,2)",
nullable: false,
defaultValue: 0m);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "UnitCost",
table: "DoorOpType");
migrationBuilder.AddColumn<HierarchyId>(
name: "DoorOpIdPathFromPatriarch",
table: "DoorOpType",
type: "hierarchyid",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "JsoncConfig",
table: "DoorOpType",
type: "nvarchar(max)",
nullable: false,
defaultValue: "");
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,48 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WebDoorCreator.Data.Migrations.WDCData
{
public partial class DoorOpTypeTempSetup : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "DoorOpTypeTemp",
columns: table => new
{
DoorOpTypId = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
OpCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
IsDefault = table.Column<bool>(type: "bit", nullable: false),
HasHw = table.Column<bool>(type: "bit", nullable: false),
IsConcrete = table.Column<bool>(type: "bit", nullable: false),
HwCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
HwDescription = table.Column<string>(type: "nvarchar(max)", nullable: false),
DisplayUrl = table.Column<string>(type: "nvarchar(max)", nullable: false),
FPath = table.Column<string>(type: "nvarchar(max)", nullable: false),
ParentDoorOpId = table.Column<int>(type: "int", nullable: false),
UnitCost = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
ExtOpCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
ExtDescript = table.Column<string>(type: "nvarchar(max)", nullable: false),
Rev = table.Column<string>(type: "nvarchar(max)", nullable: false),
ValidFrom = table.Column<DateTime>(type: "datetime2", nullable: false),
ValidUntil = table.Column<DateTime>(type: "datetime2", nullable: false),
MaxAllowed = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DoorOpTypeTemp", x => x.DoorOpTypId);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DoorOpTypeTemp");
}
}
}
@@ -330,8 +330,78 @@ namespace WebDoorCreator.Data.Migrations.WDCData
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<HierarchyId>("DoorOpIdPathFromPatriarch")
.HasColumnType("hierarchyid");
b.Property<string>("ExtDescript")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("ExtOpCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("FPath")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("HasHw")
.HasColumnType("bit");
b.Property<string>("HwCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("HwDescription")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsConcrete")
.HasColumnType("bit");
b.Property<bool>("IsDefault")
.HasColumnType("bit");
b.Property<int>("MaxAllowed")
.HasColumnType("int");
b.Property<string>("OpCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("ParentDoorOpId")
.HasColumnType("int");
b.Property<string>("Rev")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<decimal>("UnitCost")
.HasColumnType("decimal(18,2)");
b.Property<DateTime>("ValidFrom")
.HasColumnType("datetime2");
b.Property<DateTime>("ValidUntil")
.HasColumnType("datetime2");
b.HasKey("DoorOpTypId");
b.ToTable("DoorOpType");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.DoorOpTypeTempModel", b =>
{
b.Property<int>("DoorOpTypId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("DoorOpTypId"), 1L, 1);
b.Property<string>("Description")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("DisplayUrl")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("ExtDescript")
.IsRequired()
@@ -362,10 +432,6 @@ namespace WebDoorCreator.Data.Migrations.WDCData
b.Property<bool>("IsDefault")
.HasColumnType("bit");
b.Property<string>("JsoncConfig")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("MaxAllowed")
.HasColumnType("int");
@@ -380,6 +446,9 @@ namespace WebDoorCreator.Data.Migrations.WDCData
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<decimal>("UnitCost")
.HasColumnType("decimal(18,2)");
b.Property<DateTime>("ValidFrom")
.HasColumnType("datetime2");
@@ -388,7 +457,7 @@ namespace WebDoorCreator.Data.Migrations.WDCData
b.HasKey("DoorOpTypId");
b.ToTable("DoorOpType");
b.ToTable("DoorOpTypeTemp");
});
modelBuilder.Entity("WebDoorCreator.Data.DbModels.GraphicParamsModel", b =>
@@ -165,7 +165,10 @@ namespace WebDoorCreator.Data.Services
List<ListValuesTempModel> listValues = new List<ListValuesTempModel>();
ListValuesTempModel Values = new ListValuesTempModel();
dbController.TestTablesTruncate();
// usato in fase di test iniziale, da rimuovere
#if false
dbController.TestTablesTruncate();
#endif
List<string> listActiveCompo = await CompoGetAllActive(Path.Combine(rootPath, @"Default.ini"));
List<HardwareModel> listCompoS = new List<HardwareModel>();
@@ -534,6 +537,8 @@ namespace WebDoorCreator.Data.Services
fatto = await dbController.ListValuesAdd(listValues);
// ripetere con DoorOpType
return fatto;
}
@@ -971,7 +976,9 @@ namespace WebDoorCreator.Data.Services
/// <param name="doorDescr">Description for the door</param>
/// <param name="orderId">Destination order where door must be placed</param>
/// <param name="userName">userName for cloning</param>
/// <param name="isClone">true = cloning a door and save TypeId from orig, false = save to template order</param>
/// <param name="isClone">
/// true = cloning a door and save TypeId from orig, false = save to template order
/// </param>
/// <returns></returns>
public async Task<int> DoorCloneToOrder(int doorId, string doorCode, string doorDescr, int orderId, string userName, bool isClone)
{
@@ -1575,6 +1582,25 @@ namespace WebDoorCreator.Data.Services
return dbResult;
}
/// <summary>
/// Update costing for dictionary of doors
/// </summary>
/// <param name="DoorUnitCosts"></param>
/// <returns></returns>
public async Task<bool> DoorUpdateCosts(Dictionary<int, decimal> DoorUnitCosts)
{
var dbResult = await dbController.DoorUpdateCosts(DoorUnitCosts);
// elimino cache redis dati porte...
bool answ = false;
foreach (var item in DoorUnitCosts)
{
answ = await DoorFlushCache(item.Key);
}
// elimino cache redis dati ordine...
answ = answ && await OrdersFlushCache();
return dbResult;
}
/// <summary>
/// Update or add door
/// </summary>
@@ -0,0 +1,39 @@
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: S.E.L.
-- Create date: 2023.06.05
-- Description: Esecuzione preparazione tab temp x import DoorOpType
-- =============================================
CREATE PROCEDURE [dbo].[stp_DoorOpType_Import]
AS
BEGIN
SET NOCOUNT ON;
BEGIN tran
-- effettua merge dati listValues
MERGE DoorOpType as tgt
USING (SELECT DoorOpTypId,OpCode,[Description],HasHw,IsConcrete,HwCode,HwDescription,FPath,ExtOpCode,ExtDescript,Rev,ValidFrom,ValidUntil,IsDefault,DisplayUrl,MaxAllowed,ParentDoorOpId
,UnitCost FROM DoorOpTypeTemp) as src
ON tgt.OpCode = src.OpCode
WHEN MATCHED THEN
UPDATE SET [Description] = src.[Description]
, HasHw = src.HasHw
, IsConcrete = src.IsConcrete
, HwCode = src.HwCode
, HwDescription = src.HwDescription
WHEN NOT MATCHED THEN
INSERT (OpCode,[Description],HasHw,IsConcrete,HwCode,HwDescription)
VALUES (OpCode,[Description],HasHw,IsConcrete,HwCode,HwDescription);
COMMIT tran
END
GO
@@ -0,0 +1,25 @@
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: S.E.L.
-- Create date: 2023.06.05
-- Description: Esecuzione preparazione tab temp x import DoorOpType
-- =============================================
CREATE PROCEDURE [dbo].[stp_DoorOpType_Prepare]
AS
BEGIN
SET NOCOUNT ON;
BEGIN tran
-- effettua preparazione tab appoggio
TRUNCATE TABLE DoorOpTypeTemp
COMMIT tran
END
@@ -22,10 +22,14 @@ BEGIN
USING (SELECT TableName, FieldName, [Value], Label, Ordinal, InputType, DefaultVal, isSerializable FROM ListValuesTemp) as src
ON tgt.TableName = src.TableName AND tgt.FieldName = src.FieldName AND tgt.[value] = src.[value]
WHEN MATCHED THEN
UPDATE SET [value] = src.[value], DefaultVal = src.DefaultVal
UPDATE SET [Label] = src.[Label]
, Ordinal = src.Ordinal
, DefaultVal = src.DefaultVal
, InputType = src.InputType
, IsSerializable = src.IsSerializable
WHEN NOT MATCHED THEN
INSERT (TableName, FieldName, [Value], Label, Ordinal, InputType, DefaultVal, isSerializable)
VALUES (TableName, FieldName, [Value], Label, Ordinal, InputType, DefaultVal, isSerializable);
INSERT (TableName, FieldName, [Value], [Label], Ordinal, DefaultVal, InputType, isSerializable)
VALUES (TableName, FieldName, [Value], [Label], Ordinal, DefaultVal, InputType, isSerializable);
COMMIT tran
@@ -19,6 +19,11 @@ BEGIN
-- effettua preparazione tab appoggio
TRUNCATE TABLE ListValuesTemp
---- backup x sicurezza...
--DROP TABLE IF EXISTS DoorOpBackup
--SELECT * INTO DoorOpBackup
--FROM DoorOp
COMMIT tran
+1
View File
@@ -68,6 +68,7 @@ namespace WebDoorCreator.Data
public virtual DbSet<ListValuesTempModel> DbSetValuesTemp { get; set; } = null!;
public virtual DbSet<DoorOpTypeModel> DbSetDoorOpType { get; set; } = null!;
public virtual DbSet<DoorOpTypeTempModel> DbSetDoorOpTypeTemp { get; set; } = null!;
public virtual DbSet<DoorOpModel> DbSetDoorOp { get; set; } = null!;
public virtual DbSet<HardwareModel> DbSetHardware { get; set; } = null!;
public virtual DbSet<GraphicParamsModel> DbSetGraphicParams { get; set; } = null!;
@@ -35,9 +35,15 @@
</ItemGroup>
<ItemGroup>
<None Update="SqlScripts\Stored\stp_DoorOpType_Import.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="SqlScripts\Stored\stp_ListVal_Import.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="SqlScripts\Stored\stp_DoorOpType_Prepare.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="SqlScripts\Stored\stp_ListVal_Prepare.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
@@ -330,7 +330,7 @@ namespace WebDoorCreator.UI.Components.DoorMan
Dictionary<string, string> answ = new Dictionary<string, string>();
answ.Add($"D.{door.DoorId}", $"x {door.Quantity}");
answ.Add($"{door.DoorExtCode} {door.DoorDescript}", "");
answ.Add("Unit Price", $"{(door.Quantity * door.UnitCost):C2}");
answ.Add($"{door.UnitCost:C2}", $"{(door.Quantity * door.UnitCost):C2}");
return answ;
}
+1 -1
View File
@@ -136,7 +136,7 @@ namespace WebDoorCreator.UI.Pages
protected string _defaultPath = "";
protected string defaultPath { get; set; } = "";
protected string defaultPath { get; set; } = "R:\\EgtData\\Doors\\EgtCompoBase\\Compo";
protected bool isCompShow { get; set; } = true;