Compare commits

..

3 Commits

Author SHA1 Message Date
cbf7bb8de6 Namespace migration 2023-09-13 06:34:53 -04:00
68c9e01ef1 . 2023-08-23 15:04:54 -04:00
d95d947bc2 WIP 2023-03-25 17:50:25 -04:00
97 changed files with 960 additions and 533 deletions

View File

@@ -19,12 +19,29 @@ namespace PartSource.Api.Controllers
private readonly NexpartService _nexpartService;
private readonly PartService _partService;
private readonly VehicleService _vehicleService;
private readonly FitmentService _fitmentService;
public PartsController(NexpartService nexpartService, PartService partService, VehicleService vehicleService)
public PartsController(NexpartService nexpartService, PartService partService, VehicleService vehicleService, FitmentService fitmentService)
{
_nexpartService = nexpartService;
_partService = partService;
_vehicleService = vehicleService;
_fitmentService = fitmentService;
}
[HttpGet]
[Route("fitment")]
[Route("fitmentnote")]
public async Task<ActionResult> GetFitment([FromQuery] string sku, [FromQuery] int vehicleId)
{
VehicleFitmentDto vehicleFitment = await _fitmentService.GetFitmentNotes(sku, vehicleId);
if (vehicleFitment == null)
{
return NotFound();
}
return Ok(vehicleFitment);
}
[HttpGet]
@@ -34,24 +51,15 @@ namespace PartSource.Api.Controllers
Part part = await _partService.GetPartBySku(sku);
Vehicle vehicle = await _vehicleService.GetVehicleById(vehicleId);
if (part == null)
if (part == null || vehicle == null)
{
return BadRequest(new
{
Message = $"No part data is available for SKU {sku}. Confirm it is available in the database maintained by Sound Press.",
Message = $"No data is available for SKU {sku}. Confirm it is available in the database maintained by Sound Press.",
Reason = $"{nameof(_partService.GetPartBySku)} returned null"
});
}
if (vehicle == null)
{
return BadRequest(new
{
Message = $"No vehicle data is available for SKU {sku}. Confirm it is available in the database maintained by Sound Press.",
Reason = $"{nameof(_vehicleService.GetVehicleById)} returned null"
});
}
IList<DcfMapping> mappings = await _partService.GetDcfMapping(part.LineCode);
Item[] items = mappings.Select(m => new Item
{

View File

@@ -23,7 +23,6 @@
</ItemGroup>
<ItemGroup>
<None Include="..\.editorconfig" Link=".editorconfig" />
<None Include="appsettings.development.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>

View File

@@ -52,13 +52,12 @@ namespace PartSource.Api
services.AddAutoMapper(typeof(PartSourceProfile));
services.AddTransient<PartService>();
services.AddTransient<FitmentService>();
services.AddTransient<NexpartService>();
services.AddTransient<SecurityService>();
services.AddTransient<VehicleService>();
services.AddTransient<ShopifyChangelogService>();
services.AddTransient<FitmentContext>();
services.AddCors(o => o.AddPolicy("Default", builder =>
{
builder.AllowAnyOrigin()
@@ -69,9 +68,9 @@ namespace PartSource.Api
services.AddDbContext<PartSourceContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("PartSourceDatabase"))
);
//services.AddDbContext<FitmentContext>(options =>
// options.UseSqlServer(Configuration.GetConnectionString("FitmentDatabase"))
//);
services.AddDbContext<FitmentContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("FitmentDatabase"))
);
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.

View File

@@ -1,6 +1,7 @@
{
"ConnectionStrings": {
"PartSourceDatabase": "Server=tcp:ps-whi.database.windows.net,1433;Initial Catalog=ps-whi-stage;Persist Security Info=False;User ID=ps-whi;Password=9-^*N5dw!6:|.5Q;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;",
"FitmentDatabase": "Server=tcp:ps-automation.eastus2.cloudapp.azure.com,1433;Initial Catalog=WhiFitment;User ID=automation;Password=)6L)XP%m(x-UU#M;Encrypt=True;TrustServerCertificate=True;Connection Timeout=300"
//"FitmentDatabase": "Data Source=localhost;Initial Catalog=WhiFitment;Integrated Security=true"
},
"Logging": {

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace PartSource.Automation.Extensions
{
public static class FileInfoExtensions
{
public static DateTime GetWhiTimestamp(this FileInfo fileInfo)
{
Match match = Regex.Match(fileInfo.Name, "[0-9]{8}");
return match.Success && DateTime.TryParseExact(match.Value, "MMddyyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime timestamp)
? timestamp
: DateTime.MinValue;
}
}
}

View File

@@ -17,7 +17,7 @@ namespace PartSource.Automation.Jobs
private readonly ILogger<ExecuteSsisPackages> _logger;
// TODO: set from config
private readonly string[] _ssisPackages = {"Parts Price", "Parts Availability" };
private readonly string[] _ssisPackages = { "Parts Availability" };
public ExecuteSsisPackages(EmailService emailService, IConfiguration configuration, SsisService ssisService, ILogger<ExecuteSsisPackages> logger)
{

View File

@@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Data.SqlClient;
using Microsoft.Extensions.Configuration;
using PartSource.Automation.Models.Configuration;
using PartSource.Automation.Models.Ftp;
using PartSource.Automation.Services;
using Ratermania.Automation.Interfaces;
namespace PartSource.Automation.Jobs.POC
{
public class BulkUpdateInventory : IAutomationJob
{
private readonly FtpService _ftpService;
public BulkUpdateInventory(IConfiguration configuration)
{
FtpConfiguration ftpConfiguration = configuration.GetSection("FtpServers:AzureConfiguration").Get<FtpConfiguration>();
_ftpService = new FtpService(ftpConfiguration);
}
public async Task Run(CancellationToken token, params string[] arguments)
{
FtpFileInfo lastUploadedFile = _ftpService.ListFilesExtended()
.Where(f => f.FileType == FtpFileType.File && f.Filename.IndexOf("Availability") > -1)
.OrderByDescending(f => f.Modified)
.First();
string file = _ftpService.Download(lastUploadedFile.Filename, Path.GetTempPath());
DataTable dataTable = GetDataTable(file);
using SqlConnection connection = new SqlConnection("Server=tcp:ps-automation-stage.eastus2.cloudapp.azure.com,1433;Initial Catalog=ps-whi-stage;Persist Security Info=False;User ID=stageuser;Password=]FXepK^cFYS|[H<;MultipleActiveResultSets=True;Encrypt=True;TrustServerCertificate=True;Connection Timeout=30;");
connection.Open();
using SqlBulkCopy bulk = new SqlBulkCopy(connection)
{
DestinationTableName = $"PartAvailability",
BulkCopyTimeout = 14400
};
bulk.WriteToServer(dataTable);
return;
}
private DataTable GetDataTable(string filename)
{
using DataTable dataTable = new DataTable();
dataTable.Columns.Add("Store", typeof(int));
dataTable.Columns.Add("SKU", typeof(string));
dataTable.Columns.Add("QTY", typeof(int));
using StreamReader reader = new StreamReader(filename);
string line = reader.ReadLine(); // Burn the header row
while (reader.Peek() > 0)
{
line = reader.ReadLine();
string[] columns = line.Split("|");
for (int i = 0; i < columns.Length; i++)
{
columns[i] = columns[i].Replace("\"", string.Empty);
}
string sku = columns[1].Trim();
if (int.TryParse(columns[0], out int store)
&& !string.IsNullOrEmpty(sku)
&& int.TryParse(columns[2], out int quantity))
{
dataTable.Rows.Add(new object[] { store, sku, quantity });
}
}
return dataTable;
}
}
}

View File

@@ -0,0 +1,119 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using PartSource.Data.Contexts;
using PartSource.Data.Models;
using PartSource.Data.Nexpart;
using PartSource.Services;
using Ratermania.Automation.Interfaces;
using Ratermania.Shopify;
using Ratermania.Shopify.Resources;
namespace PartSource.Automation.Jobs.POC
{
public class GetImageUrls : IAutomationJob
{
private readonly NexpartService _nexpartService;
private readonly FitmentContext _fitmentContext;
private readonly PartService _partService;
private readonly ShopifyClient _shopifyClient;
public GetImageUrls(NexpartService nexpartService, PartService partService, FitmentContext fitmentContext, ShopifyClient shopifyClient)
{
_nexpartService = nexpartService;
_fitmentContext = fitmentContext;
_partService = partService;
_shopifyClient = shopifyClient;
}
public async Task Run(CancellationToken token, params string[] arguments)
{
IList<string> rows = new List<string> {
"\"Line Code\", \"Part Number\", \"Image URL(s)\""
};
using StreamReader reader = new StreamReader("C:\\Users\\Tom\\Desktop\\image parts.csv");
string line = reader.ReadLine(); // Burn the header row
while (reader.Peek() > 0)
{
line = reader.ReadLine();
string[] columns = line.Split(",");
for (int i = 0; i < columns.Length; i++)
{
columns[i] = columns[i].Replace("\"", string.Empty);
}
string partsourceCode = columns[0].Trim();
string partNumber = columns[1].Trim();
IList<DcfMapping> dcfMappings = await _partService.GetDcfMapping(partsourceCode);
if (dcfMappings.Count == 0)
{
Console.WriteLine($"No images for {partsourceCode} {partNumber}");
}
bool hasImage = false;
foreach (DcfMapping mapping in dcfMappings)
{
if (hasImage)
{
continue;
}
SmartPageDataSearch dataSearch = new SmartPageDataSearch
{
Items = new Item[]
{
new Item
{
MfrCode = mapping.WhiCode,
PartNumber = partNumber
}
},
DataOption = new[] { "ALL" }
};
SmartPageDataSearchResponse response = await _nexpartService.SendRequest<SmartPageDataSearch, SmartPageDataSearchResponse>(dataSearch);
if (response.ResponseBody.Item?.Length > 0)
{
List<string> urls = new List<string>();
if (!string.IsNullOrEmpty(response.ResponseBody.Item[0].PrimaryImg?.ImgUrl))
{
urls.Add(response.ResponseBody.Item[0].PrimaryImg?.ImgUrl);
};
if (response.ResponseBody.Item[0].AddImgs?.AddImg?.Length > 0)
{
urls.AddRange(response.ResponseBody.Item[0].AddImgs.AddImg.Select(i => i.AddImgUrl));
}
if (urls.Count > 0)
{
rows.Add($"\"{partsourceCode}\", \"{partNumber}\", \"{string.Join(";", urls)}\"");
hasImage = true;
}
}
}
if (!hasImage)
{
Console.WriteLine($"No images for {partsourceCode} {partNumber}");
}
}
await File.WriteAllLinesAsync($"C:\\users\\Tom\\desktop\\WHI Images {DateTime.Now:yyyyMMdd}.csv", rows);
}
}
}

View File

@@ -0,0 +1,106 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using PartSource.Data.Contexts;
using PartSource.Data.Models;
using PartSource.Data.Nexpart;
using PartSource.Services;
using Ratermania.Automation.Interfaces;
using Ratermania.Shopify;
using Ratermania.Shopify.Resources;
namespace PartSource.Automation.Jobs.POC
{
public class GetImageUrlsTemp : IAutomationJob
{
private readonly NexpartService _nexpartService;
private readonly FitmentContext _fitmentContext;
private readonly PartService _partService;
private readonly ShopifyClient _shopifyClient;
private readonly string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
public GetImageUrlsTemp(NexpartService nexpartService, PartService partService, FitmentContext fitmentContext, ShopifyClient shopifyClient)
{
_nexpartService = nexpartService;
_fitmentContext = fitmentContext;
_partService = partService;
_shopifyClient = shopifyClient;
}
public async Task Run(CancellationToken token, params string[] arguments)
{
IList<KeyValuePair<string, string>> parts = new List<KeyValuePair<string, string>>();
parts.Add(new KeyValuePair<string, string>("DAY", "89310"));
parts.Add(new KeyValuePair<string, string>("CNI", "141.40113"));
parts.Add(new KeyValuePair<string, string>("PRF", "MU19631"));
parts.Add(new KeyValuePair<string, string>("TRK", "SB8100"));
parts.Add(new KeyValuePair<string, string>("MON", "906970"));
parts.Add(new KeyValuePair<string, string>("FEL", "70804"));
parts.Add(new KeyValuePair<string, string>("FEL", "SS71198"));
parts.Add(new KeyValuePair<string, string>("CFP", "STS314"));
parts.Add(new KeyValuePair<string, string>("NGK", "21517"));
parts.Add(new KeyValuePair<string, string>("NGK", "RC-XX89"));
parts.Add(new KeyValuePair<string, string>("FRA", "CA176"));
for (int i = 0; i < chars.Length; i++)
{
for (int j = 0; j < chars.Length; j++)
{
for (int k = 0; k < chars.Length; k++)
{
string actualLineCode = $"{chars[i]}{chars[j]}{chars[k]}";
System.Diagnostics.Debug.WriteLine(actualLineCode);
foreach (KeyValuePair<string, string> part in parts)
{
SmartPageDataSearch dataSearch = new SmartPageDataSearch
{
Items = new Item[]
{
new Item
{
MfrCode = actualLineCode,
PartNumber = part.Value
}
},
DataOption = new[] { "DIST_LINE", "ALL" }
};
SmartPageDataSearchResponse response = await _nexpartService.SendRequest<SmartPageDataSearch, SmartPageDataSearchResponse>(dataSearch);
if (response.ResponseBody.Item?.Length > 0)
{
List<string> urls = new List<string>();
if (!string.IsNullOrEmpty(response.ResponseBody.Item[0].PrimaryImg?.ImgUrl))
{
urls.Add(response.ResponseBody.Item[0].PrimaryImg?.ImgUrl);
};
if (response.ResponseBody.Item[0].AddImgs?.AddImg?.Length > 0)
{
urls.AddRange(response.ResponseBody.Item[0].AddImgs.AddImg.Select(i => i.AddImgUrl));
}
if (urls.Count > 0)
{
Console.WriteLine($"Image {urls[0]} found for {part.Value}. Expected: {part.Key}, Actual: {actualLineCode}");
}
}
}
}
}
}
}
}
}

View File

@@ -1,84 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using PartSource.Data.Contexts;
using PartSource.Data.Models;
using PartSource.Data.Nexpart;
using PartSource.Services;
using Ratermania.Automation.Interfaces;
using Ratermania.Shopify;
using Ratermania.Shopify.Resources;
namespace PartSource.Automation.Jobs.POC
{
public class GetImageUrls : IAutomationJob
{
private readonly NexpartService _nexpartService;
private readonly PartSourceContext _partSourceContext;
public GetImageUrls(NexpartService nexpartService, PartSourceContext partSourceContext)
{
_nexpartService = nexpartService;
_partSourceContext = partSourceContext;
}
public async Task Run(CancellationToken token, params string[] arguments)
{
IList<string> rows = new List<string> {
"\"Line Code\", \"Part Number\", \"Image URL(s)\""
};
IList<ImportData> importData = await _partSourceContext.ImportData
//.Take(5000)
.ToListAsync();
foreach (ImportData item in importData)
{
SmartPageDataSearch dataSearch = new SmartPageDataSearch
{
Items = new Item[]
{
new Item
{
MfrCode = item.LineCode,
PartNumber = item.PartNumber
}
},
DataOption = new[] { "DIST_LINE", "ALL" }
};
SmartPageDataSearchResponse response = await _nexpartService.SendRequest<SmartPageDataSearch, SmartPageDataSearchResponse>(dataSearch);
if (response.ResponseBody.Item?.Length > 0)
{
List<string> urls = new List<string>();
if (!string.IsNullOrEmpty(response.ResponseBody.Item[0].PrimaryImg?.ImgUrl))
{
urls.Add(response.ResponseBody.Item[0].PrimaryImg?.ImgUrl);
};
if (response.ResponseBody.Item[0].AddImgs?.AddImg?.Length > 0)
{
urls.AddRange(response.ResponseBody.Item[0].AddImgs.AddImg.Select(i => i.AddImgUrl));
}
if (urls.Count > 0)
{
rows.Add($"\"{item.LineCode}\", \"{item.PartNumber}\", \"{string.Join(";", urls)}\"");
}
}
}
await File.WriteAllLinesAsync("C:\\users\\Tommy\\desktop\\WHI Images.csv", rows);
}
}
}

View File

@@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Data.SqlClient;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using PartSource.Automation.Models.Configuration;
using PartSource.Automation.Models.Ftp;
using PartSource.Automation.Services;
using Ratermania.Automation.Interfaces;
namespace PartSource.Automation.Jobs.POC
{
public class PartialInventoryUpdate : IAutomationJob
{
private readonly FtpService _ftpService;
private readonly ILogger<PartialInventoryUpdate> _logger;
public PartialInventoryUpdate(IConfiguration configuration, ILogger<PartialInventoryUpdate> logger)
{
FtpConfiguration ftpConfiguration = configuration.GetSection("FtpServers:AutomationConfiguration").Get<FtpConfiguration>();
_ftpService = new FtpService(ftpConfiguration);
_logger = logger;
}
public async Task Run(CancellationToken token, params string[] arguments)
{
FtpFileInfo lastUploadedFile = _ftpService.ListFilesExtended()
.Where(f => f.FileType == FtpFileType.File && f.Modified >= DateTime.Now.AddHours(-24) && f.Filename.IndexOf("Availability Partial") > -1)
.OrderByDescending(f => f.Modified)
.FirstOrDefault();
if (lastUploadedFile == null)
{
_logger.LogInformation($"No partial inventory file available for the time period {DateTime.Now.AddHours(-24)} - {DateTime.Now}");
return;
}
string file = _ftpService.Download($"{lastUploadedFile.Filename}", "C:\\Users\\Tom\\Desktop");
using SqlConnection connection = new SqlConnection("Server=tcp:ps-automation-stage.eastus2.cloudapp.azure.com,1433;Initial Catalog=ps-whi-stage;Persist Security Info=False;User ID=stageuser;Password=]FXepK^cFYS|[H<;MultipleActiveResultSets=True;Encrypt=True;TrustServerCertificate=True;Connection Timeout=30;");
connection.Open();
using StreamReader reader = new StreamReader(file);
string line = reader.ReadLine(); // Burn the header row
while (reader.Peek() > 0)
{
line = reader.ReadLine();
string[] columns = line.Split(",");
for (int i = 0; i < columns.Length; i++)
{
columns[i] = columns[i].Replace("\"", string.Empty);
}
if (int.TryParse(columns[0], out int store)
&& int.TryParse(columns[1], out int quantity)
&& int.TryParse(columns[2], out int sku))
{
using SqlCommand sqlCommand = new SqlCommand("UPDATE Inventory SET QTY = @qty WHERE SKU = @sku AND Store = @store", connection);
sqlCommand.Parameters.Add(new SqlParameter("qty", quantity));
sqlCommand.Parameters.Add(new SqlParameter("sku", sku));
sqlCommand.Parameters.Add(new SqlParameter("store", store));
await sqlCommand.ExecuteNonQueryAsync();
}
}
return;
}
}
}

View File

@@ -96,9 +96,8 @@ namespace PartSource.Automation.Jobs
Task.WaitAll(taskArray);
// _whiSeoService.CreateFitmentView();
//_whiSeoService.SaveNotes(_noteDictionary);
_whiSeoService.SaveNotes(_noteDictionary);
//_whiSeoService.CreateFitmentView();
}
public string Decompress(FileInfo fileInfo)

View File

@@ -1,5 +1,6 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using PartSource.Automation.Extensions;
using PartSource.Automation.Models.Configuration;
using PartSource.Automation.Models.Enums;
using PartSource.Automation.Services;
@@ -45,7 +46,9 @@ namespace PartSource.Automation.Jobs
string directory = Path.Combine(_ftpConfiguration.Destination, _seoDataType.ToString().ToLowerInvariant());
DirectoryInfo directoryInfo = new DirectoryInfo(directory);
IEnumerable<FileInfo> files = directoryInfo.GetFiles().Where(f => f.Name.StartsWith("seo_aces_vehicle_feed"));
IEnumerable<FileInfo> files = directoryInfo.GetFiles()
.Where(f => f.Name.StartsWith("seo_aces_vehicle_feed"))
.OrderByDescending(f => f.GetWhiTimestamp());
foreach (FileInfo fileInfo in files)
{

View File

@@ -40,11 +40,11 @@ namespace PartSource.Automation.Jobs
try
{
products = await _shopifyClient.Products.Get(new Dictionary<string, object> { { "limit", 250 }, { "product_type", "CA111-SC250-FL25049_Entry Ball Joints" } });
//products = new List<Product>
//{
// await _shopifyClient.Products.GetById(4388919574575)
//};
//products = await _shopifyClient.Products.Get(new Dictionary<string, object> { { "limit", 250 } });
products = new List<Product>
{
await _shopifyClient.Products.GetById(7285013446703)
};
}
catch (Exception ex)
@@ -72,13 +72,17 @@ namespace PartSource.Automation.Jobs
};
bool isFitment = false;
string bodyHtml = product.BodyHtml.Substring(0, product.BodyHtml.IndexOf("</ul>") + "</ul>".Length);
string bodyHtml = string.IsNullOrEmpty(product.BodyHtml)
? "<ul></ul>"
: product.BodyHtml.Substring(0, product.BodyHtml.IndexOf("</ul>") + "</ul>".Length);
IList<Vehicle> vehicles = _vehicleFitmentService.GetVehiclesForPart(importData.PartNumber, importData.LineCode);
IList<Vehicle> vehicles = await _vehicleFitmentService.GetVehiclesForPart(importData.PartNumber, importData.LineCode);
IList<int> vehicleIdFitment = _vehicleFitmentService.GetVehicleIdFitment(vehicles);
if (vehicleIdFitment.Count > 0)
if (vehicleIdFitment.Count == 0)
{
continue;
}
string vehicleIdString = string.Join(',', vehicleIdFitment.Select(j => $"v{j}"));
bodyHtml += $"<div id=\"vehicleIDs\" style=\"display:none;\">{vehicleIdString}</div>";
@@ -106,7 +110,6 @@ namespace PartSource.Automation.Jobs
_logger.LogWarning($"Vehicle ID fitment data for SKU {importData.VariantSku} is too large for Shopify and cannot be added.");
continue;
}
}
IList<string> ymmFitment = _vehicleFitmentService.GetYmmFitment(vehicles);
if (ymmFitment.Count > 0)
@@ -135,7 +138,7 @@ namespace PartSource.Automation.Jobs
bodyHtml += $"<div id=\"seoData\">{stringBuilder.ToString()}</div>";
string json = JsonConvert.SerializeObject(ymmFitment);
json = JsonConvert.SerializeObject(ymmFitment);
if (json.Length < 100000)
{
Metafield ymmMetafield = new Metafield

View File

@@ -64,7 +64,7 @@ namespace PartSource.Automation.Jobs
}
IList<Fitment> fitments = GetPositionOrderedFitments(importData?.PartNumber, importData?.LineCode);
IList<Vehicle> vehicles = _vehicleFitmentService.GetVehiclesForPart(importData?.PartNumber, importData?.LineCode);
IList<Vehicle> vehicles = await _vehicleFitmentService.GetVehiclesForPart(importData?.PartNumber, importData?.LineCode);
if (fitments.Count == 0 || vehicles.Count == 0)
{

View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PartSource.Automation.Models.Ftp
{
public class FtpFileInfo
{
public string Filename { get; set; }
public DateTime Modified { get; set; }
public long Size { get; set; }
public FtpFileType FileType { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PartSource.Automation.Models.Ftp
{
public enum FtpFileType
{
File,
Directory
}
}

View File

@@ -21,11 +21,11 @@
<PackageReference Include="Ratermania.Automation" Version="6.16.9" />
<PackageReference Include="Ratermania.Automation.Common" Version="6.16.9" />
<PackageReference Include="Ratermania.JwtSpot" Version="6.16.9" />
<PackageReference Include="Ratermania.Shopify" Version="6.16.11" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\ratermania\Packages\Shopify\Shopify.csproj" />
<ProjectReference Include="..\PartSource.Data\PartSource.Data.csproj" />
<ProjectReference Include="..\PartSource.Services\PartSource.Services.csproj" />
</ItemGroup>

View File

@@ -77,7 +77,7 @@ namespace PartSource.Automation
.AddAutomation(options =>
{
options.HasBaseInterval(new TimeSpan(0, 15, 0))
options.HasBaseInterval(new TimeSpan(0, 5, 0))
.HasMaxFailures(1)
//.HasJob<TestJob>(options => options.HasInterval(new TimeSpan(7, 0, 0, 0)));
//
@@ -95,15 +95,15 @@ namespace PartSource.Automation
//.HasJob<StatusCheck>(options => options.HasInterval(new TimeSpan(24, 0, 0))
// .StartsAt(DateTime.Parse("2021-04-01 08:00:00"))
//)
//.HasJob<ExecuteSsisPackages>(options =>
// options.HasInterval(new TimeSpan(24, 0, 0))
// //.StartsAt(DateTime.Today.AddHours(25))
// )
.HasJob<UpdateFitment>(options => options.HasInterval(new TimeSpan(24, 0, 0))
//.HasDependency<ExecuteSsisPackages>()
// .StartsAt(DateTime.Today.AddHours(28))
.HasJob<ProcessWhiVehicles>(options =>
options.HasInterval(new TimeSpan(24, 0, 0))
.StartsAt(DateTime.Today)
);
//.HasJob<PartialInventoryUpdate>(options => options.HasInterval(new TimeSpan(1, 0, 0))
//.HasDependency<ExecuteSsisPackages>()
// .StartsAt(DateTime.Today)
//);
//);
//.AddApiServer();
})
@@ -114,6 +114,7 @@ namespace PartSource.Automation
.AddSingleton<VehicleService>()
.AddSingleton<VehicleFitmentService>()
.AddSingleton<NexpartService>()
.AddSingleton<PartService>()
.AddAutoMapper(typeof(PartSourceProfile));
})

View File

@@ -1,5 +1,6 @@
using Microsoft.Extensions.Configuration;
using PartSource.Automation.Models.Configuration;
using PartSource.Automation.Models.Ftp;
using System;
using System.Collections.Generic;
using System.Configuration;
@@ -18,7 +19,55 @@ namespace PartSource.Automation.Services
_ftpConfiguration = ftpConfiguration;
}
public string[] ListFiles(string directory)
public IList<FtpFileInfo> ListFilesExtended(string directory = "")
{
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(new Uri($"{_ftpConfiguration.Url}/{directory}"));
request.Credentials = new NetworkCredential(_ftpConfiguration.Username, _ftpConfiguration.Password);
request.Method = WebRequestMethods.Ftp.ListDirectoryDetails;
using FtpWebResponse response = (FtpWebResponse)request.GetResponse();
using StreamReader reader = new StreamReader(response.GetResponseStream());
IList<FtpFileInfo> files = new List<FtpFileInfo>();
string[] fileStrings = reader.ReadToEnd().Split("\r\n");
foreach (string fileString in fileStrings)
{
if (string.IsNullOrEmpty(fileString))
{
continue;
}
string dateString = fileString[..17];
string[] sizeAndName = fileString[18..].TrimStart().Split(" ", 2);
if (sizeAndName[0].ToUpperInvariant().IndexOf("DIR") > -1)
{
files.Add(new FtpFileInfo
{
Modified = DateTime.Parse(fileString[..17]),
Size = 0,
Filename = sizeAndName[1].Trim(),
FileType = FtpFileType.Directory
});
}
else
{
files.Add(new FtpFileInfo
{
Modified = DateTime.Parse(fileString[..17]),
Size = long.Parse(sizeAndName[0]),
Filename = sizeAndName[1].Trim(),
FileType = FtpFileType.File
});
}
}
return files;
}
public string[] ListFiles(string directory = "")
{
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(new Uri($"{_ftpConfiguration.Url}/{directory}"));
request.Credentials = new NetworkCredential(_ftpConfiguration.Username, _ftpConfiguration.Password);
@@ -34,19 +83,38 @@ namespace PartSource.Automation.Services
: Array.Empty<string>();
}
public void Download(string filename)
public string Download(string filename, string destination = null)
{
string file = $"{_ftpConfiguration.Destination}\\{filename.Replace("/", "\\")}";
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(new Uri($"{_ftpConfiguration.Url}/{filename}"));
request.Credentials = new NetworkCredential(_ftpConfiguration.Username, _ftpConfiguration.Password);
request.Method = WebRequestMethods.Ftp.DownloadFile;
if (string.IsNullOrEmpty(destination))
{
destination = _ftpConfiguration.Destination;
}
if (Path.DirectorySeparatorChar == '\\')
{
filename = filename.Replace("/", "\\");
}
destination = Path.Combine(destination, filename);
string destinationDirectory = Path.GetDirectoryName(destination);
if (!Directory.Exists(destinationDirectory))
{
Directory.CreateDirectory(destinationDirectory);
}
using FtpWebResponse response = (FtpWebResponse)request.GetResponse();
using Stream responseStream = response.GetResponseStream();
using FileStream fileStream = new FileStream($"{_ftpConfiguration.Destination}\\{filename.Replace("/", "\\")}", FileMode.Create);
using FileStream fileStream = new FileStream(destination, FileMode.Create);
responseStream.CopyTo(fileStream);
return destination;
}
}
}

View File

@@ -28,7 +28,7 @@ namespace PartSource.Automation.Services
{
StartInfo = new ProcessStartInfo
{
FileName = "dtexec",
FileName = "C:\\Program Files\\Microsoft SQL Server\\150\\DTS\\Binn\\dtexec.exe",
Arguments = $"/file \"{_ssisConfiguration.Directory}\\{packageName}\"",
UseShellExecute = false,
CreateNoWindow = false,

View File

@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using PartSource.Data.Contexts;
using PartSource.Data.Dtos;
using PartSource.Data.Models;
@@ -93,18 +94,19 @@ namespace PartSource.Automation.Services
return vehicles.Select(v => v.VehicleToEngineConfigId).Distinct().ToArray();
}
public IList<Vehicle> GetVehiclesForPart(string partNumber, string lineCode, int maxVehicles = 0)
public async Task<IList<Vehicle>> GetVehiclesForPart(string partNumber, string lineCode, int maxVehicles = 0)
{
if (string.IsNullOrEmpty(partNumber) || string.IsNullOrEmpty(lineCode))
{
return null;
}
partNumber = Regex.Replace(partNumber, "[^a-zA-Z0-9\\-]", string.Empty);
partNumber = Regex.Replace(partNumber, "[^a-zA-Z0-9]", string.Empty);
IQueryable<string> whiCodes = _fitmentContext.DcfMappings
.Where(d => d.LineCode == lineCode)
.Select(d => d.WhiCode);
IList<string> whiCodes = await _fitmentContext.DcfMappings
.Where(dcf => dcf.LineCode == lineCode)
.Select(dcf => dcf.WhiCode)
.ToListAsync();
IQueryable<Vehicle> vehicles = _fitmentContext.Fitments
.Where(f => f.PartNumber == partNumber && whiCodes.Contains(f.LineCode))
@@ -122,38 +124,5 @@ namespace PartSource.Automation.Services
return vehicles.ToList();
}
public IList<VehicleFitmentDto> GetVehicleFitmentForPart(string partNumber, string lineCode, int maxVehicles = 0)
{
if (string.IsNullOrEmpty(partNumber) || string.IsNullOrEmpty(lineCode))
{
return null;
}
partNumber = Regex.Replace(partNumber, "[^a-zA-Z0-9\\-]", string.Empty);
IQueryable<string> whiCodes = _fitmentContext.DcfMappings
.Where(d => d.LineCode == lineCode)
.Select(d => d.WhiCode);
IQueryable<VehicleFitmentDto> vehicles = _fitmentContext.Fitments
.Where(f => f.PartNumber == partNumber && whiCodes.Contains(f.LineCode))
.Join(_fitmentContext.Vehicles,
f => new { f.BaseVehicleId, f.EngineConfigId },
v => new { v.BaseVehicleId, v.EngineConfigId },
(f, v) => new VehicleFitmentDto
{
Fitment = f,
Vehicle = v
})
.Distinct();
if (maxVehicles > 0)
{
vehicles = vehicles.Take(maxVehicles);
}
return vehicles.ToList();
}
}
}

View File

@@ -16,6 +16,12 @@
"Url": "ftp://waws-prod-yq1-007.ftp.azurewebsites.windows.net/site/wwwroot",
"Destination": "C:\\Partsource.Automation\\Downloads"
},
"AutomationConfiguration": {
"Username": "stageuser",
"Password": "FXepK^cFYS|[H<",
"Url": "ftp://ps-automation-stage.eastus2.cloudapp.azure.com",
"Destination": "C:\\Partsource.Automation\\Downloads\\Stage"
},
"WhiConfiguration": {
"Username": "ctc_seo",
"Password": "be34hz64e4",
@@ -35,7 +41,7 @@
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information",
"Microsoft.Hosting.Lifetime": "Information"
// "Microsoft.EntityFrameworkCore.Database.Command": "Information"
},
"EventLog": {

View File

@@ -19,6 +19,8 @@ namespace PartSource.Data.Contexts
public DbSet<Vehicle> Vehicles { get; set; }
public DbSet<VehicleFitment> VehicleFitments { get; set; }
public DbSet<Wiper> Wipers { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
@@ -28,6 +30,7 @@ namespace PartSource.Data.Contexts
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<Wiper>().HasKey(f => new { f.BaseVehicleId, f.PartNumber, f.LineCode, f.Position});
modelBuilder.Entity<VehicleFitment>().HasNoKey();
foreach (IMutableEntityType entityType in modelBuilder.Model.GetEntityTypes())
{

View File

@@ -5,10 +5,8 @@ using System.Text;
namespace PartSource.Data.Dtos
{
public class VehicleFitmentDto
public class VehicleFitmentDto : VehicleFitment
{
public Fitment Fitment { get; set; }
public Vehicle Vehicle { get; set; }
public IList<string> SubmodelNames { get; set; }
}
}

View File

@@ -0,0 +1,27 @@
namespace PartSource.Data.Models
{
public class VehicleFitment
{
public string Sku { get; set; }
public string LineCode { get; set; }
public string PartNumber { get; set; }
public string NoteText { get; set; }
public int Year { get; set; }
public string MakeName { get; set; }
public string ModelName { get; set; }
public string SubmodelName { get; set; }
public int BaseVehicleId { get; set; }
public int EngineConfigId { get; set; }
public int VehicleToEngineConfigId { get; set; }
}
}

View File

@@ -5,7 +5,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public class AddImg
{
[XmlAttribute]

View File

@@ -5,7 +5,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public class AddImgs
{
[XmlElement]

View File

@@ -8,7 +8,7 @@ using Newtonsoft.Json;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public class App
{
[XmlElement]

View File

@@ -7,7 +7,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class ApplicationSearch
{
public ApplicationSearch()

View File

@@ -8,7 +8,7 @@ using PartSource.Data.Nexpart.Interfaces;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class ApplicationSearchResponse : IResponseElement<Apps>
{

View File

@@ -3,10 +3,10 @@ using Newtonsoft.Json;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public class Apps
{
[XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlElement(Namespace = "http://whisolutions.com/pss/common/helper/parts")]
[JsonProperty("wipers")]
public App[] App { get; set; }
}

View File

@@ -8,7 +8,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public class BaseVehicle
{
[XmlAttribute]

View File

@@ -8,22 +8,22 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class BaseVehicleDetail
{
[XmlAttribute]
public int WHIMakeId { get; set; }
[XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlElement(Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public int BaseVehicleId { get; set; }
[XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlElement(Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public string MakeName { get; set; }
[XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlElement(Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public string ModelName { get; set; }
[XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlElement(Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public int Year { get; set; }
}
}

View File

@@ -8,7 +8,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class BaseVehicleDetailLookup
{
public BaseVehicleDetailLookup()

View File

@@ -9,7 +9,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class BaseVehicleDetailLookupResponse : IResponseElement<BaseVehicleDetail>
{
[XmlElement]

View File

@@ -2,7 +2,7 @@
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class BaseVehicleSearch
{
public BaseVehicleSearch()

View File

@@ -3,7 +3,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class BaseVehicleSearchResponse : IResponseElement<BaseVehicles>
{
[XmlElement]

View File

@@ -5,10 +5,10 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class BaseVehicles
{
[XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlElement(Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public BaseVehicle[] BaseVehicle { get; set; }

View File

@@ -8,37 +8,37 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class Body
{
[XmlElement(ElementName = "ApplicationSearch", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(ApplicationSearch))]
[XmlElement(ElementName = "ApplicationSearchResponse", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(ApplicationSearchResponse))]
[XmlElement(ElementName = "BaseVehicleDetailLookup", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(BaseVehicleDetailLookup))]
[XmlElement(ElementName = "BaseVehicleDetailLookupResponse", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(BaseVehicleDetailLookupResponse))]
[XmlElement(ElementName = "BaseVehicleSearch", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(BaseVehicleSearch))]
[XmlElement(ElementName = "BaseVehicleSearchResponse", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(BaseVehicleSearchResponse))]
[XmlElement(ElementName = "EngineSearch", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(EngineSearch))]
[XmlElement(ElementName = "EngineSearchResponse", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(EngineSearchResponse))]
[XmlElement(ElementName = "MakeSearch", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(MakeSearch))]
[XmlElement(ElementName = "MakeSearchResponse", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(MakeSearchResponse))]
[XmlElement(ElementName = "ModelSearch", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(ModelSearch))]
[XmlElement(ElementName = "ModelSearchResponse", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(ModelSearchResponse))]
[XmlElement(ElementName = "MenuNodesLookup", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(MenuNodesLookup))]
[XmlElement(ElementName = "MenuNodesLookupResponse", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(MenuNodesLookupResponse))]
[XmlElement(ElementName = "PartTypeSearch", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(PartTypeSearch))]
[XmlElement(ElementName = "PartTypeSearchResponse", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(PartTypeSearchResponse))]
[XmlElement(ElementName = "PartTypesValidateLookup", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(PartTypesValidateLookup))]
[XmlElement(ElementName = "PartTypesValidateLookupResponse", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(PartTypesValidateLookupResponse))]
[XmlElement(ElementName = "SmartPageDataSearch", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(SmartPageDataSearch))]
[XmlElement(ElementName = "SmartPageDataSearchResponse", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(SmartPageDataSearchResponse))]
[XmlElement(ElementName = "SubModelSearch", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(SubModelSearch))]
[XmlElement(ElementName = "SubModelSearchResponse", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(SubModelSearchResponse))]
[XmlElement(ElementName = "VehicleIdSearch", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(VehicleIdSearch))]
[XmlElement(ElementName = "VehicleIdSearchResponse", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(VehicleIdSearchResponse))]
[XmlElement(ElementName = "VehicleTypesGet", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(VehicleTypesGet))]
[XmlElement(ElementName = "VehicleTypesGetResponse", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(VehicleTypesGetResponse))]
[XmlElement(ElementName = "WHIEngineSearch", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(WHIEngineSearch))]
[XmlElement(ElementName = "WHIEngineSearchResponse", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(WHIEngineSearchResponse))]
[XmlElement(ElementName = "ApplicationSearch", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(ApplicationSearch))]
[XmlElement(ElementName = "ApplicationSearchResponse", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(ApplicationSearchResponse))]
[XmlElement(ElementName = "BaseVehicleDetailLookup", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(BaseVehicleDetailLookup))]
[XmlElement(ElementName = "BaseVehicleDetailLookupResponse", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(BaseVehicleDetailLookupResponse))]
[XmlElement(ElementName = "BaseVehicleSearch", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(BaseVehicleSearch))]
[XmlElement(ElementName = "BaseVehicleSearchResponse", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(BaseVehicleSearchResponse))]
[XmlElement(ElementName = "EngineSearch", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(EngineSearch))]
[XmlElement(ElementName = "EngineSearchResponse", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(EngineSearchResponse))]
[XmlElement(ElementName = "MakeSearch", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(MakeSearch))]
[XmlElement(ElementName = "MakeSearchResponse", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(MakeSearchResponse))]
[XmlElement(ElementName = "ModelSearch", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(ModelSearch))]
[XmlElement(ElementName = "ModelSearchResponse", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(ModelSearchResponse))]
[XmlElement(ElementName = "MenuNodesLookup", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(MenuNodesLookup))]
[XmlElement(ElementName = "MenuNodesLookupResponse", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(MenuNodesLookupResponse))]
[XmlElement(ElementName = "PartTypeSearch", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(PartTypeSearch))]
[XmlElement(ElementName = "PartTypeSearchResponse", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(PartTypeSearchResponse))]
[XmlElement(ElementName = "PartTypesValidateLookup", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(PartTypesValidateLookup))]
[XmlElement(ElementName = "PartTypesValidateLookupResponse", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(PartTypesValidateLookupResponse))]
[XmlElement(ElementName = "SmartPageDataSearch", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(SmartPageDataSearch))]
[XmlElement(ElementName = "SmartPageDataSearchResponse", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(SmartPageDataSearchResponse))]
[XmlElement(ElementName = "SubModelSearch", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(SubModelSearch))]
[XmlElement(ElementName = "SubModelSearchResponse", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(SubModelSearchResponse))]
[XmlElement(ElementName = "VehicleIdSearch", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(VehicleIdSearch))]
[XmlElement(ElementName = "VehicleIdSearchResponse", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(VehicleIdSearchResponse))]
[XmlElement(ElementName = "VehicleTypesGet", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(VehicleTypesGet))]
[XmlElement(ElementName = "VehicleTypesGetResponse", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(VehicleTypesGetResponse))]
[XmlElement(ElementName = "WHIEngineSearch", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(WHIEngineSearch))]
[XmlElement(ElementName = "WHIEngineSearchResponse", Namespace = "http://whisolutions.com/pss/common/model/parts", Type = typeof(WHIEngineSearchResponse))]
public object Content { get; set; }
}
}

View File

@@ -5,7 +5,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class Criterion
{
[XmlAttribute]

View File

@@ -8,7 +8,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public class Engine
{
[XmlAttribute]

View File

@@ -8,7 +8,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class EngineSearch
{
public EngineSearch()

View File

@@ -9,7 +9,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class EngineSearchResponse : IResponseElement<Engines>
{
[XmlElement]

View File

@@ -8,10 +8,10 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class Engines
{
[XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlElement(Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public Engine[] Engine;
}
}

View File

@@ -8,7 +8,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectCommon/2011-07-21")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/header/parts")]
public class Exceptions
{
[XmlAttribute(AttributeName = "code")]

View File

@@ -8,7 +8,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public class Item
{
[XmlAttribute]

View File

@@ -8,10 +8,10 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class Items
{
[XmlElement(ElementName = "Item", Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21", Order = 1)]
[XmlElement(ElementName = "Item", Namespace = "http://whisolutions.com/pss/common/helper/parts", Order = 1)]
public PartSource.Data.Nexpart.Item[] Item { get; set; }
}
}

View File

@@ -8,7 +8,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public class Make
{
[XmlText]

View File

@@ -8,7 +8,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class MakeSearch
{
public MakeSearch()
@@ -18,16 +18,16 @@ namespace PartSource.Data.Nexpart
this.RegionId = new int[]{ 2 };
}
[XmlElement(ElementName = "PSRequestHeader", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 1)]
[XmlElement(ElementName = "PSRequestHeader", Namespace = "http://whisolutions.com/pss/common/model/parts", Order = 1)]
public PSRequestHeader PSRequestHeader { get; set; }
[XmlElement(ElementName = "Years", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 2)]
[XmlElement(ElementName = "Years", Namespace = "http://whisolutions.com/pss/common/model/parts", Order = 2)]
public Years Years { get; set; }
[XmlElement(ElementName = "RegionId", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 3)]
[XmlElement(ElementName = "RegionId", Namespace = "http://whisolutions.com/pss/common/model/parts", Order = 3)]
public int[] RegionId { get; set; }
[XmlElement(ElementName = "VehicleTypeId", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 4)]
[XmlElement(ElementName = "VehicleTypeId", Namespace = "http://whisolutions.com/pss/common/model/parts", Order = 4)]
public int[] VehicleTypeId { get; set; }
}
}

View File

@@ -9,7 +9,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class MakeSearchResponse : IResponseElement<Makes>
{
[XmlElement]

View File

@@ -8,10 +8,10 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class Makes
{
[XmlElement(ElementName = "Make", Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21", Order = 1)]
[XmlElement(ElementName = "Make", Namespace = "http://whisolutions.com/pss/common/helper/parts", Order = 1)]
public PartSource.Data.Nexpart.Make[] Make { get; set; }
}
}

View File

@@ -8,7 +8,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class MenuNode
{
[XmlAttribute]

View File

@@ -8,10 +8,10 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class MenuNodes
{
[XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlElement(Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public MenuNode[] MenuNode{ get; set; }
}
}

View File

@@ -5,7 +5,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class MenuNodesLookup
{
public MenuNodesLookup()

View File

@@ -3,7 +3,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class MenuNodesLookupResponse : IResponseElement<MenuNodes>
{
[XmlElement]

View File

@@ -8,7 +8,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public class Model
{
[XmlText]

View File

@@ -8,7 +8,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class ModelSearch
{
public ModelSearch()
@@ -17,19 +17,19 @@ namespace PartSource.Data.Nexpart
this.RegionId = new int[] { 2 };
}
[XmlElement(ElementName = "PSRequestHeader", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 1)]
[XmlElement(ElementName = "PSRequestHeader", Namespace = "http://whisolutions.com/pss/common/model/parts", Order = 1)]
public PSRequestHeader PSRequestHeader { get; set; }
[XmlElement(ElementName = "Year", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 2)]
[XmlElement(ElementName = "Year", Namespace = "http://whisolutions.com/pss/common/model/parts", Order = 2)]
public int Year { get; set; }
[XmlElement(ElementName = "MakeId", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 3)]
[XmlElement(ElementName = "MakeId", Namespace = "http://whisolutions.com/pss/common/model/parts", Order = 3)]
public int MakeId { get; set; }
[XmlElement(ElementName = "RegionId", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 4)]
[XmlElement(ElementName = "RegionId", Namespace = "http://whisolutions.com/pss/common/model/parts", Order = 4)]
public int[] RegionId { get; set; }
[XmlElement(ElementName = "VehicleTypeId", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 5)]
[XmlElement(ElementName = "VehicleTypeId", Namespace = "http://whisolutions.com/pss/common/model/parts", Order = 5)]
public int[] VehicleTypeId { get; set; }
}
}

View File

@@ -9,13 +9,13 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class ModelSearchResponse : IResponseElement<Models[]>
{
[XmlElement]
public PSResponseHeader PSResponseHeader { get; set; }
[XmlElement(ElementName = "Models", Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlElement(ElementName = "Models", Namespace = "http://whisolutions.com/pss/common/model/parts")]
public Models[] ResponseBody { get; set; }
}
}

View File

@@ -8,7 +8,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class Models
{
public Models()
@@ -19,7 +19,7 @@ namespace PartSource.Data.Nexpart
[XmlAttribute]
public int Region { get; set; }
[XmlElement(ElementName = "Model", Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlElement(ElementName = "Model", Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public PartSource.Data.Nexpart.Model[] Model { get; set; }
}
}

View File

@@ -8,7 +8,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class PSRequestHeader
{
public PSRequestHeader()
@@ -17,10 +17,10 @@ namespace PartSource.Data.Nexpart
this.ReturnWarnings = "true";
}
[XmlElement(ElementName = "SvcVersion", Namespace = "http://whisolutions.com/PartSelectCommon/2011-07-21")]
[XmlElement(ElementName = "SvcVersion", Namespace = "http://whisolutions.com/pss/common/header/parts")]
public string SvcVersion { get; set; }
[XmlElement(ElementName = "ReturnWarnings", Namespace = "http://whisolutions.com/PartSelectCommon/2011-07-21")]
[XmlElement(ElementName = "ReturnWarnings", Namespace = "http://whisolutions.com/pss/common/header/parts")]
public string ReturnWarnings { get; set; }
}
}

View File

@@ -8,25 +8,25 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class PSResponseHeader
{
[XmlElement(ElementName = "RequestId", Namespace = "http://whisolutions.com/PartSelectCommon/2011-07-21")]
[XmlElement(ElementName = "RequestId", Namespace = "http://whisolutions.com/pss/common/header/parts")]
public string RequestId { get; set; }
[XmlElement(ElementName = "RequestProcessingTime", Namespace = "http://whisolutions.com/PartSelectCommon/2011-07-21")]
[XmlElement(ElementName = "RequestProcessingTime", Namespace = "http://whisolutions.com/pss/common/header/parts")]
public string RequestProcessingTime { get; set; }
[XmlElement(ElementName = "Build", Namespace = "http://whisolutions.com/PartSelectCommon/2011-07-21")]
[XmlElement(ElementName = "Build", Namespace = "http://whisolutions.com/pss/common/header/parts")]
public string Build { get; set; }
[XmlElement(ElementName = "TimeStamp", Namespace = "http://whisolutions.com/PartSelectCommon/2011-07-21")]
[XmlElement(ElementName = "TimeStamp", Namespace = "http://whisolutions.com/pss/common/header/parts")]
public string TimeStamp { get; set; }
[XmlElement(ElementName = "StatusCode", Namespace = "http://whisolutions.com/PartSelectCommon/2011-07-21")]
[XmlElement(ElementName = "StatusCode", Namespace = "http://whisolutions.com/pss/common/header/parts")]
public string StatusCode { get; set; }
[XmlElement(ElementName = "Exceptions", Namespace = "http://whisolutions.com/PartSelectCommon/2011-07-21")]
[XmlElement(ElementName = "Exceptions", Namespace = "http://whisolutions.com/pss/common/header/parts")]
public PartSource.Data.Nexpart.Exceptions[] Exceptions { get; set; }
}
}

View File

@@ -5,7 +5,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public class Part
{
[XmlElement]
@@ -15,7 +15,7 @@ namespace PartSource.Data.Nexpart
public PartPartType PartType { get; set; }
// There are two different kinds of PartType because of course there are...
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public class PartPartType
{
[XmlAttribute]

View File

@@ -5,7 +5,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public class PartNumber
{
[XmlText]

View File

@@ -8,7 +8,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class PartType
{
[XmlAttribute]

View File

@@ -8,7 +8,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class PartTypeSearch
{
public PartTypeSearch()

View File

@@ -9,7 +9,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class PartTypeSearchResponse : IResponseElement<PartTypes>
{
[XmlElement]

View File

@@ -8,10 +8,10 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class PartTypes
{
[XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlElement(Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public PartSource.Data.Nexpart.PartType[] PartType { get; set; }
}
}

View File

@@ -8,7 +8,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class PartTypesValidateLookup
{
public PartTypesValidateLookup()

View File

@@ -9,7 +9,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class PartTypesValidateLookupResponse : IResponseElement<PartTypes>
{
[XmlElement]

View File

@@ -8,7 +8,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public class PrimaryImg
{
[XmlElement]

View File

@@ -5,7 +5,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class Region
{
[XmlAttribute]

View File

@@ -5,7 +5,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class RegionId
{
[XmlText]

View File

@@ -5,7 +5,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class ResultOption
{
[XmlText]

View File

@@ -2,7 +2,7 @@
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class SmartPageDataSearch
{
public SmartPageDataSearch()
@@ -10,15 +10,15 @@ namespace PartSource.Data.Nexpart
PSRequestHeader = new PSRequestHeader();
}
[XmlElement(ElementName = "PSRequestHeader", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 1)]
[XmlElement(ElementName = "PSRequestHeader", Namespace = "http://whisolutions.com/pss/common/model/parts", Order = 1)]
public PSRequestHeader PSRequestHeader { get; set; }
[XmlElement(ElementName = "Item", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 2)]
[XmlElement(ElementName = "Item", Namespace = "http://whisolutions.com/pss/common/model/parts", Order = 2)]
public Item[] Items { get; set; }
[XmlElement(ElementName = "DataOption", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 3)]
[XmlElement(ElementName = "DataOption", Namespace = "http://whisolutions.com/pss/common/model/parts", Order = 3)]
public string[] DataOption { get; set; }
}
}

View File

@@ -9,7 +9,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class SmartPageDataSearchResponse : IResponseElement<Items>
{
[XmlElement]

View File

@@ -8,7 +8,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public class SubModel
{
[XmlAttribute]

View File

@@ -6,7 +6,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class SubModelSearchResponse : IResponseElement<SubModels>
{
[XmlElement]

View File

@@ -5,10 +5,10 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class SubModels
{
[XmlElement(ElementName = "SubModel", Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21", Order = 1)]
[XmlElement(ElementName = "SubModel", Namespace = "http://whisolutions.com/pss/common/helper/parts", Order = 1)]
public SubModel[] SubModel { get; set; }
}
}

View File

@@ -2,7 +2,7 @@
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class SubModelSearch
{
public SubModelSearch()

View File

@@ -8,7 +8,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class VehicleDetail
{
[XmlAttribute]
@@ -32,7 +32,7 @@ namespace PartSource.Data.Nexpart
[XmlAttribute]
public int VehicleToEngineConfigId { get; set; }
[XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlElement(Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public BaseVehicle BaseVehicle { get; set; }
}
}

View File

@@ -8,7 +8,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class VehicleIdSearch
{
public VehicleIdSearch()

View File

@@ -9,7 +9,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class VehicleIdSearchResponse : IResponseElement<VehicleDetail>
{
[XmlElement]

View File

@@ -8,13 +8,13 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class VehicleIdentifier
{
[XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlElement(Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public int BaseVehicleId { get; set; }
[XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlElement(Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public int EngineConfigId { get; set; }
public bool ShouldSerializeBaseVehicleId()

View File

@@ -8,7 +8,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public class VehicleType
{
[XmlText]

View File

@@ -8,10 +8,10 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class VehicleTypes
{
[XmlElement(ElementName = "VehicleType", Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21", Order = 1)]
[XmlElement(ElementName = "VehicleType", Namespace = "http://whisolutions.com/pss/common/helper/parts", Order = 1)]
public PartSource.Data.Nexpart.VehicleType[] VehicleType { get; set; }
}
}

View File

@@ -8,7 +8,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class VehicleTypesGet
{
public VehicleTypesGet()
@@ -16,7 +16,7 @@ namespace PartSource.Data.Nexpart
this.PSRequestHeader = new PSRequestHeader();
}
[XmlElement(ElementName = "PSRequestHeader", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 1)]
[XmlElement(ElementName = "PSRequestHeader", Namespace = "http://whisolutions.com/pss/common/model/parts", Order = 1)]
public PSRequestHeader PSRequestHeader { get; set; }
}
}

View File

@@ -9,7 +9,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class VehicleTypesGetResponse : IResponseElement<VehicleTypes>
{
[XmlElement]

View File

@@ -2,7 +2,7 @@
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public class WHIEngine
{
[XmlAttribute]

View File

@@ -5,7 +5,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class WHIEngineSearch
{
public WHIEngineSearch()

View File

@@ -6,7 +6,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class WHIEngineSearchResponse : IResponseElement<WHIEngines>
{
[XmlElement]

View File

@@ -2,10 +2,10 @@
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class WHIEngines
{
[XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")]
[XmlElement(Namespace = "http://whisolutions.com/pss/common/helper/parts")]
public WHIEngine[] WHIEngine;
}
}

View File

@@ -8,7 +8,7 @@ using System.Xml.Serialization;
namespace PartSource.Data.Nexpart
{
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")]
[XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/pss/common/model/parts")]
public class Years
{
[XmlAttribute(AttributeName = "to")]

View File

@@ -1,12 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using PartSource.Data.Contexts;
using PartSource.Data.Dtos;
using PartSource.Data.Models;
using PartSource.Data.Nexpart;
namespace PartSource.Services
{
@@ -19,6 +20,39 @@ namespace PartSource.Services
_fitmentContext = fitmentContext;
}
public async Task<VehicleFitmentDto> GetFitmentNotes(string sku, int vehicleId)
{
VehicleFitmentDto vehicleFitment = await _fitmentContext.VehicleFitments
.Where(vf => vf.VehicleToEngineConfigId == vehicleId && vf.Sku == sku)
.Select(vf => new VehicleFitmentDto
{
Sku = vf.Sku,
LineCode = vf.LineCode,
PartNumber = vf.PartNumber,
NoteText = vf.NoteText,
Year = vf.Year,
MakeName = vf.MakeName,
ModelName = vf.ModelName,
BaseVehicleId = vf.BaseVehicleId,
EngineConfigId = vf.EngineConfigId,
VehicleToEngineConfigId = vf.VehicleToEngineConfigId
})
.FirstOrDefaultAsync();
if (vehicleFitment == null)
{
return null;
}
vehicleFitment.SubmodelNames = await _fitmentContext.VehicleFitments
.Where(vf => vf.BaseVehicleId == vehicleFitment.BaseVehicleId && vf.Sku == sku)
.Select(vf => vf.SubmodelName)
.Distinct()
.ToListAsync();
return vehicleFitment;
}
public IList<string> GetYmmFitment(IList<Vehicle> vehicles)
{
if (vehicles.Count == 0)
@@ -122,38 +156,5 @@ namespace PartSource.Services
return vehicles.ToList();
}
public IList<VehicleFitmentDto> GetVehicleFitmentForPart(string partNumber, string lineCode, int maxVehicles = 0)
{
if (string.IsNullOrEmpty(partNumber) || string.IsNullOrEmpty(lineCode))
{
return null;
}
partNumber = Regex.Replace(partNumber, "[^a-zA-Z0-9\\-]", string.Empty);
IQueryable<string> whiCodes = _fitmentContext.DcfMappings
.Where(d => d.LineCode == lineCode)
.Select(d => d.WhiCode);
IQueryable<VehicleFitmentDto> vehicles = _fitmentContext.Fitments
.Where(f => f.PartNumber == partNumber && whiCodes.Contains(f.LineCode))
.Join(_fitmentContext.Vehicles,
f => new { f.BaseVehicleId, f.EngineConfigId },
v => new { v.BaseVehicleId, v.EngineConfigId },
(f, v) => new VehicleFitmentDto
{
Fitment = f,
Vehicle = v
})
.Distinct();
if (maxVehicles > 0)
{
vehicles = vehicles.Take(maxVehicles);
}
return vehicles.ToList();
}
}
}

View File

@@ -32,7 +32,7 @@ namespace PartSource.Services
try
{
//HttpResponseMessage response = await client.PostAsync(ConfigurationManager.AppSettings["NexpartUrl"], (HttpContent)new StringContent(sb.ToString(), Encoding.UTF8, "text/xml"));
HttpResponseMessage response = await client.PostAsync("http://acespssprod.nexpart.com:8081/partselect/1.0/services/PartSelectService.PartSelectHttpSoap11Endpoint/", new StringContent(textWriter.ToString(), Encoding.UTF8));
HttpResponseMessage response = await client.PostAsync("http://acespssprod.nexpart.com:8085/partselect/2.0/services/PartSelectService.PartSelectHttpSoap11Endpoint", new StringContent(textWriter.ToString(), Encoding.UTF8));
Stream result = await response.Content.ReadAsStreamAsync();
string str = await response.Content.ReadAsStringAsync();

View File

@@ -14,10 +14,10 @@
<ItemGroup>
<PackageReference Include="AutoMapper" Version="11.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Ratermania.Shopify" Version="6.16.11" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\ratermania\Packages\Shopify\Shopify.csproj" />
<ProjectReference Include="..\PartSource.Data\PartSource.Data.csproj" />
</ItemGroup>

View File

@@ -11,8 +11,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PartSource.Services", "Part
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PartSource.Automation", "PartSource.Automation\PartSource.Automation.csproj", "{C85D675B-A76C-4F9C-9C57-1E063211C946}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shopify", "..\ratermania\Packages\Shopify\Shopify.csproj", "{1A9096CE-AF40-4DBA-A754-93F8CFC1EBDA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Also Debug|Any CPU = Also Debug|Any CPU
@@ -98,24 +96,6 @@ Global
{C85D675B-A76C-4F9C-9C57-1E063211C946}.Release|x64.Build.0 = Release|Any CPU
{C85D675B-A76C-4F9C-9C57-1E063211C946}.Release|x86.ActiveCfg = Release|Any CPU
{C85D675B-A76C-4F9C-9C57-1E063211C946}.Release|x86.Build.0 = Release|Any CPU
{1A9096CE-AF40-4DBA-A754-93F8CFC1EBDA}.Also Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1A9096CE-AF40-4DBA-A754-93F8CFC1EBDA}.Also Debug|Any CPU.Build.0 = Debug|Any CPU
{1A9096CE-AF40-4DBA-A754-93F8CFC1EBDA}.Also Debug|x64.ActiveCfg = Debug|Any CPU
{1A9096CE-AF40-4DBA-A754-93F8CFC1EBDA}.Also Debug|x64.Build.0 = Debug|Any CPU
{1A9096CE-AF40-4DBA-A754-93F8CFC1EBDA}.Also Debug|x86.ActiveCfg = Debug|Any CPU
{1A9096CE-AF40-4DBA-A754-93F8CFC1EBDA}.Also Debug|x86.Build.0 = Debug|Any CPU
{1A9096CE-AF40-4DBA-A754-93F8CFC1EBDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1A9096CE-AF40-4DBA-A754-93F8CFC1EBDA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1A9096CE-AF40-4DBA-A754-93F8CFC1EBDA}.Debug|x64.ActiveCfg = Debug|Any CPU
{1A9096CE-AF40-4DBA-A754-93F8CFC1EBDA}.Debug|x64.Build.0 = Debug|Any CPU
{1A9096CE-AF40-4DBA-A754-93F8CFC1EBDA}.Debug|x86.ActiveCfg = Debug|Any CPU
{1A9096CE-AF40-4DBA-A754-93F8CFC1EBDA}.Debug|x86.Build.0 = Debug|Any CPU
{1A9096CE-AF40-4DBA-A754-93F8CFC1EBDA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1A9096CE-AF40-4DBA-A754-93F8CFC1EBDA}.Release|Any CPU.Build.0 = Release|Any CPU
{1A9096CE-AF40-4DBA-A754-93F8CFC1EBDA}.Release|x64.ActiveCfg = Release|Any CPU
{1A9096CE-AF40-4DBA-A754-93F8CFC1EBDA}.Release|x64.Build.0 = Release|Any CPU
{1A9096CE-AF40-4DBA-A754-93F8CFC1EBDA}.Release|x86.ActiveCfg = Release|Any CPU
{1A9096CE-AF40-4DBA-A754-93F8CFC1EBDA}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE