diff --git a/PartSource.Api/Controllers/BaseNexpartController.cs b/PartSource.Api/Controllers/BaseNexpartController.cs new file mode 100644 index 0000000..0b20b98 --- /dev/null +++ b/PartSource.Api/Controllers/BaseNexpartController.cs @@ -0,0 +1,36 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Controllers.BaseNexpartController +// Assembly: PartSource, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 9C95A003-DAA7-4079-9F59-D1FC80E1666C +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.dll + +using Microsoft.AspNetCore.Mvc; +using PartSource.Data.Nexpart; +using PartSource.Data.Nexpart.Interfaces; + +namespace PartSource.Api.Controllers +{ + public class BaseNexpartController : ControllerBase + { + protected ActionResult NexpartResponse(T response) where T : IResponseElement + { + Exceptions[] exceptions = response.PSResponseHeader.Exceptions; + if ((exceptions != null ? ((uint)exceptions.Length > 0U ? 1 : 0) : 0) == 0) + { + return Ok(new + { + Data = response.ResponseBody + }); + } + + string empty = string.Empty; + foreach (Exceptions exception in response.PSResponseHeader.Exceptions) + empty += string.Format("{0}\n", (object)exception.Value); + + return BadRequest(new + { + Data = response.ResponseBody + }); + } + } +} diff --git a/PartSource.Api/Controllers/ErrorController.cs b/PartSource.Api/Controllers/ErrorController.cs new file mode 100644 index 0000000..4773f30 --- /dev/null +++ b/PartSource.Api/Controllers/ErrorController.cs @@ -0,0 +1,33 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Diagnostics; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace PartSource.Api.Controllers +{ + [Route("[controller]")] + public class ErrorController : ControllerBase + { + [Route("")] + [AllowAnonymous] + public ActionResult Get() + { + IExceptionHandlerPathFeature exceptionFeature = HttpContext.Features.Get(); + + if (exceptionFeature != null) + { + string route = exceptionFeature.Path; + + Exception ex = exceptionFeature.Error; + + //TODO: Logging + } + + return StatusCode(StatusCodes.Status500InternalServerError); + } + } +} diff --git a/PartSource.Api/Controllers/InventoryController.cs b/PartSource.Api/Controllers/InventoryController.cs new file mode 100644 index 0000000..d46ad70 --- /dev/null +++ b/PartSource.Api/Controllers/InventoryController.cs @@ -0,0 +1,43 @@ +using Microsoft.AspNetCore.Mvc; +using PartSource.Data.Models; +using PartSource.Services; +using System.Net; +using System.Threading.Tasks; +using System.Web.Http; + +namespace PartSource.Api.Controllers +{ + [Route("[controller]")] + [ApiController] + public class InventoryController : BaseNexpartController + { + private readonly PartService _inventoryService; + + public InventoryController(PartService inventoryService) + { + _inventoryService = inventoryService; + } + + [HttpGet] + [Route("sku/{sku}/storeNumber/{storeNumber}")] + public async Task GetInventory(int sku, int storeNumber) + { + PartsAvailability inventory = _inventoryService.GetInventory(sku, storeNumber); + + if (inventory == null) + { + return NotFound($"No part matching SKU {sku} was found."); + } + + return Ok(new + { + data = new + { + StoreNumber = inventory.Store, + Sku = sku, + Quantity = inventory.QTY + } + }); + } + } +} diff --git a/PartSource.Api/Controllers/NexpartVehiclesController.cs b/PartSource.Api/Controllers/NexpartVehiclesController.cs new file mode 100644 index 0000000..c266ecd --- /dev/null +++ b/PartSource.Api/Controllers/NexpartVehiclesController.cs @@ -0,0 +1,159 @@ +using Microsoft.AspNetCore.Mvc; +using PartSource.Data.Nexpart; +using PartSource.Services; +using System.Threading.Tasks; +using System.Web.Http; + +namespace PartSource.Api.Controllers +{ + [Route("[controller]")] + [ApiController] + public class NexpartVehiclesController : BaseNexpartController + { + private readonly NexpartService _nexpartService; + + public NexpartVehiclesController(NexpartService nexpartService) + { + this._nexpartService = nexpartService; + } + + [HttpGet] + [Route("types")] + public async Task GetVehicleTypes() + { + NexpartVehiclesController vehiclesController = this; + VehicleTypesGetResponse response = await vehiclesController._nexpartService.SendRequest(new VehicleTypesGet()); + return vehiclesController.NexpartResponse(response); + } + + [HttpGet] + [Route("makes")] + public async Task GetMakes() + { + NexpartVehiclesController vehiclesController = this; + MakeSearch requestContent = new MakeSearch() + { + VehicleTypeId = new int[] { 5, 6, 7 } + }; + MakeSearchResponse response = await vehiclesController._nexpartService.SendRequest(requestContent); + return vehiclesController.NexpartResponse(response); + } + + [HttpGet] + [Route("makes/vehicletypeid/{vehicleTypeId}")] + public async Task GetMakes(int vehicleTypeId) + { + NexpartVehiclesController vehiclesController = this; + MakeSearch requestContent = new MakeSearch() + { + VehicleTypeId = new int[] { vehicleTypeId } + }; + MakeSearchResponse response = await vehiclesController._nexpartService.SendRequest(requestContent); + return vehiclesController.NexpartResponse(response); + } + + [HttpGet] + [Route("models/makeid/{makeId}/modelyear/{year}")] + public async Task GetModels(int makeId, int year) + { + NexpartVehiclesController vehiclesController = this; + ModelSearch requestContent = new ModelSearch() + { + MakeId = makeId, + Year = year, + VehicleTypeId = new int[] { 5, 6, 7 } + }; + ModelSearchResponse response = await vehiclesController._nexpartService.SendRequest(requestContent); + return vehiclesController.NexpartResponse(response); + } + + [HttpGet] + [Route("models/makeid/{makeId}/modelyear/{year}/vehicletypeid/{vehicleTypeId}")] + public async Task GetModels(int makeId, int year, int vehicleTypeId) + { + NexpartVehiclesController vehiclesController = this; + ModelSearch requestContent = new ModelSearch() + { + MakeId = makeId, + Year = year, + VehicleTypeId = new int[] { vehicleTypeId } + }; + ModelSearchResponse response = await vehiclesController._nexpartService.SendRequest(requestContent); + return vehiclesController.NexpartResponse(response); + } + + [HttpGet] + [Route("basevehicle/makeid/{makeId}/modelid/{modelId}/modelyear/{year}")] + public async Task GetBaseVehicle(int makeId, int modelId, int year) + { + BaseVehicleDetailLookup requestContent = new BaseVehicleDetailLookup() + { + MakeId = makeId, + ModelId = modelId, + Year = year + }; + BaseVehicleDetailLookupResponse response = await _nexpartService.SendRequest(requestContent); + return NexpartResponse(response); + } + + [HttpGet] + [Route("engines/basevehicleid/{baseVehicleId}")] + [Route("engines/basevehicleid/{baseVehicleId}/submodelid/{subModelId}")] + public async Task GetEngines(int baseVehicleId, int? subModelId = null) + { + EngineSearch requestContent = new EngineSearch() + { + VehicleIdentifier = new VehicleIdentifier() + { + BaseVehicleId = baseVehicleId + }, + SubModelId = subModelId + }; + EngineSearchResponse response = await _nexpartService.SendRequest(requestContent); + return NexpartResponse(response); + } + + [HttpGet] + [Route("trim/makeid/{makeId}/modelid/{modelId}/modelyear/{year}")] + public async Task GetTrim(int makeId, int modelId, int year) + { + SubModelSearch requestContent = new SubModelSearch() + { + MakeId = makeId, + ModelId = modelId, + Year = year, + RegionId = 2 + }; + SubModelSearchResponse response = await _nexpartService.SendRequest(requestContent); + return NexpartResponse(response); + } + + [HttpGet] + [Route("/detail/basevehicleid/{baseVehicleId}/submodelid/{subModelId}/engineconfigid/{engineConfigId}")] + public async Task GetVehicleId(int baseVehicleId, int subModelId, int engineConfigId) + { + VehicleIdSearch requestContent = new VehicleIdSearch + { + VehicleIdentifier = new VehicleIdentifier() + { + BaseVehicleId = baseVehicleId, + EngineConfigId = engineConfigId + }, + Criterion = new Criterion[1]{ + new Criterion + { + Attribute = "SUB_MODEL", + Id = subModelId + } + }, + RegionId = new RegionId + { + Value = 2 + }, + }; + + VehicleIdSearchResponse response = await _nexpartService.SendRequest(requestContent); + return NexpartResponse(response); + } + } +} diff --git a/PartSource.Api/Controllers/PartsController.cs b/PartSource.Api/Controllers/PartsController.cs new file mode 100644 index 0000000..fe06685 --- /dev/null +++ b/PartSource.Api/Controllers/PartsController.cs @@ -0,0 +1,92 @@ +using Microsoft.AspNetCore.Mvc; +using PartSource.Data.Dtos; +using PartSource.Data.Models; +using PartSource.Data.Nexpart; +using PartSource.Services; +using System.Collections.Generic; +using System.Threading.Tasks; +using System.Web.Http; + +namespace PartSource.Api.Controllers +{ + [Route("[controller]")] + [ApiController] + public class PartsController : BaseNexpartController + { + private readonly NexpartService _nexpartService; + private readonly PartService _partService; + + public PartsController(NexpartService nexpartService, PartService partService) + { + this._nexpartService = nexpartService; + _partService = partService; + } + + [HttpGet] + [Route("PartNumber/{partNumber}/LineCode/{lineCode}")] + public ActionResult GetPart(string partNumber, string lineCode) + { + new SmartPageDataSearch().Items = new Item[1] + { + new Item() + { + PartNumber = partNumber.ToUpperInvariant(), + MfrCode = lineCode.ToUpperInvariant() + } + }; + return (ActionResult)this.Ok(); + } + + [HttpGet] + [Route("search/basevehicleid/{baseVehicleId}")] + public async Task Search(int baseVehicleId, [FromQuery] string query) + { + PartsController partsController = this; + PartTypeSearch requestContent = new PartTypeSearch() + { + SearchString = query, + SearchType = "ALL", + SearchOptions = "PARTIAL_MATCH", + VehicleIdentifier = new VehicleIdentifier() + { + BaseVehicleId = baseVehicleId + } + }; + PartTypeSearchResponse response = await partsController._nexpartService.SendRequest(requestContent); + return partsController.NexpartResponse(response); + } + + [HttpGet] + [Route("validate/partTypeId/{partTypeId}/baseVehicleId/{baseVehicleId}")] + public async Task ValidatePartFitment(int partTypeId, int baseVehicleId) + { + PartsController partsController = this; + PartTypesValidateLookup typesValidateLookup = new PartTypesValidateLookup(); + typesValidateLookup.PartTypes = new PartType[1] + { + new PartType() { Id = partTypeId } + }; + typesValidateLookup.VehicleIdentifier = new VehicleIdentifier() + { + BaseVehicleId = baseVehicleId + }; + PartTypesValidateLookup requestContent = typesValidateLookup; + PartTypesValidateLookupResponse response = await partsController._nexpartService.SendRequest(requestContent); + return partsController.NexpartResponse(response); + } + + [HttpGet] + [Route("search/fitment")] + public async Task FitmentSearch([FromQuery] FitmentSearchDto fitmentSearchDto) + { + IList fitments = _partService.GetFitments(fitmentSearchDto); + + if (fitments == null) + { + return NotFound(); + } + + return Ok(new { Data = fitments }); + } + } +} diff --git a/PartSource.Api/Controllers/SearchController.cs b/PartSource.Api/Controllers/SearchController.cs new file mode 100644 index 0000000..18d2cbb --- /dev/null +++ b/PartSource.Api/Controllers/SearchController.cs @@ -0,0 +1,32 @@ +using Microsoft.AspNetCore.Mvc; +using PartSource.Data.Nexpart; +using PartSource.Services; +using System.Threading.Tasks; + +namespace PartSource.Api.Controllers +{ + [Route("[controller]")] + [ApiController] + public class SearchController : BaseNexpartController + { + private readonly NexpartService _nexpartService; + + public SearchController() + { + this._nexpartService = new NexpartService(); + } + + [HttpGet] + [Route("makes/vehicletypeid/{vehicleTypeId}")] + public async Task GetMakes(int vehicleTypeId) + { + SearchController searchController = this; + MakeSearch requestContent = new MakeSearch() + { + VehicleTypeId = new int[] { vehicleTypeId } + }; + MakeSearchResponse response = await searchController._nexpartService.SendRequest(requestContent); + return searchController.NexpartResponse(response); + } + } +} diff --git a/PartSource.Api/Controllers/StoresController.cs b/PartSource.Api/Controllers/StoresController.cs new file mode 100644 index 0000000..671c37f --- /dev/null +++ b/PartSource.Api/Controllers/StoresController.cs @@ -0,0 +1,47 @@ +//using Microsoft.AspNetCore.Mvc; +//using PartSource.Data.Models; +//using PartSource.Services; +//using System.Web.Http; + +//namespace PartSource.Api.Controllers +//{ +// [Route("stores")] +// public class StoresController : ControllerBase +// { +// private const int Count = 5; +// private const int Page = 1; +// private readonly LocationService _service; + +// public StoresController(LocationService service) +// { +// this._service = service; +// } + +// [HttpGet] +// [Route("nearest/{postal}")] +// [Route("nearest/{postal}/count/{count}")] +// [Route("nearest/{postal}/count/{count}/page/{page}")] +// public ActionResult GetNearestStores(string postal, int count = 5, int page = 1) +// { +// PostalCode postalCodeData = this._service.GetPostalCodeData(postal); +// if (postalCodeData == null) +// return (ActionResult)this.BadRequest("Invalid postal code"); +// return (ActionResult)this.Ok(new +// { +// Data = this._service.GetClosestLocations(postalCodeData, count, page) +// }); +// } + +// [HttpGet] +// [Route("nearest/{postal}/radius/{radius}")] +// [Route("nearest/{postal}/radius/{radius}/count/{count}")] +// [Route("nearest/{postal}/radius/{radius}/count/{count}/page/{page}")] +// public ActionResult GetNearestStores(string postal, double radius, int count = 5, int page = 1) +// { +// return (ActionResult)this.Ok(new +// { +// Data = this._service.GetClosestLocations(this._service.GetPostalCodeData(postal), count, page, radius) +// }); +// } +// } +//} diff --git a/PartSource.Api/Controllers/TemplatesController.cs b/PartSource.Api/Controllers/TemplatesController.cs new file mode 100644 index 0000000..177eb00 --- /dev/null +++ b/PartSource.Api/Controllers/TemplatesController.cs @@ -0,0 +1,40 @@ +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Primitives; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace PartSource.Api.Controllers +{ + [Route("[controller]")] + [ApiController] + public class TemplatesController : ControllerBase + { + + [Route("{templateName}/{vehicleId}")] + [HttpGet] + public IActionResult GetTemplate(string templateName, int vehicleId) + { + StringValues contentType = new StringValues("application/liquid"); + Response.Headers.Add("Content-Type", contentType); + + string content = $"{templateName},{vehicleId}"; + + return Ok(content); + } + + //Crappy oauth code to make the app installable on shopify + + //HttpRequest request = HttpContext.Request; + + //string location = "https://ratermaniac.myshopify.com/admin/oauth/authorize?client_id=097de154602f28499e058f66b8653033&scope=read_customers&redirect_uri=https://soundpress.com&state=0.4585849384"; + + //StringValues locationHeader = new StringValues(location); + + // //Response.Headers.Add("Location", location); + + // return Redirect(location); + } +} diff --git a/PartSource.Api/Controllers/VehiclesController.cs b/PartSource.Api/Controllers/VehiclesController.cs new file mode 100644 index 0000000..0307ed4 --- /dev/null +++ b/PartSource.Api/Controllers/VehiclesController.cs @@ -0,0 +1,101 @@ +using Microsoft.AspNetCore.Mvc; +using PartSource.Data.Models; +using PartSource.Services; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; + +namespace PartSource.Api.Controllers +{ + [Route("[controller]")] + [ApiController] + public class VehiclesController : BaseNexpartController + { + private readonly VehicleService _vehicleService; + + public VehiclesController(VehicleService vehicleService) + { + this._vehicleService = vehicleService; + } + + [HttpGet] + [Route("makes")] + public async Task GetMakes() + { + IList makes = await _vehicleService.GetAllMakes(); + + return Ok(makes); + } + + [HttpGet] + [Route("models/makeid/{makeId}/modelyear/{year}")] + public async Task GetModels(int makeId, int year) + { + IList models = await _vehicleService.GetModels(makeId, year); + + return Ok(models); + } + + [HttpGet] + [Route("basevehicle/makeid/{makeId}/modelid/{modelId}/modelyear/{year}")] + [Route("basevehicles/makeid/{makeId}/modelid/{modelId}/modelyear/{year}")] + public async Task GetBaseVehicle(int makeId, int modelId, int year) + { + IList baseVehicles = await _vehicleService.GetBaseVehicles(makeId, modelId, year); + + return Ok(baseVehicles); + } + + [HttpGet] + [Route("engines/basevehicleid/{baseVehicleId}")] + [Route("engines/basevehicleid/{baseVehicleId}/submodelid/{subModelId}")] + public async Task GetEngines(int baseVehicleId, int? submodelId = null) + { + IList engines = submodelId == null + ? await _vehicleService.GetEngines(baseVehicleId) + : await _vehicleService.GetEngines(baseVehicleId, (int)submodelId); + + return Ok(engines); + } + + [HttpGet] + [Route("trim/makeid/{makeId}/modelid/{modelId}/modelyear/{year}")] + [Route("submodels/makeid/{makeId}/modelid/{modelId}/modelyear/{year}")] + public async Task GetSubmodels(int makeId, int modelId, int year) + { + IList submodels = await _vehicleService.GetSubmodels(makeId, modelId, year); + + return Ok(submodels); + } + + [HttpGet] + [Route("/detail/basevehicleid/{baseVehicleId}/submodelid/{submodelId}/engineconfigid/{engineConfigId}")] + public async Task GetVehicleDetail(int baseVehicleId, int submodelId, int engineConfigId) + { + VehicleData vehicle = await _vehicleService.GetVehicle(baseVehicleId, engineConfigId, submodelId); + + return Ok(vehicle); + } + + [HttpGet] + [Route("types")] + public ActionResult GetVehicleTypes() + { + return new StatusCodeResult((int)HttpStatusCode.Gone); + } + + [HttpGet] + [Route("makes/vehicletypeid/{vehicleTypeId}")] + public ActionResult GetMakes(int vehicleTypeId) + { + return new StatusCodeResult((int)HttpStatusCode.Gone); + } + + [HttpGet] + [Route("models/makeid/{makeId}/modelyear/{year}/vehicletypeid/{vehicleTypeId}")] + public ActionResult GetModels(int makeId, int year, int vehicleTypeId) + { + return new StatusCodeResult((int)HttpStatusCode.Gone); + } + } +} diff --git a/PartSource.Api/Formatters/LiquidTemplateOutputFormatter.cs b/PartSource.Api/Formatters/LiquidTemplateOutputFormatter.cs new file mode 100644 index 0000000..3bebf71 --- /dev/null +++ b/PartSource.Api/Formatters/LiquidTemplateOutputFormatter.cs @@ -0,0 +1,28 @@ +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc.Formatters; +using System; +using System.Text; +using System.Threading.Tasks; + +namespace PartSource.Api.Formatters +{ + public class LiquidTemplateOutputFormatter : TextOutputFormatter + { + public LiquidTemplateOutputFormatter() + { + SupportedMediaTypes.Add("application/liquid"); + SupportedEncodings.Add(Encoding.UTF8); + SupportedEncodings.Add(Encoding.Unicode); + } + + protected override bool CanWriteType(Type type) + { + return type == typeof(string); + } + + public override async Task WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding) + { + await context.HttpContext.Response.WriteAsync((string)context.Object); + } + } +} diff --git a/PartSource.Api/PartSource.Api.csproj b/PartSource.Api/PartSource.Api.csproj new file mode 100644 index 0000000..2f70119 --- /dev/null +++ b/PartSource.Api/PartSource.Api.csproj @@ -0,0 +1,33 @@ + + + + netcoreapp3.1 + f9e2fd37-0f2d-4e3a-955a-8e49a16fce1c + Debug;Release;Also Debug + + + + + + + + + + + + + Always + + + + + + + + + + + + + + diff --git a/PartSource.Api/Program.cs b/PartSource.Api/Program.cs new file mode 100644 index 0000000..d000859 --- /dev/null +++ b/PartSource.Api/Program.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; + +namespace PartSource.Api +{ + public class Program + { + public static void Main(string[] args) + { + CreateWebHostBuilder(args).Build().Run(); + } + + public static IWebHostBuilder CreateWebHostBuilder(string[] args) => + WebHost.CreateDefaultBuilder(args) + .UseStartup(); + } +} diff --git a/PartSource.Api/Properties/launchSettings.json b/PartSource.Api/Properties/launchSettings.json new file mode 100644 index 0000000..319f4c1 --- /dev/null +++ b/PartSource.Api/Properties/launchSettings.json @@ -0,0 +1,29 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:31337", + "sslPort": 0 + } + }, + "$schema": "http://json.schemastore.org/launchsettings.json", + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchUrl": "api/values", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "PartSource.Api": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "api/values", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "https://localhost:5001;http://localhost:5000" + } + } +} \ No newline at end of file diff --git a/PartSource.Api/Startup.cs b/PartSource.Api/Startup.cs new file mode 100644 index 0000000..6ea5bd1 --- /dev/null +++ b/PartSource.Api/Startup.cs @@ -0,0 +1,64 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using PartSource.Api.Formatters; +using PartSource.Data; +using PartSource.Services; + +namespace PartSource.Api +{ + public class Startup + { + public IConfiguration Configuration { get; } + + public Startup(IConfiguration configuration) + { + Configuration = configuration; + } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + services.AddMvc(options => + { + options.OutputFormatters.Add(new LiquidTemplateOutputFormatter()); + }); + + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + + services.AddCors(o => o.AddPolicy("Default", builder => + { + builder.AllowAnyOrigin() + .AllowAnyMethod() + .AllowAnyHeader(); + })); + + services.AddDbContext(options => + options.UseSqlServer(Configuration.GetConnectionString("PartSourceDatabase")) + ); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IHostingEnvironment env) + { + //if (env.IsDevelopment()) + //{ + // app.UseDeveloperExceptionPage(); + //} + //else + //{ + // app.UseHsts(); + //} + + app.UseCors("Default"); + + app.UseExceptionHandler("/Error"); + // app.UseHttpsRedirection(); + app.UseMvc(); + } + } +} diff --git a/PartSource.Api/appsettings.development.json b/PartSource.Api/appsettings.development.json new file mode 100644 index 0000000..307ae89 --- /dev/null +++ b/PartSource.Api/appsettings.development.json @@ -0,0 +1,6 @@ +{ + + "ConnectionStrings": { + "PartSourceDatabase": "Server=(localdb)\\mssqllocaldb;Database=PartSource;Trusted_Connection=True;" + } +} diff --git a/PartSource.Api/appsettings.json b/PartSource.Api/appsettings.json new file mode 100644 index 0000000..77e9658 --- /dev/null +++ b/PartSource.Api/appsettings.json @@ -0,0 +1,21 @@ +{ + "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;" + }, + "Logging": { + "LogLevel": { + "Default": "Warning" + } + }, + "AllowedHosts": "*", + "Nexpart": { + "ApiKey": "AFA5CC1431CD43DCA663C17BDAD850BB-C8F5BDF9A09C4464A66731CA4427CBB9", + "ApiSecret": "7AB35766-0379-4DF0-9665-DAEE13822F43", + "Url": "http://acespssint.nexpart.com:4001/partselect/1.0/services/PartSelectService.PartSelectHttpSoap11Endpoint/" + }, + "Shopify": { + "ApiKey": "9a533dad460321c6ce8f30bf5b8691ed", + "ApiSecret": "dc9e28365d9858e544d57ac7af43fee7", + "ShopDomain": "dev-partsource.myshopify.com" + } +} diff --git a/PartSource.Automation/.editorconfig b/PartSource.Automation/.editorconfig new file mode 100644 index 0000000..b0099bc --- /dev/null +++ b/PartSource.Automation/.editorconfig @@ -0,0 +1,13 @@ +[*.cs] + +# CA1307: Specify StringComparison +dotnet_diagnostic.CA1307.severity = suggestion + +# CA1031: Do not catch general exception types +dotnet_diagnostic.CA1031.severity = none + +# CA2007: Consider calling ConfigureAwait on the awaited task +dotnet_diagnostic.CA2007.severity = silent + +# CA1303: Do not pass literals as localized parameters +dotnet_diagnostic.CA1303.severity = silent diff --git a/PartSource.Automation/Factories/JobFactory.cs b/PartSource.Automation/Factories/JobFactory.cs new file mode 100644 index 0000000..9107072 --- /dev/null +++ b/PartSource.Automation/Factories/JobFactory.cs @@ -0,0 +1,49 @@ +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using PartSource.Automation.Jobs; +using PartSource.Automation.Jobs.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace PartSource.Automation.Factories +{ + public class JobFactory + { + public IServiceProvider _serviceProvider; + + public JobFactory(IServiceProvider serviceProvider) + { + _serviceProvider = serviceProvider; + } + + public IAutomationJob Build(string jobName) + { + switch (jobName) + { + case nameof(AddProducts): + return _serviceProvider.GetService(); + + case nameof(DeleteProducts): + return _serviceProvider.GetService(); + + case nameof(TestJob): + return new TestJob(); + + case nameof(UpdateFitment): + return _serviceProvider.GetService(); + + case nameof(UpdatePricing): + return _serviceProvider.GetService(); + + case nameof(ExecuteSsisPackages): + return _serviceProvider.GetService(); + + default: + throw new Exception($"The job {jobName} could not be found."); + } + } + } +} diff --git a/PartSource.Automation/Jobs/AddProducts.cs b/PartSource.Automation/Jobs/AddProducts.cs new file mode 100644 index 0000000..97bf561 --- /dev/null +++ b/PartSource.Automation/Jobs/AddProducts.cs @@ -0,0 +1,145 @@ +using PartSource.Automation.Jobs.Interfaces; +using PartSource.Automation.Models; +using PartSource.Automation.Services; +using PartSource.Data; +using PartSource.Data.Models; +using PartSource.Data.Shopify; +using PartSource.Services; +using PartSource.Services.Integrations; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace PartSource.Automation.Jobs +{ + public class AddProducts : IAutomationJob + { + private readonly PartSourceContext _partSourceContext; + private readonly ShopifyClient _shopifyClient; + + public AddProducts(PartSourceContext partSourceContext, ShopifyClient shopifyClient) + { + _partSourceContext = partSourceContext; + _shopifyClient = shopifyClient; + } + + + public async Task Run() + { + await AddSkus(); + + return new AutomationJobResult + { + IsSuccess = true + }; + } + + public async Task AddSkus() + { + ImportData importData = _partSourceContext.ImportData.FirstOrDefault(p => !p.ShopifyId.HasValue); + + while (importData != null) + { + if (importData == null) + { + continue; + } + + // Images + List productImages = new List(); + string[] imageUrls = importData.ImageSrc?.Split(','); + + if (imageUrls?.Length > 0) + { + foreach (string url in imageUrls) + { + productImages.Add(new ProductImage + { + Src = url, + Alt = importData.ImageAltText + }); + } + } + + else + { + productImages.Add(new ProductImage + { + Src = "https://cdn.shopify.com/s/files/1/2239/4255/files/No_Image_Found.jpg", + Alt = "No Image Found" + }); + } + + // Product Tags + List productTags = new List + { + importData.LineCode, + importData.PartNumber, + }; + + List productVariants = new List(); + productVariants.Add(new ProductVariant + { + InventoryPolicy = "Deny", + CompareAtPrice = importData.CompareAt, + Price = importData.Price, + Sku = importData.VariantSku, + Title = importData.VariantTitle, + Option1 = importData.IsVariant.ToString(), + RequiresShipping = false + }); + + Product requestData = new Product + { + BodyHtml = importData.BodyHtml, + Title = importData.Title, + Vendor = importData.Vendor, + Tags = string.Join(",", productTags), + Published = true, + //ProductType = importData.FINELINE_NM, + Images = productImages.ToArray(), + Variants = productVariants.ToArray(), + CreatedAt = DateTime.Now, + UpdatedAt = DateTime.Now + }; + + requestData = await _shopifyClient.Products.Add(requestData); + + if (requestData.Id > 0) + { + importData.ShopifyId = requestData.Id; + + _partSourceContext.SaveChanges(); + + Console.WriteLine($"{importData.VariantSku}"); + } + + else + { + Console.WriteLine($"SHOPIFY ID WAS 0 - {importData.VariantSku}"); + } + + importData = _partSourceContext.ImportData.FirstOrDefault(p => !p.ShopifyId.HasValue); + } + } + } + + //private void Log(string message) + //{ + // try + // { + // using (FileStream fileStream = File.OpenWrite(@"C:\users\tommy\desktop\log.txt")) + // { + // fileStream.Write(Encoding.UTF8.GetBytes(message + "\n")); + // } + // } + + // catch + // { + // // LOL Fix this + // Log(message); + // } + //} +} diff --git a/PartSource.Automation/Jobs/BuildVehicleCache.cs b/PartSource.Automation/Jobs/BuildVehicleCache.cs new file mode 100644 index 0000000..3be9869 --- /dev/null +++ b/PartSource.Automation/Jobs/BuildVehicleCache.cs @@ -0,0 +1,320 @@ +//using Microsoft.EntityFrameworkCore; +//using PartSource.Automation.Jobs.Interfaces; +//using PartSource.Automation.Services; +//using PartSource.Data; +//using PartSource.Data.Models; +//using PartSource.Data.Nexpart; +//using PartSource.Services; +//using System; +//using System.Collections.Generic; +//using System.Linq; +//using System.Text; + +//using BaseVehicle = PartSource.Data.Models.BaseVehicle; + +//namespace PartSource.Automation.Jobs +//{ +// public class BuildVehicleCache : IAutomationJob +// { +// private readonly NexpartService _nexpartService; +// private readonly PartSourceContext _partSourceContext; + +// private readonly IServiceProvider _serviceProvider; + +// public BuildVehicleCache(IServiceProvider serviceProvider, PartSourceContext partSourceContext, NexpartService nexpartService) +// { +// _nexpartService = nexpartService; +// _partSourceContext = partSourceContext; +// _serviceProvider = serviceProvider; +// } + +// public void Run() +// { +// try +// { +// //AddMakes(); +// //AddModels(); + +// // AddEngines(); + +// //AddYearMakeModels(); + +// AddSubmodels(); +// } + +// catch (Exception ex) +// { +// ; +// } +// } + +// private void AddEngines() +// { +// IList baseVehicles = _partSourceContext.BaseVehicles.ToList(); + +// foreach (BaseVehicle baseVehicle in baseVehicles) +// { +// try +// { +// WHIEngineSearch whiEngineSearch = new WHIEngineSearch +// { +// VehicleIdentifier = new VehicleIdentifier +// { +// BaseVehicleId = baseVehicle.Id +// } +// }; + +// WHIEngineSearchResponse response = _nexpartService.SendRequest(whiEngineSearch).Result; + +// foreach (WHIEngine engine in response.ResponseBody.WHIEngine) +// { +// try +// { + +// if (!_partSourceContext.Engines.Any(e => e.Id == engine.Id)) +// { +// _partSourceContext.Engines.Add(new Data.Models.Engine +// { +// Id = engine.Id, +// Description = engine.Description +// }); +// } + + +// _partSourceContext.SaveChanges(); +// } + +// catch (Exception ex) +// { +// Console.WriteLine($"Failed to add engine { engine.Id } - { ex.Message }"); +// } +// } +// } + +// catch (Exception ex) +// { +// Console.WriteLine($"Failed to add engines for base vehicle { baseVehicle.Id } - { ex.Message }"); +// } +// } +// } + +// private void AddSubmodels() +// { +// int maxBaseVehicleId = _partSourceContext.Submodels.Any() +// ? _partSourceContext.Submodels.Max(s => s.BaseVehicleId) +// : 0; + +// IList baseVehicles = _partSourceContext.BaseVehicles.AsNoTracking().Where(b => b.Id > maxBaseVehicleId).ToList(); + +// foreach (BaseVehicle baseVehicle in baseVehicles) +// { +// try +// { +// SubModelSearch smSearch = new SubModelSearch() +// { +// MakeId = baseVehicle.VehicleMakeId, +// ModelId = baseVehicle.VehicleModelId, +// Year = baseVehicle.Year, +// RegionId = 2 +// }; +// SubModelSearchResponse smResponse = _nexpartService.SendRequest(smSearch).Result; + +// SubModel[] subModels = smResponse.ResponseBody?.SubModel; +// if (subModels == null) +// { +// continue; +// } + +// foreach (SubModel submodel in subModels) +// { +// EngineSearch requestContent = new EngineSearch() +// { +// VehicleIdentifier = new VehicleIdentifier() +// { +// BaseVehicleId = baseVehicle.Id +// }, +// SubModelId = int.Parse(submodel.Id) +// }; +// EngineSearchResponse response = _nexpartService.SendRequest(requestContent).Result; + +// if (response.ResponseBody == null) +// { +// continue; +// } + +// foreach (Data.Nexpart.Engine engine in response.ResponseBody.Engine) +// { +// VehicleIdSearch vidSearch = new VehicleIdSearch +// { +// VehicleIdentifier = new VehicleIdentifier() +// { +// BaseVehicleId = baseVehicle.Id, +// EngineConfigId = engine.Id +// }, +// Criterion = new Criterion[] +// { +// new Criterion +// { +// Attribute = "SUB_MODEL", +// Id = int.Parse(submodel.Id) +// } +// }, +// RegionId = new RegionId +// { +// Value = 2 +// }, +// ResultOption = new ResultOption[] +// { +// new ResultOption +// { +// Value = "WHI_ENGINE" +// } +// } +// }; + +// VehicleIdSearchResponse vidResponse = _nexpartService.SendRequest(vidSearch).Result; + +// if (vidResponse != null && vidResponse.ResponseBody.VehicleToEngineConfigId > 0) +// { +// _partSourceContext.Submodels.Add(new Submodel +// { +// VehicleToEngineConfigId = vidResponse.ResponseBody.VehicleToEngineConfigId, +// SubmodelId = int.Parse(submodel.Id), +// BaseVehicleId = baseVehicle.Id, +// EngineId = vidResponse.ResponseBody.WHIEngineId +// }); +// } +// } +// } + +// _partSourceContext.SaveChanges(); +// } + +// catch (Exception ex) +// { +// Console.WriteLine($"Failed to add BaseVehicleId {baseVehicle.Id}: {ex.Message}"); +// } +// } +// } + +// private void AddYearMakeModels() +// { +// BaseVehicleSearch request = new BaseVehicleSearch +// { +// Years = new Years +// { +// From = 1950, +// To = 2020 +// }, +// Region = new[] +// { +// new Region +// { +// Id = 2 +// } +// }, +// VehicleType = new[] +// { +// new VehicleType +// { +// Id = 5 +// }, +// new VehicleType +// { +// Id = 6 +// }, +// new VehicleType +// { +// Id = 7 +// } +// } +// }; + +// BaseVehicleSearchResponse response = _nexpartService.SendRequest(request).Result; + +// foreach (Data.Nexpart.BaseVehicle vehicle in response.ResponseBody.BaseVehicle) +// { +// _partSourceContext.BaseVehicles.Add(new Data.Models.BaseVehicle +// { +// Id = (int)vehicle.BaseVehicleId, +// VehicleMakeId = (int)vehicle.MakeId, +// VehicleModelId = (int)vehicle.ModelId, +// Year = (int)vehicle.Year +// }); +// } + +// _partSourceContext.SaveChanges(); +// } + +// private void AddMakes() +// { +// MakeSearch requestContent = new MakeSearch() +// { +// VehicleTypeId = new int[] { 5, 6, 7 }, +// RegionId = new int[] { 2 } +// }; + +// MakeSearchResponse response = _nexpartService.SendRequest(requestContent).Result; + +// foreach (Make make in response.ResponseBody.Make) +// { +// _partSourceContext.VehicleMakes.Add(new VehicleMake +// { +// Id = make.Id, +// Name = make.Value +// }); +// } + +// _partSourceContext.SaveChanges(); +// } + +// private void AddModels() +// { +// IList vehicleMakes = _partSourceContext.VehicleMakes.ToList(); +// IDictionary vehicleModels = new Dictionary(); + +// foreach (VehicleMake vehicleMake in vehicleMakes) +// { +// for (int year = 1950; year <= 2020; year++) +// { +// ModelSearch requestContent = new ModelSearch() +// { +// MakeId = vehicleMake.Id, +// Year = year, +// VehicleTypeId = new int[] { 5, 6, 7 }, +// RegionId = new int[] { 2 } +// }; + +// ModelSearchResponse response = _nexpartService.SendRequest(requestContent).Result; + +// if (response.ResponseBody == null || response.ResponseBody.Length == 0) +// { +// continue; +// } + +// foreach (Model model in response.ResponseBody[0].Model) +// { +// bool result = vehicleModels.TryGetValue(model.Id, out VehicleModel throwaway); + +// if (!result) +// { +// VehicleModel vehicleModel = new VehicleModel +// { +// Id = model.Id, +// Name = model.Value, +// VehicleMakeId = vehicleMake.Id +// }; + +// vehicleModels.Add(model.Id, vehicleModel); +// } +// } +// } +// } + +// _partSourceContext.VehicleModels.AddRange(vehicleModels.Values); +// _partSourceContext.SaveChanges(); +// } + + +// } +//} diff --git a/PartSource.Automation/Jobs/DeleteProducts.cs b/PartSource.Automation/Jobs/DeleteProducts.cs new file mode 100644 index 0000000..2be7673 --- /dev/null +++ b/PartSource.Automation/Jobs/DeleteProducts.cs @@ -0,0 +1,62 @@ +using PartSource.Data.Shopify; +using PartSource.Services; +using PartSource.Automation.Jobs.Interfaces; +using PartSource.Automation.Services; +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Linq; +using PartSource.Data; +using PartSource.Data.Models; +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using PartSource.Services.Integrations; +using PartSource.Automation.Models; + +namespace PartSource.Automation.Jobs +{ + public class DeleteProducts : IAutomationJob + { + private readonly ShopifyClient _shopifyClient; + + public DeleteProducts(ShopifyClient shopifyClient) + { + _shopifyClient = shopifyClient; + } + + // If this job fails, oh well. Run it again and again until it works, or use the Shopify UI (LOL) + public async Task Run() + { + Console.WriteLine("This job will delete ALL PRODUCTS from Shopify. If you really want to delete EVERY SINGLE PRODUCT, type 'mechanical keyboard' below."); + string input = Console.ReadLine(); + + if (input != "mechanical keyboard") + { + return new AutomationJobResult + { + IsSuccess = true + }; + } + + IEnumerable products = await _shopifyClient.Products.Get(); + + while (products != null) + { + foreach (Product product in products) + { + bool result = await _shopifyClient.Products.Delete(product); + } + + products = await _shopifyClient.Products.GetNext(); + + Console.Write('.'); + } + + return new AutomationJobResult + { + Message = "All products deleted. Don't forget to truncate the ImportData table", + IsSuccess = true + }; + } + } +} \ No newline at end of file diff --git a/PartSource.Automation/Jobs/ExecuteSsisPackages.cs b/PartSource.Automation/Jobs/ExecuteSsisPackages.cs new file mode 100644 index 0000000..7f09c32 --- /dev/null +++ b/PartSource.Automation/Jobs/ExecuteSsisPackages.cs @@ -0,0 +1,53 @@ +using PartSource.Automation.Jobs.Interfaces; +using PartSource.Automation.Models; +using PartSource.Automation.Services; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace PartSource.Automation.Jobs +{ + public class ExecuteSsisPackages : IAutomationJob + { + private readonly FtpService _ftpService; + private readonly SsisService _ssisService; + + // TODO: set from config + private readonly string[] _ssisPackages = { "Parts Availability", "Parts Price" }; + + public ExecuteSsisPackages(FtpService ftpService, SsisService ssisService) + { + _ftpService = ftpService; + _ssisService = ssisService; + } + + public async Task Run() + { + IList updatedPackages = new List(); + IList failedPackages = new List(); + + foreach (string package in _ssisPackages) + { + try + { + _ftpService.Download($"{package}.txt"); + _ssisService.Execute($"{package}.dtsx"); + + updatedPackages.Add(package); + } + + catch (Exception ex) + { + failedPackages.Add(package); + // TODO: Log + } + } + + return new AutomationJobResult + { + Message = $"Updated Packages: {string.Join(',', updatedPackages)} \n Failed Packages: {string.Join(',', failedPackages)}", + IsSuccess = failedPackages.Count == 0 + }; + } + } +} diff --git a/PartSource.Automation/Jobs/Interfaces/IAutomationJob.cs b/PartSource.Automation/Jobs/Interfaces/IAutomationJob.cs new file mode 100644 index 0000000..05e2229 --- /dev/null +++ b/PartSource.Automation/Jobs/Interfaces/IAutomationJob.cs @@ -0,0 +1,14 @@ +using PartSource.Automation.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace PartSource.Automation.Jobs.Interfaces +{ + public interface IAutomationJob + { + Task Run(); + } +} diff --git a/PartSource.Automation/Jobs/TestJob.cs b/PartSource.Automation/Jobs/TestJob.cs new file mode 100644 index 0000000..6c83085 --- /dev/null +++ b/PartSource.Automation/Jobs/TestJob.cs @@ -0,0 +1,21 @@ +using PartSource.Automation.Jobs.Interfaces; +using PartSource.Automation.Models; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace PartSource.Automation.Jobs +{ + public class TestJob : IAutomationJob + { + public async Task Run() + { + return new AutomationJobResult + { + Message = "Test job ran successfully", + IsSuccess = true + }; + } + } +} diff --git a/PartSource.Automation/Jobs/UpdateFitment - Copy.cs b/PartSource.Automation/Jobs/UpdateFitment - Copy.cs new file mode 100644 index 0000000..960bcff --- /dev/null +++ b/PartSource.Automation/Jobs/UpdateFitment - Copy.cs @@ -0,0 +1,535 @@ +//using Microsoft.EntityFrameworkCore; +//using PartSource.Automation.Jobs.Interfaces; +//using PartSource.Automation.Services; +//using PartSource.Data; +//using PartSource.Data.Models; +//using PartSource.Data.Nexpart; +//using PartSource.Data.Shopify; +//using PartSource.Services; +//using System; +//using System.Collections.Concurrent; +//using System.Collections.Generic; +//using System.Data; +//using System.Data.SqlClient; +//using System.IO; +//using System.Linq; +//using System.Text; +//using System.Text.RegularExpressions; +//using System.Threading.Tasks; + +//namespace PartSource.Automation.Jobs +//{ +// public class UpdateFitmentCopy : AddProducts, IAutomationJob +// { +// private readonly IServiceProvider _serviceProvider; +// private readonly SuperOldShopifyService _shopifyService; +// private readonly PartSourceContext _partSourceContext; +// private readonly NexpartService _nexpartService; + + +// private ConcurrentQueue _shopifyIdQueue; +// private string _connectionString = "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=True;Encrypt=True;TrustServerCertificate=False;Connection Timeout=3600;"; + +// private readonly int _threadCount = 1; + +// public UpdateFitmentCopy(IServiceProvider serviceProvider, PartSourceContext partSourceContext, SuperOldShopifyService shopifyService, NexpartService nexpartService) : base(serviceProvider, partSourceContext, nexpartService, shopifyService) +// { +// _serviceProvider = serviceProvider; +// _nexpartService = nexpartService; +// _shopifyService = shopifyService; +// _partSourceContext = partSourceContext; + +// } + +// new public void Run() +// { +// Console.WriteLine(""); + + +// UpdateMetafields(26); + + + + +// //UpdatePublished(); + + +// //FitmentReport(); + +// // List shopifyIds = _partSourceContext.ImportData.Where(s => s.IsFitment.Value && s.ShopifyId != null).Select(s => (long)s.ShopifyId).ToList(); +// //List shopifyIds = _partSourceContext.ImportData.Where(s => s.ShopifyId != null).Select(s => (long)s.ShopifyId).ToList(); + +// //_shopifyIdQueue = new ConcurrentQueue(shopifyIds); + +// //Parallel.For(0, _threadCount, i => +// // { + + +// // //Categorize(); +// // }); +// // }); +// } + + +// private IList GetYmmFitmentTags(BuyersGuideSearchResponse response) +// { +// BuyersGuideMake[] makes = response?.ResponseBody?.Apps?.Make; +// if (makes == null) +// { +// return new List(); +// } + +// IList fitmentTags = new List(); + +// foreach (BuyersGuideMake make in makes) +// { +// foreach (BuyersGuideModel model in make.Model) +// { +// IList years = new List(); +// for (int year = model.FromYear; year <= model.ToYear; year++) +// { +// years.Add(year); +// } + +// string tag = $"{string.Join('-', years)} {make.Name} {model.Name}"; + +// fitmentTags.Add(tag); +// } +// } + +// return fitmentTags; +// } + +// //private IList GetVehicleIdFitmentTags(BuyersGuideSearchResponse response) +// //{ +// // BuyersGuideMake[] makes = response?.ResponseBody?.Apps?.Make; +// // if (makes == null) +// // { +// // return new List(); +// // } + +// // IList fitmentTags = new List(); + +// // foreach (BuyersGuideMake make in makes) +// // { +// // foreach (BuyersGuideModel model in make.Model) +// // { +// // foreach (BuyersGuideEngine engine in model.Engine) +// // { +// // IList vehicleIds = _partSourceContext.VehicleData.Where(d => +// // d.EngineDescription == engine.Desc +// // && d.Year == engine.Year +// // && d.MakeName == make.Name +// // && d.ModelName == model.Name +// // ) +// // .Select(d => d.VehicleToEngineConfigId) +// // .ToList(); + +// // foreach (int id in vehicleIds) +// // { +// // string tag = $"v{id}"; + +// // fitmentTags.Add(tag); +// // } +// // } +// // } +// // } + +// // return fitmentTags; +// //} + +// /* public void UpdateFitmentViaBuyersGuideSearch() +// { +// int i = 0; +// IList products = _shopifyService.GetManyProducts(250, i).Result; + +// while (products.Count > 0) +// { +// foreach (Product product in products) +// { +// try +// { +// //if (product.Tags.Contains("-v") || product.Tags.ToLowerInvariant().Contains("zzzisfitment=false")) +// //{ +// // continue; +// //} + +// ImportData importData = _partSourceContext.ImportData.FirstOrDefault(p => p.ShopifyId == product.Id); +// if (importData == null || !importData.IsFitment.Value) +// { +// continue; +// } + +// importData.DcfMappings = _partSourceContext.DcfMappings.Where(d => d.LineCode == importData.LineCode).ToList(); + +// BuyersGuideSearch buyersGuideSearch = new BuyersGuideSearch(); +// List ymmFitmentTags = new List(); +// List vehicleIdFitmentTags = new List(); + +// foreach (DcfMapping mapping in importData.DcfMappings) +// { +// buyersGuideSearch = new BuyersGuideSearch +// { +// Part = new BuyersGuidePart +// { +// PartNumber = importData.PartNumber, +// MfrCode = mapping.WhiCode +// } +// }; + +// BuyersGuideSearchResponse response = _nexpartService.SendRequest(buyersGuideSearch).Result; + +// if (response.ResponseBody != null) +// { +// ymmFitmentTags.AddRange(GetYmmFitmentTags(response)); +// //vehicleIdFitmentTags.AddRange(GetVehicleIdFitmentTags(response)); +// } +// } + +// bool published = true; +// List productTags = new List +// { +// importData.LineCode, +// importData.PartNumber +// }; + +// published = (ymmFitmentTags.Count > 0 || vehicleIdFitmentTags.Count > 0); + +// productTags.Add($"zzzisFitment={importData.IsFitment}"); +// productTags.AddRange(vehicleIdFitmentTags); +// productTags.AddRange(ymmFitmentTags); + + +// if (productTags.Count > 249) +// { +// string message = $"Truncating {importData.VariantSku} - {productTags.Count} product tags"; + +// // Console.WriteLine(message); + +// productTags = productTags.Take(249).ToList(); +// } + +// published = (ymmFitmentTags.Count > 0 || vehicleIdFitmentTags.Count > 0); + + +// product.Tags = string.Join(",", productTags); +// product.PublishedAt = published ? (DateTime?)DateTime.Now : null; + +// bool updateResult = _shopifyService.UpdateProduct(product).Result; + +// if (updateResult) +// { +// if (published) +// { +// Console.WriteLine($"{product.Id}"); +// } +// } + +// else +// { +// Console.WriteLine($"Failed to update product {product.Id}"); +// } +// } + +// catch (Exception ex) +// { +// Console.WriteLine($"{ex.Message}"); +// } +// } + +// i++; +// products = _shopifyService.GetManyProducts(250, i).Result; +// } + +// } */ + +// /* private void UpdatePublished() +// { +// DbContextOptionsBuilder optionsBuilder = new DbContextOptionsBuilder(); +// optionsBuilder.UseSqlServer(_connectionString); + +// PartSourceContext threadDbContext = new PartSourceContext(optionsBuilder.Options); + +// int i = 0; +// int updated = 0; +// IList products = _shopifyService.GetManyProducts(250, i).Result; + +// while (products.Count > 0) +// { +// foreach (Product product in products) +// { +// try +// { +// ImportData importData = threadDbContext.ImportData.FirstOrDefault(p => p.ShopifyId == product.Id); + +// if (importData == null || !importData.IsFitment.Value) +// { +// continue; +// } + +// if (product.PublishedAt == null) +// { +// if (product.Tags.Contains("-v")) +// { +// IList tags = product.Tags.Split(','); + +// string fitmentTag = tags.Where(t => t.ToLowerInvariant().Contains("zzzisfitment")).FirstOrDefault(); +// tags.Remove(fitmentTag); +// tags.Add("zzzisFitment=True"); + +// product.Tags = string.Join(',', tags); +// product.PublishedAt = DateTime.Now; + +// bool result = _shopifyService.UpdateProduct(product).Result; + +// updated++; +// } +// } + +// } + +// catch (Exception ex) +// { +// continue; +// } +// } + +// i++; +// products = _shopifyService.GetManyProducts(250, i).Result; + +// Console.Write($"\ri={i}"); +// } +// } */ + +// private void FitmentReport() +// { +// IList importCache = _partSourceContext.ImportData.Where(s => s.IsFitment.Value && s.ShopifyId != null).ToList(); +// IList mappingCache = _partSourceContext.DcfMappings.ToList(); + +// Regex regex = new Regex("v[0-9]{6}"); + +// using (StreamWriter writer = File.AppendText("c:\\users\\tommy\\desktop\\fitment report.csv")) +// { + +// writer.WriteLine("Line Code,Part Number,WHI Match"); + +// int i = 0; +// IList products = _shopifyService.GetManyProducts(250, i).Result; + + +// while (products.Count > 0) +// { +// try +// { +// foreach (Product product in products) +// { +// ImportData importData = importCache.Join( +// mappingCache, +// d => d.LineCode, +// m => m.LineCode, +// (d, m) => d +// ) +// .FirstOrDefault(p => p.ShopifyId == product.Id); + +// if (importData == null || !importData.IsFitment.Value || product.Variants.Length == 0) +// { +// continue; +// } + +// bool tagged = regex.IsMatch(product.Tags); + +// if (!tagged) +// { +// // IList whiCodes = mappingCache.Where(d => d.LineCode == importData.LineCode).Select(d => d.WhiCode).ToList(); +// writer.WriteLine($"{importData.LineCode},{importData.PartNumber},{tagged}"); +// } +// } + +// i++; +// products = _shopifyService.GetManyProducts(250, i).Result; +// } + +// catch (Exception ex) +// { +// Console.WriteLine("whoops"); +// } +// } +// } +// } + + + +// private void UpdateMetafields(int i) +// { +// DbContextOptionsBuilder optionsBuilder = new DbContextOptionsBuilder(); +// optionsBuilder.UseSqlServer(_connectionString); + +// ShopifyClient shopifyClient = new ShopifyClient(new Ratermania.Shopify.ShopifyOptionsBuilder +// { +// ShopDomain = "partsource.myshopify.com", +// ApiVersion = "2020-01", +// ApiKey = "88f931933b566ade1fc92c6a39f04b34", +// ApiSecret = "527a3b4213c2c7ecb214728a899052df" +// }); + +// PartSourceContext threadDbContext = new PartSourceContext(optionsBuilder.Options); +// threadDbContext.Database.SetCommandTimeout(1440); + +// IList products = _shopifyService.GetManyProducts(250, i).Result; + +// while (products.Count > 0) +// { +// try +// { +// foreach (Product product in products) +// { +// try +// { +// if (product.Tags.Contains("-v") || product.Tags.ToLowerInvariant().Contains("zzzisfitment=false")) +// { +// continue; +// } + +// ImportData test = threadDbContext.ImportData.First(); + +// ImportData importData = threadDbContext.ImportData.FirstOrDefault(p => p.ShopifyId == product.Id); + +// if (importData == null) +// { +// continue; +// } + +// bool published = true; +// List productTags = new List +// { +// importData.LineCode, +// importData.PartNumber +// }; + + + +// IDictionary> positions = new Dictionary>(); + +// string partNumber = Regex.Replace(importData.PartNumber, "[^a-zA-Z0-9]", string.Empty); + +// string sql = $"select distinct BaseVehicleId, EngineConfigId, LineCode, PartNumber, Position from dbo.Fitment where LineCode in (select WhiCode from DcfMapping where LineCode='{importData.LineCode}') and PartNumber = '{partNumber}'"; + +// IList fitments = _partSourceContext.Fitments.FromSql(sql).ToList(); + + +// foreach (Fitment fitment in fitments) +// { +// fitment.Position = fitment.Position.Replace("\"", string.Empty); + +// if (string.IsNullOrEmpty(fitment.Position)) +// { +// continue; +// } + +// VehicleData vehicle = _partSourceContext.VehicleData.FirstOrDefault(v => v.BaseVehicleId == fitment.BaseVehicleId && v.EngineConfigId == fitment.EngineConfigId); + +// if (vehicle == null) +// { +// continue; +// } + +// if (positions.ContainsKey(fitment.Position)) +// { +// positions[fitment.Position].Add(vehicle.VehicleToEngineConfigId.ToString()); +// } + +// else +// { +// positions.Add(fitment.Position, new List +// { +// vehicle.VehicleToEngineConfigId.ToString() +// }); +// } +// } + +// foreach (KeyValuePair> position in positions) +// { +// Metafield metafield = new Metafield +// { +// OwnerId = product.Id, +// OwnerResource = "product", +// Namespace = "partsource", +// Key = position.Key, +// Value = string.Join(',', position.Value), +// ValueType = "string" +// }; + +// var x = shopifyClient.Metafields.Add(metafield).Result; + +// Console.WriteLine(product.Id); +// } + + + +// } + +// catch (Exception ex) +// { +// Console.WriteLine($"{ex.Message}"); +// } +// } + + +// i += _threadCount; +// products = _shopifyService.GetManyProducts(250, i).Result; + +// Console.WriteLine(i); +// } + +// catch (Exception ex) +// { +// Console.WriteLine($"{ex.Message}"); +// } +// } + +// } + +// private MenuNode[] GetMenuNodes(int menuId, int numberOfLevels, int? parentMenuNodeId = null) +// { +// MenuNodesLookup request = new MenuNodesLookup +// { +// MenuId = menuId, +// NumberOfLevels = numberOfLevels, +// ParentMenuNodeId = parentMenuNodeId +// }; + +// MenuNodesLookupResponse response = _nexpartService.SendRequest(request).Result; + +// return response.ResponseBody.MenuNode; +// } + +// //private bool IsFitmentLineCode(string lineCode) +// //{ +// // string sql = $"select WhiCode from DcfMapping where PartSourceCode='{importData.LineCode}'"; + +// // using (DataTable dataTable = new DataTable()) +// // { +// // using (SqlConnection connection = new SqlConnection(_connectionString)) +// // { +// // connection.Open(); + +// // using (SqlCommand command = new SqlCommand(sql, connection)) +// // { + +// // SqlDataAdapter dataAdapter = new SqlDataAdapter(command); +// // dataAdapter.Fill(dataTable); +// // } +// // } + +// // if (dataTable.Rows.Count == 0) +// // { +// // return false; +// // } + +// // lineCode = dataTable.Rows[0]["WhiCode"].ToString(); + + +// // } +// //} +// } +//} diff --git a/PartSource.Automation/Jobs/UpdateFitment.cs b/PartSource.Automation/Jobs/UpdateFitment.cs new file mode 100644 index 0000000..286ec75 --- /dev/null +++ b/PartSource.Automation/Jobs/UpdateFitment.cs @@ -0,0 +1,184 @@ +using Microsoft.EntityFrameworkCore; +using Newtonsoft.Json; +using PartSource.Automation.Jobs.Interfaces; +using PartSource.Automation.Models; +using PartSource.Automation.Services; +using PartSource.Data; +using PartSource.Data.Models; +using PartSource.Data.Nexpart; +using PartSource.Data.Shopify; +using PartSource.Services; +using PartSource.Services.Integrations; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; + +namespace PartSource.Automation.Jobs +{ + public class UpdateFitment : IAutomationJob + { + private readonly IServiceProvider _serviceProvider; + private readonly ShopifyClient _shopifyClient; + private readonly PartSourceContext _partSourceContext; + private readonly NexpartService _nexpartService; + + private readonly VehicleService _vehicleService; + + public UpdateFitment(IServiceProvider serviceProvider, PartSourceContext partSourceContext, ShopifyClient shopifyClient, NexpartService nexpartService, VehicleService vehicleService) + { + _partSourceContext = partSourceContext; + _shopifyClient = shopifyClient; + _vehicleService = vehicleService; + } + + public async Task Run() + { + IEnumerable products = await _shopifyClient.Products.Get(); + + while (products != null && products.Any()) + { + foreach (Product product in products) + { + try + { + await DeleteFitmentMetafields(product.Id); + + ImportData importData = _partSourceContext.ImportData.FirstOrDefault(i => i.VariantSku == product.Variants[0].Sku); + IList vehicles = _vehicleService.GetVehiclesForPart(importData?.PartNumber, importData?.LineCode); + + if (vehicles.Count > 0) + { + bool isFitment = false; + + IList vehicleIdFitment = _vehicleService.GetVehicleIdFitment(vehicles); + if (vehicleIdFitment.Count > 0) + { + isFitment = true; + + string json = JsonConvert.SerializeObject(vehicleIdFitment); + if (json.Length >= 100000) + { + continue; + } + + Metafield vehicleMetafield = new Metafield + { + Namespace = "fitment", + Key = "ids", + Value = json, + ValueType = "json_string", + OwnerResource = "product", + OwnerId = product.Id + }; + + await _shopifyClient.Metafields.Add(vehicleMetafield); + } + + IList ymmFitment = _vehicleService.GetYmmFitment(vehicles); + if (ymmFitment.Count > 0) + { + isFitment = true; + + string json = JsonConvert.SerializeObject(ymmFitment); + if (json.Length >= 100000) + { + continue; + } + + Metafield ymmMetafield = new Metafield + { + Namespace = "fitment", + Key = "seo", + Value = json, + ValueType = "json_string", + OwnerResource = "product", + OwnerId = product.Id + }; + + await _shopifyClient.Metafields.Add(ymmMetafield); + } + + Metafield isFitmentMetafield = new Metafield + { + Namespace = "Flags", + Key = "IsFitment", + Value = isFitment.ToString(), + ValueType = "string", + OwnerResource = "product", + OwnerId = product.Id + }; + + await _shopifyClient.Metafields.Add(isFitmentMetafield); + } + } + + + catch + { + Console.WriteLine(product.Id); + } + } + + try + { + Console.Write('.'); + + products = await _shopifyClient.Products.GetNext(); + } + + catch (Exception ex) + { + products = await _shopifyClient.Products.GetNext(); + } + } + + return new AutomationJobResult + { + IsSuccess = true + }; + } + + private async Task DeleteFitmentMetafields(long shopifyId) + { + IDictionary parameters = new Dictionary + { + { "metafield[owner_id]", shopifyId}, + { "metafield[owner_resource]", "product" }, + { "namespace", "fitment" }, + }; + + IEnumerable metafields = await _shopifyClient.Metafields.Get(parameters); + + foreach (Metafield metafield in metafields) + { + await _shopifyClient.Metafields.Delete(metafield); + } + } + + public IList GetVehicles(string partNumber, string lineCode) + { + partNumber = Regex.Replace(partNumber, "[^a-zA-Z0-9]", string.Empty); + + //string sql = $"select distinct BaseVehicleId, EngineConfigId from dbo.Fitment where ManufacturerCode in (select WhiCode from DcfMapping where PartSourceCode='{lineCode}') and (partNumber = '{partNumber}' or partNumber = '{partNumber.Replace("-", string.Empty)}')"; + string sql = $"with FitmentIds (BaseVehicleId, EngineConfigId) as (select distinct BaseVehicleId, EngineConfigId from dbo.Fitment where LineCode in (select WhiCode from DcfMapping where LineCode='{lineCode}') and PartNumber = '{partNumber}') select v.* from VehicleData v join FitmentIds f on v.BaseVehicleId = f.BaseVehicleId and v.EngineConfigId = f.EngineConfigId;"; + +#pragma warning disable EF1000 // Possible SQL injection vulnerability. + IList vehicles = _partSourceContext.VehicleData.FromSql(sql).ToList(); +#pragma warning restore EF1000 // Possible SQL injection vulnerability. + + return vehicles; + } + private void Update() + { + + } + + } +} diff --git a/PartSource.Automation/Jobs/UpdatePricing.cs b/PartSource.Automation/Jobs/UpdatePricing.cs new file mode 100644 index 0000000..b51870a --- /dev/null +++ b/PartSource.Automation/Jobs/UpdatePricing.cs @@ -0,0 +1,105 @@ +using PartSource.Automation.Jobs.Interfaces; +using PartSource.Automation.Models; +using PartSource.Data; +using PartSource.Data.Models; +using PartSource.Data.Shopify; +using PartSource.Services.Integrations; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace PartSource.Automation.Jobs +{ + public class UpdatePricing : IAutomationJob + { + private readonly PartSourceContext _partSourceContext; + private readonly ShopifyClient _shopifyClient; + + public UpdatePricing(PartSourceContext partSourceContext, ShopifyClient shopifyClient) + { + _partSourceContext = partSourceContext; + _shopifyClient = shopifyClient; + + } + + public async Task Run() + { + IEnumerable products = null; + int updateCount = 0; + + try + { + products = await _shopifyClient.Products.Get(); + } + + catch (Exception ex) + { + // TODO: Logging + + return new AutomationJobResult + { + Message = "Failed to get products from Shopify", + IsSuccess = false + }; + } + + while (products != null && products.Any()) + { + foreach (Product product in products) + { + if (product.Variants.Length > 0) + { + ProductVariant variant = product.Variants[0]; + PartPrice partPrice = _partSourceContext.PartPrices.Where(p => p.SKU == variant.Sku).FirstOrDefault(); + + if (partPrice == null) + { + continue; + } + + if (product.Variants[0].Price != partPrice.Your_Price.Value || product.Variants[0].CompareAtPrice != partPrice.Compare_Price.Value) + { + product.Variants[0].Price = partPrice.Your_Price.Value; + product.Variants[0].CompareAtPrice = partPrice.Compare_Price.Value; + + try + { + await _shopifyClient.Products.Update(product); + + updateCount++; + } + + catch (Exception ex) + { + // TODO: Logged failed pricing update here + } + } + } + } + + try + { + products = await _shopifyClient.Products.GetNext(); + } + + catch (Exception ex) + { + // TODO: Logging + + return new AutomationJobResult + { + Message = $"Failed to get the next set of products from Shopify. {updateCount} products were able to be updated.", + IsSuccess = false + }; + } + } + + return new AutomationJobResult + { + Message = $"The nightly pricing update has completed. {updateCount} products were updated.", + IsSuccess = true + }; + } + } +} \ No newline at end of file diff --git a/PartSource.Automation/Models/AutomationJobResult.cs b/PartSource.Automation/Models/AutomationJobResult.cs new file mode 100644 index 0000000..355fb96 --- /dev/null +++ b/PartSource.Automation/Models/AutomationJobResult.cs @@ -0,0 +1,9 @@ +namespace PartSource.Automation.Models +{ + public class AutomationJobResult + { + public string Message { get; set; } + + public bool IsSuccess { get; set; } + } +} diff --git a/PartSource.Automation/Models/Cache/VehicleCacheItem.cs b/PartSource.Automation/Models/Cache/VehicleCacheItem.cs new file mode 100644 index 0000000..d65e111 --- /dev/null +++ b/PartSource.Automation/Models/Cache/VehicleCacheItem.cs @@ -0,0 +1,19 @@ +using PartSource.Data.Nexpart; +using System; +using System.Collections.Generic; +using System.Text; + +namespace PartSource.Automation.Models.Cache +{ + public class VehicleCacheItem + { + public BaseVehicle BaseVehicle { get; set; } + + public IList VehicleIds { get; set; } + + public VehicleCacheItem() + { + VehicleIds = new List(); + } + } +} diff --git a/PartSource.Automation/Models/Configuration/EmailConfiguration.cs b/PartSource.Automation/Models/Configuration/EmailConfiguration.cs new file mode 100644 index 0000000..978e01d --- /dev/null +++ b/PartSource.Automation/Models/Configuration/EmailConfiguration.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace PartSource.Automation.Models.Configuration +{ + public class EmailConfiguration + { + public string From { get; set; } + + public string To { get; set; } + + public string SmtpHost { get; set; } + } +} diff --git a/PartSource.Automation/Models/Configuration/FtpConfiguration.cs b/PartSource.Automation/Models/Configuration/FtpConfiguration.cs new file mode 100644 index 0000000..7feee23 --- /dev/null +++ b/PartSource.Automation/Models/Configuration/FtpConfiguration.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace PartSource.Automation.Models.Configuration +{ + public class FtpConfiguration + { + public string Url { get; set; } + + public string Destination { get; set; } + + public string Username { get; set; } + + public string Password { get; set; } + } +} diff --git a/PartSource.Automation/Models/Configuration/SsisConfiguration.cs b/PartSource.Automation/Models/Configuration/SsisConfiguration.cs new file mode 100644 index 0000000..1be829b --- /dev/null +++ b/PartSource.Automation/Models/Configuration/SsisConfiguration.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace PartSource.Automation.Models.Configuration +{ + public class SsisConfiguration + { + public string Directory { get; set; } + } +} diff --git a/PartSource.Automation/PartSource.Automation.csproj b/PartSource.Automation/PartSource.Automation.csproj new file mode 100644 index 0000000..39e989a --- /dev/null +++ b/PartSource.Automation/PartSource.Automation.csproj @@ -0,0 +1,32 @@ + + + + Exe + netcoreapp3.1 + AnyCPU;x86;x64 + Debug;Release;Also Debug + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + PreserveNewest + + + + diff --git a/PartSource.Automation/Program.cs b/PartSource.Automation/Program.cs new file mode 100644 index 0000000..a5114d6 --- /dev/null +++ b/PartSource.Automation/Program.cs @@ -0,0 +1,120 @@ +using PartSource.Data.Shopify; +using PartSource.Services; +using PartSource.Automation.Factories; +using PartSource.Automation.Jobs.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Configuration.FileExtensions; +using Microsoft.Extensions.Configuration.Json; + +using PartSource.Data; +using System.IO; +using Microsoft.EntityFrameworkCore; +using PartSource.Automation.Models.Configuration; +using PartSource.Automation.Jobs; +using PartSource.Automation.Services; +using PartSource.Services.Integrations; + +using Ratermania.Shopify.DependencyInjection; +using PartSource.Automation.Models; + +namespace PartSource.Automation +{ + internal class Program + { + + private static void Main(string[] args) + { + IServiceProvider serviceProvider = ConfigureServices(); + + JobFactory jobFactory = serviceProvider.GetService(); + EmailService emailService = serviceProvider.GetService(); + + foreach (string arg in args) + { + Console.Write($"Running job {arg}... "); + + try + { + IAutomationJob job = jobFactory.Build(arg); + AutomationJobResult result = job.Run().Result; + + if (result.IsSuccess) + { + emailService.Send($"{arg} Completed Successfully", result.Message); + } + + else + { + emailService.Send($"{arg} Failed", result.Message); + } + + Console.WriteLine("Done"); + } + + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } + } + } + + private static IServiceProvider ConfigureServices() + { + string environment = Environment.GetEnvironmentVariable("PS_AUTOMATION_ENVIRONMENT"); + + IConfigurationBuilder builder = new ConfigurationBuilder() + .SetBasePath(Directory.GetCurrentDirectory()) + .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) + .AddJsonFile($"appsettings.{environment}.json", optional: true, reloadOnChange: true); + + IConfigurationRoot configuration = builder.Build(); + + EmailConfiguration emailConfiguration = new EmailConfiguration(); + FtpConfiguration ftpConfiguration = new FtpConfiguration(); + SsisConfiguration ssisConfiguration = new SsisConfiguration(); + + configuration.Bind("emailConfiguration", emailConfiguration); + configuration.Bind("ftpConfiguration", ftpConfiguration); + configuration.Bind("ssisConfiguration", ssisConfiguration); + + ServiceProvider serviceProvider = new ServiceCollection() + .AddDbContext(options => + options.UseSqlServer(configuration.GetConnectionString("PartSourceDatabase"), opts => opts.EnableRetryOnFailure()) + ) + + .AddShopify(options => { + options.ApiKey = configuration["Shopify:ApiKey"]; + options.ApiSecret = configuration["Shopify:ApiSecret"]; + options.ApiVersion = "2020-01"; + options.ShopDomain = configuration["Shopify:ShopDomain"]; + }) + + + .AddSingleton(emailConfiguration) + .AddSingleton(ftpConfiguration) + .AddSingleton(ssisConfiguration) + .AddSingleton() + .AddSingleton() + .AddSingleton() + .AddSingleton() + .AddSingleton() + .AddSingleton() + //.AddSingleton() + //.AddSingleton() + //.AddSingleton() + .AddSingleton() + .AddSingleton() + .AddSingleton() + .AddSingleton() + .AddSingleton() + .BuildServiceProvider(); + + return serviceProvider; + } + } +} diff --git a/PartSource.Automation/Properties/launchSettings.json b/PartSource.Automation/Properties/launchSettings.json new file mode 100644 index 0000000..85bfddd --- /dev/null +++ b/PartSource.Automation/Properties/launchSettings.json @@ -0,0 +1,11 @@ +{ + "profiles": { + "PartSource.Automation": { + "commandName": "Project", + "commandLineArgs": "UpdatePricing", + "environmentVariables": { + "PS_AUTOMATION_ENVIRONMENT": "development" + } + } + } +} \ No newline at end of file diff --git a/PartSource.Automation/Services/EmailService.cs b/PartSource.Automation/Services/EmailService.cs new file mode 100644 index 0000000..b051d91 --- /dev/null +++ b/PartSource.Automation/Services/EmailService.cs @@ -0,0 +1,42 @@ +using PartSource.Automation.Models.Configuration; +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Linq; +using System.Net.Mail; +using System.Text; +using System.Threading.Tasks; + +namespace PartSource.Automation.Services +{ + public class EmailService + { + private readonly EmailConfiguration _emailConfiguration; + + public EmailService(EmailConfiguration emailConfiguration) + { + _emailConfiguration = emailConfiguration; + } + + public void Send(string subject, string body) + { + using (SmtpClient smtpClient = new SmtpClient { Host = _emailConfiguration.SmtpHost }) + { + MailMessage mailMessage = new MailMessage + { + From = new MailAddress(_emailConfiguration.From), + Subject = subject, + Body = body, + IsBodyHtml = true + }; + + foreach (string address in _emailConfiguration.To.Split(',')) + { + mailMessage.To.Add(address); + } + + smtpClient.Send(mailMessage); + } + } + } +} diff --git a/PartSource.Automation/Services/FtpService.cs b/PartSource.Automation/Services/FtpService.cs new file mode 100644 index 0000000..7945fe5 --- /dev/null +++ b/PartSource.Automation/Services/FtpService.cs @@ -0,0 +1,35 @@ +using PartSource.Automation.Models.Configuration; +using System; +using System.Configuration; +using System.IO; +using System.Net; +using System.Threading.Tasks; + +namespace PartSource.Automation.Services +{ + public class FtpService + { + private readonly FtpConfiguration _ftpConfiguration; + + public FtpService(FtpConfiguration ftpConfiguration) + { + _ftpConfiguration = ftpConfiguration; + } + + public void Download(string filename) + { + FtpWebRequest request = (FtpWebRequest)WebRequest.Create($"{_ftpConfiguration.Url}/{filename}"); + request.Credentials = new NetworkCredential(_ftpConfiguration.Username, _ftpConfiguration.Password); + request.Method = WebRequestMethods.Ftp.DownloadFile; + + using (FtpWebResponse response = (FtpWebResponse)request.GetResponse()) + { + using (Stream responseStream = response.GetResponseStream()) + using (FileStream fileStream = new FileStream($"{_ftpConfiguration.Destination}\\{filename}", FileMode.Create)) + { + responseStream.CopyTo(fileStream); + } + } + } + } +} diff --git a/PartSource.Automation/Services/SsisService.cs b/PartSource.Automation/Services/SsisService.cs new file mode 100644 index 0000000..4cc00ca --- /dev/null +++ b/PartSource.Automation/Services/SsisService.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Data.SqlClient; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using PartSource.Automation.Models.Configuration; +using System.Configuration; +using System.Diagnostics; + +namespace PartSource.Automation.Services +{ + public class SsisService + { + private readonly SsisConfiguration _ssisConfiguration; + + public SsisService(SsisConfiguration ssisConfiguration) + { + _ssisConfiguration = ssisConfiguration; + } + + public bool Execute(string packageName) + { + try + { + using Process process = new Process + { + StartInfo = new ProcessStartInfo + { + FileName = "dtexec", + Arguments = $"/file \"{_ssisConfiguration.Directory}\\{packageName}\"", + UseShellExecute = false, + CreateNoWindow = false, + RedirectStandardOutput = true, + RedirectStandardError = true + + } + }; + + process.Start(); + + //process.WaitForExit(); + + string stdout = process.StandardOutput.ReadToEnd(); + string stderr = process.StandardError.ReadToEnd(); + + Console.WriteLine(stdout); + Console.WriteLine(stderr); + + // Application application = new Application(); + //Package package = application.LoadPackage($"{_ssisConfiguration.Directory}\\{packageName}", null); + + //DTSExecResult result = package.Execute(); + + return true; //result == DTSExecResult.Success; + + } + + catch (Exception ex) + { + ; + return false; + } + } + } +} diff --git a/PartSource.Automation/Services/VehicleCacheService.cs b/PartSource.Automation/Services/VehicleCacheService.cs new file mode 100644 index 0000000..483c281 --- /dev/null +++ b/PartSource.Automation/Services/VehicleCacheService.cs @@ -0,0 +1,141 @@ +using PartSource.Automation.Models.Cache; +using PartSource.Data.Nexpart; +using PartSource.Services; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace PartSource.Automation.Services +{ + public class VehicleCacheService + { + private readonly ConcurrentBag _vehicleCache; + private readonly ConcurrentBag _sorryNotCanadianCache; + + private readonly NexpartService _nexpartService; + + public VehicleCacheService(NexpartService nexpartService) + { + _vehicleCache = new ConcurrentBag(); + _sorryNotCanadianCache = new ConcurrentBag(); + + _nexpartService = nexpartService; + } + + public VehicleCacheItem Get(int baseVehicleId, int engineConfigId) + { + return _vehicleCache.FirstOrDefault(v => v.BaseVehicle.BaseVehicleId == baseVehicleId && v.BaseVehicle.EngineConfigId == engineConfigId); + } + + public void Add(VehicleCacheItem vehicle) + { + _vehicleCache.Add(vehicle); + } + + public bool TryAdd(int baseVehicleId, int engineConfigId) + { + BaseVehicle sorryNotCanadian = _sorryNotCanadianCache.FirstOrDefault(b => b.BaseVehicleId == baseVehicleId && b.EngineConfigId == engineConfigId); + if (sorryNotCanadian != null) + { + return false; + } + + VehicleIdSearch vehicleIdSearch = new VehicleIdSearch + { + VehicleIdentifier = new VehicleIdentifier + { + BaseVehicleId = baseVehicleId, + EngineConfigId = engineConfigId + }, + ResultOption = new ResultOption[2] + { + new ResultOption { Value = "BASE_VEHICLE" }, + new ResultOption { Value = "BASE_VEHICLE_DESC" } + }, + RegionId = new RegionId + { + Value = 2 + } + }; + + VehicleIdSearchResponse response = _nexpartService.SendRequest(vehicleIdSearch).Result; + if (response.ResponseBody?.BaseVehicle == null) + { + BaseVehicle vehicle = new BaseVehicle + { + BaseVehicleId = baseVehicleId, + EngineConfigId = engineConfigId + }; + + _sorryNotCanadianCache.Add(vehicle); + + return false; + } + + BaseVehicle baseVehicle = response.ResponseBody.BaseVehicle; + baseVehicle.EngineConfigId = engineConfigId; + + SubModelSearch smSearch = new SubModelSearch() + { + MakeId = baseVehicle.MakeId, + ModelId = baseVehicle.ModelId, + Year = baseVehicle.Year, + RegionId = 2 + }; + SubModelSearchResponse smResponse = _nexpartService.SendRequest(smSearch).Result; + + SubModel[] subModels = smResponse.ResponseBody?.SubModel; + if (subModels == null) + { + _sorryNotCanadianCache.Add(baseVehicle); + return false; + } + + IList vehicleIds = new List(); + + foreach (SubModel submodel in subModels) + { + VehicleIdSearch vidSearch = new VehicleIdSearch + { + VehicleIdentifier = new VehicleIdentifier() + { + BaseVehicleId = baseVehicle.BaseVehicleId, + EngineConfigId = baseVehicle.EngineConfigId + }, + Criterion = new Criterion[1] + { + new Criterion + { + Attribute = "SUB_MODEL", + Id = int.Parse(submodel.Id) + } + }, + RegionId = new RegionId + { + Value = 2 + }, + }; + + VehicleIdSearchResponse vidResponse = _nexpartService.SendRequest(vidSearch).Result; + + int? vehicleId = vidResponse.ResponseBody?.VehicleToEngineConfigId; + if (vehicleId != null && vehicleId > 0) + { + vehicleIds.Add((int)vehicleId); + } + } + + VehicleCacheItem cacheItem = new VehicleCacheItem + { + BaseVehicle = baseVehicle, + VehicleIds = vehicleIds + }; + + _vehicleCache.Add(cacheItem); + + return true; + } + } +} diff --git a/PartSource.Automation/appsettings.json b/PartSource.Automation/appsettings.json new file mode 100644 index 0000000..5629a06 --- /dev/null +++ b/PartSource.Automation/appsettings.json @@ -0,0 +1,32 @@ +{ + "ConnectionStrings": { + //"PartSourceDatabase": "Server=(localdb)\\mssqllocaldb;Database=PartSource;Trusted_Connection=True;" + "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=True;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" + }, + "emailConfiguration": { + + "From": "alerts@ps-shopify.canadaeast.cloudapp.azure.com", + // "To": "tom@soundpress.com,Anas.Bajwa@Partsource.ca", + "To": "tommy@localhost", + "SmtpHost": "localhost" + }, + "ftpConfiguration": { + "Username": "ps-ftp\\$ps-ftp", + "Password": "ycvXptffBxqkBXW4vuRYqn4Zi1soCvnvMMolTe5HNSeAlcl3bAyJYtNhG579", + "Url": "ftp://waws-prod-yq1-007.ftp.azurewebsites.windows.net/site/wwwroot", + "Destination": "C:\\Users\\soundpress\\Desktop" + }, + "ssisConfiguration": { + "Directory": "c:\\users\\soundpress\\desktop" + }, + //"Shopify": { + // "ApiKey": "9a533dad460321c6ce8f30bf5b8691ed", + // "ApiSecret": "dc9e28365d9858e544d57ac7af43fee7", + // "ShopDomain": "dev-partsource.myshopify.com" + //} + "Shopify": { + "ApiKey": "88f931933b566ade1fc92c6a39f04b34", + "ApiSecret": "527a3b4213c2c7ecb214728a899052df", + "ShopDomain": "partsource.myshopify.com" + } +} \ No newline at end of file diff --git a/PartSource.Data/Dtos/FitmentSearchDto.cs b/PartSource.Data/Dtos/FitmentSearchDto.cs new file mode 100644 index 0000000..4f61da2 --- /dev/null +++ b/PartSource.Data/Dtos/FitmentSearchDto.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace PartSource.Data.Dtos +{ + public class FitmentSearchDto + { + public string ManufacturerCode { get; set; } + + public string PartNumber { get; set; } + + public int? BaseVehicleId { get; set; } + + public int? EngineConfigId { get; set; } + } +} diff --git a/PartSource.Data/Dtos/StoreDto.cs b/PartSource.Data/Dtos/StoreDto.cs new file mode 100644 index 0000000..1783085 --- /dev/null +++ b/PartSource.Data/Dtos/StoreDto.cs @@ -0,0 +1,15 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Dtos.StoreDto +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +namespace PartSource.Data.Dtos +{ + public class StoreDto + { + public int StoreNumber { get; set; } + + public double? Distance { get; set; } + } +} diff --git a/PartSource.Data/Migrations/20190811020941_ImportDateDcfMapping.Designer.cs b/PartSource.Data/Migrations/20190811020941_ImportDateDcfMapping.Designer.cs new file mode 100644 index 0000000..47989b4 --- /dev/null +++ b/PartSource.Data/Migrations/20190811020941_ImportDateDcfMapping.Designer.cs @@ -0,0 +1,405 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using PartSource.Data; + +namespace PartSource.Data.Migrations +{ + [DbContext(typeof(PartSourceContext))] + [Migration("20190811020941_ImportDateDcfMapping")] + partial class ImportDateDcfMapping + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.2.2-servicing-10034") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("PartSource.Data.Models.ApiClient", b => + { + b.Property("Key") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("AppName"); + + b.Property("Secret"); + + b.HasKey("Key"); + + b.ToTable("ApiClient"); + }); + + modelBuilder.Entity("PartSource.Data.Models.BaseVehicle", b => + { + b.Property("Id"); + + b.Property("VehicleMakeId"); + + b.Property("VehicleModelId"); + + b.Property("Year"); + + b.HasKey("Id"); + + b.ToTable("BaseVehicle","Vehicle"); + }); + + modelBuilder.Entity("PartSource.Data.Models.DcfMapping", b => + { + b.Property("LineCode"); + + b.Property("WhiCode"); + + b.HasKey("LineCode", "WhiCode"); + + b.ToTable("DcfMapping"); + }); + + modelBuilder.Entity("PartSource.Data.Models.Fitment", b => + { + b.Property("FitmentId") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("BaseVehicleId"); + + b.Property("EngineConfigId"); + + b.Property("ManufacturerCode"); + + b.Property("NoteText"); + + b.Property("PartLabel"); + + b.Property("PartNumber"); + + b.Property("Position"); + + b.HasKey("FitmentId"); + + b.ToTable("Fitment"); + }); + + modelBuilder.Entity("PartSource.Data.Models.ImportData", b => + { + b.Property("VariantSku") + .ValueGeneratedOnAdd(); + + b.Property("BodyHtml"); + + b.Property("CompareAt"); + + b.Property("ImageAltText"); + + b.Property("ImageSrc"); + + b.Property("IsFitment"); + + b.Property("IsVariant"); + + b.Property("LineCode"); + + b.Property("PartNumber"); + + b.Property("Price"); + + b.Property("ShopifyId"); + + b.Property("Title"); + + b.Property("VariantTitle"); + + b.Property("Vendor"); + + b.HasKey("VariantSku"); + + b.ToTable("ImportData"); + }); + + modelBuilder.Entity("PartSource.Data.Models.ImportMetric", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("ChangedItems"); + + b.Property("ImportDate"); + + b.Property("TotalItems"); + + b.HasKey("Id"); + + b.ToTable("ImportMetric"); + }); + + modelBuilder.Entity("PartSource.Data.Models.Manufacturer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("LineCode"); + + b.Property("Name"); + + b.HasKey("Id"); + + b.ToTable("Manufacturer"); + }); + + modelBuilder.Entity("PartSource.Data.Models.Part", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description"); + + b.Property("ManufacturerId"); + + b.Property("Name"); + + b.Property("PartNumber"); + + b.Property("ShopifyId"); + + b.Property("Sku"); + + b.HasKey("Id"); + + b.HasIndex("ManufacturerId"); + + b.ToTable("Part"); + }); + + modelBuilder.Entity("PartSource.Data.Models.PartData", b => + { + b.Property("SKU") + .ValueGeneratedOnAdd() + .HasMaxLength(255); + + b.Property("BRAND_NM") + .HasMaxLength(255); + + b.Property("CATEGORY_NM") + .HasMaxLength(255); + + b.Property("CORPORATE_STATUS_NM") + .HasMaxLength(255); + + b.Property("Compare_Price") + .HasColumnName("Compare Price") + .HasColumnType("money"); + + b.Property("FAMILY_FEATURES_BENEFITS1") + .HasMaxLength(255); + + b.Property("FAMILY_FEATURES_BENEFITS10") + .HasMaxLength(255); + + b.Property("FAMILY_FEATURES_BENEFITS11") + .HasMaxLength(255); + + b.Property("FAMILY_FEATURES_BENEFITS12") + .HasMaxLength(255); + + b.Property("FAMILY_FEATURES_BENEFITS13") + .HasMaxLength(255); + + b.Property("FAMILY_FEATURES_BENEFITS14") + .HasMaxLength(255); + + b.Property("FAMILY_FEATURES_BENEFITS2") + .HasMaxLength(255); + + b.Property("FAMILY_FEATURES_BENEFITS3") + .HasMaxLength(255); + + b.Property("FAMILY_FEATURES_BENEFITS4") + .HasMaxLength(255); + + b.Property("FAMILY_FEATURES_BENEFITS5") + .HasMaxLength(255); + + b.Property("FAMILY_FEATURES_BENEFITS6") + .HasMaxLength(255); + + b.Property("FAMILY_FEATURES_BENEFITS7") + .HasMaxLength(255); + + b.Property("FAMILY_FEATURES_BENEFITS8") + .HasMaxLength(255); + + b.Property("FAMILY_FEATURES_BENEFITS9") + .HasMaxLength(255); + + b.Property("FINELINE_NM") + .HasMaxLength(255); + + b.Property("IsFitment"); + + b.Property("LOB_NM") + .HasMaxLength(255); + + b.Property("Line_Code") + .HasColumnName("Line Code") + .HasMaxLength(255); + + b.Property("PRODUCT_ENGLISH_LONG_DESC") + .HasMaxLength(255); + + b.Property("Part_Number") + .HasColumnName("Part Number") + .HasMaxLength(255); + + b.Property("Published"); + + b.Property("SUBCATEGORY_NM") + .HasMaxLength(255); + + b.Property("Tested") + .HasMaxLength(255); + + b.Property("Title"); + + b.Property("VariantTitle"); + + b.Property("Your_Price") + .HasColumnName("Your Price") + .HasColumnType("money"); + + b.HasKey("SKU"); + + b.ToTable("PartData"); + }); + + modelBuilder.Entity("PartSource.Data.Models.PartImage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Sku"); + + b.Property("Url"); + + b.HasKey("Id"); + + b.ToTable("PartImage"); + }); + + modelBuilder.Entity("PartSource.Data.Models.PartPrice", b => + { + b.Property("SKU") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Compare_Price"); + + b.Property("Your_Price"); + + b.HasKey("SKU"); + + b.ToTable("PartPrice"); + }); + + modelBuilder.Entity("PartSource.Data.Models.PartsAvailability", b => + { + b.Property("Store"); + + b.Property("SKU"); + + b.Property("Line_Code") + .HasColumnName("Line Code") + .HasMaxLength(50); + + b.Property("Part_Number") + .HasColumnName("Part Number") + .HasMaxLength(50); + + b.Property("QTY"); + + b.HasKey("Store", "SKU"); + + b.ToTable("PartsAvailability"); + }); + + modelBuilder.Entity("PartSource.Data.Models.Submodel", b => + { + b.Property("VehicleToEngineConfigId"); + + b.Property("BaseVehicleId"); + + b.Property("EngineId"); + + b.Property("SubmodelId"); + + b.HasKey("VehicleToEngineConfigId"); + + b.ToTable("Submodel","Vehicle"); + }); + + modelBuilder.Entity("PartSource.Data.Models.VehicleEngine", b => + { + b.Property("Id"); + + b.Property("Description"); + + b.HasKey("Id"); + + b.ToTable("VehicleEngine","Vehicle"); + }); + + modelBuilder.Entity("PartSource.Data.Models.VehicleMake", b => + { + b.Property("Id"); + + b.Property("Name"); + + b.HasKey("Id"); + + b.ToTable("VehicleMake","Vehicle"); + }); + + modelBuilder.Entity("PartSource.Data.Models.VehicleModel", b => + { + b.Property("Id"); + + b.Property("Name"); + + b.Property("VehicleMakeId"); + + b.HasKey("Id"); + + b.ToTable("VehicleModel","Vehicle"); + }); + + modelBuilder.Entity("PartSource.Data.Models.DcfMapping", b => + { + b.HasOne("PartSource.Data.Models.ImportData") + .WithMany("DcfMapping") + .HasForeignKey("LineCode") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("PartSource.Data.Models.Part", b => + { + b.HasOne("PartSource.Data.Models.Manufacturer", "Manufacturer") + .WithMany() + .HasForeignKey("ManufacturerId") + .OnDelete(DeleteBehavior.Cascade); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/PartSource.Data/Migrations/20190811020941_ImportDateDcfMapping.cs b/PartSource.Data/Migrations/20190811020941_ImportDateDcfMapping.cs new file mode 100644 index 0000000..44a5e08 --- /dev/null +++ b/PartSource.Data/Migrations/20190811020941_ImportDateDcfMapping.cs @@ -0,0 +1,358 @@ +using System; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace PartSource.Data.Migrations +{ + public partial class ImportDateDcfMapping : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.EnsureSchema( + name: "Vehicle"); + + migrationBuilder.CreateTable( + name: "ApiClient", + columns: table => new + { + Key = table.Column(nullable: false), + AppName = table.Column(nullable: true), + Secret = table.Column(nullable: true), + Active = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ApiClient", x => x.Key); + }); + + migrationBuilder.CreateTable( + name: "Fitment", + columns: table => new + { + FitmentId = table.Column(nullable: false) + .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), + ManufacturerCode = table.Column(nullable: true), + PartNumber = table.Column(nullable: true), + PartLabel = table.Column(nullable: true), + BaseVehicleId = table.Column(nullable: true), + EngineConfigId = table.Column(nullable: true), + NoteText = table.Column(nullable: true), + Position = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Fitment", x => x.FitmentId); + }); + + migrationBuilder.CreateTable( + name: "ImportData", + columns: table => new + { + VariantSku = table.Column(nullable: false), + Title = table.Column(nullable: true), + BodyHtml = table.Column(nullable: true), + Vendor = table.Column(nullable: true), + IsVariant = table.Column(nullable: true), + VariantTitle = table.Column(nullable: true), + Price = table.Column(nullable: false), + CompareAt = table.Column(nullable: false), + ShopifyId = table.Column(nullable: true), + ImageSrc = table.Column(nullable: true), + ImageAltText = table.Column(nullable: true), + IsFitment = table.Column(nullable: true), + LineCode = table.Column(nullable: true), + PartNumber = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_ImportData", x => x.VariantSku); + }); + + migrationBuilder.CreateTable( + name: "ImportMetric", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), + TotalItems = table.Column(nullable: true), + ChangedItems = table.Column(nullable: true), + ImportDate = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ImportMetric", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Manufacturer", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), + Name = table.Column(nullable: true), + LineCode = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Manufacturer", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "PartData", + columns: table => new + { + SKU = table.Column(maxLength: 255, nullable: false), + LOB_NM = table.Column(maxLength: 255, nullable: true), + CATEGORY_NM = table.Column(maxLength: 255, nullable: true), + SUBCATEGORY_NM = table.Column(maxLength: 255, nullable: true), + FINELINE_NM = table.Column(maxLength: 255, nullable: true), + PRODUCT_ENGLISH_LONG_DESC = table.Column(maxLength: 255, nullable: true), + BRAND_NM = table.Column(maxLength: 255, nullable: true), + CORPORATE_STATUS_NM = table.Column(maxLength: 255, nullable: true), + FAMILY_FEATURES_BENEFITS1 = table.Column(maxLength: 255, nullable: true), + FAMILY_FEATURES_BENEFITS2 = table.Column(maxLength: 255, nullable: true), + FAMILY_FEATURES_BENEFITS3 = table.Column(maxLength: 255, nullable: true), + FAMILY_FEATURES_BENEFITS4 = table.Column(maxLength: 255, nullable: true), + FAMILY_FEATURES_BENEFITS5 = table.Column(maxLength: 255, nullable: true), + FAMILY_FEATURES_BENEFITS6 = table.Column(maxLength: 255, nullable: true), + FAMILY_FEATURES_BENEFITS7 = table.Column(maxLength: 255, nullable: true), + FAMILY_FEATURES_BENEFITS8 = table.Column(maxLength: 255, nullable: true), + FAMILY_FEATURES_BENEFITS9 = table.Column(maxLength: 255, nullable: true), + FAMILY_FEATURES_BENEFITS10 = table.Column(maxLength: 255, nullable: true), + FAMILY_FEATURES_BENEFITS11 = table.Column(maxLength: 255, nullable: true), + FAMILY_FEATURES_BENEFITS12 = table.Column(maxLength: 255, nullable: true), + FAMILY_FEATURES_BENEFITS13 = table.Column(maxLength: 255, nullable: true), + FAMILY_FEATURES_BENEFITS14 = table.Column(maxLength: 255, nullable: true), + Tested = table.Column(maxLength: 255, nullable: true), + LineCode = table.Column(name: "Line Code", maxLength: 255, nullable: true), + PartNumber = table.Column(name: "Part Number", maxLength: 255, nullable: true), + ComparePrice = table.Column(name: "Compare Price", type: "money", nullable: true), + YourPrice = table.Column(name: "Your Price", type: "money", nullable: true), + Title = table.Column(nullable: true), + VariantTitle = table.Column(nullable: true), + IsFitment = table.Column(nullable: true), + Published = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_PartData", x => x.SKU); + }); + + migrationBuilder.CreateTable( + name: "PartImage", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), + Sku = table.Column(nullable: true), + Url = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_PartImage", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "PartPrice", + columns: table => new + { + SKU = table.Column(nullable: false), + Compare_Price = table.Column(nullable: true), + Your_Price = table.Column(nullable: true), + Active = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_PartPrice", x => x.SKU); + }); + + migrationBuilder.CreateTable( + name: "PartsAvailability", + columns: table => new + { + Store = table.Column(nullable: false), + SKU = table.Column(nullable: false), + LineCode = table.Column(name: "Line Code", maxLength: 50, nullable: true), + PartNumber = table.Column(name: "Part Number", maxLength: 50, nullable: true), + QTY = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_PartsAvailability", x => new { x.Store, x.SKU }); + }); + + migrationBuilder.CreateTable( + name: "BaseVehicle", + schema: "Vehicle", + columns: table => new + { + Id = table.Column(nullable: false), + Year = table.Column(nullable: false), + VehicleMakeId = table.Column(nullable: false), + VehicleModelId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_BaseVehicle", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Submodel", + schema: "Vehicle", + columns: table => new + { + VehicleToEngineConfigId = table.Column(nullable: false), + SubmodelId = table.Column(nullable: false), + BaseVehicleId = table.Column(nullable: false), + EngineId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Submodel", x => x.VehicleToEngineConfigId); + }); + + migrationBuilder.CreateTable( + name: "VehicleEngine", + schema: "Vehicle", + columns: table => new + { + Id = table.Column(nullable: false), + Description = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_VehicleEngine", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "VehicleMake", + schema: "Vehicle", + columns: table => new + { + Id = table.Column(nullable: false), + Name = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_VehicleMake", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "VehicleModel", + schema: "Vehicle", + columns: table => new + { + Id = table.Column(nullable: false), + Name = table.Column(nullable: true), + VehicleMakeId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_VehicleModel", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "DcfMapping", + columns: table => new + { + LineCode = table.Column(nullable: false), + WhiCode = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_DcfMapping", x => new { x.LineCode, x.WhiCode }); + table.ForeignKey( + name: "FK_DcfMapping_ImportData_LineCode", + column: x => x.LineCode, + principalTable: "ImportData", + principalColumn: "VariantSku", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Part", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), + ManufacturerId = table.Column(nullable: false), + ShopifyId = table.Column(nullable: true), + Sku = table.Column(nullable: false), + PartNumber = table.Column(nullable: true), + Name = table.Column(nullable: true), + Description = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Part", x => x.Id); + table.ForeignKey( + name: "FK_Part_Manufacturer_ManufacturerId", + column: x => x.ManufacturerId, + principalTable: "Manufacturer", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Part_ManufacturerId", + table: "Part", + column: "ManufacturerId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ApiClient"); + + migrationBuilder.DropTable( + name: "DcfMapping"); + + migrationBuilder.DropTable( + name: "Fitment"); + + migrationBuilder.DropTable( + name: "ImportMetric"); + + migrationBuilder.DropTable( + name: "Part"); + + migrationBuilder.DropTable( + name: "PartData"); + + migrationBuilder.DropTable( + name: "PartImage"); + + migrationBuilder.DropTable( + name: "PartPrice"); + + migrationBuilder.DropTable( + name: "PartsAvailability"); + + migrationBuilder.DropTable( + name: "BaseVehicle", + schema: "Vehicle"); + + migrationBuilder.DropTable( + name: "Submodel", + schema: "Vehicle"); + + migrationBuilder.DropTable( + name: "VehicleEngine", + schema: "Vehicle"); + + migrationBuilder.DropTable( + name: "VehicleMake", + schema: "Vehicle"); + + migrationBuilder.DropTable( + name: "VehicleModel", + schema: "Vehicle"); + + migrationBuilder.DropTable( + name: "ImportData"); + + migrationBuilder.DropTable( + name: "Manufacturer"); + } + } +} diff --git a/PartSource.Data/Migrations/PartSourceContextModelSnapshot.cs b/PartSource.Data/Migrations/PartSourceContextModelSnapshot.cs new file mode 100644 index 0000000..a089ce0 --- /dev/null +++ b/PartSource.Data/Migrations/PartSourceContextModelSnapshot.cs @@ -0,0 +1,403 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using PartSource.Data; + +namespace PartSource.Data.Migrations +{ + [DbContext(typeof(PartSourceContext))] + partial class PartSourceContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.2.2-servicing-10034") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("PartSource.Data.Models.ApiClient", b => + { + b.Property("Key") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("AppName"); + + b.Property("Secret"); + + b.HasKey("Key"); + + b.ToTable("ApiClient"); + }); + + modelBuilder.Entity("PartSource.Data.Models.BaseVehicle", b => + { + b.Property("Id"); + + b.Property("VehicleMakeId"); + + b.Property("VehicleModelId"); + + b.Property("Year"); + + b.HasKey("Id"); + + b.ToTable("BaseVehicle","Vehicle"); + }); + + modelBuilder.Entity("PartSource.Data.Models.DcfMapping", b => + { + b.Property("LineCode"); + + b.Property("WhiCode"); + + b.HasKey("LineCode", "WhiCode"); + + b.ToTable("DcfMapping"); + }); + + modelBuilder.Entity("PartSource.Data.Models.Fitment", b => + { + b.Property("FitmentId") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("BaseVehicleId"); + + b.Property("EngineConfigId"); + + b.Property("ManufacturerCode"); + + b.Property("NoteText"); + + b.Property("PartLabel"); + + b.Property("PartNumber"); + + b.Property("Position"); + + b.HasKey("FitmentId"); + + b.ToTable("Fitment"); + }); + + modelBuilder.Entity("PartSource.Data.Models.ImportData", b => + { + b.Property("VariantSku") + .ValueGeneratedOnAdd(); + + b.Property("BodyHtml"); + + b.Property("CompareAt"); + + b.Property("ImageAltText"); + + b.Property("ImageSrc"); + + b.Property("IsFitment"); + + b.Property("IsVariant"); + + b.Property("LineCode"); + + b.Property("PartNumber"); + + b.Property("Price"); + + b.Property("ShopifyId"); + + b.Property("Title"); + + b.Property("VariantTitle"); + + b.Property("Vendor"); + + b.HasKey("VariantSku"); + + b.ToTable("ImportData"); + }); + + modelBuilder.Entity("PartSource.Data.Models.ImportMetric", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("ChangedItems"); + + b.Property("ImportDate"); + + b.Property("TotalItems"); + + b.HasKey("Id"); + + b.ToTable("ImportMetric"); + }); + + modelBuilder.Entity("PartSource.Data.Models.Manufacturer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("LineCode"); + + b.Property("Name"); + + b.HasKey("Id"); + + b.ToTable("Manufacturer"); + }); + + modelBuilder.Entity("PartSource.Data.Models.Part", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Description"); + + b.Property("ManufacturerId"); + + b.Property("Name"); + + b.Property("PartNumber"); + + b.Property("ShopifyId"); + + b.Property("Sku"); + + b.HasKey("Id"); + + b.HasIndex("ManufacturerId"); + + b.ToTable("Part"); + }); + + modelBuilder.Entity("PartSource.Data.Models.PartData", b => + { + b.Property("SKU") + .ValueGeneratedOnAdd() + .HasMaxLength(255); + + b.Property("BRAND_NM") + .HasMaxLength(255); + + b.Property("CATEGORY_NM") + .HasMaxLength(255); + + b.Property("CORPORATE_STATUS_NM") + .HasMaxLength(255); + + b.Property("Compare_Price") + .HasColumnName("Compare Price") + .HasColumnType("money"); + + b.Property("FAMILY_FEATURES_BENEFITS1") + .HasMaxLength(255); + + b.Property("FAMILY_FEATURES_BENEFITS10") + .HasMaxLength(255); + + b.Property("FAMILY_FEATURES_BENEFITS11") + .HasMaxLength(255); + + b.Property("FAMILY_FEATURES_BENEFITS12") + .HasMaxLength(255); + + b.Property("FAMILY_FEATURES_BENEFITS13") + .HasMaxLength(255); + + b.Property("FAMILY_FEATURES_BENEFITS14") + .HasMaxLength(255); + + b.Property("FAMILY_FEATURES_BENEFITS2") + .HasMaxLength(255); + + b.Property("FAMILY_FEATURES_BENEFITS3") + .HasMaxLength(255); + + b.Property("FAMILY_FEATURES_BENEFITS4") + .HasMaxLength(255); + + b.Property("FAMILY_FEATURES_BENEFITS5") + .HasMaxLength(255); + + b.Property("FAMILY_FEATURES_BENEFITS6") + .HasMaxLength(255); + + b.Property("FAMILY_FEATURES_BENEFITS7") + .HasMaxLength(255); + + b.Property("FAMILY_FEATURES_BENEFITS8") + .HasMaxLength(255); + + b.Property("FAMILY_FEATURES_BENEFITS9") + .HasMaxLength(255); + + b.Property("FINELINE_NM") + .HasMaxLength(255); + + b.Property("IsFitment"); + + b.Property("LOB_NM") + .HasMaxLength(255); + + b.Property("Line_Code") + .HasColumnName("Line Code") + .HasMaxLength(255); + + b.Property("PRODUCT_ENGLISH_LONG_DESC") + .HasMaxLength(255); + + b.Property("Part_Number") + .HasColumnName("Part Number") + .HasMaxLength(255); + + b.Property("Published"); + + b.Property("SUBCATEGORY_NM") + .HasMaxLength(255); + + b.Property("Tested") + .HasMaxLength(255); + + b.Property("Title"); + + b.Property("VariantTitle"); + + b.Property("Your_Price") + .HasColumnName("Your Price") + .HasColumnType("money"); + + b.HasKey("SKU"); + + b.ToTable("PartData"); + }); + + modelBuilder.Entity("PartSource.Data.Models.PartImage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Sku"); + + b.Property("Url"); + + b.HasKey("Id"); + + b.ToTable("PartImage"); + }); + + modelBuilder.Entity("PartSource.Data.Models.PartPrice", b => + { + b.Property("SKU") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Compare_Price"); + + b.Property("Your_Price"); + + b.HasKey("SKU"); + + b.ToTable("PartPrice"); + }); + + modelBuilder.Entity("PartSource.Data.Models.PartsAvailability", b => + { + b.Property("Store"); + + b.Property("SKU"); + + b.Property("Line_Code") + .HasColumnName("Line Code") + .HasMaxLength(50); + + b.Property("Part_Number") + .HasColumnName("Part Number") + .HasMaxLength(50); + + b.Property("QTY"); + + b.HasKey("Store", "SKU"); + + b.ToTable("PartsAvailability"); + }); + + modelBuilder.Entity("PartSource.Data.Models.Submodel", b => + { + b.Property("VehicleToEngineConfigId"); + + b.Property("BaseVehicleId"); + + b.Property("EngineId"); + + b.Property("SubmodelId"); + + b.HasKey("VehicleToEngineConfigId"); + + b.ToTable("Submodel","Vehicle"); + }); + + modelBuilder.Entity("PartSource.Data.Models.VehicleEngine", b => + { + b.Property("Id"); + + b.Property("Description"); + + b.HasKey("Id"); + + b.ToTable("VehicleEngine","Vehicle"); + }); + + modelBuilder.Entity("PartSource.Data.Models.VehicleMake", b => + { + b.Property("Id"); + + b.Property("Name"); + + b.HasKey("Id"); + + b.ToTable("VehicleMake","Vehicle"); + }); + + modelBuilder.Entity("PartSource.Data.Models.VehicleModel", b => + { + b.Property("Id"); + + b.Property("Name"); + + b.Property("VehicleMakeId"); + + b.HasKey("Id"); + + b.ToTable("VehicleModel","Vehicle"); + }); + + modelBuilder.Entity("PartSource.Data.Models.DcfMapping", b => + { + b.HasOne("PartSource.Data.Models.ImportData") + .WithMany("DcfMapping") + .HasForeignKey("LineCode") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("PartSource.Data.Models.Part", b => + { + b.HasOne("PartSource.Data.Models.Manufacturer", "Manufacturer") + .WithMany() + .HasForeignKey("ManufacturerId") + .OnDelete(DeleteBehavior.Cascade); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/PartSource.Data/Models/ApiClient.cs b/PartSource.Data/Models/ApiClient.cs new file mode 100644 index 0000000..3afe981 --- /dev/null +++ b/PartSource.Data/Models/ApiClient.cs @@ -0,0 +1,20 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Models.ApiClient +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +namespace PartSource.Data.Models +{ + public class ApiClient + { + [System.ComponentModel.DataAnnotations.Key] + public string Key { get; set; } + + public string AppName { get; set; } + + public string Secret { get; set; } + + public bool Active { get; set; } + } +} diff --git a/PartSource.Data/Models/BaseVehicle.cs b/PartSource.Data/Models/BaseVehicle.cs new file mode 100644 index 0000000..ff954d4 --- /dev/null +++ b/PartSource.Data/Models/BaseVehicle.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text; + +namespace PartSource.Data.Models +{ + public class BaseVehicle + { + public int BaseVehicleId { get; set; } + + public int Year { get; set; } + + public int MakeId { get; set; } + + public int ModelId { get; set; } + } +} diff --git a/PartSource.Data/Models/DcfMapping.cs b/PartSource.Data/Models/DcfMapping.cs new file mode 100644 index 0000000..6f380d9 --- /dev/null +++ b/PartSource.Data/Models/DcfMapping.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace PartSource.Data.Models +{ + public class DcfMapping + { + public string LineCode { get; set; } + + public string WhiCode { get; set; } + } +} diff --git a/PartSource.Data/Models/Engine.cs b/PartSource.Data/Models/Engine.cs new file mode 100644 index 0000000..4330461 --- /dev/null +++ b/PartSource.Data/Models/Engine.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text; + +namespace PartSource.Data.Models +{ + public class Engine + { + public int EngineConfigId { get; set; } + + public string Description { get; set; } + + public int BaseVehicleId { get; set; } + + public int SubmodelId { get; set; } + } +} diff --git a/PartSource.Data/Models/Fitment.cs b/PartSource.Data/Models/Fitment.cs new file mode 100644 index 0000000..179d39b --- /dev/null +++ b/PartSource.Data/Models/Fitment.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace PartSource.Data.Models +{ + public partial class Fitment + { + public string PartNumber { get; set; } + + public string LineCode { get; set; } + + public int? BaseVehicleId { get; set; } + + public int? EngineConfigId { get; set; } + + public string Position { get; set; } + } +} diff --git a/PartSource.Data/Models/ImportData.cs b/PartSource.Data/Models/ImportData.cs new file mode 100644 index 0000000..3650076 --- /dev/null +++ b/PartSource.Data/Models/ImportData.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text; + +namespace PartSource.Data.Models +{ + //[Table("ImportDataOld")] + public class ImportData + { + public string Title { get; set; } + + public string BodyHtml { get; set; } + + public string Vendor { get; set; } + + public bool? IsVariant { get; set; } + + public string VariantTitle { get; set; } + + [Key] + public string VariantSku { get; set; } + + public decimal Price { get; set; } + + public decimal CompareAt { get; set; } + + public long? ShopifyId { get; set; } + + public string ImageSrc { get; set; } + + public string ImageAltText { get; set; } + + public bool? IsFitment { get; set; } + + public string LineCode { get; set; } + + public string PartNumber { get; set; } + } +} diff --git a/PartSource.Data/Models/ImportMetric.cs b/PartSource.Data/Models/ImportMetric.cs new file mode 100644 index 0000000..768a12a --- /dev/null +++ b/PartSource.Data/Models/ImportMetric.cs @@ -0,0 +1,22 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace PartSource.Data.Models +{ + using System; + using System.Collections.Generic; + + public partial class ImportMetric + { + public int Id { get; set; } + public Nullable TotalItems { get; set; } + public Nullable ChangedItems { get; set; } + public System.DateTime ImportDate { get; set; } + } +} diff --git a/PartSource.Data/Models/Manufacturer.cs b/PartSource.Data/Models/Manufacturer.cs new file mode 100644 index 0000000..1e5e682 --- /dev/null +++ b/PartSource.Data/Models/Manufacturer.cs @@ -0,0 +1,17 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Models.Manufacturer +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +namespace PartSource.Data.Models +{ + public class Manufacturer + { + public int Id { get; set; } + + public string Name { get; set; } + + public string LineCode { get; set; } + } +} diff --git a/PartSource.Data/Models/Part.cs b/PartSource.Data/Models/Part.cs new file mode 100644 index 0000000..b674b60 --- /dev/null +++ b/PartSource.Data/Models/Part.cs @@ -0,0 +1,27 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Models.Part +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +namespace PartSource.Data.Models +{ + public class Part + { + public int Id { get; set; } + + public int ManufacturerId { get; set; } + + public long? ShopifyId { get; set; } + + public int Sku { get; set; } + + public string PartNumber { get; set; } + + public string Name { get; set; } + + public string Description { get; set; } + + public Manufacturer Manufacturer { get; set; } + } +} diff --git a/PartSource.Data/Models/PartData.cs b/PartSource.Data/Models/PartData.cs new file mode 100644 index 0000000..c821d4f --- /dev/null +++ b/PartSource.Data/Models/PartData.cs @@ -0,0 +1,108 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Models.PartData +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace PartSource.Data.Models +{ + [Table("PartData")] + public class PartData + { + [Key] + [StringLength(255)] + public string SKU { get; set; } + + [StringLength(255)] + public string LOB_NM { get; set; } + + [StringLength(255)] + public string CATEGORY_NM { get; set; } + + [StringLength(255)] + public string SUBCATEGORY_NM { get; set; } + + [StringLength(255)] + public string FINELINE_NM { get; set; } + + [StringLength(255)] + public string PRODUCT_ENGLISH_LONG_DESC { get; set; } + + [StringLength(255)] + public string BRAND_NM { get; set; } + + [StringLength(255)] + public string CORPORATE_STATUS_NM { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS1 { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS2 { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS3 { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS4 { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS5 { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS6 { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS7 { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS8 { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS9 { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS10 { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS11 { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS12 { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS13 { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS14 { get; set; } + + [StringLength(255)] + public string Tested { get; set; } + + [Column("Line Code")] + [StringLength(255)] + public string Line_Code { get; set; } + + [Column("Part Number")] + [StringLength(255)] + public string Part_Number { get; set; } + + [Column("Compare Price", TypeName = "money")] + public Decimal? Compare_Price { get; set; } + + [Column("Your Price", TypeName = "money")] + public Decimal? Your_Price { get; set; } + + public string Title { get; set; } + + public string VariantTitle { get; set; } + + public byte? IsFitment { get; set; } + + public byte? Published { get; set; } + } +} diff --git a/PartSource.Data/Models/PartImage.cs b/PartSource.Data/Models/PartImage.cs new file mode 100644 index 0000000..b852d51 --- /dev/null +++ b/PartSource.Data/Models/PartImage.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace PartSource.Data.Models +{ + public class PartImage + { + public int Id { get; set; } + + public string Sku { get; set; } + + public string Url { get; set; } + } +} diff --git a/PartSource.Data/Models/PartPrice.cs b/PartSource.Data/Models/PartPrice.cs new file mode 100644 index 0000000..b4b617c --- /dev/null +++ b/PartSource.Data/Models/PartPrice.cs @@ -0,0 +1,17 @@ +namespace PartSource.Data.Models +{ + using System; + using System.Collections.Generic; + using System.ComponentModel.DataAnnotations; + + public partial class PartPrice + { + [Key] + public string SKU { get; set; } + public Nullable Compare_Price { get; set; } + public Nullable Your_Price { get; set; } + public string Active { get; set; } + + // public virtual PartData PartData { get; set; } + } +} diff --git a/PartSource.Data/Models/PartsAvailability.cs b/PartSource.Data/Models/PartsAvailability.cs new file mode 100644 index 0000000..1edacb1 --- /dev/null +++ b/PartSource.Data/Models/PartsAvailability.cs @@ -0,0 +1,26 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace PartSource.Data.Models +{ + public class PartsAvailability + { + [Column(Order = 0)] + [DatabaseGenerated(DatabaseGeneratedOption.None)] + public int Store { get; set; } + + [Column(Order = 1)] + [DatabaseGenerated(DatabaseGeneratedOption.None)] + public int SKU { get; set; } + + [Column("Line Code")] + [StringLength(50)] + public string Line_Code { get; set; } + + [Column("Part Number")] + [StringLength(50)] + public string Part_Number { get; set; } + + public int? QTY { get; set; } + } +} diff --git a/PartSource.Data/Models/PostalCode.cs b/PartSource.Data/Models/PostalCode.cs new file mode 100644 index 0000000..94da159 --- /dev/null +++ b/PartSource.Data/Models/PostalCode.cs @@ -0,0 +1,33 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace PartSource.Data.Models +{ + public class PostalCode + { + [Key] + [MaxLength(3)] + public string ForwardSortationArea { get; set; } + + [Required] + public string City { get; set; } + + [Required] + public string Province { get; set; } + + //[Required] + //public DbGeography Location { get; set; } + + [NotMapped] + public string LocalDeliveryUnit { get; set; } + + [NotMapped] + public string Code + { + get + { + return string.Format("{0} {1}", (object) this.ForwardSortationArea, (object) this.LocalDeliveryUnit); + } + } + } +} diff --git a/PartSource.Data/Models/ProductBackup.cs b/PartSource.Data/Models/ProductBackup.cs new file mode 100644 index 0000000..b908809 --- /dev/null +++ b/PartSource.Data/Models/ProductBackup.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Text; + +namespace PartSource.Data.Models +{ + public class ProductBackup + { + [Key] + public long ShopifyId { get; set; } + + public string ProductJson { get; set; } + } +} diff --git a/PartSource.Data/Models/Store.cs b/PartSource.Data/Models/Store.cs new file mode 100644 index 0000000..a62602c --- /dev/null +++ b/PartSource.Data/Models/Store.cs @@ -0,0 +1,18 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Models.Store +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.ComponentModel.DataAnnotations; + +namespace PartSource.Data.Models +{ + public class Store + { + [Key] + public int StoreNumber { get; set; } + + //public DbGeography Location { get; set; } + } +} diff --git a/PartSource.Data/Models/StorePart.cs b/PartSource.Data/Models/StorePart.cs new file mode 100644 index 0000000..c345dbb --- /dev/null +++ b/PartSource.Data/Models/StorePart.cs @@ -0,0 +1,31 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Models.StorePart +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace PartSource.Data.Models +{ + public class StorePart + { + [Key] + [Column(Order = 0)] + public int StoreNumber { get; set; } + + [Key] + [Column(Order = 1)] + public int PartId { get; set; } + + public int Quantity { get; set; } + + public Decimal Price { get; set; } + + public Store Store { get; set; } + + public Part Part { get; set; } + } +} diff --git a/PartSource.Data/Models/Submodel.cs b/PartSource.Data/Models/Submodel.cs new file mode 100644 index 0000000..f65b6ff --- /dev/null +++ b/PartSource.Data/Models/Submodel.cs @@ -0,0 +1,26 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text; + +namespace PartSource.Data.Models +{ + [Table("Submodel", Schema = "Vehicle")] + public class Submodel + { + public int SubmodelId { get; set; } + + public string Name { get; set; } + + [JsonIgnore] + public int Year { get; set; } + + [JsonIgnore] + public int MakeId { get; set; } + + [JsonIgnore] + public int ModelId { get; set; } + } +} diff --git a/PartSource.Data/Models/VehicleData.cs b/PartSource.Data/Models/VehicleData.cs new file mode 100644 index 0000000..241e964 --- /dev/null +++ b/PartSource.Data/Models/VehicleData.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text; + +namespace PartSource.Data.Models +{ + public class VehicleData + { + public int? MakeId { get; set; } + + public string MakeName { get; set; } + + public int? ModelId { get; set; } + + public string ModelName { get; set; } + + public int? EngineConfigId { get; set; } + + public string EngineDescription { get; set; } + + public int? BaseVehicleId { get; set; } + + public int? Year { get; set; } + + public int? SubmodelId { get; set; } + + public string SubmodelName { get; set; } + + [Key] + public int VehicleToEngineConfigId { get; set; } + + [NotMapped] + public string Position { get; set; } + } +} diff --git a/PartSource.Data/Models/VehicleMake.cs b/PartSource.Data/Models/VehicleMake.cs new file mode 100644 index 0000000..6b9a4ad --- /dev/null +++ b/PartSource.Data/Models/VehicleMake.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text; + +namespace PartSource.Data.Models +{ + public class VehicleMake + { + [DatabaseGenerated(DatabaseGeneratedOption.None)] + public int Id { get; set; } + + public string Name { get; set; } + } +} diff --git a/PartSource.Data/Models/VehicleModel.cs b/PartSource.Data/Models/VehicleModel.cs new file mode 100644 index 0000000..589cacb --- /dev/null +++ b/PartSource.Data/Models/VehicleModel.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text; + +namespace PartSource.Data.Models +{ + public class VehicleModel + { + [DatabaseGenerated(DatabaseGeneratedOption.None)] + public int Id { get; set; } + + public string Name { get; set; } + + public int VehicleMakeId { get; set; } + + } +} diff --git a/PartSource.Data/Nexpart/AddImg.cs b/PartSource.Data/Nexpart/AddImg.cs new file mode 100644 index 0000000..d653707 --- /dev/null +++ b/PartSource.Data/Nexpart/AddImg.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public class AddImg + { + [XmlAttribute] + public string AddImgUrl { get; set; } + + [XmlAttribute] + public string AddThumbUrl { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/AddImgs.cs b/PartSource.Data/Nexpart/AddImgs.cs new file mode 100644 index 0000000..245b816 --- /dev/null +++ b/PartSource.Data/Nexpart/AddImgs.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public class AddImgs + { + [XmlElement] + public AddImg[] AddImg { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/Apps.cs b/PartSource.Data/Nexpart/Apps.cs new file mode 100644 index 0000000..3b2cd67 --- /dev/null +++ b/PartSource.Data/Nexpart/Apps.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public class Apps + { + [XmlElement] + public BuyersGuideMake[] Make { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/BaseVehicle.cs b/PartSource.Data/Nexpart/BaseVehicle.cs new file mode 100644 index 0000000..6f10dd4 --- /dev/null +++ b/PartSource.Data/Nexpart/BaseVehicle.cs @@ -0,0 +1,34 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.BaseVehicleDetail +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public class BaseVehicle + { + [XmlAttribute] + public int BaseVehicleId { get; set; } + + [XmlAttribute] + public int MakeId { get; set; } + + [XmlAttribute] + public int ModelId { get; set; } + + [XmlAttribute] + public string MakeName { get; set; } + + [XmlAttribute] + public string ModelName { get; set; } + + [XmlAttribute] + public int Year { get; set; } + + public int EngineConfigId { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/BaseVehicleDetail.cs b/PartSource.Data/Nexpart/BaseVehicleDetail.cs new file mode 100644 index 0000000..667ef30 --- /dev/null +++ b/PartSource.Data/Nexpart/BaseVehicleDetail.cs @@ -0,0 +1,29 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.BaseVehicleDetail +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class BaseVehicleDetail + { + [XmlAttribute] + public int WHIMakeId { get; set; } + + [XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public int BaseVehicleId { get; set; } + + [XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public string MakeName { get; set; } + + [XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public string ModelName { get; set; } + + [XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public int Year { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/BaseVehicleDetailLookup.cs b/PartSource.Data/Nexpart/BaseVehicleDetailLookup.cs new file mode 100644 index 0000000..b7e90f3 --- /dev/null +++ b/PartSource.Data/Nexpart/BaseVehicleDetailLookup.cs @@ -0,0 +1,31 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.BaseVehicleDetailLookup +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class BaseVehicleDetailLookup + { + public BaseVehicleDetailLookup() + { + this.PSRequestHeader = new PSRequestHeader(); + } + + [XmlElement(Order = 1)] + public PSRequestHeader PSRequestHeader { get; set; } + + [XmlElement(Order = 2)] + public int Year { get; set; } + + [XmlElement(Order = 3)] + public int MakeId { get; set; } + + [XmlElement(Order = 4)] + public int ModelId { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/BaseVehicleDetailLookupResponse.cs b/PartSource.Data/Nexpart/BaseVehicleDetailLookupResponse.cs new file mode 100644 index 0000000..b4d8b28 --- /dev/null +++ b/PartSource.Data/Nexpart/BaseVehicleDetailLookupResponse.cs @@ -0,0 +1,21 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.BaseVehicleDetailLookupResponse +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using PartSource.Data.Nexpart.Interfaces; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class BaseVehicleDetailLookupResponse : IResponseElement + { + [XmlElement] + public PSResponseHeader PSResponseHeader { get; set; } + + [XmlElement(ElementName = "BaseVehicleDetail")] + public BaseVehicleDetail ResponseBody { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/BaseVehicleSearch.cs b/PartSource.Data/Nexpart/BaseVehicleSearch.cs new file mode 100644 index 0000000..fda2c9e --- /dev/null +++ b/PartSource.Data/Nexpart/BaseVehicleSearch.cs @@ -0,0 +1,32 @@ +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class BaseVehicleSearch + { + public BaseVehicleSearch() + { + this.PSRequestHeader = new PSRequestHeader(); + Region = new Region[] + { + new Region + { + Id = 2 + } + }; + } + + [XmlElement(Order = 1)] + public PSRequestHeader PSRequestHeader { get; set; } + + [XmlElement(Order = 2)] + public Years Years { get; set; } + + [XmlElement(Order = 3)] + public Region[] Region { get; set; } + + [XmlElement(Order = 4)] + public VehicleType[] VehicleType { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/BaseVehicleSearchResponse.cs b/PartSource.Data/Nexpart/BaseVehicleSearchResponse.cs new file mode 100644 index 0000000..1dcd8b2 --- /dev/null +++ b/PartSource.Data/Nexpart/BaseVehicleSearchResponse.cs @@ -0,0 +1,15 @@ +using PartSource.Data.Nexpart.Interfaces; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class BaseVehicleSearchResponse : IResponseElement + { + [XmlElement] + public PSResponseHeader PSResponseHeader { get; set; } + + [XmlElement(ElementName = "BaseVehicles")] + public BaseVehicles ResponseBody { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/BaseVehicles.cs b/PartSource.Data/Nexpart/BaseVehicles.cs new file mode 100644 index 0000000..3367fd3 --- /dev/null +++ b/PartSource.Data/Nexpart/BaseVehicles.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class BaseVehicles + { + [XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public BaseVehicle[] BaseVehicle { get; set; } + + + } +} diff --git a/PartSource.Data/Nexpart/Body.cs b/PartSource.Data/Nexpart/Body.cs new file mode 100644 index 0000000..270d011 --- /dev/null +++ b/PartSource.Data/Nexpart/Body.cs @@ -0,0 +1,44 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.Body +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class Body + { + [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 = "BuyersGuideSearch", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(BuyersGuideSearch))] + [XmlElement(ElementName = "BuyersGuideSearchResponse", Namespace = "http://whisolutions.com/PartSelectService-v1", Type = typeof(BuyersGuideSearchResponse))] + [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))] + public object Content { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/BuyersGuideData.cs b/PartSource.Data/Nexpart/BuyersGuideData.cs new file mode 100644 index 0000000..6dd5127 --- /dev/null +++ b/PartSource.Data/Nexpart/BuyersGuideData.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class BuyersGuideData + { + [XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public Apps Apps { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/BuyersGuideEngine.cs b/PartSource.Data/Nexpart/BuyersGuideEngine.cs new file mode 100644 index 0000000..b7330dc --- /dev/null +++ b/PartSource.Data/Nexpart/BuyersGuideEngine.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public class BuyersGuideEngine + { + [XmlAttribute] + public string Desc { get; set; } + + [XmlAttribute] + public int PerVehicle { get; set; } + + [XmlAttribute] + public int Year { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/BuyersGuideMake.cs b/PartSource.Data/Nexpart/BuyersGuideMake.cs new file mode 100644 index 0000000..75c790f --- /dev/null +++ b/PartSource.Data/Nexpart/BuyersGuideMake.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public class BuyersGuideMake + { + [XmlAttribute] + public string Name { get; set; } + + [XmlAttribute] + public int FromYear { get; set; } + + [XmlAttribute] + public int ToYear { get; set; } + + [XmlAttribute] + public int MakeCount { get; set; } + + [XmlElement] + public BuyersGuideModel[] Model { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/BuyersGuideModel.cs b/PartSource.Data/Nexpart/BuyersGuideModel.cs new file mode 100644 index 0000000..7c4e55b --- /dev/null +++ b/PartSource.Data/Nexpart/BuyersGuideModel.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public class BuyersGuideModel + { + [XmlAttribute] + public string Name { get; set; } + + [XmlAttribute] + public int FromYear { get; set; } + + [XmlAttribute] + public int ToYear { get; set; } + + [XmlAttribute] + public int ModelCount { get; set; } + + [XmlElement] + public BuyersGuideEngine[] Engine { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/BuyersGuidePart.cs b/PartSource.Data/Nexpart/BuyersGuidePart.cs new file mode 100644 index 0000000..52065ce --- /dev/null +++ b/PartSource.Data/Nexpart/BuyersGuidePart.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public class BuyersGuidePart + { + [XmlAttribute] + public string PartNumber { get; set; } + + [XmlAttribute] + public string MfrCode { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/BuyersGuideSearch.cs b/PartSource.Data/Nexpart/BuyersGuideSearch.cs new file mode 100644 index 0000000..7f95c77 --- /dev/null +++ b/PartSource.Data/Nexpart/BuyersGuideSearch.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class BuyersGuideSearch + { + public BuyersGuideSearch() + { + PSRequestHeader = new PSRequestHeader(); + } + + [XmlElement(Order = 1)] + public PSRequestHeader PSRequestHeader { get; set; } + + [XmlElement(Order = 2)] + public BuyersGuidePart Part { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/BuyersGuideSearchResponse.cs b/PartSource.Data/Nexpart/BuyersGuideSearchResponse.cs new file mode 100644 index 0000000..678077f --- /dev/null +++ b/PartSource.Data/Nexpart/BuyersGuideSearchResponse.cs @@ -0,0 +1,18 @@ +using PartSource.Data.Nexpart.Interfaces; +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class BuyersGuideSearchResponse : IResponseElement + { + [XmlElement] + public PSResponseHeader PSResponseHeader { get; set; } + + [XmlElement(ElementName = "BuyersGuideData")] + public BuyersGuideData ResponseBody { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/Criterion.cs b/PartSource.Data/Nexpart/Criterion.cs new file mode 100644 index 0000000..73ae819 --- /dev/null +++ b/PartSource.Data/Nexpart/Criterion.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class Criterion + { + [XmlAttribute] + public int Id { get; set; } + + [XmlAttribute(AttributeName = "Attrib")] + public string Attribute { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/Engine.cs b/PartSource.Data/Nexpart/Engine.cs new file mode 100644 index 0000000..1ccffc9 --- /dev/null +++ b/PartSource.Data/Nexpart/Engine.cs @@ -0,0 +1,20 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.Engine +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public class Engine + { + [XmlAttribute] + public int Id { get; set; } + + [XmlText] + public string Value { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/EngineSearch.cs b/PartSource.Data/Nexpart/EngineSearch.cs new file mode 100644 index 0000000..587b0e5 --- /dev/null +++ b/PartSource.Data/Nexpart/EngineSearch.cs @@ -0,0 +1,37 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.EngineSearch +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class EngineSearch + { + public EngineSearch() + { + this.PSRequestHeader = new PSRequestHeader(); + this.RegionId = new int[1] { 2 }; + } + + [XmlElement(Order = 1)] + public PSRequestHeader PSRequestHeader { get; set; } + + [XmlElement(Order = 2)] + public VehicleIdentifier VehicleIdentifier { get; set; } + + [XmlElement(Order = 3)] + public int[] RegionId { get; set; } + + [XmlElement(Order = 4)] + public int? SubModelId { get; set; } + + public bool ShouldSerializeSubModelId() + { + return SubModelId != null; + } + } +} diff --git a/PartSource.Data/Nexpart/EngineSearchResponse.cs b/PartSource.Data/Nexpart/EngineSearchResponse.cs new file mode 100644 index 0000000..9be5b2f --- /dev/null +++ b/PartSource.Data/Nexpart/EngineSearchResponse.cs @@ -0,0 +1,21 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.EngineSearchResponse +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using PartSource.Data.Nexpart.Interfaces; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class EngineSearchResponse : IResponseElement + { + [XmlElement] + public PSResponseHeader PSResponseHeader { get; set; } + + [XmlElement(ElementName = "Engines")] + public Engines ResponseBody { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/Engines.cs b/PartSource.Data/Nexpart/Engines.cs new file mode 100644 index 0000000..63674cd --- /dev/null +++ b/PartSource.Data/Nexpart/Engines.cs @@ -0,0 +1,17 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.Engines +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class Engines + { + [XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public Engine[] Engine; + } +} diff --git a/PartSource.Data/Nexpart/Envelope.cs b/PartSource.Data/Nexpart/Envelope.cs new file mode 100644 index 0000000..5e9d322 --- /dev/null +++ b/PartSource.Data/Nexpart/Envelope.cs @@ -0,0 +1,26 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.Envelope +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://schemas.xmlsoap.org/soap/envelope/")] + [XmlRoot(IsNullable = false, Namespace = "http://schemas.xmlsoap.org/soap/envelope/")] + public class Envelope + { + public Envelope() + { + this.Body = new Body(); + } + + [XmlElement(ElementName = "Header", Namespace = "http://schemas.xmlsoap.org/soap/envelope/")] + public string Header { get; set; } + + [XmlElement(ElementName = "Body", Namespace = "http://schemas.xmlsoap.org/soap/envelope/")] + public Body Body { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/Exceptions.cs b/PartSource.Data/Nexpart/Exceptions.cs new file mode 100644 index 0000000..2594481 --- /dev/null +++ b/PartSource.Data/Nexpart/Exceptions.cs @@ -0,0 +1,20 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.Exceptions +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectCommon/2011-07-21")] + public class Exceptions + { + [XmlAttribute(AttributeName = "code")] + public string Code { get; set; } + + [XmlText] + public string Value { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/Interfaces/IResponseElement.cs b/PartSource.Data/Nexpart/Interfaces/IResponseElement.cs new file mode 100644 index 0000000..509e29c --- /dev/null +++ b/PartSource.Data/Nexpart/Interfaces/IResponseElement.cs @@ -0,0 +1,15 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.Interfaces.IResponseElement`1 +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +namespace PartSource.Data.Nexpart.Interfaces +{ + public interface IResponseElement + { + PSResponseHeader PSResponseHeader { get; set; } + + T ResponseBody { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/Item.cs b/PartSource.Data/Nexpart/Item.cs new file mode 100644 index 0000000..e9a4b00 --- /dev/null +++ b/PartSource.Data/Nexpart/Item.cs @@ -0,0 +1,29 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.Item +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public class Item + { + [XmlAttribute] + public string PartNumber { get; set; } + + [XmlAttribute] + public string MfrCode { get; set; } + + [XmlElement] + public PrimaryImg PrimaryImg { get; set; } + + [XmlElement] + public AddImgs AddImgs { get; set; } + + [XmlElement] + public Part Part { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/Items.cs b/PartSource.Data/Nexpart/Items.cs new file mode 100644 index 0000000..ee3d888 --- /dev/null +++ b/PartSource.Data/Nexpart/Items.cs @@ -0,0 +1,17 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.Items +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class Items + { + [XmlElement(ElementName = "Item", Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21", Order = 1)] + public PartSource.Data.Nexpart.Item[] Item { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/Make.cs b/PartSource.Data/Nexpart/Make.cs new file mode 100644 index 0000000..fd48574 --- /dev/null +++ b/PartSource.Data/Nexpart/Make.cs @@ -0,0 +1,23 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.Make +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public class Make + { + [XmlText] + public string Value { get; set; } + + [XmlAttribute(AttributeName = "id")] + public int Id { get; set; } + + [XmlAttribute] + public int WHIId { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/MakeSearch.cs b/PartSource.Data/Nexpart/MakeSearch.cs new file mode 100644 index 0000000..6dec0ce --- /dev/null +++ b/PartSource.Data/Nexpart/MakeSearch.cs @@ -0,0 +1,33 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.MakeSearch +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class MakeSearch + { + public MakeSearch() + { + this.PSRequestHeader = new PSRequestHeader(); + this.Years = new Years() { From = 1900, To = 2049 }; + this.RegionId = new int[]{ 2 }; + } + + [XmlElement(ElementName = "PSRequestHeader", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 1)] + public PSRequestHeader PSRequestHeader { get; set; } + + [XmlElement(ElementName = "Years", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 2)] + public Years Years { get; set; } + + [XmlElement(ElementName = "RegionId", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 3)] + public int[] RegionId { get; set; } + + [XmlElement(ElementName = "VehicleTypeId", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 4)] + public int[] VehicleTypeId { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/MakeSearchResponse.cs b/PartSource.Data/Nexpart/MakeSearchResponse.cs new file mode 100644 index 0000000..9337679 --- /dev/null +++ b/PartSource.Data/Nexpart/MakeSearchResponse.cs @@ -0,0 +1,21 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.MakeSearchResponse +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using PartSource.Data.Nexpart.Interfaces; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class MakeSearchResponse : IResponseElement + { + [XmlElement] + public PSResponseHeader PSResponseHeader { get; set; } + + [XmlElement(ElementName = "Makes")] + public Makes ResponseBody { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/Makes.cs b/PartSource.Data/Nexpart/Makes.cs new file mode 100644 index 0000000..18d87a3 --- /dev/null +++ b/PartSource.Data/Nexpart/Makes.cs @@ -0,0 +1,17 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.Makes +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class Makes + { + [XmlElement(ElementName = "Make", Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21", Order = 1)] + public PartSource.Data.Nexpart.Make[] Make { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/MenuNode.cs b/PartSource.Data/Nexpart/MenuNode.cs new file mode 100644 index 0000000..794921a --- /dev/null +++ b/PartSource.Data/Nexpart/MenuNode.cs @@ -0,0 +1,29 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.PartType +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class MenuNode + { + [XmlAttribute] + public int Id { get; set; } + + [XmlAttribute] + public string NodeType { get; set; } + + [XmlAttribute] + public int NodeTypeId { get; set; } + + [XmlAttribute(AttributeName = "Desc")] + public string Description { get; set; } + + [XmlAttribute] + public int SourceId { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/MenuNodes.cs b/PartSource.Data/Nexpart/MenuNodes.cs new file mode 100644 index 0000000..f6c8c63 --- /dev/null +++ b/PartSource.Data/Nexpart/MenuNodes.cs @@ -0,0 +1,17 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.PartTypes +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class MenuNodes + { + [XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public MenuNode[] MenuNode{ get; set; } + } +} diff --git a/PartSource.Data/Nexpart/MenuNodesLookup.cs b/PartSource.Data/Nexpart/MenuNodesLookup.cs new file mode 100644 index 0000000..5e03f10 --- /dev/null +++ b/PartSource.Data/Nexpart/MenuNodesLookup.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class MenuNodesLookup + { + public MenuNodesLookup() + { + this.PSRequestHeader = new PSRequestHeader(); + } + + [XmlElement(Order = 1)] + public PSRequestHeader PSRequestHeader { get; set; } + + [XmlElement(Order = 2)] + public int MenuId { get; set; } + + [XmlElement(Order = 3)] + public int? ParentMenuNodeId { get; set; } + + [XmlElement(Order = 4, ElementName = "numOfLevels")] + public int NumberOfLevels { get; set; } + + public bool ShouldSerializeParentMenuNodeId() + { + return ParentMenuNodeId != null; + } + } +} diff --git a/PartSource.Data/Nexpart/MenuNodesLookupResponse.cs b/PartSource.Data/Nexpart/MenuNodesLookupResponse.cs new file mode 100644 index 0000000..16c74ae --- /dev/null +++ b/PartSource.Data/Nexpart/MenuNodesLookupResponse.cs @@ -0,0 +1,15 @@ +using PartSource.Data.Nexpart.Interfaces; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class MenuNodesLookupResponse : IResponseElement + { + [XmlElement] + public PSResponseHeader PSResponseHeader { get; set; } + + [XmlElement(ElementName = "MenuNodes")] + public MenuNodes ResponseBody { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/Model.cs b/PartSource.Data/Nexpart/Model.cs new file mode 100644 index 0000000..af901c3 --- /dev/null +++ b/PartSource.Data/Nexpart/Model.cs @@ -0,0 +1,20 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.Model +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public class Model + { + [XmlText] + public string Value { get; set; } + + [XmlAttribute(AttributeName = "id")] + public int Id { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/ModelSearch.cs b/PartSource.Data/Nexpart/ModelSearch.cs new file mode 100644 index 0000000..9c13a71 --- /dev/null +++ b/PartSource.Data/Nexpart/ModelSearch.cs @@ -0,0 +1,35 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.ModelSearch +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class ModelSearch + { + public ModelSearch() + { + this.PSRequestHeader = new PSRequestHeader(); + this.RegionId = new int[] { 2 }; + } + + [XmlElement(ElementName = "PSRequestHeader", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 1)] + public PSRequestHeader PSRequestHeader { get; set; } + + [XmlElement(ElementName = "Year", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 2)] + public int Year { get; set; } + + [XmlElement(ElementName = "MakeId", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 3)] + public int MakeId { get; set; } + + [XmlElement(ElementName = "RegionId", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 4)] + public int[] RegionId { get; set; } + + [XmlElement(ElementName = "VehicleTypeId", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 5)] + public int[] VehicleTypeId { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/ModelSearchResponse.cs b/PartSource.Data/Nexpart/ModelSearchResponse.cs new file mode 100644 index 0000000..af77cee --- /dev/null +++ b/PartSource.Data/Nexpart/ModelSearchResponse.cs @@ -0,0 +1,21 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.ModelSearchResponse +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using PartSource.Data.Nexpart.Interfaces; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class ModelSearchResponse : IResponseElement + { + [XmlElement] + public PSResponseHeader PSResponseHeader { get; set; } + + [XmlElement(ElementName = "Models", Namespace = "http://whisolutions.com/PartSelectService-v1")] + public Models[] ResponseBody { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/Models.cs b/PartSource.Data/Nexpart/Models.cs new file mode 100644 index 0000000..9c01ea2 --- /dev/null +++ b/PartSource.Data/Nexpart/Models.cs @@ -0,0 +1,25 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.Models +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class Models + { + public Models() + { + Region = 2; + } + + [XmlAttribute] + public int Region { get; set; } + + [XmlElement(ElementName = "Model", Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public PartSource.Data.Nexpart.Model[] Model { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/PSRequestHeader.cs b/PartSource.Data/Nexpart/PSRequestHeader.cs new file mode 100644 index 0000000..f5497e5 --- /dev/null +++ b/PartSource.Data/Nexpart/PSRequestHeader.cs @@ -0,0 +1,26 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.PSRequestHeader +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class PSRequestHeader + { + public PSRequestHeader() + { + this.SvcVersion = "1.0"; + this.ReturnWarnings = "true"; + } + + [XmlElement(ElementName = "SvcVersion", Namespace = "http://whisolutions.com/PartSelectCommon/2011-07-21")] + public string SvcVersion { get; set; } + + [XmlElement(ElementName = "ReturnWarnings", Namespace = "http://whisolutions.com/PartSelectCommon/2011-07-21")] + public string ReturnWarnings { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/PSResponseHeader.cs b/PartSource.Data/Nexpart/PSResponseHeader.cs new file mode 100644 index 0000000..9967d02 --- /dev/null +++ b/PartSource.Data/Nexpart/PSResponseHeader.cs @@ -0,0 +1,32 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.PSResponseHeader +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class PSResponseHeader + { + [XmlElement(ElementName = "RequestId", Namespace = "http://whisolutions.com/PartSelectCommon/2011-07-21")] + public string RequestId { get; set; } + + [XmlElement(ElementName = "RequestProcessingTime", Namespace = "http://whisolutions.com/PartSelectCommon/2011-07-21")] + public string RequestProcessingTime { get; set; } + + [XmlElement(ElementName = "Build", Namespace = "http://whisolutions.com/PartSelectCommon/2011-07-21")] + public string Build { get; set; } + + [XmlElement(ElementName = "TimeStamp", Namespace = "http://whisolutions.com/PartSelectCommon/2011-07-21")] + public string TimeStamp { get; set; } + + [XmlElement(ElementName = "StatusCode", Namespace = "http://whisolutions.com/PartSelectCommon/2011-07-21")] + public string StatusCode { get; set; } + + [XmlElement(ElementName = "Exceptions", Namespace = "http://whisolutions.com/PartSelectCommon/2011-07-21")] + public PartSource.Data.Nexpart.Exceptions[] Exceptions { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/Part.cs b/PartSource.Data/Nexpart/Part.cs new file mode 100644 index 0000000..f6cfc75 --- /dev/null +++ b/PartSource.Data/Nexpart/Part.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public class Part + { + [XmlElement] + public string PartNumber { get; set; } + + [XmlElement] + 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")] + public class PartPartType + { + [XmlAttribute] + public int Id { get; set; } + + [XmlAttribute] + public string PartTypeDesc { get; set; } + } + + } +} diff --git a/PartSource.Data/Nexpart/PartNumber.cs b/PartSource.Data/Nexpart/PartNumber.cs new file mode 100644 index 0000000..42ceeea --- /dev/null +++ b/PartSource.Data/Nexpart/PartNumber.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public class PartNumber + { + [XmlText] + public string Value { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/PartType.cs b/PartSource.Data/Nexpart/PartType.cs new file mode 100644 index 0000000..03d1ecd --- /dev/null +++ b/PartSource.Data/Nexpart/PartType.cs @@ -0,0 +1,23 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.PartType +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class PartType + { + [XmlAttribute] + public int Id { get; set; } + + [XmlAttribute] + public int PositionGroupId { get; set; } + + [XmlAttribute] + public string Description { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/PartTypeSearch.cs b/PartSource.Data/Nexpart/PartTypeSearch.cs new file mode 100644 index 0000000..707b06f --- /dev/null +++ b/PartSource.Data/Nexpart/PartTypeSearch.cs @@ -0,0 +1,34 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.PartTypeSearch +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class PartTypeSearch + { + public PartTypeSearch() + { + this.PSRequestHeader = new PSRequestHeader(); + } + + [XmlElement(Order = 1)] + public PSRequestHeader PSRequestHeader { get; set; } + + [XmlElement(Order = 2)] + public string SearchString { get; set; } + + [XmlElement(Order = 3)] + public string SearchType { get; set; } + + [XmlElement(Order = 4)] + public string SearchOptions { get; set; } + + [XmlElement(Order = 5)] + public VehicleIdentifier VehicleIdentifier { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/PartTypeSearchResponse.cs b/PartSource.Data/Nexpart/PartTypeSearchResponse.cs new file mode 100644 index 0000000..0316603 --- /dev/null +++ b/PartSource.Data/Nexpart/PartTypeSearchResponse.cs @@ -0,0 +1,25 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.PartTypeSearchResponse +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using PartSource.Data.Nexpart.Interfaces; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class PartTypeSearchResponse : IResponseElement + { + [XmlElement] + public PSResponseHeader PSResponseHeader { get; set; } + + public string RequestedSearchString { get; set; } + + public string ExecutedSearchString { get; set; } + + [XmlElement(ElementName = "PartTypes")] + public PartTypes ResponseBody { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/PartTypes.cs b/PartSource.Data/Nexpart/PartTypes.cs new file mode 100644 index 0000000..ba5345e --- /dev/null +++ b/PartSource.Data/Nexpart/PartTypes.cs @@ -0,0 +1,17 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.PartTypes +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class PartTypes + { + [XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public PartSource.Data.Nexpart.PartType[] PartType { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/PartTypesValidateLookup.cs b/PartSource.Data/Nexpart/PartTypesValidateLookup.cs new file mode 100644 index 0000000..0cde0d3 --- /dev/null +++ b/PartSource.Data/Nexpart/PartTypesValidateLookup.cs @@ -0,0 +1,28 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.PartTypesValidateLookup +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class PartTypesValidateLookup + { + public PartTypesValidateLookup() + { + this.PSRequestHeader = new PSRequestHeader(); + } + + [XmlElement(Order = 1)] + public PSRequestHeader PSRequestHeader { get; set; } + + [XmlElement(ElementName = "PartType", Order = 2)] + public PartType[] PartTypes { get; set; } + + [XmlElement(Order = 3)] + public VehicleIdentifier VehicleIdentifier { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/PartTypesValidateLookupResponse.cs b/PartSource.Data/Nexpart/PartTypesValidateLookupResponse.cs new file mode 100644 index 0000000..116169a --- /dev/null +++ b/PartSource.Data/Nexpart/PartTypesValidateLookupResponse.cs @@ -0,0 +1,21 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.PartTypesValidateLookupResponse +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using PartSource.Data.Nexpart.Interfaces; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class PartTypesValidateLookupResponse : IResponseElement + { + [XmlElement] + public PSResponseHeader PSResponseHeader { get; set; } + + [XmlElement(ElementName = "PartTypes")] + public PartTypes ResponseBody { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/PrimaryImg.cs b/PartSource.Data/Nexpart/PrimaryImg.cs new file mode 100644 index 0000000..fb0dfdc --- /dev/null +++ b/PartSource.Data/Nexpart/PrimaryImg.cs @@ -0,0 +1,17 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.PrimaryImg +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public class PrimaryImg + { + [XmlElement] + public string ImgUrl { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/Region.cs b/PartSource.Data/Nexpart/Region.cs new file mode 100644 index 0000000..bb5513a --- /dev/null +++ b/PartSource.Data/Nexpart/Region.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class Region + { + [XmlAttribute] + public int Id { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/RegionId.cs b/PartSource.Data/Nexpart/RegionId.cs new file mode 100644 index 0000000..de0f944 --- /dev/null +++ b/PartSource.Data/Nexpart/RegionId.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class RegionId + { + [XmlText] + public int Value { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/ResultOption.cs b/PartSource.Data/Nexpart/ResultOption.cs new file mode 100644 index 0000000..c26ccbd --- /dev/null +++ b/PartSource.Data/Nexpart/ResultOption.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class ResultOption + { + [XmlText] + public string Value { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/SmartPageDataSearch.cs b/PartSource.Data/Nexpart/SmartPageDataSearch.cs new file mode 100644 index 0000000..b50075a --- /dev/null +++ b/PartSource.Data/Nexpart/SmartPageDataSearch.cs @@ -0,0 +1,25 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.SmartPageDataSearch +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class SmartPageDataSearch + { + public SmartPageDataSearch() + { + this.PSRequestHeader = new PSRequestHeader(); + } + + [XmlElement(ElementName = "PSRequestHeader", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 1)] + public PSRequestHeader PSRequestHeader { get; set; } + + [XmlElement(ElementName = "Item", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 2)] + public Item[] Items { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/SmartPageDataSearchResponse.cs b/PartSource.Data/Nexpart/SmartPageDataSearchResponse.cs new file mode 100644 index 0000000..28b3f44 --- /dev/null +++ b/PartSource.Data/Nexpart/SmartPageDataSearchResponse.cs @@ -0,0 +1,21 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.SmartPageDataSearchResponse +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using PartSource.Data.Nexpart.Interfaces; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class SmartPageDataSearchResponse : IResponseElement + { + [XmlElement] + public PSResponseHeader PSResponseHeader { get; set; } + + [XmlElement(ElementName = "Items")] + public Items ResponseBody { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/SubModel.cs b/PartSource.Data/Nexpart/SubModel.cs new file mode 100644 index 0000000..366ee88 --- /dev/null +++ b/PartSource.Data/Nexpart/SubModel.cs @@ -0,0 +1,20 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.Item +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public class SubModel + { + [XmlAttribute] + public string Id { get; set; } + + [XmlText] + public string Description { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/SubModelSearchResponse.cs b/PartSource.Data/Nexpart/SubModelSearchResponse.cs new file mode 100644 index 0000000..5b2f7e1 --- /dev/null +++ b/PartSource.Data/Nexpart/SubModelSearchResponse.cs @@ -0,0 +1,18 @@ +using PartSource.Data.Nexpart.Interfaces; +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class SubModelSearchResponse : IResponseElement + { + [XmlElement] + public PSResponseHeader PSResponseHeader { get; set; } + + [XmlElement(ElementName = "SubModels")] + public SubModels ResponseBody { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/SubModels.cs b/PartSource.Data/Nexpart/SubModels.cs new file mode 100644 index 0000000..a2ba80b --- /dev/null +++ b/PartSource.Data/Nexpart/SubModels.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class SubModels + { + [XmlElement(ElementName = "SubModel", Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21", Order = 1)] + public SubModel[] SubModel { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/SubModelsSearch.cs b/PartSource.Data/Nexpart/SubModelsSearch.cs new file mode 100644 index 0000000..6e7813a --- /dev/null +++ b/PartSource.Data/Nexpart/SubModelsSearch.cs @@ -0,0 +1,29 @@ +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class SubModelSearch + { + public SubModelSearch() + { + this.PSRequestHeader = new PSRequestHeader(); + RegionId = 2; + } + + [XmlElement(Order = 1)] + public PSRequestHeader PSRequestHeader { get; set; } + + [XmlElement(Order = 2)] + public int Year { get; set; } + + [XmlElement(Order = 3)] + public int MakeId { get; set; } + + [XmlElement(Order = 4)] + public int ModelId { get; set; } + + [XmlElement(Order = 5)] + public int RegionId { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/VehicleDetail.cs b/PartSource.Data/Nexpart/VehicleDetail.cs new file mode 100644 index 0000000..315d311 --- /dev/null +++ b/PartSource.Data/Nexpart/VehicleDetail.cs @@ -0,0 +1,38 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.VehicleDetail +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class VehicleDetail + { + [XmlAttribute] + public int BaseVehicleId { get; set; } + + [XmlAttribute] + public int WHIEngineId { get; set; } + + [XmlAttribute] + public string WHIEngineDesc { get; set; } + + [XmlAttribute] + public int EngineConfigId { get; set; } + + [XmlAttribute] + public string Description { get; set; } + + [XmlAttribute] + public int VehicleId { get; set; } + + [XmlAttribute] + public int VehicleToEngineConfigId { get; set; } + + [XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public BaseVehicle BaseVehicle { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/VehicleIdSearch.cs b/PartSource.Data/Nexpart/VehicleIdSearch.cs new file mode 100644 index 0000000..46ebad0 --- /dev/null +++ b/PartSource.Data/Nexpart/VehicleIdSearch.cs @@ -0,0 +1,38 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.VehicleIdSearch +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class VehicleIdSearch + { + public VehicleIdSearch() + { + this.PSRequestHeader = new PSRequestHeader(); + RegionId = new RegionId + { + Value = 2 + }; + } + + [XmlElement(Order = 1)] + public PSRequestHeader PSRequestHeader { get; set; } + + [XmlElement(Order = 2)] + public VehicleIdentifier VehicleIdentifier { get; set; } + + [XmlElement(Order = 3)] + public Criterion[] Criterion { get; set; } + + [XmlElement(Order = 4)] + public RegionId RegionId { get; set; } + + [XmlElement(Order = 5)] + public ResultOption[] ResultOption { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/VehicleIdSearchResponse.cs b/PartSource.Data/Nexpart/VehicleIdSearchResponse.cs new file mode 100644 index 0000000..b96ade7 --- /dev/null +++ b/PartSource.Data/Nexpart/VehicleIdSearchResponse.cs @@ -0,0 +1,21 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.VehicleIdSearchResponse +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using PartSource.Data.Nexpart.Interfaces; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class VehicleIdSearchResponse : IResponseElement + { + [XmlElement] + public PSResponseHeader PSResponseHeader { get; set; } + + [XmlElement(ElementName = "VehicleDetail")] + public VehicleDetail ResponseBody { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/VehicleIdentifier.cs b/PartSource.Data/Nexpart/VehicleIdentifier.cs new file mode 100644 index 0000000..b292248 --- /dev/null +++ b/PartSource.Data/Nexpart/VehicleIdentifier.cs @@ -0,0 +1,30 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.VehicleIdentifier +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class VehicleIdentifier + { + [XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public int BaseVehicleId { get; set; } + + [XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public int EngineConfigId { get; set; } + + public bool ShouldSerializeBaseVehicleId() + { + return BaseVehicleId != 0; + } + + public bool ShouldSerializeEngineConfigId() + { + return EngineConfigId != 0; + } + } +} diff --git a/PartSource.Data/Nexpart/VehicleType.cs b/PartSource.Data/Nexpart/VehicleType.cs new file mode 100644 index 0000000..ac7fa9a --- /dev/null +++ b/PartSource.Data/Nexpart/VehicleType.cs @@ -0,0 +1,20 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.VehicleType +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public class VehicleType + { + [XmlText] + public string Value { get; set; } + + [XmlAttribute] + public int Id { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/VehicleTypes.cs b/PartSource.Data/Nexpart/VehicleTypes.cs new file mode 100644 index 0000000..004d989 --- /dev/null +++ b/PartSource.Data/Nexpart/VehicleTypes.cs @@ -0,0 +1,17 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.VehicleTypes +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class VehicleTypes + { + [XmlElement(ElementName = "VehicleType", Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21", Order = 1)] + public PartSource.Data.Nexpart.VehicleType[] VehicleType { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/VehicleTypesGet.cs b/PartSource.Data/Nexpart/VehicleTypesGet.cs new file mode 100644 index 0000000..82e8b0e --- /dev/null +++ b/PartSource.Data/Nexpart/VehicleTypesGet.cs @@ -0,0 +1,22 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.VehicleTypesGet +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class VehicleTypesGet + { + public VehicleTypesGet() + { + this.PSRequestHeader = new PSRequestHeader(); + } + + [XmlElement(ElementName = "PSRequestHeader", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 1)] + public PSRequestHeader PSRequestHeader { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/VehicleTypesGetResponse.cs b/PartSource.Data/Nexpart/VehicleTypesGetResponse.cs new file mode 100644 index 0000000..a550513 --- /dev/null +++ b/PartSource.Data/Nexpart/VehicleTypesGetResponse.cs @@ -0,0 +1,21 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.VehicleTypesGetResponse +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using PartSource.Data.Nexpart.Interfaces; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class VehicleTypesGetResponse : IResponseElement + { + [XmlElement] + public PSResponseHeader PSResponseHeader { get; set; } + + [XmlElement(ElementName = "VehicleTypes")] + public VehicleTypes ResponseBody { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/WHIEngine.cs b/PartSource.Data/Nexpart/WHIEngine.cs new file mode 100644 index 0000000..ddad15c --- /dev/null +++ b/PartSource.Data/Nexpart/WHIEngine.cs @@ -0,0 +1,14 @@ +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public class WHIEngine + { + [XmlAttribute] + public int Id { get; set; } + + [XmlAttribute(AttributeName = "Desc")] + public string Description{ get; set; } + } +} diff --git a/PartSource.Data/Nexpart/WHIEngineSearch.cs b/PartSource.Data/Nexpart/WHIEngineSearch.cs new file mode 100644 index 0000000..06bab14 --- /dev/null +++ b/PartSource.Data/Nexpart/WHIEngineSearch.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class WHIEngineSearch + { + public WHIEngineSearch() + { + this.PSRequestHeader = new PSRequestHeader(); + RegionId = new RegionId[] + { + new RegionId + { + Value = 2 + } + }; + } + + [XmlElement(Order = 1)] + public PSRequestHeader PSRequestHeader { get; set; } + + [XmlElement(Order = 2)] + public VehicleIdentifier VehicleIdentifier { get; set; } + + [XmlElement(Order = 3)] + public RegionId[] RegionId { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/WHIEngineSearchResponse.cs b/PartSource.Data/Nexpart/WHIEngineSearchResponse.cs new file mode 100644 index 0000000..ff6d027 --- /dev/null +++ b/PartSource.Data/Nexpart/WHIEngineSearchResponse.cs @@ -0,0 +1,18 @@ +using PartSource.Data.Nexpart.Interfaces; +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class WHIEngineSearchResponse : IResponseElement + { + [XmlElement] + public PSResponseHeader PSResponseHeader { get; set; } + + [XmlElement(ElementName = "WHIEngines")] + public WHIEngines ResponseBody { get; set; } + } +} diff --git a/PartSource.Data/Nexpart/WHIEngines.cs b/PartSource.Data/Nexpart/WHIEngines.cs new file mode 100644 index 0000000..6b7e2d6 --- /dev/null +++ b/PartSource.Data/Nexpart/WHIEngines.cs @@ -0,0 +1,11 @@ +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class WHIEngines + { + [XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public WHIEngine[] WHIEngine; + } +} diff --git a/PartSource.Data/Nexpart/Years.cs b/PartSource.Data/Nexpart/Years.cs new file mode 100644 index 0000000..2202041 --- /dev/null +++ b/PartSource.Data/Nexpart/Years.cs @@ -0,0 +1,20 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Nexpart.Years +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +using System.Xml.Serialization; + +namespace PartSource.Data.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class Years + { + [XmlAttribute(AttributeName = "to")] + public int To { get; set; } + + [XmlAttribute(AttributeName = "from")] + public int From { get; set; } + } +} diff --git a/PartSource.Data/PartSource.Data.csproj b/PartSource.Data/PartSource.Data.csproj new file mode 100644 index 0000000..281cce9 --- /dev/null +++ b/PartSource.Data/PartSource.Data.csproj @@ -0,0 +1,18 @@ + + + + netcoreapp3.1 + Debug;Release;Also Debug + + + + + + + + + + + + + diff --git a/PartSource.Data/PartSourceContext.cs b/PartSource.Data/PartSourceContext.cs new file mode 100644 index 0000000..3688585 --- /dev/null +++ b/PartSource.Data/PartSourceContext.cs @@ -0,0 +1,81 @@ +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata.Internal; +using PartSource.Data.Models; + +namespace PartSource.Data +{ + public class PartSourceContext : DbContext + { + public PartSourceContext(DbContextOptions contextOptions) + : base(contextOptions) { } + + public DbSet ApiClients { get; set; } + + public DbSet ProductBackups { get; set; } + + public DbSet DcfMappings { get; set; } + + public DbSet Fitments { get; set; } + + public DbSet Manufacturers { get; set; } + + public DbSet ImportData { get; set; } + + public DbSet ImportMetrics { get; set; } + + public DbSet PartData { get; set; } + + public DbSet PartImages { get; set; } + + public DbSet PartPrices { get; set; } + + public DbSet Parts { get; set; } + + public DbSet VehicleMakes { get; set; } + + public DbSet VehicleModels { get; set; } + + + public DbSet VehicleData { get; set; } + + public DbSet PartAvailabilities { get; set; } + + public DbQuery BaseVehicles { get; set; } + + public DbQuery Engines { get; set; } + + public DbQuery Submodels { get; set; } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + base.OnModelCreating(modelBuilder); + + modelBuilder.Query().ToView(nameof(BaseVehicle)); + modelBuilder.Query().ToView(nameof(Engine)); + modelBuilder.Query().ToView(nameof(Submodel)); + + modelBuilder.Entity().HasKey(p => new { p.Store, p.SKU }); + modelBuilder.Entity().HasKey(d => new { d.LineCode, d.WhiCode }); + + modelBuilder.Entity().HasKey(f => new { f.BaseVehicleId, f.EngineConfigId, f.LineCode, f.PartNumber }); + + foreach (IMutableEntityType entityType in modelBuilder.Model.GetEntityTypes()) + { + entityType.Relational().TableName = entityType.ClrType.Name; + } + + } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + + if (!optionsBuilder.IsConfigured) + { + optionsBuilder.UseSqlServer("Server=(localdb)\\mssqllocaldb;Database=PartSource;Trusted_Connection=True;"); + } + } + } +} + \ No newline at end of file diff --git a/PartSource.Data/Shopify/Format.cs b/PartSource.Data/Shopify/Format.cs new file mode 100644 index 0000000..b406209 --- /dev/null +++ b/PartSource.Data/Shopify/Format.cs @@ -0,0 +1,14 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Shopify.Format +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +namespace PartSource.Data.Shopify +{ + public enum Format + { + Json, + Xml, + } +} diff --git a/PartSource.Data/Shopify/FulfillmentService.cs b/PartSource.Data/Shopify/FulfillmentService.cs new file mode 100644 index 0000000..552f37c --- /dev/null +++ b/PartSource.Data/Shopify/FulfillmentService.cs @@ -0,0 +1,29 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Shopify.FulfillmentService +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +namespace PartSource.Data.Shopify +{ + public class FulfillmentService + { + public int LocationId { get; set; } + + public string CallbackUrl { get; set; } + + public string Handle { get; set; } + + public string Name { get; set; } + + public string ProviderId { get; set; } + + public bool InventoryManagement { get; set; } + + public bool RequiresShippingMethod { get; set; } + + public bool TrackingSupport { get; set; } + + public Format Format { get; set; } + } +} diff --git a/PartSource.Data/Shopify/InventoryPolicy.cs b/PartSource.Data/Shopify/InventoryPolicy.cs new file mode 100644 index 0000000..3e351db --- /dev/null +++ b/PartSource.Data/Shopify/InventoryPolicy.cs @@ -0,0 +1,14 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Shopify.InventoryPolicy +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +namespace PartSource.Data.Shopify +{ + public enum InventoryPolicy + { + Deny, + Continue, + } +} diff --git a/PartSource.Data/Shopify/Metafield.cs b/PartSource.Data/Shopify/Metafield.cs new file mode 100644 index 0000000..0971cc1 --- /dev/null +++ b/PartSource.Data/Shopify/Metafield.cs @@ -0,0 +1,21 @@ +using Ratermania.Shopify; + +namespace PartSource.Data.Shopify +{ + public class Metafield : ShopifyEntity + { + public string Description { get; set; } + + public string Namespace { get; set; } + + public string Key { get; set; } + + public string Value { get; set; } + + public string OwnerResource { get; set; } + + public long OwnerId { get; set; } + + public string ValueType { get; set; } + } +} diff --git a/PartSource.Data/Shopify/Product.cs b/PartSource.Data/Shopify/Product.cs new file mode 100644 index 0000000..17823d2 --- /dev/null +++ b/PartSource.Data/Shopify/Product.cs @@ -0,0 +1,36 @@ +using Ratermania.Shopify; +using System; + +namespace PartSource.Data.Shopify +{ + public class Product : ShopifyEntity + { + public string BodyHtml { get; set; } + + public string Handle { get; set; } + + public string MetafieldsGlobalTitleTag { get; set; } + + public string MetafieldsGlobalDescriptionTag { get; set; } + + public string ProductType { get; set; } + + public string Tags { get; set; } + + public string TemplateSuffix { get; set; } + + public string Title { get; set; } + + public string Vendor { get; set; } + + public bool Published { get; set; } + + public DateTime? PublishedAt { get; set; } + + public ProductImage[] Images { get; set; } + + public ProductVariant[] Variants { get; set; } + + public PartSource.Data.Shopify.PublishedScope? PublishedScope { get; set; } + } +} diff --git a/PartSource.Data/Shopify/ProductImage.cs b/PartSource.Data/Shopify/ProductImage.cs new file mode 100644 index 0000000..3eebde2 --- /dev/null +++ b/PartSource.Data/Shopify/ProductImage.cs @@ -0,0 +1,21 @@ +using Ratermania.Shopify; + +namespace PartSource.Data.Shopify +{ + public class ProductImage : ShopifyEntity + { + public int Height { get; set; } + + public int Position { get; set; } + + public int Width { get; set; } + + public long ProductId { get; set; } + + public long[] VariantIds { get; set; } + + public string Src { get; set; } + + public string Alt { get; set; } + } +} diff --git a/PartSource.Data/Shopify/ProductVariant.cs b/PartSource.Data/Shopify/ProductVariant.cs new file mode 100644 index 0000000..fabd877 --- /dev/null +++ b/PartSource.Data/Shopify/ProductVariant.cs @@ -0,0 +1,46 @@ +using Ratermania.Shopify; +using System; + +namespace PartSource.Data.Shopify +{ + public class ProductVariant : ShopifyEntity + { + public string Option1 { get; set; } + + public long ImageId { get; set; } + + public long InventoryItemId { get; set; } + + public long ProductId { get; set; } + + public int Position { get; set; } + + public bool RequiresShipping { get; set; } + + public bool Taxable { get; set; } + + public Decimal CompareAtPrice { get; set; } + + public Decimal Price { get; set; } + + public double Grams { get; set; } + + public double Weight { get; set; } + + public string Barcode { get; set; } + + public string Sku { get; set; } + + public string Title { get; set; } + + public string FulfillmentService { get; set; } + + public string InventoryManagement { get; set; } + + public Metafield[] Metafields { get; set; } + + public string InventoryPolicy { get; set; } + + public string WeightUnit { get; set; } + } +} diff --git a/PartSource.Data/Shopify/PublishedScope.cs b/PartSource.Data/Shopify/PublishedScope.cs new file mode 100644 index 0000000..4590371 --- /dev/null +++ b/PartSource.Data/Shopify/PublishedScope.cs @@ -0,0 +1,14 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Shopify.PublishedScope +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +namespace PartSource.Data.Shopify +{ + public enum PublishedScope + { + Global, + Web, + } +} diff --git a/PartSource.Data/Shopify/ValueType.cs b/PartSource.Data/Shopify/ValueType.cs new file mode 100644 index 0000000..ecddbc0 --- /dev/null +++ b/PartSource.Data/Shopify/ValueType.cs @@ -0,0 +1,14 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Shopify.ValueType +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +namespace PartSource.Data.Shopify +{ + public enum ValueType + { + Integer, + String, + } +} diff --git a/PartSource.Data/Shopify/WeightUnit.cs b/PartSource.Data/Shopify/WeightUnit.cs new file mode 100644 index 0000000..9cafd9b --- /dev/null +++ b/PartSource.Data/Shopify/WeightUnit.cs @@ -0,0 +1,16 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Data.Shopify.WeightUnit +// Assembly: PartSource.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Data.dll + +namespace PartSource.Data.Shopify +{ + public enum WeightUnit + { + G, + Kg, + Oz, + Lb, + } +} diff --git a/PartSource.Data/SqlServerTypes/Loader.cs b/PartSource.Data/SqlServerTypes/Loader.cs new file mode 100644 index 0000000..ce606cf --- /dev/null +++ b/PartSource.Data/SqlServerTypes/Loader.cs @@ -0,0 +1,45 @@ +using System; +using System.IO; +using System.Runtime.InteropServices; + +namespace SqlServerTypes +{ + /// + /// Utility methods related to CLR Types for SQL Server + /// + public class Utilities + { + [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] + private static extern IntPtr LoadLibrary(string libname); + + /// + /// Loads the required native assemblies for the current architecture (x86 or x64) + /// + /// + /// Root path of the current application. Use Server.MapPath(".") for ASP.NET applications + /// and AppDomain.CurrentDomain.BaseDirectory for desktop applications. + /// + public static void LoadNativeAssemblies(string rootApplicationPath) + { + var nativeBinaryPath = IntPtr.Size > 4 + ? Path.Combine(rootApplicationPath, @"SqlServerTypes\x64\") + : Path.Combine(rootApplicationPath, @"SqlServerTypes\x86\"); + + LoadNativeAssembly(nativeBinaryPath, "msvcr120.dll"); + LoadNativeAssembly(nativeBinaryPath, "SqlServerSpatial140.dll"); + } + + private static void LoadNativeAssembly(string nativeBinaryPath, string assemblyName) + { + var path = Path.Combine(nativeBinaryPath, assemblyName); + var ptr = LoadLibrary(path); + if (ptr == IntPtr.Zero) + { + throw new Exception(string.Format( + "Error loading {0} (ErrorCode: {1})", + assemblyName, + Marshal.GetLastWin32Error())); + } + } + } +} \ No newline at end of file diff --git a/PartSource.Data/SqlServerTypes/readme.htm b/PartSource.Data/SqlServerTypes/readme.htm new file mode 100644 index 0000000..02d9ac8 --- /dev/null +++ b/PartSource.Data/SqlServerTypes/readme.htm @@ -0,0 +1,61 @@ + + + + Microsoft.SqlServer.Types + + + +
+

Action required to load native assemblies

+

+ To deploy an application that uses spatial data types to a machine that does not have 'System CLR Types for SQL Server' installed you also need to deploy the native assembly SqlServerSpatial140.dll. Both x86 (32 bit) and x64 (64 bit) versions of this assembly have been added to your project under the SqlServerTypes\x86 and SqlServerTypes\x64 subdirectories. The native assembly msvcr120.dll is also included in case the C++ runtime is not installed. +

+

+ You need to add code to load the correct one of these assemblies at runtime (depending on the current architecture). +

+

ASP.NET Web Sites

+

+ For ASP.NET Web Sites, add the following block of code to the code behind file of the Web Form where you have added Report Viewer Control: +

+    Default.aspx.cs:
+        
+    public partial class _Default : System.Web.UI.Page
+    {
+        static bool _isSqlTypesLoaded = false;
+
+        public _Default()
+        {
+            if (!_isSqlTypesLoaded)
+            {
+                SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("~"));
+                _isSqlTypesLoaded = true;
+            }
+            
+        }
+    }
+
+

+

ASP.NET Web Applications

+

+ For ASP.NET Web Applications, add the following line of code to the Application_Start method in Global.asax.cs: +

    SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("~/bin"));
+

+

Desktop Applications

+

+ For desktop applications, add the following line of code to run before any spatial operations are performed: +

    SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);
+

+
+ + \ No newline at end of file diff --git a/PartSource.Entities/App.config b/PartSource.Entities/App.config new file mode 100644 index 0000000..7e1d79c --- /dev/null +++ b/PartSource.Entities/App.config @@ -0,0 +1,17 @@ + + + + +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/PartSource.Entities/AssemblyInfo.cs b/PartSource.Entities/AssemblyInfo.cs new file mode 100644 index 0000000..003e6da --- /dev/null +++ b/PartSource.Entities/AssemblyInfo.cs @@ -0,0 +1,14 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("PartSource.Entities")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("PartSource.Entities")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: ComVisible(false)] +[assembly: Guid("401cb98a-0375-47e4-b582-93ed2ffd665b")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.0.0.0")] diff --git a/PartSource.Entities/Dtos/StoreDto.cs b/PartSource.Entities/Dtos/StoreDto.cs new file mode 100644 index 0000000..17abdc5 --- /dev/null +++ b/PartSource.Entities/Dtos/StoreDto.cs @@ -0,0 +1,15 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Dtos.StoreDto +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +namespace PartSource.Entities.Dtos +{ + public class StoreDto + { + public int StoreNumber { get; set; } + + public double? Distance { get; set; } + } +} diff --git a/PartSource.Entities/Models/ApiClient.cs b/PartSource.Entities/Models/ApiClient.cs new file mode 100644 index 0000000..dd7cb1d --- /dev/null +++ b/PartSource.Entities/Models/ApiClient.cs @@ -0,0 +1,20 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Models.ApiClient +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +namespace PartSource.Entities.Models +{ + public class ApiClient + { + [System.ComponentModel.DataAnnotations.Key] + public string Key { get; set; } + + public string AppName { get; set; } + + public string Secret { get; set; } + + public bool Active { get; set; } + } +} diff --git a/PartSource.Entities/Models/Manufacturer.cs b/PartSource.Entities/Models/Manufacturer.cs new file mode 100644 index 0000000..90ec75a --- /dev/null +++ b/PartSource.Entities/Models/Manufacturer.cs @@ -0,0 +1,17 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Models.Manufacturer +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +namespace PartSource.Entities.Models +{ + public class Manufacturer + { + public int Id { get; set; } + + public string Name { get; set; } + + public string LineCode { get; set; } + } +} diff --git a/PartSource.Entities/Models/Part.cs b/PartSource.Entities/Models/Part.cs new file mode 100644 index 0000000..629c6bb --- /dev/null +++ b/PartSource.Entities/Models/Part.cs @@ -0,0 +1,27 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Models.Part +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +namespace PartSource.Entities.Models +{ + public class Part + { + public int Id { get; set; } + + public int ManufacturerId { get; set; } + + public long? ShopifyId { get; set; } + + public int Sku { get; set; } + + public string PartNumber { get; set; } + + public string Name { get; set; } + + public string Description { get; set; } + + public Manufacturer Manufacturer { get; set; } + } +} diff --git a/PartSource.Entities/Models/PartData.cs b/PartSource.Entities/Models/PartData.cs new file mode 100644 index 0000000..0b3c01e --- /dev/null +++ b/PartSource.Entities/Models/PartData.cs @@ -0,0 +1,100 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Models.PartData +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace PartSource.Entities.Models +{ + [Table("PartData")] + public class PartData + { + [Key] + [StringLength(255)] + public string SKU { get; set; } + + [StringLength(255)] + public string LOB_NM { get; set; } + + [StringLength(255)] + public string CATEGORY_NM { get; set; } + + [StringLength(255)] + public string SUBCATEGORY_NM { get; set; } + + [StringLength(255)] + public string FINELINE_NM { get; set; } + + [StringLength(255)] + public string PRODUCT_ENGLISH_LONG_DESC { get; set; } + + [StringLength(255)] + public string BRAND_NM { get; set; } + + [StringLength(255)] + public string CORPORATE_STATUS_NM { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS1 { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS2 { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS3 { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS4 { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS5 { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS6 { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS7 { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS8 { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS9 { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS10 { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS11 { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS12 { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS13 { get; set; } + + [StringLength(255)] + public string FAMILY_FEATURES_BENEFITS14 { get; set; } + + [StringLength(255)] + public string Tested { get; set; } + + [Column("Line Code")] + [StringLength(255)] + public string Line_Code { get; set; } + + [Column("Part Number")] + [StringLength(255)] + public string Part_Number { get; set; } + + [Column("Compare Price", TypeName = "money")] + public Decimal? Compare_Price { get; set; } + + [Column("Your Price", TypeName = "money")] + public Decimal? Your_Price { get; set; } + } +} diff --git a/PartSource.Entities/Models/PostalCode.cs b/PartSource.Entities/Models/PostalCode.cs new file mode 100644 index 0000000..6963350 --- /dev/null +++ b/PartSource.Entities/Models/PostalCode.cs @@ -0,0 +1,40 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Models.PostalCode +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Data.Entity.Spatial; + +namespace PartSource.Entities.Models +{ + public class PostalCode + { + [Key] + [MaxLength(3)] + public string ForwardSortationArea { get; set; } + + [Required] + public string City { get; set; } + + [Required] + public string Province { get; set; } + + [Required] + public DbGeography Location { get; set; } + + [NotMapped] + public string LocalDeliveryUnit { get; set; } + + [NotMapped] + public string Code + { + get + { + return string.Format("{0} {1}", (object) this.ForwardSortationArea, (object) this.LocalDeliveryUnit); + } + } + } +} diff --git a/PartSource.Entities/Models/SeoFitment.cs b/PartSource.Entities/Models/SeoFitment.cs new file mode 100644 index 0000000..219d18d --- /dev/null +++ b/PartSource.Entities/Models/SeoFitment.cs @@ -0,0 +1,35 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Models.SeoFitment +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace PartSource.Entities.Models +{ + [Table("SeoFitment")] + public class SeoFitment + { + public int Id { get; set; } + + [StringLength(255)] + public string mfg_code { get; set; } + + [StringLength(255)] + public string part_number { get; set; } + + public int? pt_num { get; set; } + + [StringLength(255)] + public string part_label { get; set; } + + public int basevehicleid { get; set; } + + public int engconfigid { get; set; } + + [StringLength(255)] + public string note_text { get; set; } + } +} diff --git a/PartSource.Entities/Models/Store.cs b/PartSource.Entities/Models/Store.cs new file mode 100644 index 0000000..a82d09b --- /dev/null +++ b/PartSource.Entities/Models/Store.cs @@ -0,0 +1,19 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Models.Store +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.ComponentModel.DataAnnotations; +using System.Data.Entity.Spatial; + +namespace PartSource.Entities.Models +{ + public class Store + { + [Key] + public int StoreNumber { get; set; } + + public DbGeography Location { get; set; } + } +} diff --git a/PartSource.Entities/Models/StorePart.cs b/PartSource.Entities/Models/StorePart.cs new file mode 100644 index 0000000..d1a8733 --- /dev/null +++ b/PartSource.Entities/Models/StorePart.cs @@ -0,0 +1,31 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Models.StorePart +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace PartSource.Entities.Models +{ + public class StorePart + { + [Key] + [Column(Order = 0)] + public int StoreNumber { get; set; } + + [Key] + [Column(Order = 1)] + public int PartId { get; set; } + + public int Quantity { get; set; } + + public Decimal Price { get; set; } + + public Store Store { get; set; } + + public Part Part { get; set; } + } +} diff --git a/PartSource.Entities/Models/ps_parts_availability.cs b/PartSource.Entities/Models/ps_parts_availability.cs new file mode 100644 index 0000000..ac254fa --- /dev/null +++ b/PartSource.Entities/Models/ps_parts_availability.cs @@ -0,0 +1,34 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Models.ps_parts_availability +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace PartSource.Entities.Models +{ + public class ps_parts_availability + { + [Key] + [Column(Order = 0)] + [DatabaseGenerated(DatabaseGeneratedOption.None)] + public int Store { get; set; } + + [Key] + [Column(Order = 1)] + [DatabaseGenerated(DatabaseGeneratedOption.None)] + public int SKU { get; set; } + + [Column("Line Code")] + [StringLength(50)] + public string Line_Code { get; set; } + + [Column("Part Number")] + [StringLength(50)] + public string Part_Number { get; set; } + + public int? QTY { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/BaseVehicleDetail.cs b/PartSource.Entities/Nexpart/BaseVehicleDetail.cs new file mode 100644 index 0000000..de51f67 --- /dev/null +++ b/PartSource.Entities/Nexpart/BaseVehicleDetail.cs @@ -0,0 +1,29 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.BaseVehicleDetail +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class BaseVehicleDetail + { + [XmlAttribute] + public uint WHIMakeId { get; set; } + + [XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public uint BaseVehicleId { get; set; } + + [XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public string MakeName { get; set; } + + [XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public string ModelName { get; set; } + + [XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public uint Year { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/BaseVehicleDetailLookup.cs b/PartSource.Entities/Nexpart/BaseVehicleDetailLookup.cs new file mode 100644 index 0000000..5448787 --- /dev/null +++ b/PartSource.Entities/Nexpart/BaseVehicleDetailLookup.cs @@ -0,0 +1,31 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.BaseVehicleDetailLookup +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class BaseVehicleDetailLookup + { + public BaseVehicleDetailLookup() + { + this.PSRequestHeader = new PSRequestHeader(); + } + + [XmlElement(Order = 1)] + public PSRequestHeader PSRequestHeader { get; set; } + + [XmlElement(Order = 2)] + public uint Year { get; set; } + + [XmlElement(Order = 3)] + public uint MakeId { get; set; } + + [XmlElement(Order = 4)] + public uint ModelId { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/BaseVehicleDetailLookupResponse.cs b/PartSource.Entities/Nexpart/BaseVehicleDetailLookupResponse.cs new file mode 100644 index 0000000..efedde3 --- /dev/null +++ b/PartSource.Entities/Nexpart/BaseVehicleDetailLookupResponse.cs @@ -0,0 +1,21 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.BaseVehicleDetailLookupResponse +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using PartSource.Entities.Nexpart.Interfaces; +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class BaseVehicleDetailLookupResponse : IResponseElement + { + [XmlElement] + public PSResponseHeader PSResponseHeader { get; set; } + + [XmlElement(ElementName = "BaseVehicleDetail")] + public BaseVehicleDetail ResponseBody { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/Body.cs b/PartSource.Entities/Nexpart/Body.cs new file mode 100644 index 0000000..00ff61a --- /dev/null +++ b/PartSource.Entities/Nexpart/Body.cs @@ -0,0 +1,32 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.Body +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class Body + { + [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 = "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 = "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 = "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))] + public object Content { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/Engine.cs b/PartSource.Entities/Nexpart/Engine.cs new file mode 100644 index 0000000..a1ff862 --- /dev/null +++ b/PartSource.Entities/Nexpart/Engine.cs @@ -0,0 +1,20 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.Engine +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public class Engine + { + [XmlAttribute] + public uint EngineId { get; set; } + + [XmlText] + public string Value { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/EngineSearch.cs b/PartSource.Entities/Nexpart/EngineSearch.cs new file mode 100644 index 0000000..ea8c55b --- /dev/null +++ b/PartSource.Entities/Nexpart/EngineSearch.cs @@ -0,0 +1,29 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.EngineSearch +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class EngineSearch + { + public EngineSearch() + { + this.PSRequestHeader = new PSRequestHeader(); + this.RegionId = new uint[1]{ 2U }; + } + + [XmlElement(Order = 1)] + public PSRequestHeader PSRequestHeader { get; set; } + + [XmlElement(Order = 2)] + public uint[] RegionId { get; set; } + + [XmlElement(Order = 3)] + public VehicleIdentifier VehicleIdentifier { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/EngineSearchResponse.cs b/PartSource.Entities/Nexpart/EngineSearchResponse.cs new file mode 100644 index 0000000..e96d95b --- /dev/null +++ b/PartSource.Entities/Nexpart/EngineSearchResponse.cs @@ -0,0 +1,21 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.EngineSearchResponse +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using PartSource.Entities.Nexpart.Interfaces; +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class EngineSearchResponse : IResponseElement + { + [XmlElement] + public PSResponseHeader PSResponseHeader { get; set; } + + [XmlElement(ElementName = "Engines")] + public Engines ResponseBody { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/Engines.cs b/PartSource.Entities/Nexpart/Engines.cs new file mode 100644 index 0000000..3d92c71 --- /dev/null +++ b/PartSource.Entities/Nexpart/Engines.cs @@ -0,0 +1,15 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.Engines +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class Engines + { + } +} diff --git a/PartSource.Entities/Nexpart/Envelope.cs b/PartSource.Entities/Nexpart/Envelope.cs new file mode 100644 index 0000000..56091fb --- /dev/null +++ b/PartSource.Entities/Nexpart/Envelope.cs @@ -0,0 +1,26 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.Envelope +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://schemas.xmlsoap.org/soap/envelope/")] + [XmlRoot(IsNullable = false, Namespace = "http://schemas.xmlsoap.org/soap/envelope/")] + public class Envelope + { + public Envelope() + { + this.Body = new Body(); + } + + [XmlElement(ElementName = "Header", Namespace = "http://schemas.xmlsoap.org/soap/envelope/")] + public string Header { get; set; } + + [XmlElement(ElementName = "Body", Namespace = "http://schemas.xmlsoap.org/soap/envelope/")] + public Body Body { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/Exceptions.cs b/PartSource.Entities/Nexpart/Exceptions.cs new file mode 100644 index 0000000..d539550 --- /dev/null +++ b/PartSource.Entities/Nexpart/Exceptions.cs @@ -0,0 +1,20 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.Exceptions +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectCommon/2011-07-21")] + public class Exceptions + { + [XmlAttribute(AttributeName = "code")] + public string Code { get; set; } + + [XmlText] + public string Value { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/Interfaces/IResponseElement.cs b/PartSource.Entities/Nexpart/Interfaces/IResponseElement.cs new file mode 100644 index 0000000..1e7a0fd --- /dev/null +++ b/PartSource.Entities/Nexpart/Interfaces/IResponseElement.cs @@ -0,0 +1,15 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.Interfaces.IResponseElement`1 +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +namespace PartSource.Entities.Nexpart.Interfaces +{ + public interface IResponseElement + { + PSResponseHeader PSResponseHeader { get; set; } + + T ResponseBody { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/Item.cs b/PartSource.Entities/Nexpart/Item.cs new file mode 100644 index 0000000..0920d92 --- /dev/null +++ b/PartSource.Entities/Nexpart/Item.cs @@ -0,0 +1,23 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.Item +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public class Item + { + [XmlAttribute] + public string PartNumber { get; set; } + + [XmlAttribute] + public string MfrCode { get; set; } + + [XmlElement] + public PrimaryImg PrimaryImg { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/Items.cs b/PartSource.Entities/Nexpart/Items.cs new file mode 100644 index 0000000..e4d7328 --- /dev/null +++ b/PartSource.Entities/Nexpart/Items.cs @@ -0,0 +1,17 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.Items +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class Items + { + [XmlElement] + public PartSource.Entities.Nexpart.Item[] Item { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/Make.cs b/PartSource.Entities/Nexpart/Make.cs new file mode 100644 index 0000000..ebfaaa3 --- /dev/null +++ b/PartSource.Entities/Nexpart/Make.cs @@ -0,0 +1,23 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.Make +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public class Make + { + [XmlText] + public string Value { get; set; } + + [XmlAttribute(AttributeName = "id")] + public int Id { get; set; } + + [XmlAttribute] + public int WHIId { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/MakeSearch.cs b/PartSource.Entities/Nexpart/MakeSearch.cs new file mode 100644 index 0000000..24a6ad7 --- /dev/null +++ b/PartSource.Entities/Nexpart/MakeSearch.cs @@ -0,0 +1,33 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.MakeSearch +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class MakeSearch + { + public MakeSearch() + { + this.PSRequestHeader = new PSRequestHeader(); + this.Years = new Years() { From = 1900, To = 2049 }; + this.RegionId = new uint[1]{ 2U }; + } + + [XmlElement(ElementName = "PSRequestHeader", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 1)] + public PSRequestHeader PSRequestHeader { get; set; } + + [XmlElement(ElementName = "Years", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 2)] + public Years Years { get; set; } + + [XmlElement(ElementName = "RegionId", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 3)] + public uint[] RegionId { get; set; } + + [XmlElement(ElementName = "VehicleTypeId", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 4)] + public uint[] VehicleTypeId { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/MakeSearchResponse.cs b/PartSource.Entities/Nexpart/MakeSearchResponse.cs new file mode 100644 index 0000000..803dd2c --- /dev/null +++ b/PartSource.Entities/Nexpart/MakeSearchResponse.cs @@ -0,0 +1,21 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.MakeSearchResponse +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using PartSource.Entities.Nexpart.Interfaces; +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class MakeSearchResponse : IResponseElement + { + [XmlElement] + public PSResponseHeader PSResponseHeader { get; set; } + + [XmlElement(ElementName = "Makes")] + public Makes ResponseBody { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/Makes.cs b/PartSource.Entities/Nexpart/Makes.cs new file mode 100644 index 0000000..6aa3563 --- /dev/null +++ b/PartSource.Entities/Nexpart/Makes.cs @@ -0,0 +1,17 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.Makes +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class Makes + { + [XmlElement(ElementName = "Make", Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21", Order = 1)] + public PartSource.Entities.Nexpart.Make[] Make { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/Model.cs b/PartSource.Entities/Nexpart/Model.cs new file mode 100644 index 0000000..275bf52 --- /dev/null +++ b/PartSource.Entities/Nexpart/Model.cs @@ -0,0 +1,20 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.Model +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public class Model + { + [XmlText] + public string Value { get; set; } + + [XmlAttribute(AttributeName = "id")] + public int Id { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/ModelSearch.cs b/PartSource.Entities/Nexpart/ModelSearch.cs new file mode 100644 index 0000000..4a02b65 --- /dev/null +++ b/PartSource.Entities/Nexpart/ModelSearch.cs @@ -0,0 +1,35 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.ModelSearch +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class ModelSearch + { + public ModelSearch() + { + this.PSRequestHeader = new PSRequestHeader(); + this.RegionId = new uint[1]{ 2U }; + } + + [XmlElement(ElementName = "PSRequestHeader", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 1)] + public PSRequestHeader PSRequestHeader { get; set; } + + [XmlElement(ElementName = "Year", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 2)] + public uint Year { get; set; } + + [XmlElement(ElementName = "MakeId", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 3)] + public uint MakeId { get; set; } + + [XmlElement(ElementName = "RegionId", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 4)] + public uint[] RegionId { get; set; } + + [XmlElement(ElementName = "VehicleTypeId", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 5)] + public uint[] VehicleTypeId { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/ModelSearchResponse.cs b/PartSource.Entities/Nexpart/ModelSearchResponse.cs new file mode 100644 index 0000000..a5a56e7 --- /dev/null +++ b/PartSource.Entities/Nexpart/ModelSearchResponse.cs @@ -0,0 +1,21 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.ModelSearchResponse +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using PartSource.Entities.Nexpart.Interfaces; +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class ModelSearchResponse : IResponseElement + { + [XmlElement] + public PSResponseHeader PSResponseHeader { get; set; } + + [XmlElement(ElementName = "Models", Namespace = "http://whisolutions.com/PartSelectService-v1")] + public Models[] ResponseBody { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/Models.cs b/PartSource.Entities/Nexpart/Models.cs new file mode 100644 index 0000000..76e6994 --- /dev/null +++ b/PartSource.Entities/Nexpart/Models.cs @@ -0,0 +1,20 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.Models +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class Models + { + [XmlAttribute] + public int Region { get; set; } + + [XmlElement(ElementName = "Model", Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public PartSource.Entities.Nexpart.Model[] Model { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/PSRequestHeader.cs b/PartSource.Entities/Nexpart/PSRequestHeader.cs new file mode 100644 index 0000000..88c4c47 --- /dev/null +++ b/PartSource.Entities/Nexpart/PSRequestHeader.cs @@ -0,0 +1,26 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.PSRequestHeader +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class PSRequestHeader + { + public PSRequestHeader() + { + this.SvcVersion = "1.0"; + this.ReturnWarnings = "true"; + } + + [XmlElement(ElementName = "SvcVersion", Namespace = "http://whisolutions.com/PartSelectCommon/2011-07-21")] + public string SvcVersion { get; set; } + + [XmlElement(ElementName = "ReturnWarnings", Namespace = "http://whisolutions.com/PartSelectCommon/2011-07-21")] + public string ReturnWarnings { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/PSResponseHeader.cs b/PartSource.Entities/Nexpart/PSResponseHeader.cs new file mode 100644 index 0000000..b7a12be --- /dev/null +++ b/PartSource.Entities/Nexpart/PSResponseHeader.cs @@ -0,0 +1,32 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.PSResponseHeader +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class PSResponseHeader + { + [XmlElement(ElementName = "RequestId", Namespace = "http://whisolutions.com/PartSelectCommon/2011-07-21")] + public string RequestId { get; set; } + + [XmlElement(ElementName = "RequestProcessingTime", Namespace = "http://whisolutions.com/PartSelectCommon/2011-07-21")] + public string RequestProcessingTime { get; set; } + + [XmlElement(ElementName = "Build", Namespace = "http://whisolutions.com/PartSelectCommon/2011-07-21")] + public string Build { get; set; } + + [XmlElement(ElementName = "TimeStamp", Namespace = "http://whisolutions.com/PartSelectCommon/2011-07-21")] + public string TimeStamp { get; set; } + + [XmlElement(ElementName = "StatusCode", Namespace = "http://whisolutions.com/PartSelectCommon/2011-07-21")] + public string StatusCode { get; set; } + + [XmlElement(ElementName = "Exceptions", Namespace = "http://whisolutions.com/PartSelectCommon/2011-07-21")] + public PartSource.Entities.Nexpart.Exceptions[] Exceptions { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/PartType.cs b/PartSource.Entities/Nexpart/PartType.cs new file mode 100644 index 0000000..c9bdb7e --- /dev/null +++ b/PartSource.Entities/Nexpart/PartType.cs @@ -0,0 +1,23 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.PartType +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class PartType + { + [XmlAttribute] + public uint Id { get; set; } + + [XmlAttribute] + public uint PositionGroupId { get; set; } + + [XmlAttribute] + public string Description { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/PartTypeSearch.cs b/PartSource.Entities/Nexpart/PartTypeSearch.cs new file mode 100644 index 0000000..19edd74 --- /dev/null +++ b/PartSource.Entities/Nexpart/PartTypeSearch.cs @@ -0,0 +1,34 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.PartTypeSearch +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class PartTypeSearch + { + public PartTypeSearch() + { + this.PSRequestHeader = new PSRequestHeader(); + } + + [XmlElement(Order = 1)] + public PSRequestHeader PSRequestHeader { get; set; } + + [XmlElement(Order = 2)] + public string SearchString { get; set; } + + [XmlElement(Order = 3)] + public string SearchType { get; set; } + + [XmlElement(Order = 4)] + public string SearchOptions { get; set; } + + [XmlElement(Order = 5)] + public VehicleIdentifier VehicleIdentifier { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/PartTypeSearchResponse.cs b/PartSource.Entities/Nexpart/PartTypeSearchResponse.cs new file mode 100644 index 0000000..ffe4493 --- /dev/null +++ b/PartSource.Entities/Nexpart/PartTypeSearchResponse.cs @@ -0,0 +1,25 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.PartTypeSearchResponse +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using PartSource.Entities.Nexpart.Interfaces; +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class PartTypeSearchResponse : IResponseElement + { + [XmlElement] + public PSResponseHeader PSResponseHeader { get; set; } + + public string RequestedSearchString { get; set; } + + public string ExecutedSearchString { get; set; } + + [XmlElement(ElementName = "PartTypes")] + public PartTypes ResponseBody { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/PartTypes.cs b/PartSource.Entities/Nexpart/PartTypes.cs new file mode 100644 index 0000000..530136c --- /dev/null +++ b/PartSource.Entities/Nexpart/PartTypes.cs @@ -0,0 +1,17 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.PartTypes +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class PartTypes + { + [XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public PartSource.Entities.Nexpart.PartType[] PartType { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/PartTypesValidateLookup.cs b/PartSource.Entities/Nexpart/PartTypesValidateLookup.cs new file mode 100644 index 0000000..3775ab3 --- /dev/null +++ b/PartSource.Entities/Nexpart/PartTypesValidateLookup.cs @@ -0,0 +1,28 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.PartTypesValidateLookup +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class PartTypesValidateLookup + { + public PartTypesValidateLookup() + { + this.PSRequestHeader = new PSRequestHeader(); + } + + [XmlElement(Order = 1)] + public PSRequestHeader PSRequestHeader { get; set; } + + [XmlElement(ElementName = "PartType", Order = 2)] + public PartType[] PartTypes { get; set; } + + [XmlElement(Order = 3)] + public VehicleIdentifier VehicleIdentifier { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/PartTypesValidateLookupResponse.cs b/PartSource.Entities/Nexpart/PartTypesValidateLookupResponse.cs new file mode 100644 index 0000000..4cf9077 --- /dev/null +++ b/PartSource.Entities/Nexpart/PartTypesValidateLookupResponse.cs @@ -0,0 +1,21 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.PartTypesValidateLookupResponse +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using PartSource.Entities.Nexpart.Interfaces; +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class PartTypesValidateLookupResponse : IResponseElement + { + [XmlElement] + public PSResponseHeader PSResponseHeader { get; set; } + + [XmlElement(ElementName = "PartTypes")] + public PartTypes ResponseBody { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/PrimaryImg.cs b/PartSource.Entities/Nexpart/PrimaryImg.cs new file mode 100644 index 0000000..fe27ef1 --- /dev/null +++ b/PartSource.Entities/Nexpart/PrimaryImg.cs @@ -0,0 +1,17 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.PrimaryImg +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public class PrimaryImg + { + [XmlElement] + public string ImgUrl { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/SmartPageDataSearch.cs b/PartSource.Entities/Nexpart/SmartPageDataSearch.cs new file mode 100644 index 0000000..11baa2e --- /dev/null +++ b/PartSource.Entities/Nexpart/SmartPageDataSearch.cs @@ -0,0 +1,25 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.SmartPageDataSearch +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class SmartPageDataSearch + { + public SmartPageDataSearch() + { + this.PSRequestHeader = new PSRequestHeader(); + } + + [XmlElement(ElementName = "PSRequestHeader", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 1)] + public PSRequestHeader PSRequestHeader { get; set; } + + [XmlElement(ElementName = "Item", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 2)] + public Item[] Items { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/SmartPageDataSearchResponse.cs b/PartSource.Entities/Nexpart/SmartPageDataSearchResponse.cs new file mode 100644 index 0000000..3c1c7dc --- /dev/null +++ b/PartSource.Entities/Nexpart/SmartPageDataSearchResponse.cs @@ -0,0 +1,21 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.SmartPageDataSearchResponse +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using PartSource.Entities.Nexpart.Interfaces; +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class SmartPageDataSearchResponse : IResponseElement + { + [XmlElement] + public PSResponseHeader PSResponseHeader { get; set; } + + [XmlElement(ElementName = "Items", Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public Items ResponseBody { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/VehicleDetail.cs b/PartSource.Entities/Nexpart/VehicleDetail.cs new file mode 100644 index 0000000..b4eec57 --- /dev/null +++ b/PartSource.Entities/Nexpart/VehicleDetail.cs @@ -0,0 +1,35 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.VehicleDetail +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class VehicleDetail + { + [XmlAttribute] + public int BaseVehicleId { get; set; } + + [XmlAttribute] + public int WHIEngineId { get; set; } + + [XmlAttribute] + public string WHIEngineDesc { get; set; } + + [XmlAttribute] + public int EngineConfigId { get; set; } + + [XmlAttribute] + public string Description { get; set; } + + [XmlAttribute] + public int VehicleId { get; set; } + + [XmlAttribute] + public int VehicleToEngineConfigId { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/VehicleIdSearch.cs b/PartSource.Entities/Nexpart/VehicleIdSearch.cs new file mode 100644 index 0000000..f8c51a6 --- /dev/null +++ b/PartSource.Entities/Nexpart/VehicleIdSearch.cs @@ -0,0 +1,25 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.VehicleIdSearch +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class VehicleIdSearch + { + public VehicleIdSearch() + { + this.PSRequestHeader = new PSRequestHeader(); + } + + [XmlElement(Order = 1)] + public PSRequestHeader PSRequestHeader { get; set; } + + [XmlElement(Order = 2)] + public VehicleIdentifier VehicleIdentifier { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/VehicleIdSearchResponse.cs b/PartSource.Entities/Nexpart/VehicleIdSearchResponse.cs new file mode 100644 index 0000000..096db3d --- /dev/null +++ b/PartSource.Entities/Nexpart/VehicleIdSearchResponse.cs @@ -0,0 +1,21 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.VehicleIdSearchResponse +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using PartSource.Entities.Nexpart.Interfaces; +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class VehicleIdSearchResponse : IResponseElement + { + [XmlElement] + public PSResponseHeader PSResponseHeader { get; set; } + + [XmlElement(ElementName = "VehicleDetail")] + public VehicleDetail ResponseBody { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/VehicleIdentifier.cs b/PartSource.Entities/Nexpart/VehicleIdentifier.cs new file mode 100644 index 0000000..1616cb3 --- /dev/null +++ b/PartSource.Entities/Nexpart/VehicleIdentifier.cs @@ -0,0 +1,20 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.VehicleIdentifier +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class VehicleIdentifier + { + [XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public uint BaseVehicleId { get; set; } + + [XmlElement(Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public uint EngineConfigId { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/VehicleType.cs b/PartSource.Entities/Nexpart/VehicleType.cs new file mode 100644 index 0000000..32ea60c --- /dev/null +++ b/PartSource.Entities/Nexpart/VehicleType.cs @@ -0,0 +1,20 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.VehicleType +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21")] + public class VehicleType + { + [XmlText] + public string Value { get; set; } + + [XmlAttribute] + public int Id { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/VehicleTypes.cs b/PartSource.Entities/Nexpart/VehicleTypes.cs new file mode 100644 index 0000000..5729ebd --- /dev/null +++ b/PartSource.Entities/Nexpart/VehicleTypes.cs @@ -0,0 +1,17 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.VehicleTypes +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class VehicleTypes + { + [XmlElement(ElementName = "VehicleType", Namespace = "http://whisolutions.com/PartSelectServ/2011-07-21", Order = 1)] + public PartSource.Entities.Nexpart.VehicleType[] VehicleType { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/VehicleTypesGet.cs b/PartSource.Entities/Nexpart/VehicleTypesGet.cs new file mode 100644 index 0000000..267144a --- /dev/null +++ b/PartSource.Entities/Nexpart/VehicleTypesGet.cs @@ -0,0 +1,22 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.VehicleTypesGet +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class VehicleTypesGet + { + public VehicleTypesGet() + { + this.PSRequestHeader = new PSRequestHeader(); + } + + [XmlElement(ElementName = "PSRequestHeader", Namespace = "http://whisolutions.com/PartSelectService-v1", Order = 1)] + public PSRequestHeader PSRequestHeader { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/VehicleTypesGetResponse.cs b/PartSource.Entities/Nexpart/VehicleTypesGetResponse.cs new file mode 100644 index 0000000..7227ed6 --- /dev/null +++ b/PartSource.Entities/Nexpart/VehicleTypesGetResponse.cs @@ -0,0 +1,21 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.VehicleTypesGetResponse +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using PartSource.Entities.Nexpart.Interfaces; +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class VehicleTypesGetResponse : IResponseElement + { + [XmlElement] + public PSResponseHeader PSResponseHeader { get; set; } + + [XmlElement(ElementName = "VehicleTypes")] + public VehicleTypes ResponseBody { get; set; } + } +} diff --git a/PartSource.Entities/Nexpart/Years.cs b/PartSource.Entities/Nexpart/Years.cs new file mode 100644 index 0000000..d7a37d6 --- /dev/null +++ b/PartSource.Entities/Nexpart/Years.cs @@ -0,0 +1,20 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Nexpart.Years +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System.Xml.Serialization; + +namespace PartSource.Entities.Nexpart +{ + [XmlType(AnonymousType = true, Namespace = "http://whisolutions.com/PartSelectService-v1")] + public class Years + { + [XmlAttribute(AttributeName = "to")] + public int To { get; set; } + + [XmlAttribute(AttributeName = "from")] + public int From { get; set; } + } +} diff --git a/PartSource.Entities/PartSource.Entities.csproj b/PartSource.Entities/PartSource.Entities.csproj new file mode 100644 index 0000000..e5b919d --- /dev/null +++ b/PartSource.Entities/PartSource.Entities.csproj @@ -0,0 +1,139 @@ + + + + + Debug + AnyCPU + {B10E5082-B886-4859-8A64-29DA70E55EE9} + Library + PartSource.Entities + v4.6.1 + 1.0.0.0 + 512 + PartSource.Entities + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll + + + ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll + + + ..\packages\Microsoft.SqlServer.Types.14.0.1016.290\lib\net40\Microsoft.SqlServer.Types.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + \ No newline at end of file diff --git a/PartSource.Entities/PartSourceContext.cs b/PartSource.Entities/PartSourceContext.cs new file mode 100644 index 0000000..5247cbd --- /dev/null +++ b/PartSource.Entities/PartSourceContext.cs @@ -0,0 +1,41 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.PartSourceContext +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using PartSource.Entities.Models; +using System.Data.Entity; +using System.Data.Entity.ModelConfiguration.Conventions; + +namespace PartSource.Entities +{ + public class PartSourceContext : DbContext + { + public DbSet ApiClients { get; set; } + + public DbSet Manufacturers { get; set; } + + public DbSet PartData { get; set; } + + public DbSet Parts { get; set; } + + public DbSet PostalCodes { get; set; } + + public DbSet SeoFitments { get; set; } + + public DbSet Stores { get; set; } + + public DbSet StoreParts { get; set; } + + public DbSet ps_parts_availability { get; set; } + + protected override void OnModelCreating(DbModelBuilder modelBuilder) + { + base.OnModelCreating(modelBuilder); + + modelBuilder.Conventions.Remove(); + // Database.SetInitializer((IDatabaseInitializer)null); + } + } +} diff --git a/PartSource.Entities/Shopify/BaseShopifyModel.cs b/PartSource.Entities/Shopify/BaseShopifyModel.cs new file mode 100644 index 0000000..9dd8f1e --- /dev/null +++ b/PartSource.Entities/Shopify/BaseShopifyModel.cs @@ -0,0 +1,19 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Shopify.BaseShopifyModel +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System; + +namespace PartSource.Entities.Shopify +{ + public class BaseShopifyModel + { + public long Id { get; set; } + + public DateTime CreatedAt { get; set; } + + public DateTime UpdatedAt { get; set; } + } +} diff --git a/PartSource.Entities/Shopify/Format.cs b/PartSource.Entities/Shopify/Format.cs new file mode 100644 index 0000000..49f5abb --- /dev/null +++ b/PartSource.Entities/Shopify/Format.cs @@ -0,0 +1,14 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Shopify.Format +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +namespace PartSource.Entities.Shopify +{ + public enum Format + { + Json, + Xml, + } +} diff --git a/PartSource.Entities/Shopify/FulfillmentService.cs b/PartSource.Entities/Shopify/FulfillmentService.cs new file mode 100644 index 0000000..0d3ed18 --- /dev/null +++ b/PartSource.Entities/Shopify/FulfillmentService.cs @@ -0,0 +1,29 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Shopify.FulfillmentService +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +namespace PartSource.Entities.Shopify +{ + public class FulfillmentService + { + public int LocationId { get; set; } + + public string CallbackUrl { get; set; } + + public string Handle { get; set; } + + public string Name { get; set; } + + public string ProviderId { get; set; } + + public bool InventoryManagement { get; set; } + + public bool RequiresShippingMethod { get; set; } + + public bool TrackingSupport { get; set; } + + public Format Format { get; set; } + } +} diff --git a/PartSource.Entities/Shopify/InventoryPolicy.cs b/PartSource.Entities/Shopify/InventoryPolicy.cs new file mode 100644 index 0000000..850f824 --- /dev/null +++ b/PartSource.Entities/Shopify/InventoryPolicy.cs @@ -0,0 +1,14 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Shopify.InventoryPolicy +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +namespace PartSource.Entities.Shopify +{ + public enum InventoryPolicy + { + Deny, + Continue, + } +} diff --git a/PartSource.Entities/Shopify/Metafield.cs b/PartSource.Entities/Shopify/Metafield.cs new file mode 100644 index 0000000..d13a5f6 --- /dev/null +++ b/PartSource.Entities/Shopify/Metafield.cs @@ -0,0 +1,21 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Shopify.Metafield +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +namespace PartSource.Entities.Shopify +{ + public class Metafield + { + public string Description { get; set; } + + public string Key { get; set; } + + public string Namespace { get; set; } + + public string Value { get; set; } + + public ValueType ValueType { get; set; } + } +} diff --git a/PartSource.Entities/Shopify/Product.cs b/PartSource.Entities/Shopify/Product.cs new file mode 100644 index 0000000..bce0c6f --- /dev/null +++ b/PartSource.Entities/Shopify/Product.cs @@ -0,0 +1,41 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Shopify.Product +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System; + +namespace PartSource.Entities.Shopify +{ + public class Product : BaseShopifyModel + { + public string BodyHtml { get; set; } + + public string Handle { get; set; } + + public string MetafieldsGlobalTitleTag { get; set; } + + public string MetafieldsGlobalDescriptionTag { get; set; } + + public string ProductType { get; set; } + + public string Tags { get; set; } + + public string TemplateSuffix { get; set; } + + public string Title { get; set; } + + public string Vendor { get; set; } + + public bool Published { get; set; } + + public DateTime? PublishedAt { get; set; } + + public ProductImage[] Images { get; set; } + + public ProductVariant[] Variants { get; set; } + + public PartSource.Entities.Shopify.PublishedScope? PublishedScope { get; set; } + } +} diff --git a/PartSource.Entities/Shopify/ProductImage.cs b/PartSource.Entities/Shopify/ProductImage.cs new file mode 100644 index 0000000..91bc782 --- /dev/null +++ b/PartSource.Entities/Shopify/ProductImage.cs @@ -0,0 +1,23 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Shopify.ProductImage +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +namespace PartSource.Entities.Shopify +{ + public class ProductImage : BaseShopifyModel + { + public int Height { get; set; } + + public int Position { get; set; } + + public int Width { get; set; } + + public long ProductId { get; set; } + + public long[] VariantIds { get; set; } + + public string Src { get; set; } + } +} diff --git a/PartSource.Entities/Shopify/ProductVariant.cs b/PartSource.Entities/Shopify/ProductVariant.cs new file mode 100644 index 0000000..0506857 --- /dev/null +++ b/PartSource.Entities/Shopify/ProductVariant.cs @@ -0,0 +1,49 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Shopify.ProductVariant +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +using System; + +namespace PartSource.Entities.Shopify +{ + public class ProductVariant : BaseShopifyModel + { + public long ImageId { get; set; } + + public long InventoryItemId { get; set; } + + public long ProductId { get; set; } + + public int Position { get; set; } + + public bool RequiresShipping { get; set; } + + public bool Taxable { get; set; } + + public Decimal CompareAtPrice { get; set; } + + public Decimal Price { get; set; } + + public double Grams { get; set; } + + public double Weight { get; set; } + + public string Barcode { get; set; } + + public string Sku { get; set; } + + public string Title { get; set; } + + public string FulfillmentService { get; set; } + + public string InventoryManagement { get; set; } + + public Metafield[] Metafields { get; set; } + + public string InventoryPolicy { get; set; } + + public string WeightUnit { get; set; } + } +} diff --git a/PartSource.Entities/Shopify/PublishedScope.cs b/PartSource.Entities/Shopify/PublishedScope.cs new file mode 100644 index 0000000..909f390 --- /dev/null +++ b/PartSource.Entities/Shopify/PublishedScope.cs @@ -0,0 +1,14 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Shopify.PublishedScope +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +namespace PartSource.Entities.Shopify +{ + public enum PublishedScope + { + Global, + Web, + } +} diff --git a/PartSource.Entities/Shopify/ValueType.cs b/PartSource.Entities/Shopify/ValueType.cs new file mode 100644 index 0000000..8883cb9 --- /dev/null +++ b/PartSource.Entities/Shopify/ValueType.cs @@ -0,0 +1,14 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Shopify.ValueType +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +namespace PartSource.Entities.Shopify +{ + public enum ValueType + { + Integer, + String, + } +} diff --git a/PartSource.Entities/Shopify/WeightUnit.cs b/PartSource.Entities/Shopify/WeightUnit.cs new file mode 100644 index 0000000..579e26d --- /dev/null +++ b/PartSource.Entities/Shopify/WeightUnit.cs @@ -0,0 +1,16 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Entities.Shopify.WeightUnit +// Assembly: PartSource.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 3EDAB3F5-83E7-4F65-906E-B40192014C57 +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.Entities.dll + +namespace PartSource.Entities.Shopify +{ + public enum WeightUnit + { + G, + Kg, + Oz, + Lb, + } +} diff --git a/PartSource.Entities/SqlServerTypes/Loader.cs b/PartSource.Entities/SqlServerTypes/Loader.cs new file mode 100644 index 0000000..ce606cf --- /dev/null +++ b/PartSource.Entities/SqlServerTypes/Loader.cs @@ -0,0 +1,45 @@ +using System; +using System.IO; +using System.Runtime.InteropServices; + +namespace SqlServerTypes +{ + /// + /// Utility methods related to CLR Types for SQL Server + /// + public class Utilities + { + [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] + private static extern IntPtr LoadLibrary(string libname); + + /// + /// Loads the required native assemblies for the current architecture (x86 or x64) + /// + /// + /// Root path of the current application. Use Server.MapPath(".") for ASP.NET applications + /// and AppDomain.CurrentDomain.BaseDirectory for desktop applications. + /// + public static void LoadNativeAssemblies(string rootApplicationPath) + { + var nativeBinaryPath = IntPtr.Size > 4 + ? Path.Combine(rootApplicationPath, @"SqlServerTypes\x64\") + : Path.Combine(rootApplicationPath, @"SqlServerTypes\x86\"); + + LoadNativeAssembly(nativeBinaryPath, "msvcr120.dll"); + LoadNativeAssembly(nativeBinaryPath, "SqlServerSpatial140.dll"); + } + + private static void LoadNativeAssembly(string nativeBinaryPath, string assemblyName) + { + var path = Path.Combine(nativeBinaryPath, assemblyName); + var ptr = LoadLibrary(path); + if (ptr == IntPtr.Zero) + { + throw new Exception(string.Format( + "Error loading {0} (ErrorCode: {1})", + assemblyName, + Marshal.GetLastWin32Error())); + } + } + } +} \ No newline at end of file diff --git a/PartSource.Entities/SqlServerTypes/readme.htm b/PartSource.Entities/SqlServerTypes/readme.htm new file mode 100644 index 0000000..02d9ac8 --- /dev/null +++ b/PartSource.Entities/SqlServerTypes/readme.htm @@ -0,0 +1,61 @@ + + + + Microsoft.SqlServer.Types + + + +
+

Action required to load native assemblies

+

+ To deploy an application that uses spatial data types to a machine that does not have 'System CLR Types for SQL Server' installed you also need to deploy the native assembly SqlServerSpatial140.dll. Both x86 (32 bit) and x64 (64 bit) versions of this assembly have been added to your project under the SqlServerTypes\x86 and SqlServerTypes\x64 subdirectories. The native assembly msvcr120.dll is also included in case the C++ runtime is not installed. +

+

+ You need to add code to load the correct one of these assemblies at runtime (depending on the current architecture). +

+

ASP.NET Web Sites

+

+ For ASP.NET Web Sites, add the following block of code to the code behind file of the Web Form where you have added Report Viewer Control: +

+    Default.aspx.cs:
+        
+    public partial class _Default : System.Web.UI.Page
+    {
+        static bool _isSqlTypesLoaded = false;
+
+        public _Default()
+        {
+            if (!_isSqlTypesLoaded)
+            {
+                SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("~"));
+                _isSqlTypesLoaded = true;
+            }
+            
+        }
+    }
+
+

+

ASP.NET Web Applications

+

+ For ASP.NET Web Applications, add the following line of code to the Application_Start method in Global.asax.cs: +

    SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("~/bin"));
+

+

Desktop Applications

+

+ For desktop applications, add the following line of code to run before any spatial operations are performed: +

    SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);
+

+
+ + \ No newline at end of file diff --git a/PartSource.Entities/packages.config b/PartSource.Entities/packages.config new file mode 100644 index 0000000..faf7a8e --- /dev/null +++ b/PartSource.Entities/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/PartSource.Services/Integrations/ShopifyClient.cs b/PartSource.Services/Integrations/ShopifyClient.cs new file mode 100644 index 0000000..5667329 --- /dev/null +++ b/PartSource.Services/Integrations/ShopifyClient.cs @@ -0,0 +1,22 @@ +using PartSource.Data.Shopify; +using Ratermania.Shopify; +using System; +using System.Collections.Generic; +using System.Text; + +namespace PartSource.Services.Integrations +{ + public class ShopifyClient : BaseShopifyClient + { + public ShopifyClient(ShopifyOptionsBuilder optionsBuilder) : base(optionsBuilder) { } + + public ShopifyResource Products { get; set; } + + public ShopifyResource Metafields { get; set; } + + //public ShopifyResource SmartCollections { get; set; } + + public ShopifyResource ProductImages { get; set; } + } +} + diff --git a/PartSource.Services/NexpartService.cs b/PartSource.Services/NexpartService.cs new file mode 100644 index 0000000..e2c7c25 --- /dev/null +++ b/PartSource.Services/NexpartService.cs @@ -0,0 +1,43 @@ +using PartSource.Data.Nexpart; +using System; +using System.Configuration; +using System.IO; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Serialization; + +namespace PartSource.Services +{ + public class NexpartService + { + public async Task SendRequest(T requestContent) + { + Envelope envelope = new Envelope(); + envelope.Body.Content = (object)(T)requestContent; + XmlSerializer serializer = new XmlSerializer(typeof(Envelope)); + StringBuilder sb = new StringBuilder(); + using (TextWriter textWriter = (TextWriter)new StringWriter(sb)) + serializer.Serialize(textWriter, (object)envelope); + U content; + using (HttpClient client = new HttpClient()) + { + client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", "QUZBNUNDMTQzMUNENDNEQ0E2NjNDMTdCREFEODUwQkItQzhGNUJERjlBMDlDNDQ2NEE2NjczMUNBNDQyN0NCQjk6N0FCMzU3NjYtMDM3OS00REYwLTk2NjUtREFFRTEzODIyRjQz"); + try + { + //HttpResponseMessage response = await client.PostAsync(ConfigurationManager.AppSettings["NexpartUrl"], (HttpContent)new StringContent(sb.ToString(), Encoding.UTF8, "text/xml")); + HttpResponseMessage response = await client.PostAsync("http://acespssint.nexpart.com:4001/partselect/1.0/services/PartSelectService.PartSelectHttpSoap11Endpoint/", (HttpContent)new StringContent(sb.ToString(), Encoding.UTF8, "text/xml")); + Stream result = await response.Content.ReadAsStreamAsync(); + string str = await response.Content.ReadAsStringAsync(); + content = (U)((Envelope)serializer.Deserialize(result)).Body.Content; + } + catch (Exception ex) + { + throw; + } + } + return content; + } + } +} diff --git a/PartSource.Services/PartService.cs b/PartSource.Services/PartService.cs new file mode 100644 index 0000000..3ef3128 --- /dev/null +++ b/PartSource.Services/PartService.cs @@ -0,0 +1,45 @@ +using PartSource.Data; +using PartSource.Data.Dtos; +using PartSource.Data.Models; +using System.Collections.Generic; +using System.Linq; + +namespace PartSource.Services +{ + public class PartService + { + private readonly PartSourceContext _context; + + public PartService(PartSourceContext context) + { + _context = context; + } + + public Part GetPart(string partNumber, string lineCode) + { + return _context.Parts.FirstOrDefault(p => p.PartNumber == partNumber && p.Manufacturer.LineCode == lineCode); + } + + public Part GetPart(int sku) + { + return _context.Parts.FirstOrDefault(p => p.Sku == sku); + } + + public PartsAvailability GetInventory(int sku, int storeNumber) + { + return _context.PartAvailabilities.FirstOrDefault(s => s.Store == storeNumber && s.SKU == sku); + } + + public IList GetFitments(FitmentSearchDto fitmentSearchDto) + { + return null; + + //return _context.Fitments.Where(f => + // f.ManufacturerCode == fitmentSearchDto.ManufacturerCode && + // f.PartNumber == fitmentSearchDto.PartNumber && + // f.BaseVehicleId == fitmentSearchDto.BaseVehicleId && + // f.EngineConfigId == fitmentSearchDto.EngineConfigId + //).ToList(); + } + } +} diff --git a/PartSource.Services/PartSource.Services.csproj b/PartSource.Services/PartSource.Services.csproj new file mode 100644 index 0000000..764eb56 --- /dev/null +++ b/PartSource.Services/PartSource.Services.csproj @@ -0,0 +1,23 @@ + + + + netcoreapp3.1 + Debug;Release;Also Debug + + + + + + + + + + + + + + PreserveNewest + + + + diff --git a/PartSource.Services/SecurityService.cs b/PartSource.Services/SecurityService.cs new file mode 100644 index 0000000..e119521 --- /dev/null +++ b/PartSource.Services/SecurityService.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore; +using PartSource.Data; +using PartSource.Data.Models; +using System.Threading.Tasks; + +namespace PartSource.Services +{ + public class SecurityService + { + private readonly PartSourceContext _context; + + public SecurityService(PartSourceContext context) + { + _context = context; + } + + public async Task GetApiClientByKeyAsync(string key) + { + return await _context.ApiClients.FirstOrDefaultAsync(c => c.Key == key); + } + } +} diff --git a/PartSource.Services/VehicleService.cs b/PartSource.Services/VehicleService.cs new file mode 100644 index 0000000..a842999 --- /dev/null +++ b/PartSource.Services/VehicleService.cs @@ -0,0 +1,137 @@ +using Microsoft.EntityFrameworkCore; +using PartSource.Data; +using PartSource.Data.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; + +namespace PartSource.Services +{ + public class VehicleService + { + private readonly PartSourceContext _partSourceContext; + + public VehicleService(PartSourceContext partSourceContext) + { + _partSourceContext = partSourceContext; + } + + public async Task> GetAllMakes() + { + return await _partSourceContext.VehicleMakes.ToListAsync(); + } + + public async Task> GetModels(int makeId, int year) + { + return await _partSourceContext.VehicleData.Where(d => + d.MakeId == makeId + && d.Year == year + ) + .ToListAsync(); + } + + public async Task> GetBaseVehicles(int makeId, int modelId, int year) + { + return await _partSourceContext.BaseVehicles.Where(d => + d.MakeId == makeId + && d.ModelId == modelId + && d.Year == year + ) + .ToListAsync(); + } + + public async Task> GetEngines(int baseVehicleId) + { + return await _partSourceContext.Engines.Where(e => e.BaseVehicleId == baseVehicleId).ToListAsync(); + } + + public async Task> GetEngines(int baseVehicleId, int submodelId) + { + return await _partSourceContext.Engines.Where(e => + e.BaseVehicleId == baseVehicleId + && e.SubmodelId == submodelId + ) + .ToListAsync(); + } + + public async Task> GetSubmodels(int makeId, int modelId, int year) + { + return await _partSourceContext.Submodels.Where(s => + s.MakeId == makeId + && s.ModelId == modelId + && s.Year == modelId + ) + .ToListAsync(); + } + + public async Task GetVehicle(int baseVehicleId, int engineConfigId, int submodelId) + { + return await _partSourceContext.VehicleData.FirstOrDefaultAsync(d => + d.BaseVehicleId == baseVehicleId + && d.EngineConfigId == engineConfigId + && d.SubmodelId == submodelId + ); + } + + public IList GetYmmFitment(IList vehicles) + { + if (vehicles.Count == 0) + { + return null; + } + + IList fitmentTags = new List(); + + IList makeModels = vehicles.Select(v => $"{v.MakeName},{v.ModelName}").Distinct().ToList(); + + foreach (string makeModel in makeModels) + { + string make = makeModel.Split(',')[0]; + string model = makeModel.Split(',')[1]; + + List years = vehicles + .Where(v => v.MakeName == make && v.ModelName == model) + .OrderBy(v => v.Year) + .Select(v => v.Year.HasValue ? v.Year.Value.ToString().Trim() : string.Empty) + .Distinct() + .ToList(); + + string tag = $"{string.Join('-', years)} {make.Trim()} {model.Trim()}"; + + Console.WriteLine(tag); + + fitmentTags.Add(tag); + } + + return fitmentTags; + } + + + public IList GetVehicleIdFitment(IList vehicles) + { + return vehicles.Select(v => v.VehicleToEngineConfigId).ToArray(); + } + + public IList GetVehiclesForPart(string partNumber, string lineCode) + { + partNumber = Regex.Replace(partNumber, "[^a-zA-Z0-9]", string.Empty); + + IQueryable whiCodes = _partSourceContext.DcfMappings + .Where(d => d.LineCode == lineCode) + .Select(d => d.WhiCode); + + IQueryable vehicles = _partSourceContext.Fitments + .Where(f => f.PartNumber == partNumber && whiCodes.Contains(f.LineCode)) + .Join(_partSourceContext.VehicleData, + f => new { f.BaseVehicleId, f.EngineConfigId }, + v => new { v.BaseVehicleId, v.EngineConfigId }, + (f, v) => v); + + return vehicles.ToList(); + } + } +} + diff --git a/PartSource.Services/appsettings.json b/PartSource.Services/appsettings.json new file mode 100644 index 0000000..c48779c --- /dev/null +++ b/PartSource.Services/appsettings.json @@ -0,0 +1,22 @@ +{ + "ConnectionStrings": { + //"PartSourceDatabase": "Server=(localdb)\\mssqllocaldb;Database=PartSource;Trusted_Connection=True;" + "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;" + }, + "emailConfiguration": { + + "From": "alerts@ps-shopify.canadaeast.cloudapp.azure.com", + // "To": "tom@soundpress.com,Anas.Bajwa@Partsource.ca", + "To": "tommy@localhost", + "SmtpHost": "localhost" + }, + "ftpConfiguration": { + "Username": "ps-ftp\\$ps-ftp", + "Password": "ycvXptffBxqkBXW4vuRYqn4Zi1soCvnvMMolTe5HNSeAlcl3bAyJYtNhG579", + "Url": "ftp://waws-prod-yq1-007.ftp.azurewebsites.windows.net/site/wwwroot", + "Destination": "C:\\Users\\soundpress\\Desktop" + }, + "ssisConfiguration": { + "Directory": "c:\\users\\soundpress\\desktop" + } +} \ No newline at end of file diff --git a/PartSource.sln b/PartSource.sln new file mode 100644 index 0000000..dc735a2 --- /dev/null +++ b/PartSource.sln @@ -0,0 +1,60 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29613.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PartSource.Api", "PartSource.Api\PartSource.Api.csproj", "{126B8961-1D86-4F73-9BB9-79ECE78E9257}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PartSource.Data", "PartSource.Data\PartSource.Data.csproj", "{B4848BCD-6BCC-44BD-AD6E-38511AEC1851}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PartSource.Services", "PartSource.Services\PartSource.Services.csproj", "{2E7BCDF6-643E-405A-A69A-4907DF5491AF}" +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\shopify\Shopify\Shopify.csproj", "{344CF7B1-AC28-43DD-B0E3-34A87EC835E5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Also Debug|Any CPU = Also Debug|Any CPU + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {126B8961-1D86-4F73-9BB9-79ECE78E9257}.Also Debug|Any CPU.ActiveCfg = Also Debug|Any CPU + {126B8961-1D86-4F73-9BB9-79ECE78E9257}.Also Debug|Any CPU.Build.0 = Also Debug|Any CPU + {126B8961-1D86-4F73-9BB9-79ECE78E9257}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {126B8961-1D86-4F73-9BB9-79ECE78E9257}.Debug|Any CPU.Build.0 = Debug|Any CPU + {126B8961-1D86-4F73-9BB9-79ECE78E9257}.Release|Any CPU.ActiveCfg = Release|Any CPU + {126B8961-1D86-4F73-9BB9-79ECE78E9257}.Release|Any CPU.Build.0 = Release|Any CPU + {B4848BCD-6BCC-44BD-AD6E-38511AEC1851}.Also Debug|Any CPU.ActiveCfg = Also Debug|Any CPU + {B4848BCD-6BCC-44BD-AD6E-38511AEC1851}.Also Debug|Any CPU.Build.0 = Also Debug|Any CPU + {B4848BCD-6BCC-44BD-AD6E-38511AEC1851}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B4848BCD-6BCC-44BD-AD6E-38511AEC1851}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B4848BCD-6BCC-44BD-AD6E-38511AEC1851}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B4848BCD-6BCC-44BD-AD6E-38511AEC1851}.Release|Any CPU.Build.0 = Release|Any CPU + {2E7BCDF6-643E-405A-A69A-4907DF5491AF}.Also Debug|Any CPU.ActiveCfg = Also Debug|Any CPU + {2E7BCDF6-643E-405A-A69A-4907DF5491AF}.Also Debug|Any CPU.Build.0 = Also Debug|Any CPU + {2E7BCDF6-643E-405A-A69A-4907DF5491AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2E7BCDF6-643E-405A-A69A-4907DF5491AF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2E7BCDF6-643E-405A-A69A-4907DF5491AF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2E7BCDF6-643E-405A-A69A-4907DF5491AF}.Release|Any CPU.Build.0 = Release|Any CPU + {C85D675B-A76C-4F9C-9C57-1E063211C946}.Also Debug|Any CPU.ActiveCfg = Also Debug|Any CPU + {C85D675B-A76C-4F9C-9C57-1E063211C946}.Also Debug|Any CPU.Build.0 = Also Debug|Any CPU + {C85D675B-A76C-4F9C-9C57-1E063211C946}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C85D675B-A76C-4F9C-9C57-1E063211C946}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C85D675B-A76C-4F9C-9C57-1E063211C946}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C85D675B-A76C-4F9C-9C57-1E063211C946}.Release|Any CPU.Build.0 = Release|Any CPU + {344CF7B1-AC28-43DD-B0E3-34A87EC835E5}.Also Debug|Any CPU.ActiveCfg = Debug|Any CPU + {344CF7B1-AC28-43DD-B0E3-34A87EC835E5}.Also Debug|Any CPU.Build.0 = Debug|Any CPU + {344CF7B1-AC28-43DD-B0E3-34A87EC835E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {344CF7B1-AC28-43DD-B0E3-34A87EC835E5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {344CF7B1-AC28-43DD-B0E3-34A87EC835E5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {344CF7B1-AC28-43DD-B0E3-34A87EC835E5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {748B86B2-06ED-42A2-A8F8-D2461B8D747B} + EndGlobalSection +EndGlobal diff --git a/PartSource/App.config b/PartSource/App.config new file mode 100644 index 0000000..86aa9da --- /dev/null +++ b/PartSource/App.config @@ -0,0 +1,29 @@ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PartSource/App_Start/FilterConfig.cs b/PartSource/App_Start/FilterConfig.cs new file mode 100644 index 0000000..f4b8095 --- /dev/null +++ b/PartSource/App_Start/FilterConfig.cs @@ -0,0 +1,12 @@ +using System.Web.Mvc; + +namespace PartSource +{ + public class FilterConfig + { + public static void RegisterGlobalFilters(GlobalFilterCollection filters) + { + filters.Add(new HandleErrorAttribute()); + } + } +} diff --git a/PartSource/App_Start/NinjectWebCommon.cs b/PartSource/App_Start/NinjectWebCommon.cs new file mode 100644 index 0000000..37b3d4a --- /dev/null +++ b/PartSource/App_Start/NinjectWebCommon.cs @@ -0,0 +1,56 @@ +using Microsoft.Web.Infrastructure.DynamicModuleHelper; +using Ninject; +using Ninject.Activation; +using Ninject.Modules; +using Ninject.Web.Common; +using Ninject.Web.Common.WebHost; +using PartSource.Entities; +using PartSource.Entities.Nexpart; +using PartSource.Services; +using System; +using System.Web; + +namespace PartSource +{ + public static class NinjectWebCommon + { + private static readonly Bootstrapper bootstrapper = new Bootstrapper(); + + public static void Start() + { + DynamicModuleUtility.RegisterModule(typeof(OnePerRequestHttpModule)); + DynamicModuleUtility.RegisterModule(typeof(NinjectHttpModule)); + NinjectWebCommon.bootstrapper.Initialize(new Func(NinjectWebCommon.CreateKernel)); + } + + public static void Stop() + { + NinjectWebCommon.bootstrapper.ShutDown(); + } + + private static IKernel CreateKernel() + { + StandardKernel standardKernel = new StandardKernel(Array.Empty()); + try + { + standardKernel.Bind>().ToMethod((Func>)(ctx => (Func)(() => new Bootstrapper().Kernel))); + standardKernel.Bind().To(); + NinjectWebCommon.RegisterServices((IKernel)standardKernel); + return (IKernel)standardKernel; + } + catch + { + standardKernel.Dispose(); + throw; + } + } + + private static void RegisterServices(IKernel kernel) + { + kernel.Bind().To(); + kernel.Bind().To(); + kernel.Bind().To(); + kernel.Bind().To(); + } + } +} diff --git a/PartSource/App_Start/WebApiConfig.cs b/PartSource/App_Start/WebApiConfig.cs new file mode 100644 index 0000000..cd02173 --- /dev/null +++ b/PartSource/App_Start/WebApiConfig.cs @@ -0,0 +1,27 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.WebApiConfig +// Assembly: PartSource, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 9C95A003-DAA7-4079-9F59-D1FC80E1666C +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.dll + +using System.Net.Http.Formatting; +using System.Net.Http.Headers; +using System.Web.Http; + +namespace PartSource +{ + public static class WebApiConfig + { + public static void Register(HttpConfiguration config) + { + HttpConfigurationExtensions.MapHttpAttributeRoutes(config); + HttpRouteCollectionExtensions.MapHttpRoute(config.Routes, "DefaultApi", "{controller}/{id}", new + { + id = RouteParameter.Optional + }); + + config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("application/json")); + config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html")); + } + } +} diff --git a/PartSource/AssemblyInfo.cs b/PartSource/AssemblyInfo.cs new file mode 100644 index 0000000..b85d0ab --- /dev/null +++ b/PartSource/AssemblyInfo.cs @@ -0,0 +1,18 @@ +using PartSource; +using System.Reflection; +using System.Runtime.InteropServices; +using WebActivatorEx; + +[assembly: PreApplicationStartMethod(typeof (NinjectWebCommon), "Start")] +[assembly: ApplicationShutdownMethod(typeof (NinjectWebCommon), "Stop")] +[assembly: AssemblyTitle("CanadianTire")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CanadianTire")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: ComVisible(false)] +[assembly: Guid("ab430735-adfd-42b5-bce1-55f18897a618")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.0.0.0")] diff --git a/PartSource/Controllers/BaseNexpartController.cs b/PartSource/Controllers/BaseNexpartController.cs new file mode 100644 index 0000000..7118226 --- /dev/null +++ b/PartSource/Controllers/BaseNexpartController.cs @@ -0,0 +1,47 @@ +// Decompiled with JetBrains decompiler +// Type: PartSource.Controllers.BaseNexpartController +// Assembly: PartSource, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// MVID: 9C95A003-DAA7-4079-9F59-D1FC80E1666C +// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.dll + +using PartSource.Entities.Nexpart; +using PartSource.Entities.Nexpart.Interfaces; +using System; +using System.Net; +using System.Web.Http; + +namespace PartSource.Controllers +{ + public class BaseNexpartController : ApiController + { + public IHttpActionResult NexpartResponse(T response) where T : IResponseElement + { + try + { + Exceptions[] exceptions = response.PSResponseHeader.Exceptions; + if ((exceptions != null ? ((uint)exceptions.Length > 0U ? 1 : 0) : 0) == 0) + return Ok(new + { + Data = response.ResponseBody + }); + string empty = string.Empty; + foreach (Exceptions exception in response.PSResponseHeader.Exceptions) + empty += string.Format("{0}\n", (object)exception.Value); + return (IHttpActionResult)this.Content(HttpStatusCode.BadRequest, new + { + Data = response.ResponseBody + }); + } + + catch (Exception ex) + { + return (IHttpActionResult)this.Content(HttpStatusCode.InternalServerError, new + { + Message = ex.Message + }); + } + } + + + } +} diff --git a/PartSource/Controllers/InventoryController.cs b/PartSource/Controllers/InventoryController.cs new file mode 100644 index 0000000..b58262b --- /dev/null +++ b/PartSource/Controllers/InventoryController.cs @@ -0,0 +1,38 @@ +using PartSource.Entities.Models; +using PartSource.Services; +using System.Net; +using System.Threading.Tasks; +using System.Web.Http; + +namespace PartSource.Controllers +{ + [RoutePrefix("inventory")] + public class InventoryController : BaseNexpartController + { + private readonly InventoryService _inventoryService; + + public InventoryController(InventoryService inventoryService) + { + _inventoryService = inventoryService; + } + + [HttpGet] + [Route("sku/{sku}/storeNumber/{storeNumber}")] + public async Task GetInventory(int sku, int storeNumber) + { + ps_parts_availability inventory = _inventoryService.GetInventory(sku, storeNumber); + + return inventory == null + ? Content(HttpStatusCode.NotFound, $"No part matching SKU {sku} was found.") + : (IHttpActionResult)Ok(new + { + data = new + { + StoreNumber = inventory.Store, + Sku = sku, + Quantity = inventory.QTY + } + }); + } + } +} diff --git a/PartSource/Controllers/PartsController.cs b/PartSource/Controllers/PartsController.cs new file mode 100644 index 0000000..dcfd71b --- /dev/null +++ b/PartSource/Controllers/PartsController.cs @@ -0,0 +1,71 @@ +using PartSource.Entities.Nexpart; +using PartSource.Services; +using System.Threading.Tasks; +using System.Web.Http; + +namespace PartSource.Controllers +{ + [RoutePrefix("parts")] + public class PartsController : BaseNexpartController + { + private readonly NexpartService _nexpartService; + + public PartsController(NexpartService nexpartService) + { + this._nexpartService = nexpartService; + } + + [HttpGet] + [Route("PartNumber/{partNumber}/LineCode/{lineCode}")] + public IHttpActionResult GetPart(string partNumber, string lineCode) + { + new SmartPageDataSearch().Items = new Item[1] + { + new Item() + { + PartNumber = partNumber.ToUpperInvariant(), + MfrCode = lineCode.ToUpperInvariant() + } + }; + return (IHttpActionResult)this.Ok(); + } + + [HttpGet] + [Route("search/basevehicleid/{baseVehicleId}")] + public async Task Search(uint baseVehicleId, [FromUri] string query) + { + PartsController partsController = this; + PartTypeSearch requestContent = new PartTypeSearch() + { + SearchString = query, + SearchType = "ALL", + SearchOptions = "PARTIAL_MATCH", + VehicleIdentifier = new VehicleIdentifier() + { + BaseVehicleId = baseVehicleId + } + }; + PartTypeSearchResponse response = await partsController._nexpartService.SendRequest(requestContent); + return partsController.NexpartResponse(response); + } + + [HttpGet] + [Route("validate/partTypeId/{partTypeId}/baseVehicleId/{baseVehicleId}")] + public async Task ValidatePartFitment(uint partTypeId, uint baseVehicleId) + { + PartsController partsController = this; + PartTypesValidateLookup typesValidateLookup = new PartTypesValidateLookup(); + typesValidateLookup.PartTypes = new PartType[1] + { + new PartType() { Id = partTypeId } + }; + typesValidateLookup.VehicleIdentifier = new VehicleIdentifier() + { + BaseVehicleId = baseVehicleId + }; + PartTypesValidateLookup requestContent = typesValidateLookup; + PartTypesValidateLookupResponse response = await partsController._nexpartService.SendRequest(requestContent); + return partsController.NexpartResponse(response); + } + } +} diff --git a/PartSource/Controllers/SearchController.cs b/PartSource/Controllers/SearchController.cs new file mode 100644 index 0000000..b275534 --- /dev/null +++ b/PartSource/Controllers/SearchController.cs @@ -0,0 +1,31 @@ +using PartSource.Entities.Nexpart; +using PartSource.Services; +using System.Threading.Tasks; +using System.Web.Http; + +namespace PartSource.Controllers +{ + [RoutePrefix("search")] + public class SearchController : BaseNexpartController + { + private readonly NexpartService _nexpartService; + + public SearchController() + { + this._nexpartService = new NexpartService(); + } + + [HttpGet] + [Route("makes/vehicletypeid/{vehicleTypeId}")] + public async Task GetMakes(uint vehicleTypeId) + { + SearchController searchController = this; + MakeSearch requestContent = new MakeSearch() + { + VehicleTypeId = new uint[1] { vehicleTypeId } + }; + MakeSearchResponse response = await searchController._nexpartService.SendRequest(requestContent); + return searchController.NexpartResponse(response); + } + } +} diff --git a/PartSource/Controllers/StoresController.cs b/PartSource/Controllers/StoresController.cs new file mode 100644 index 0000000..787ad7f --- /dev/null +++ b/PartSource/Controllers/StoresController.cs @@ -0,0 +1,46 @@ +using PartSource.Entities.Models; +using PartSource.Services; +using System.Web.Http; + +namespace PartSource.Controllers +{ + [RoutePrefix("stores")] + public class StoresController : ApiController + { + private const int Count = 5; + private const int Page = 1; + private readonly LocationService _service; + + public StoresController(LocationService service) + { + this._service = service; + } + + [HttpGet] + [Route("nearest/{postal}")] + [Route("nearest/{postal}/count/{count}")] + [Route("nearest/{postal}/count/{count}/page/{page}")] + public IHttpActionResult GetNearestStores(string postal, int count = 5, int page = 1) + { + PostalCode postalCodeData = this._service.GetPostalCodeData(postal); + if (postalCodeData == null) + return (IHttpActionResult)this.BadRequest("Invalid postal code"); + return (IHttpActionResult)this.Ok(new + { + Data = this._service.GetClosestLocations(postalCodeData, count, page) + }); + } + + [HttpGet] + [Route("nearest/{postal}/radius/{radius}")] + [Route("nearest/{postal}/radius/{radius}/count/{count}")] + [Route("nearest/{postal}/radius/{radius}/count/{count}/page/{page}")] + public IHttpActionResult GetNearestStores(string postal, double radius, int count = 5, int page = 1) + { + return (IHttpActionResult)this.Ok(new + { + Data = this._service.GetClosestLocations(this._service.GetPostalCodeData(postal), count, page, radius) + }); + } + } +} diff --git a/PartSource/Controllers/VehiclesController.cs b/PartSource/Controllers/VehiclesController.cs new file mode 100644 index 0000000..7d70d76 --- /dev/null +++ b/PartSource/Controllers/VehiclesController.cs @@ -0,0 +1,114 @@ +using PartSource.Entities.Nexpart; +using PartSource.Services; +using System.Threading.Tasks; +using System.Web.Http; + +namespace PartSource.Controllers +{ + [RoutePrefix("vehicles")] + public class VehiclesController : BaseNexpartController + { + private readonly NexpartService _nexpartService; + + public VehiclesController(NexpartService nexpartService) + { + this._nexpartService = nexpartService; + } + + [HttpGet] + [Route("types")] + public async Task GetVehicleTypes() + { + VehiclesController vehiclesController = this; + VehicleTypesGetResponse response = await vehiclesController._nexpartService.SendRequest(new VehicleTypesGet()); + return vehiclesController.NexpartResponse(response); + } + + [HttpGet] + [Route("makes")] + public async Task GetMakes() + { + VehiclesController vehiclesController = this; + MakeSearch requestContent = new MakeSearch() + { + VehicleTypeId = new uint[3] { 5U, 6U, 7U } + }; + MakeSearchResponse response = await vehiclesController._nexpartService.SendRequest(requestContent); + return vehiclesController.NexpartResponse(response); + } + + [HttpGet] + [Route("makes/vehicletypeid/{vehicleTypeId}")] + public async Task GetMakes(uint vehicleTypeId) + { + VehiclesController vehiclesController = this; + MakeSearch requestContent = new MakeSearch() + { + VehicleTypeId = new uint[1] { vehicleTypeId } + }; + MakeSearchResponse response = await vehiclesController._nexpartService.SendRequest(requestContent); + return vehiclesController.NexpartResponse(response); + } + + [HttpGet] + [Route("models/makeid/{makeId}/modelyear/{year}")] + public async Task GetModels(uint makeId, uint year) + { + VehiclesController vehiclesController = this; + ModelSearch requestContent = new ModelSearch() + { + MakeId = makeId, + Year = year, + VehicleTypeId = new uint[3] { 5U, 6U, 7U } + }; + ModelSearchResponse response = await vehiclesController._nexpartService.SendRequest(requestContent); + return vehiclesController.NexpartResponse(response); + } + + [HttpGet] + [Route("models/makeid/{makeId}/modelyear/{year}/vehicletypeid/{vehicleTypeId}")] + public async Task GetModels(uint makeId, uint year, uint vehicleTypeId) + { + VehiclesController vehiclesController = this; + ModelSearch requestContent = new ModelSearch() + { + MakeId = makeId, + Year = year, + VehicleTypeId = new uint[1] { vehicleTypeId } + }; + ModelSearchResponse response = await vehiclesController._nexpartService.SendRequest(requestContent); + return vehiclesController.NexpartResponse(response); + } + + [HttpGet] + [Route("basevehicle/makeid/{makeId}/modelid/{modelId}/modelyear/{year}")] + public async Task GetBaseVehicle(uint makeId, uint modelId, uint year) + { + VehiclesController vehiclesController = this; + BaseVehicleDetailLookup requestContent = new BaseVehicleDetailLookup() + { + MakeId = makeId, + ModelId = modelId, + Year = year + }; + BaseVehicleDetailLookupResponse response = await vehiclesController._nexpartService.SendRequest(requestContent); + return vehiclesController.NexpartResponse(response); + } + + [HttpGet] + [Route("engines/basevehicleid/{baseVehicleId}")] + public async Task GetEngines(uint baseVehicleId) + { + VehiclesController vehiclesController = this; + EngineSearch requestContent = new EngineSearch() + { + VehicleIdentifier = new VehicleIdentifier() + { + BaseVehicleId = baseVehicleId + } + }; + EngineSearchResponse response = await vehiclesController._nexpartService.SendRequest(requestContent); + return vehiclesController.NexpartResponse(response); + } + } +} diff --git a/PartSource/Filters/HmacAuthenticationAttribute.cs b/PartSource/Filters/HmacAuthenticationAttribute.cs new file mode 100644 index 0000000..d5edd5f --- /dev/null +++ b/PartSource/Filters/HmacAuthenticationAttribute.cs @@ -0,0 +1,100 @@ +using Ninject; +using Ninject.Modules; +using Ninject.Parameters; +using PartSource.Entities.Models; +using PartSource.Services; +using System; +using System.Configuration; +using System.Net; +using System.Net.Http; +using System.Security.Cryptography; +using System.Security.Principal; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Web.Http; +using System.Web.Http.Filters; + +namespace PartSource.Filters +{ + public class HmacAuthenticationAttribute : Attribute, IAuthenticationFilter, IFilter + { + private readonly SecurityService _securityService; + + public bool AllowMultiple { get { return false; } } + + public HmacAuthenticationAttribute() + { + _securityService = new StandardKernel().Get(); + } + + public async Task AuthenticateAsync(HttpAuthenticationContext context, CancellationToken cancellationToken) + { + if (context.Request.Headers.Date.HasValue) + { + DateTimeOffset? date = context.Request.Headers.Date; + DateTimeOffset timestamp = date.Value; + if (ValidateTimestamp(timestamp)) + { + if (context.Request.Headers.Authorization == null) + { + context.ErrorResult = new HmacErrorResult(HttpStatusCode.Unauthorized); + return; + } + + string[] authParams = context.Request.Headers.Authorization.Parameter.Split(':'); + ApiClient client = await _securityService.GetApiClientByKeyAsync(authParams[0]); + if (client == null || !client.Active) + { + context.ErrorResult = (IHttpActionResult)new HmacErrorResult(HttpStatusCode.Unauthorized); + return; + } + byte[] secret = Encoding.UTF8.GetBytes(client.Secret); + StringBuilder builder = new StringBuilder(); + builder.Append((object)secret); + builder.Append((object)context.Request.Method); + StringBuilder stringBuilder = builder; + date = context.Request.Headers.Date; + string str = date.Value.ToString("r"); + stringBuilder.Append(str); + if (context.Request.Method != HttpMethod.Get) + { + using (MD5CryptoServiceProvider md5Provider = new MD5CryptoServiceProvider()) + builder.Append((object)md5Provider.ComputeHash(Encoding.UTF8.GetBytes(await context.Request.Content.ReadAsStringAsync()))); + } + byte[] numArray; + using (HMACSHA1 hmacshA1 = new HMACSHA1(secret)) + { + numArray = Encoding.UTF8.GetBytes(builder.ToString()); + numArray = hmacshA1.ComputeHash(numArray); + } + if (Convert.ToBase64String(numArray) == authParams[1]) + { + string[] roles = new string[1] { "ValidUser" }; + context.Principal = (IPrincipal)new GenericPrincipal((IIdentity)new GenericIdentity(client.AppName), roles); + return; + } + context.ErrorResult = (IHttpActionResult)new HmacErrorResult(HttpStatusCode.Unauthorized); + return; + } + } + + context.ErrorResult = (IHttpActionResult)new HmacErrorResult(HttpStatusCode.Unauthorized); + } + + public Task ChallengeAsync(HttpAuthenticationChallengeContext context, CancellationToken cancellationToken) + { + return new Task(null); + } + + private bool ValidateTimestamp(DateTimeOffset timestamp) + { + if (int.TryParse(ConfigurationManager.AppSettings["ClockDriftThresholdMinutes"], out int result) && DateTimeOffset.UtcNow.AddMinutes((double)(result * -1)) < timestamp) + { + return timestamp < DateTimeOffset.UtcNow.AddMinutes((double)result); + } + + return false; + } + } +} diff --git a/PartSource/Filters/HmacErrorResult.cs b/PartSource/Filters/HmacErrorResult.cs new file mode 100644 index 0000000..f0f676d --- /dev/null +++ b/PartSource/Filters/HmacErrorResult.cs @@ -0,0 +1,33 @@ +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using System.Web.Http; + +namespace PartSource.Filters +{ + public class HmacErrorResult : IHttpActionResult + { + private HttpStatusCode _statusCode; + private string _content; + + public HmacErrorResult(HttpStatusCode statusCode) + { + this._statusCode = statusCode; + } + + public HmacErrorResult(HttpStatusCode statusCode, string content) + { + this._statusCode = statusCode; + this._content = content; + } + + public async Task ExecuteAsync(CancellationToken cancellationToken) + { + return new HttpResponseMessage(this._statusCode) + { + Content = !string.IsNullOrEmpty(this._content) ? (HttpContent)new StringContent(this._content) : (HttpContent)new StringContent(this._statusCode.ToString()) + }; + } + } +} diff --git a/PartSource/Filters/LocalizationAttribute.cs b/PartSource/Filters/LocalizationAttribute.cs new file mode 100644 index 0000000..d7946a9 --- /dev/null +++ b/PartSource/Filters/LocalizationAttribute.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Threading; +using System.Threading.Tasks; +using System.Web.Http.Controllers; +using System.Web.Http.Filters; + +namespace PartSource.Filters +{ + public class LocalizationAttribute : Attribute, IActionFilter, IFilter + { + public bool AllowMultiple + { + get + { + return false; + } + } + + public async Task ExecuteActionFilterAsync(HttpActionContext actionContext, CancellationToken cancellationToken, Func> continuation) + { + foreach (StringWithQualityHeaderValue qualityHeaderValue in (IEnumerable) ((IEnumerable) actionContext.Request.Headers.AcceptLanguage.ToString().Split(',')).Select(new Func(StringWithQualityHeaderValue.Parse)).OrderByDescending((Func) (s => s.Quality.GetValueOrDefault(1.0)))) + ; + return await continuation(); + } + } +} diff --git a/PartSource/Global.asax.cs b/PartSource/Global.asax.cs new file mode 100644 index 0000000..32958bb --- /dev/null +++ b/PartSource/Global.asax.cs @@ -0,0 +1,17 @@ +using System; +using System.Web; +using System.Web.Http; +using System.Web.Mvc; + +namespace PartSource +{ + public class WebApiApplication : HttpApplication + { + protected void Application_Start() + { + AreaRegistration.RegisterAllAreas(); + GlobalConfiguration.Configure(new Action(WebApiConfig.Register)); + FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); + } + } +} diff --git a/PartSource/PartSource.csproj b/PartSource/PartSource.csproj new file mode 100644 index 0000000..ab52f87 --- /dev/null +++ b/PartSource/PartSource.csproj @@ -0,0 +1,114 @@ + + + + + Debug + AnyCPU + {68F2C48E-87D6-4BD3-9259-136E5DA2BE2E} + Library + PartSource + v4.6.1 + 1.0.0.0 + 512 + PartSource + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll + + + ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll + + + ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll + + + ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll + + + ..\packages\Ninject.3.3.4\lib\net45\Ninject.dll + + + ..\packages\Ninject.Web.Common.3.3.1\lib\net45\Ninject.Web.Common.dll + + + ..\packages\Ninject.Web.Common.WebHost.3.3.1\lib\net45\Ninject.Web.Common.WebHost.dll + + + + ..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll + + + + + + + + ..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.Helpers.dll + + + ..\packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll + + + ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.7\lib\net45\System.Web.Http.WebHost.dll + + + ..\packages\Microsoft.AspNet.Mvc.5.2.7\lib\net45\System.Web.Mvc.dll + + + ..\packages\Microsoft.AspNet.Razor.3.2.7\lib\net45\System.Web.Razor.dll + + + ..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.dll + + + ..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.Deployment.dll + + + ..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.Razor.dll + + + ..\packages\WebActivatorEx.2.2.0\lib\net40\WebActivatorEx.dll + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PartSource/lib/PartSource.Entities.dll b/PartSource/lib/PartSource.Entities.dll new file mode 100644 index 0000000..135aaec Binary files /dev/null and b/PartSource/lib/PartSource.Entities.dll differ diff --git a/PartSource/lib/PartSource.Services.dll b/PartSource/lib/PartSource.Services.dll new file mode 100644 index 0000000..a8945bc Binary files /dev/null and b/PartSource/lib/PartSource.Services.dll differ diff --git a/PartSource/packages.config b/PartSource/packages.config new file mode 100644 index 0000000..c96c6f9 --- /dev/null +++ b/PartSource/packages.config @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file