DBContext changes
This commit is contained in:
@@ -38,9 +38,47 @@ namespace PartSource.Automation.Jobs
|
|||||||
|
|
||||||
IEnumerable<Product> products = null;
|
IEnumerable<Product> products = null;
|
||||||
|
|
||||||
|
IList<string> partTypes = new List<string>
|
||||||
|
{
|
||||||
|
"CA115-SC118-FL11803_Custom Lighting Accessories",
|
||||||
|
"CA117-SC141-FL14106_Jeep Accessories",
|
||||||
|
"CA117-SC141-FL14134_Truck Running Board and Steps",
|
||||||
|
"CA117-SC141-FL14199_Bumpers, Bull Bars & Brush Guards",
|
||||||
|
"CA117-SC157-FL15704_Headache Rack Frames",
|
||||||
|
"CA117-SC158-FL15802_Salters and Plow Accessories",
|
||||||
|
"CA117-SC699-FL69902_Crossover Boxes",
|
||||||
|
"CA117-SC699-FL69903_Specialty Boxes",
|
||||||
|
"CA117-SC699-FL69904_Transfer Tanks",
|
||||||
|
"CA135-SC176-FL17601_Trailer Lighting, Stop, Turn, Tail",
|
||||||
|
"CA135-SC186-FL18607_Roof Racks",
|
||||||
|
"CA135-SC186-FL18608_Bike Carriers",
|
||||||
|
"CA135-SC186-FL18609_Cargo Accessories",
|
||||||
|
"CA135-SC186-FL18610_Cargo Carriers",
|
||||||
|
"CA135-SC186-FL18611_Watersport Carriers",
|
||||||
|
"CA135-SC192-FL19201_Class 1 Hitches",
|
||||||
|
"CA135-SC192-FL19202_Class 2 Hitches",
|
||||||
|
"CA135-SC192-FL19203_Class 3 Hitches",
|
||||||
|
"CA135-SC192-FL19204_Towing, Heavy Duty",
|
||||||
|
"CA135-SC192-FL19205_Towing Electrical, Vehicle Specific",
|
||||||
|
"CA135-SC192-FL19206_Trailer Parts & Accessories",
|
||||||
|
"CA135-SC192-FL19207_Trailer Winches, Jacks & Couplers",
|
||||||
|
"CA135-SC192-FL19208_Class 5 Hitches",
|
||||||
|
"CA135-SC192-FL19221_Towing Electrical, Connectors & Adapters",
|
||||||
|
"CA135-SC192-FL19230_Towing Electrical, Controls & Converters",
|
||||||
|
"CA135-SC192-FL19235_Towing Electrical, Harnesses",
|
||||||
|
"CA135-SC192-FL19240_Towing Security, Non-Locking",
|
||||||
|
"CA135-SC192-FL19245_Towing Class V",
|
||||||
|
"CA135-SC192-FL19280_Towing Balls",
|
||||||
|
"CA135-SC192-FL19281_Towing Ball Mounts",
|
||||||
|
"CA135-SC192-FL19282_Towing Security, Locking",
|
||||||
|
"CA135-SC192-FL19283_Towing Kits & Acc"
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (string partType in partTypes)
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
products = await _shopifyClient.Products.Get(new Dictionary<string, object> { { "limit", 250 }, { "product_type", "CA111-SC250-FL25049_Entry Ball Joints" } });
|
products = await _shopifyClient.Products.Get(new Dictionary<string, object> { { "limit", 250 }, { "product_type", partType } });
|
||||||
//products = new List<Product>
|
//products = new List<Product>
|
||||||
//{
|
//{
|
||||||
// await _shopifyClient.Products.GetById(4388919574575)
|
// await _shopifyClient.Products.GetById(4388919574575)
|
||||||
@@ -77,6 +115,12 @@ namespace PartSource.Automation.Jobs
|
|||||||
IList<Vehicle> vehicles = _vehicleFitmentService.GetVehiclesForPart(importData.PartNumber, importData.LineCode);
|
IList<Vehicle> vehicles = _vehicleFitmentService.GetVehiclesForPart(importData.PartNumber, importData.LineCode);
|
||||||
IList<int> vehicleIdFitment = _vehicleFitmentService.GetVehicleIdFitment(vehicles);
|
IList<int> vehicleIdFitment = _vehicleFitmentService.GetVehicleIdFitment(vehicles);
|
||||||
|
|
||||||
|
if (!vehicleIdFitment.Any())
|
||||||
|
{
|
||||||
|
Console.WriteLine($"No fitment data for SKU {importData.VariantSku}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (vehicleIdFitment.Count > 0)
|
if (vehicleIdFitment.Count > 0)
|
||||||
{
|
{
|
||||||
string vehicleIdString = string.Join(',', vehicleIdFitment.Select(j => $"v{j}"));
|
string vehicleIdString = string.Join(',', vehicleIdFitment.Select(j => $"v{j}"));
|
||||||
@@ -245,6 +289,9 @@ namespace PartSource.Automation.Jobs
|
|||||||
products = await _shopifyClient.Products.GetPrevious();
|
products = await _shopifyClient.Products.GetPrevious();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Console.WriteLine($"Finished {partType}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -30,6 +30,7 @@ namespace PartSource.Data.Contexts
|
|||||||
modelBuilder.Entity<DcfMapping>().HasKey(d => new { d.LineCode, d.WhiCode });
|
modelBuilder.Entity<DcfMapping>().HasKey(d => new { d.LineCode, d.WhiCode });
|
||||||
modelBuilder.Entity<Fitment>().HasKey(f => new { f.BaseVehicleId, f.EngineConfigId, f.LineCode, f.PartNumber });
|
modelBuilder.Entity<Fitment>().HasKey(f => new { f.BaseVehicleId, f.EngineConfigId, f.LineCode, f.PartNumber });
|
||||||
modelBuilder.Entity<Wiper>().HasKey(f => new { f.BaseVehicleId, f.PartNumber, f.LineCode, f.Position});
|
modelBuilder.Entity<Wiper>().HasKey(f => new { f.BaseVehicleId, f.PartNumber, f.LineCode, f.Position});
|
||||||
|
modelBuilder.Entity<VehicleFitment>().HasNoKey();
|
||||||
|
|
||||||
foreach (IMutableEntityType entityType in modelBuilder.Model.GetEntityTypes())
|
foreach (IMutableEntityType entityType in modelBuilder.Model.GetEntityTypes())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user