Initial commit
This commit is contained in:
36
PartSource.Api/Controllers/BaseNexpartController.cs
Normal file
36
PartSource.Api/Controllers/BaseNexpartController.cs
Normal file
@@ -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, U>(T response) where T : IResponseElement<U>
|
||||
{
|
||||
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
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
33
PartSource.Api/Controllers/ErrorController.cs
Normal file
33
PartSource.Api/Controllers/ErrorController.cs
Normal file
@@ -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<IExceptionHandlerPathFeature>();
|
||||
|
||||
if (exceptionFeature != null)
|
||||
{
|
||||
string route = exceptionFeature.Path;
|
||||
|
||||
Exception ex = exceptionFeature.Error;
|
||||
|
||||
//TODO: Logging
|
||||
}
|
||||
|
||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||
}
|
||||
}
|
||||
}
|
||||
43
PartSource.Api/Controllers/InventoryController.cs
Normal file
43
PartSource.Api/Controllers/InventoryController.cs
Normal file
@@ -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<ActionResult> 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
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
159
PartSource.Api/Controllers/NexpartVehiclesController.cs
Normal file
159
PartSource.Api/Controllers/NexpartVehiclesController.cs
Normal file
@@ -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<ActionResult> GetVehicleTypes()
|
||||
{
|
||||
NexpartVehiclesController vehiclesController = this;
|
||||
VehicleTypesGetResponse response = await vehiclesController._nexpartService.SendRequest<VehicleTypesGet, VehicleTypesGetResponse>(new VehicleTypesGet());
|
||||
return vehiclesController.NexpartResponse<VehicleTypesGetResponse, VehicleTypes>(response);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("makes")]
|
||||
public async Task<ActionResult> GetMakes()
|
||||
{
|
||||
NexpartVehiclesController vehiclesController = this;
|
||||
MakeSearch requestContent = new MakeSearch()
|
||||
{
|
||||
VehicleTypeId = new int[] { 5, 6, 7 }
|
||||
};
|
||||
MakeSearchResponse response = await vehiclesController._nexpartService.SendRequest<MakeSearch, MakeSearchResponse>(requestContent);
|
||||
return vehiclesController.NexpartResponse<MakeSearchResponse, Makes>(response);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("makes/vehicletypeid/{vehicleTypeId}")]
|
||||
public async Task<ActionResult> GetMakes(int vehicleTypeId)
|
||||
{
|
||||
NexpartVehiclesController vehiclesController = this;
|
||||
MakeSearch requestContent = new MakeSearch()
|
||||
{
|
||||
VehicleTypeId = new int[] { vehicleTypeId }
|
||||
};
|
||||
MakeSearchResponse response = await vehiclesController._nexpartService.SendRequest<MakeSearch, MakeSearchResponse>(requestContent);
|
||||
return vehiclesController.NexpartResponse<MakeSearchResponse, Makes>(response);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("models/makeid/{makeId}/modelyear/{year}")]
|
||||
public async Task<ActionResult> 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<ModelSearch, ModelSearchResponse>(requestContent);
|
||||
return vehiclesController.NexpartResponse<ModelSearchResponse, Models[]>(response);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("models/makeid/{makeId}/modelyear/{year}/vehicletypeid/{vehicleTypeId}")]
|
||||
public async Task<ActionResult> 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<ModelSearch, ModelSearchResponse>(requestContent);
|
||||
return vehiclesController.NexpartResponse<ModelSearchResponse, Models[]>(response);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("basevehicle/makeid/{makeId}/modelid/{modelId}/modelyear/{year}")]
|
||||
public async Task<ActionResult> GetBaseVehicle(int makeId, int modelId, int year)
|
||||
{
|
||||
BaseVehicleDetailLookup requestContent = new BaseVehicleDetailLookup()
|
||||
{
|
||||
MakeId = makeId,
|
||||
ModelId = modelId,
|
||||
Year = year
|
||||
};
|
||||
BaseVehicleDetailLookupResponse response = await _nexpartService.SendRequest<BaseVehicleDetailLookup, BaseVehicleDetailLookupResponse>(requestContent);
|
||||
return NexpartResponse<BaseVehicleDetailLookupResponse, BaseVehicleDetail>(response);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("engines/basevehicleid/{baseVehicleId}")]
|
||||
[Route("engines/basevehicleid/{baseVehicleId}/submodelid/{subModelId}")]
|
||||
public async Task<ActionResult> GetEngines(int baseVehicleId, int? subModelId = null)
|
||||
{
|
||||
EngineSearch requestContent = new EngineSearch()
|
||||
{
|
||||
VehicleIdentifier = new VehicleIdentifier()
|
||||
{
|
||||
BaseVehicleId = baseVehicleId
|
||||
},
|
||||
SubModelId = subModelId
|
||||
};
|
||||
EngineSearchResponse response = await _nexpartService.SendRequest<EngineSearch, EngineSearchResponse>(requestContent);
|
||||
return NexpartResponse<EngineSearchResponse, Engines>(response);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("trim/makeid/{makeId}/modelid/{modelId}/modelyear/{year}")]
|
||||
public async Task<ActionResult> GetTrim(int makeId, int modelId, int year)
|
||||
{
|
||||
SubModelSearch requestContent = new SubModelSearch()
|
||||
{
|
||||
MakeId = makeId,
|
||||
ModelId = modelId,
|
||||
Year = year,
|
||||
RegionId = 2
|
||||
};
|
||||
SubModelSearchResponse response = await _nexpartService.SendRequest<SubModelSearch, SubModelSearchResponse>(requestContent);
|
||||
return NexpartResponse<SubModelSearchResponse, SubModels>(response);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("/detail/basevehicleid/{baseVehicleId}/submodelid/{subModelId}/engineconfigid/{engineConfigId}")]
|
||||
public async Task<ActionResult> 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<VehicleIdSearch, VehicleIdSearchResponse>(requestContent);
|
||||
return NexpartResponse<VehicleIdSearchResponse, VehicleDetail>(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
92
PartSource.Api/Controllers/PartsController.cs
Normal file
92
PartSource.Api/Controllers/PartsController.cs
Normal file
@@ -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<ActionResult> 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<PartTypeSearch, PartTypeSearchResponse>(requestContent);
|
||||
return partsController.NexpartResponse<PartTypeSearchResponse, PartTypes>(response);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("validate/partTypeId/{partTypeId}/baseVehicleId/{baseVehicleId}")]
|
||||
public async Task<ActionResult> 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<PartTypesValidateLookup, PartTypesValidateLookupResponse>(requestContent);
|
||||
return partsController.NexpartResponse<PartTypesValidateLookupResponse, PartTypes>(response);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("search/fitment")]
|
||||
public async Task<ActionResult> FitmentSearch([FromQuery] FitmentSearchDto fitmentSearchDto)
|
||||
{
|
||||
IList<Fitment> fitments = _partService.GetFitments(fitmentSearchDto);
|
||||
|
||||
if (fitments == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(new { Data = fitments });
|
||||
}
|
||||
}
|
||||
}
|
||||
32
PartSource.Api/Controllers/SearchController.cs
Normal file
32
PartSource.Api/Controllers/SearchController.cs
Normal file
@@ -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<ActionResult> GetMakes(int vehicleTypeId)
|
||||
{
|
||||
SearchController searchController = this;
|
||||
MakeSearch requestContent = new MakeSearch()
|
||||
{
|
||||
VehicleTypeId = new int[] { vehicleTypeId }
|
||||
};
|
||||
MakeSearchResponse response = await searchController._nexpartService.SendRequest<MakeSearch, MakeSearchResponse>(requestContent);
|
||||
return searchController.NexpartResponse<MakeSearchResponse, Makes>(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
47
PartSource.Api/Controllers/StoresController.cs
Normal file
47
PartSource.Api/Controllers/StoresController.cs
Normal file
@@ -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)
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
40
PartSource.Api/Controllers/TemplatesController.cs
Normal file
40
PartSource.Api/Controllers/TemplatesController.cs
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
101
PartSource.Api/Controllers/VehiclesController.cs
Normal file
101
PartSource.Api/Controllers/VehiclesController.cs
Normal file
@@ -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<ActionResult> GetMakes()
|
||||
{
|
||||
IList<VehicleMake> makes = await _vehicleService.GetAllMakes();
|
||||
|
||||
return Ok(makes);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("models/makeid/{makeId}/modelyear/{year}")]
|
||||
public async Task<ActionResult> GetModels(int makeId, int year)
|
||||
{
|
||||
IList<VehicleData> 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<ActionResult> GetBaseVehicle(int makeId, int modelId, int year)
|
||||
{
|
||||
IList<BaseVehicle> baseVehicles = await _vehicleService.GetBaseVehicles(makeId, modelId, year);
|
||||
|
||||
return Ok(baseVehicles);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("engines/basevehicleid/{baseVehicleId}")]
|
||||
[Route("engines/basevehicleid/{baseVehicleId}/submodelid/{subModelId}")]
|
||||
public async Task<ActionResult> GetEngines(int baseVehicleId, int? submodelId = null)
|
||||
{
|
||||
IList<Engine> 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<ActionResult> GetSubmodels(int makeId, int modelId, int year)
|
||||
{
|
||||
IList<Submodel> submodels = await _vehicleService.GetSubmodels(makeId, modelId, year);
|
||||
|
||||
return Ok(submodels);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("/detail/basevehicleid/{baseVehicleId}/submodelid/{submodelId}/engineconfigid/{engineConfigId}")]
|
||||
public async Task<ActionResult> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
28
PartSource.Api/Formatters/LiquidTemplateOutputFormatter.cs
Normal file
28
PartSource.Api/Formatters/LiquidTemplateOutputFormatter.cs
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
33
PartSource.Api/PartSource.Api.csproj
Normal file
33
PartSource.Api/PartSource.Api.csproj
Normal file
@@ -0,0 +1,33 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<UserSecretsId>f9e2fd37-0f2d-4e3a-955a-8e49a16fce1c</UserSecretsId>
|
||||
<Configurations>Debug;Release;Also Debug</Configurations>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Remove="appsettings.development.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="wwwroot\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="appsettings.development.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PartSource.Data\PartSource.Data.csproj" />
|
||||
<ProjectReference Include="..\PartSource.Services\PartSource.Services.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
24
PartSource.Api/Program.cs
Normal file
24
PartSource.Api/Program.cs
Normal file
@@ -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<Startup>();
|
||||
}
|
||||
}
|
||||
29
PartSource.Api/Properties/launchSettings.json
Normal file
29
PartSource.Api/Properties/launchSettings.json
Normal file
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
64
PartSource.Api/Startup.cs
Normal file
64
PartSource.Api/Startup.cs
Normal file
@@ -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<PartService>();
|
||||
services.AddTransient<NexpartService>();
|
||||
services.AddTransient<SecurityService>();
|
||||
|
||||
services.AddCors(o => o.AddPolicy("Default", builder =>
|
||||
{
|
||||
builder.AllowAnyOrigin()
|
||||
.AllowAnyMethod()
|
||||
.AllowAnyHeader();
|
||||
}));
|
||||
|
||||
services.AddDbContext<PartSourceContext>(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();
|
||||
}
|
||||
}
|
||||
}
|
||||
6
PartSource.Api/appsettings.development.json
Normal file
6
PartSource.Api/appsettings.development.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
|
||||
"ConnectionStrings": {
|
||||
"PartSourceDatabase": "Server=(localdb)\\mssqllocaldb;Database=PartSource;Trusted_Connection=True;"
|
||||
}
|
||||
}
|
||||
21
PartSource.Api/appsettings.json
Normal file
21
PartSource.Api/appsettings.json
Normal file
@@ -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"
|
||||
}
|
||||
}
|
||||
13
PartSource.Automation/.editorconfig
Normal file
13
PartSource.Automation/.editorconfig
Normal file
@@ -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
|
||||
49
PartSource.Automation/Factories/JobFactory.cs
Normal file
49
PartSource.Automation/Factories/JobFactory.cs
Normal file
@@ -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<AddProducts>();
|
||||
|
||||
case nameof(DeleteProducts):
|
||||
return _serviceProvider.GetService<DeleteProducts>();
|
||||
|
||||
case nameof(TestJob):
|
||||
return new TestJob();
|
||||
|
||||
case nameof(UpdateFitment):
|
||||
return _serviceProvider.GetService<UpdateFitment>();
|
||||
|
||||
case nameof(UpdatePricing):
|
||||
return _serviceProvider.GetService<UpdatePricing>();
|
||||
|
||||
case nameof(ExecuteSsisPackages):
|
||||
return _serviceProvider.GetService<ExecuteSsisPackages>();
|
||||
|
||||
default:
|
||||
throw new Exception($"The job {jobName} could not be found.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
145
PartSource.Automation/Jobs/AddProducts.cs
Normal file
145
PartSource.Automation/Jobs/AddProducts.cs
Normal file
@@ -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<AutomationJobResult> 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<ProductImage> productImages = new List<ProductImage>();
|
||||
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<string> productTags = new List<string>
|
||||
{
|
||||
importData.LineCode,
|
||||
importData.PartNumber,
|
||||
};
|
||||
|
||||
List<ProductVariant> productVariants = new List<ProductVariant>();
|
||||
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);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
320
PartSource.Automation/Jobs/BuildVehicleCache.cs
Normal file
320
PartSource.Automation/Jobs/BuildVehicleCache.cs
Normal file
@@ -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<BaseVehicle> 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, WHIEngineSearchResponse>(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<BaseVehicle> 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<SubModelSearch, SubModelSearchResponse>(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<EngineSearch, EngineSearchResponse>(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<VehicleIdSearch, VehicleIdSearchResponse>(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<BaseVehicleSearch, BaseVehicleSearchResponse>(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<MakeSearch, MakeSearchResponse>(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<VehicleMake> vehicleMakes = _partSourceContext.VehicleMakes.ToList();
|
||||
// IDictionary<int, VehicleModel> vehicleModels = new Dictionary<int, VehicleModel>();
|
||||
|
||||
// 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<ModelSearch, ModelSearchResponse>(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();
|
||||
// }
|
||||
|
||||
|
||||
// }
|
||||
//}
|
||||
62
PartSource.Automation/Jobs/DeleteProducts.cs
Normal file
62
PartSource.Automation/Jobs/DeleteProducts.cs
Normal file
@@ -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<AutomationJobResult> 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<Product> 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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
53
PartSource.Automation/Jobs/ExecuteSsisPackages.cs
Normal file
53
PartSource.Automation/Jobs/ExecuteSsisPackages.cs
Normal file
@@ -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<AutomationJobResult> Run()
|
||||
{
|
||||
IList<string> updatedPackages = new List<string>();
|
||||
IList<string> failedPackages = new List<string>();
|
||||
|
||||
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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
14
PartSource.Automation/Jobs/Interfaces/IAutomationJob.cs
Normal file
14
PartSource.Automation/Jobs/Interfaces/IAutomationJob.cs
Normal file
@@ -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<AutomationJobResult> Run();
|
||||
}
|
||||
}
|
||||
21
PartSource.Automation/Jobs/TestJob.cs
Normal file
21
PartSource.Automation/Jobs/TestJob.cs
Normal file
@@ -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<AutomationJobResult> Run()
|
||||
{
|
||||
return new AutomationJobResult
|
||||
{
|
||||
Message = "Test job ran successfully",
|
||||
IsSuccess = true
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
535
PartSource.Automation/Jobs/UpdateFitment - Copy.cs
Normal file
535
PartSource.Automation/Jobs/UpdateFitment - Copy.cs
Normal file
@@ -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<long> _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<long> shopifyIds = _partSourceContext.ImportData.Where(s => s.IsFitment.Value && s.ShopifyId != null).Select(s => (long)s.ShopifyId).ToList();
|
||||
// //List<long> shopifyIds = _partSourceContext.ImportData.Where(s => s.ShopifyId != null).Select(s => (long)s.ShopifyId).ToList();
|
||||
|
||||
// //_shopifyIdQueue = new ConcurrentQueue<long>(shopifyIds);
|
||||
|
||||
// //Parallel.For(0, _threadCount, i =>
|
||||
// // {
|
||||
|
||||
|
||||
// // //Categorize();
|
||||
// // });
|
||||
// // });
|
||||
// }
|
||||
|
||||
|
||||
// private IList<string> GetYmmFitmentTags(BuyersGuideSearchResponse response)
|
||||
// {
|
||||
// BuyersGuideMake[] makes = response?.ResponseBody?.Apps?.Make;
|
||||
// if (makes == null)
|
||||
// {
|
||||
// return new List<string>();
|
||||
// }
|
||||
|
||||
// IList<string> fitmentTags = new List<string>();
|
||||
|
||||
// foreach (BuyersGuideMake make in makes)
|
||||
// {
|
||||
// foreach (BuyersGuideModel model in make.Model)
|
||||
// {
|
||||
// IList<int> years = new List<int>();
|
||||
// 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<string> GetVehicleIdFitmentTags(BuyersGuideSearchResponse response)
|
||||
// //{
|
||||
// // BuyersGuideMake[] makes = response?.ResponseBody?.Apps?.Make;
|
||||
// // if (makes == null)
|
||||
// // {
|
||||
// // return new List<string>();
|
||||
// // }
|
||||
|
||||
// // IList<string> fitmentTags = new List<string>();
|
||||
|
||||
// // foreach (BuyersGuideMake make in makes)
|
||||
// // {
|
||||
// // foreach (BuyersGuideModel model in make.Model)
|
||||
// // {
|
||||
// // foreach (BuyersGuideEngine engine in model.Engine)
|
||||
// // {
|
||||
// // IList<int> 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<Product> 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<string> ymmFitmentTags = new List<string>();
|
||||
// List<string> vehicleIdFitmentTags = new List<string>();
|
||||
|
||||
// foreach (DcfMapping mapping in importData.DcfMappings)
|
||||
// {
|
||||
// buyersGuideSearch = new BuyersGuideSearch
|
||||
// {
|
||||
// Part = new BuyersGuidePart
|
||||
// {
|
||||
// PartNumber = importData.PartNumber,
|
||||
// MfrCode = mapping.WhiCode
|
||||
// }
|
||||
// };
|
||||
|
||||
// BuyersGuideSearchResponse response = _nexpartService.SendRequest<BuyersGuideSearch, BuyersGuideSearchResponse>(buyersGuideSearch).Result;
|
||||
|
||||
// if (response.ResponseBody != null)
|
||||
// {
|
||||
// ymmFitmentTags.AddRange(GetYmmFitmentTags(response));
|
||||
// //vehicleIdFitmentTags.AddRange(GetVehicleIdFitmentTags(response));
|
||||
// }
|
||||
// }
|
||||
|
||||
// bool published = true;
|
||||
// List<string> productTags = new List<string>
|
||||
// {
|
||||
// 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<PartSourceContext> optionsBuilder = new DbContextOptionsBuilder<PartSourceContext>();
|
||||
// optionsBuilder.UseSqlServer(_connectionString);
|
||||
|
||||
// PartSourceContext threadDbContext = new PartSourceContext(optionsBuilder.Options);
|
||||
|
||||
// int i = 0;
|
||||
// int updated = 0;
|
||||
// IList<Product> 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<string> 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<ImportData> importCache = _partSourceContext.ImportData.Where(s => s.IsFitment.Value && s.ShopifyId != null).ToList();
|
||||
// IList<DcfMapping> 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<Product> 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<string> 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<PartSourceContext> optionsBuilder = new DbContextOptionsBuilder<PartSourceContext>();
|
||||
// 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<Product> 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<string> productTags = new List<string>
|
||||
// {
|
||||
// importData.LineCode,
|
||||
// importData.PartNumber
|
||||
// };
|
||||
|
||||
|
||||
|
||||
// IDictionary<string, IList<string>> positions = new Dictionary<string, IList<string>>();
|
||||
|
||||
// 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<Fitment> 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<string>
|
||||
// {
|
||||
// vehicle.VehicleToEngineConfigId.ToString()
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
// foreach (KeyValuePair<string, IList<string>> 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<MenuNodesLookup, MenuNodesLookupResponse>(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();
|
||||
|
||||
|
||||
// // }
|
||||
// //}
|
||||
// }
|
||||
//}
|
||||
184
PartSource.Automation/Jobs/UpdateFitment.cs
Normal file
184
PartSource.Automation/Jobs/UpdateFitment.cs
Normal file
@@ -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<AutomationJobResult> Run()
|
||||
{
|
||||
IEnumerable<Product> 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<VehicleData> vehicles = _vehicleService.GetVehiclesForPart(importData?.PartNumber, importData?.LineCode);
|
||||
|
||||
if (vehicles.Count > 0)
|
||||
{
|
||||
bool isFitment = false;
|
||||
|
||||
IList<int> 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<string> 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<string, object> parameters = new Dictionary<string, object>
|
||||
{
|
||||
{ "metafield[owner_id]", shopifyId},
|
||||
{ "metafield[owner_resource]", "product" },
|
||||
{ "namespace", "fitment" },
|
||||
};
|
||||
|
||||
IEnumerable<Metafield> metafields = await _shopifyClient.Metafields.Get(parameters);
|
||||
|
||||
foreach (Metafield metafield in metafields)
|
||||
{
|
||||
await _shopifyClient.Metafields.Delete(metafield);
|
||||
}
|
||||
}
|
||||
|
||||
public IList<VehicleData> 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<VehicleData> vehicles = _partSourceContext.VehicleData.FromSql(sql).ToList();
|
||||
#pragma warning restore EF1000 // Possible SQL injection vulnerability.
|
||||
|
||||
return vehicles;
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
105
PartSource.Automation/Jobs/UpdatePricing.cs
Normal file
105
PartSource.Automation/Jobs/UpdatePricing.cs
Normal file
@@ -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<AutomationJobResult> Run()
|
||||
{
|
||||
IEnumerable<Product> 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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
9
PartSource.Automation/Models/AutomationJobResult.cs
Normal file
9
PartSource.Automation/Models/AutomationJobResult.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace PartSource.Automation.Models
|
||||
{
|
||||
public class AutomationJobResult
|
||||
{
|
||||
public string Message { get; set; }
|
||||
|
||||
public bool IsSuccess { get; set; }
|
||||
}
|
||||
}
|
||||
19
PartSource.Automation/Models/Cache/VehicleCacheItem.cs
Normal file
19
PartSource.Automation/Models/Cache/VehicleCacheItem.cs
Normal file
@@ -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<int> VehicleIds { get; set; }
|
||||
|
||||
public VehicleCacheItem()
|
||||
{
|
||||
VehicleIds = new List<int>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
32
PartSource.Automation/PartSource.Automation.csproj
Normal file
32
PartSource.Automation/PartSource.Automation.csproj
Normal file
@@ -0,0 +1,32 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<Platforms>AnyCPU;x86;x64</Platforms>
|
||||
<Configurations>Debug;Release;Also Debug</Configurations>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.6">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\ratermania\shopify\Shopify\Shopify.csproj" />
|
||||
<ProjectReference Include="..\PartSource.Data\PartSource.Data.csproj" />
|
||||
<ProjectReference Include="..\PartSource.Services\PartSource.Services.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
120
PartSource.Automation/Program.cs
Normal file
120
PartSource.Automation/Program.cs
Normal file
@@ -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<JobFactory>();
|
||||
EmailService emailService = serviceProvider.GetService<EmailService>();
|
||||
|
||||
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<PartSourceContext>(options =>
|
||||
options.UseSqlServer(configuration.GetConnectionString("PartSourceDatabase"), opts => opts.EnableRetryOnFailure())
|
||||
)
|
||||
|
||||
.AddShopify<ShopifyClient>(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<NexpartService>()
|
||||
.AddSingleton<VehicleService>()
|
||||
.AddSingleton<SsisService>()
|
||||
.AddSingleton<FtpService>()
|
||||
.AddSingleton<EmailService>()
|
||||
.AddSingleton<AddProducts>()
|
||||
//.AddSingleton<BuildCategories>()
|
||||
//.AddSingleton<BackupProducts>()
|
||||
//.AddSingleton<BuildVehicleCache>()
|
||||
.AddSingleton<DeleteProducts>()
|
||||
.AddSingleton<UpdateFitment>()
|
||||
.AddSingleton<UpdatePricing>()
|
||||
.AddSingleton<ExecuteSsisPackages>()
|
||||
.AddSingleton<JobFactory>()
|
||||
.BuildServiceProvider();
|
||||
|
||||
return serviceProvider;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
PartSource.Automation/Properties/launchSettings.json
Normal file
11
PartSource.Automation/Properties/launchSettings.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"profiles": {
|
||||
"PartSource.Automation": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "UpdatePricing",
|
||||
"environmentVariables": {
|
||||
"PS_AUTOMATION_ENVIRONMENT": "development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
42
PartSource.Automation/Services/EmailService.cs
Normal file
42
PartSource.Automation/Services/EmailService.cs
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
35
PartSource.Automation/Services/FtpService.cs
Normal file
35
PartSource.Automation/Services/FtpService.cs
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
66
PartSource.Automation/Services/SsisService.cs
Normal file
66
PartSource.Automation/Services/SsisService.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
141
PartSource.Automation/Services/VehicleCacheService.cs
Normal file
141
PartSource.Automation/Services/VehicleCacheService.cs
Normal file
@@ -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<VehicleCacheItem> _vehicleCache;
|
||||
private readonly ConcurrentBag<BaseVehicle> _sorryNotCanadianCache;
|
||||
|
||||
private readonly NexpartService _nexpartService;
|
||||
|
||||
public VehicleCacheService(NexpartService nexpartService)
|
||||
{
|
||||
_vehicleCache = new ConcurrentBag<VehicleCacheItem>();
|
||||
_sorryNotCanadianCache = new ConcurrentBag<BaseVehicle>();
|
||||
|
||||
_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, VehicleIdSearchResponse>(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<SubModelSearch, SubModelSearchResponse>(smSearch).Result;
|
||||
|
||||
SubModel[] subModels = smResponse.ResponseBody?.SubModel;
|
||||
if (subModels == null)
|
||||
{
|
||||
_sorryNotCanadianCache.Add(baseVehicle);
|
||||
return false;
|
||||
}
|
||||
|
||||
IList<int> vehicleIds = new List<int>();
|
||||
|
||||
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<VehicleIdSearch, VehicleIdSearchResponse>(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;
|
||||
}
|
||||
}
|
||||
}
|
||||
32
PartSource.Automation/appsettings.json
Normal file
32
PartSource.Automation/appsettings.json
Normal file
@@ -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"
|
||||
}
|
||||
}
|
||||
17
PartSource.Data/Dtos/FitmentSearchDto.cs
Normal file
17
PartSource.Data/Dtos/FitmentSearchDto.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
15
PartSource.Data/Dtos/StoreDto.cs
Normal file
15
PartSource.Data/Dtos/StoreDto.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
405
PartSource.Data/Migrations/20190811020941_ImportDateDcfMapping.Designer.cs
generated
Normal file
405
PartSource.Data/Migrations/20190811020941_ImportDateDcfMapping.Designer.cs
generated
Normal file
@@ -0,0 +1,405 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using 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<string>("Key")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<bool>("Active");
|
||||
|
||||
b.Property<string>("AppName");
|
||||
|
||||
b.Property<string>("Secret");
|
||||
|
||||
b.HasKey("Key");
|
||||
|
||||
b.ToTable("ApiClient");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.BaseVehicle", b =>
|
||||
{
|
||||
b.Property<int>("Id");
|
||||
|
||||
b.Property<int>("VehicleMakeId");
|
||||
|
||||
b.Property<int>("VehicleModelId");
|
||||
|
||||
b.Property<int>("Year");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("BaseVehicle","Vehicle");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.DcfMapping", b =>
|
||||
{
|
||||
b.Property<string>("LineCode");
|
||||
|
||||
b.Property<string>("WhiCode");
|
||||
|
||||
b.HasKey("LineCode", "WhiCode");
|
||||
|
||||
b.ToTable("DcfMapping");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.Fitment", b =>
|
||||
{
|
||||
b.Property<int>("FitmentId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int?>("BaseVehicleId");
|
||||
|
||||
b.Property<int?>("EngineConfigId");
|
||||
|
||||
b.Property<string>("ManufacturerCode");
|
||||
|
||||
b.Property<string>("NoteText");
|
||||
|
||||
b.Property<string>("PartLabel");
|
||||
|
||||
b.Property<string>("PartNumber");
|
||||
|
||||
b.Property<string>("Position");
|
||||
|
||||
b.HasKey("FitmentId");
|
||||
|
||||
b.ToTable("Fitment");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.ImportData", b =>
|
||||
{
|
||||
b.Property<string>("VariantSku")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("BodyHtml");
|
||||
|
||||
b.Property<decimal>("CompareAt");
|
||||
|
||||
b.Property<string>("ImageAltText");
|
||||
|
||||
b.Property<string>("ImageSrc");
|
||||
|
||||
b.Property<bool?>("IsFitment");
|
||||
|
||||
b.Property<bool?>("IsVariant");
|
||||
|
||||
b.Property<string>("LineCode");
|
||||
|
||||
b.Property<string>("PartNumber");
|
||||
|
||||
b.Property<decimal>("Price");
|
||||
|
||||
b.Property<long?>("ShopifyId");
|
||||
|
||||
b.Property<string>("Title");
|
||||
|
||||
b.Property<string>("VariantTitle");
|
||||
|
||||
b.Property<string>("Vendor");
|
||||
|
||||
b.HasKey("VariantSku");
|
||||
|
||||
b.ToTable("ImportData");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.ImportMetric", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int?>("ChangedItems");
|
||||
|
||||
b.Property<DateTime>("ImportDate");
|
||||
|
||||
b.Property<int?>("TotalItems");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ImportMetric");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.Manufacturer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("LineCode");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Manufacturer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.Part", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("Description");
|
||||
|
||||
b.Property<int>("ManufacturerId");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.Property<string>("PartNumber");
|
||||
|
||||
b.Property<long?>("ShopifyId");
|
||||
|
||||
b.Property<int>("Sku");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ManufacturerId");
|
||||
|
||||
b.ToTable("Part");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.PartData", b =>
|
||||
{
|
||||
b.Property<string>("SKU")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("BRAND_NM")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("CATEGORY_NM")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("CORPORATE_STATUS_NM")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<decimal?>("Compare_Price")
|
||||
.HasColumnName("Compare Price")
|
||||
.HasColumnType("money");
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS1")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS10")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS11")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS12")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS13")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS14")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS2")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS3")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS4")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS5")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS6")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS7")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS8")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS9")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FINELINE_NM")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<byte?>("IsFitment");
|
||||
|
||||
b.Property<string>("LOB_NM")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("Line_Code")
|
||||
.HasColumnName("Line Code")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("PRODUCT_ENGLISH_LONG_DESC")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("Part_Number")
|
||||
.HasColumnName("Part Number")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<byte?>("Published");
|
||||
|
||||
b.Property<string>("SUBCATEGORY_NM")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("Tested")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("Title");
|
||||
|
||||
b.Property<string>("VariantTitle");
|
||||
|
||||
b.Property<decimal?>("Your_Price")
|
||||
.HasColumnName("Your Price")
|
||||
.HasColumnType("money");
|
||||
|
||||
b.HasKey("SKU");
|
||||
|
||||
b.ToTable("PartData");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.PartImage", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("Sku");
|
||||
|
||||
b.Property<string>("Url");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("PartImage");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.PartPrice", b =>
|
||||
{
|
||||
b.Property<string>("SKU")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("Active");
|
||||
|
||||
b.Property<decimal?>("Compare_Price");
|
||||
|
||||
b.Property<decimal?>("Your_Price");
|
||||
|
||||
b.HasKey("SKU");
|
||||
|
||||
b.ToTable("PartPrice");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.PartsAvailability", b =>
|
||||
{
|
||||
b.Property<int>("Store");
|
||||
|
||||
b.Property<int>("SKU");
|
||||
|
||||
b.Property<string>("Line_Code")
|
||||
.HasColumnName("Line Code")
|
||||
.HasMaxLength(50);
|
||||
|
||||
b.Property<string>("Part_Number")
|
||||
.HasColumnName("Part Number")
|
||||
.HasMaxLength(50);
|
||||
|
||||
b.Property<int?>("QTY");
|
||||
|
||||
b.HasKey("Store", "SKU");
|
||||
|
||||
b.ToTable("PartsAvailability");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.Submodel", b =>
|
||||
{
|
||||
b.Property<int>("VehicleToEngineConfigId");
|
||||
|
||||
b.Property<int>("BaseVehicleId");
|
||||
|
||||
b.Property<int>("EngineId");
|
||||
|
||||
b.Property<int>("SubmodelId");
|
||||
|
||||
b.HasKey("VehicleToEngineConfigId");
|
||||
|
||||
b.ToTable("Submodel","Vehicle");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.VehicleEngine", b =>
|
||||
{
|
||||
b.Property<int>("Id");
|
||||
|
||||
b.Property<string>("Description");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("VehicleEngine","Vehicle");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.VehicleMake", b =>
|
||||
{
|
||||
b.Property<int>("Id");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("VehicleMake","Vehicle");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.VehicleModel", b =>
|
||||
{
|
||||
b.Property<int>("Id");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.Property<int>("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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<string>(nullable: false),
|
||||
AppName = table.Column<string>(nullable: true),
|
||||
Secret = table.Column<string>(nullable: true),
|
||||
Active = table.Column<bool>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ApiClient", x => x.Key);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Fitment",
|
||||
columns: table => new
|
||||
{
|
||||
FitmentId = table.Column<int>(nullable: false)
|
||||
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
|
||||
ManufacturerCode = table.Column<string>(nullable: true),
|
||||
PartNumber = table.Column<string>(nullable: true),
|
||||
PartLabel = table.Column<string>(nullable: true),
|
||||
BaseVehicleId = table.Column<int>(nullable: true),
|
||||
EngineConfigId = table.Column<int>(nullable: true),
|
||||
NoteText = table.Column<string>(nullable: true),
|
||||
Position = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Fitment", x => x.FitmentId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ImportData",
|
||||
columns: table => new
|
||||
{
|
||||
VariantSku = table.Column<string>(nullable: false),
|
||||
Title = table.Column<string>(nullable: true),
|
||||
BodyHtml = table.Column<string>(nullable: true),
|
||||
Vendor = table.Column<string>(nullable: true),
|
||||
IsVariant = table.Column<bool>(nullable: true),
|
||||
VariantTitle = table.Column<string>(nullable: true),
|
||||
Price = table.Column<decimal>(nullable: false),
|
||||
CompareAt = table.Column<decimal>(nullable: false),
|
||||
ShopifyId = table.Column<long>(nullable: true),
|
||||
ImageSrc = table.Column<string>(nullable: true),
|
||||
ImageAltText = table.Column<string>(nullable: true),
|
||||
IsFitment = table.Column<bool>(nullable: true),
|
||||
LineCode = table.Column<string>(nullable: true),
|
||||
PartNumber = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ImportData", x => x.VariantSku);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ImportMetric",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
|
||||
TotalItems = table.Column<int>(nullable: true),
|
||||
ChangedItems = table.Column<int>(nullable: true),
|
||||
ImportDate = table.Column<DateTime>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ImportMetric", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Manufacturer",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
LineCode = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Manufacturer", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PartData",
|
||||
columns: table => new
|
||||
{
|
||||
SKU = table.Column<string>(maxLength: 255, nullable: false),
|
||||
LOB_NM = table.Column<string>(maxLength: 255, nullable: true),
|
||||
CATEGORY_NM = table.Column<string>(maxLength: 255, nullable: true),
|
||||
SUBCATEGORY_NM = table.Column<string>(maxLength: 255, nullable: true),
|
||||
FINELINE_NM = table.Column<string>(maxLength: 255, nullable: true),
|
||||
PRODUCT_ENGLISH_LONG_DESC = table.Column<string>(maxLength: 255, nullable: true),
|
||||
BRAND_NM = table.Column<string>(maxLength: 255, nullable: true),
|
||||
CORPORATE_STATUS_NM = table.Column<string>(maxLength: 255, nullable: true),
|
||||
FAMILY_FEATURES_BENEFITS1 = table.Column<string>(maxLength: 255, nullable: true),
|
||||
FAMILY_FEATURES_BENEFITS2 = table.Column<string>(maxLength: 255, nullable: true),
|
||||
FAMILY_FEATURES_BENEFITS3 = table.Column<string>(maxLength: 255, nullable: true),
|
||||
FAMILY_FEATURES_BENEFITS4 = table.Column<string>(maxLength: 255, nullable: true),
|
||||
FAMILY_FEATURES_BENEFITS5 = table.Column<string>(maxLength: 255, nullable: true),
|
||||
FAMILY_FEATURES_BENEFITS6 = table.Column<string>(maxLength: 255, nullable: true),
|
||||
FAMILY_FEATURES_BENEFITS7 = table.Column<string>(maxLength: 255, nullable: true),
|
||||
FAMILY_FEATURES_BENEFITS8 = table.Column<string>(maxLength: 255, nullable: true),
|
||||
FAMILY_FEATURES_BENEFITS9 = table.Column<string>(maxLength: 255, nullable: true),
|
||||
FAMILY_FEATURES_BENEFITS10 = table.Column<string>(maxLength: 255, nullable: true),
|
||||
FAMILY_FEATURES_BENEFITS11 = table.Column<string>(maxLength: 255, nullable: true),
|
||||
FAMILY_FEATURES_BENEFITS12 = table.Column<string>(maxLength: 255, nullable: true),
|
||||
FAMILY_FEATURES_BENEFITS13 = table.Column<string>(maxLength: 255, nullable: true),
|
||||
FAMILY_FEATURES_BENEFITS14 = table.Column<string>(maxLength: 255, nullable: true),
|
||||
Tested = table.Column<string>(maxLength: 255, nullable: true),
|
||||
LineCode = table.Column<string>(name: "Line Code", maxLength: 255, nullable: true),
|
||||
PartNumber = table.Column<string>(name: "Part Number", maxLength: 255, nullable: true),
|
||||
ComparePrice = table.Column<decimal>(name: "Compare Price", type: "money", nullable: true),
|
||||
YourPrice = table.Column<decimal>(name: "Your Price", type: "money", nullable: true),
|
||||
Title = table.Column<string>(nullable: true),
|
||||
VariantTitle = table.Column<string>(nullable: true),
|
||||
IsFitment = table.Column<byte>(nullable: true),
|
||||
Published = table.Column<byte>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PartData", x => x.SKU);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PartImage",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
|
||||
Sku = table.Column<string>(nullable: true),
|
||||
Url = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PartImage", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PartPrice",
|
||||
columns: table => new
|
||||
{
|
||||
SKU = table.Column<string>(nullable: false),
|
||||
Compare_Price = table.Column<decimal>(nullable: true),
|
||||
Your_Price = table.Column<decimal>(nullable: true),
|
||||
Active = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PartPrice", x => x.SKU);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PartsAvailability",
|
||||
columns: table => new
|
||||
{
|
||||
Store = table.Column<int>(nullable: false),
|
||||
SKU = table.Column<int>(nullable: false),
|
||||
LineCode = table.Column<string>(name: "Line Code", maxLength: 50, nullable: true),
|
||||
PartNumber = table.Column<string>(name: "Part Number", maxLength: 50, nullable: true),
|
||||
QTY = table.Column<int>(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<int>(nullable: false),
|
||||
Year = table.Column<int>(nullable: false),
|
||||
VehicleMakeId = table.Column<int>(nullable: false),
|
||||
VehicleModelId = table.Column<int>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_BaseVehicle", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Submodel",
|
||||
schema: "Vehicle",
|
||||
columns: table => new
|
||||
{
|
||||
VehicleToEngineConfigId = table.Column<int>(nullable: false),
|
||||
SubmodelId = table.Column<int>(nullable: false),
|
||||
BaseVehicleId = table.Column<int>(nullable: false),
|
||||
EngineId = table.Column<int>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Submodel", x => x.VehicleToEngineConfigId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "VehicleEngine",
|
||||
schema: "Vehicle",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false),
|
||||
Description = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_VehicleEngine", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "VehicleMake",
|
||||
schema: "Vehicle",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false),
|
||||
Name = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_VehicleMake", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "VehicleModel",
|
||||
schema: "Vehicle",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
VehicleMakeId = table.Column<int>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_VehicleModel", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "DcfMapping",
|
||||
columns: table => new
|
||||
{
|
||||
LineCode = table.Column<string>(nullable: false),
|
||||
WhiCode = table.Column<string>(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<int>(nullable: false)
|
||||
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
|
||||
ManufacturerId = table.Column<int>(nullable: false),
|
||||
ShopifyId = table.Column<long>(nullable: true),
|
||||
Sku = table.Column<int>(nullable: false),
|
||||
PartNumber = table.Column<string>(nullable: true),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
Description = table.Column<string>(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");
|
||||
}
|
||||
}
|
||||
}
|
||||
403
PartSource.Data/Migrations/PartSourceContextModelSnapshot.cs
Normal file
403
PartSource.Data/Migrations/PartSourceContextModelSnapshot.cs
Normal file
@@ -0,0 +1,403 @@
|
||||
// <auto-generated />
|
||||
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<string>("Key")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<bool>("Active");
|
||||
|
||||
b.Property<string>("AppName");
|
||||
|
||||
b.Property<string>("Secret");
|
||||
|
||||
b.HasKey("Key");
|
||||
|
||||
b.ToTable("ApiClient");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.BaseVehicle", b =>
|
||||
{
|
||||
b.Property<int>("Id");
|
||||
|
||||
b.Property<int>("VehicleMakeId");
|
||||
|
||||
b.Property<int>("VehicleModelId");
|
||||
|
||||
b.Property<int>("Year");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("BaseVehicle","Vehicle");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.DcfMapping", b =>
|
||||
{
|
||||
b.Property<string>("LineCode");
|
||||
|
||||
b.Property<string>("WhiCode");
|
||||
|
||||
b.HasKey("LineCode", "WhiCode");
|
||||
|
||||
b.ToTable("DcfMapping");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.Fitment", b =>
|
||||
{
|
||||
b.Property<int>("FitmentId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int?>("BaseVehicleId");
|
||||
|
||||
b.Property<int?>("EngineConfigId");
|
||||
|
||||
b.Property<string>("ManufacturerCode");
|
||||
|
||||
b.Property<string>("NoteText");
|
||||
|
||||
b.Property<string>("PartLabel");
|
||||
|
||||
b.Property<string>("PartNumber");
|
||||
|
||||
b.Property<string>("Position");
|
||||
|
||||
b.HasKey("FitmentId");
|
||||
|
||||
b.ToTable("Fitment");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.ImportData", b =>
|
||||
{
|
||||
b.Property<string>("VariantSku")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("BodyHtml");
|
||||
|
||||
b.Property<decimal>("CompareAt");
|
||||
|
||||
b.Property<string>("ImageAltText");
|
||||
|
||||
b.Property<string>("ImageSrc");
|
||||
|
||||
b.Property<bool?>("IsFitment");
|
||||
|
||||
b.Property<bool?>("IsVariant");
|
||||
|
||||
b.Property<string>("LineCode");
|
||||
|
||||
b.Property<string>("PartNumber");
|
||||
|
||||
b.Property<decimal>("Price");
|
||||
|
||||
b.Property<long?>("ShopifyId");
|
||||
|
||||
b.Property<string>("Title");
|
||||
|
||||
b.Property<string>("VariantTitle");
|
||||
|
||||
b.Property<string>("Vendor");
|
||||
|
||||
b.HasKey("VariantSku");
|
||||
|
||||
b.ToTable("ImportData");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.ImportMetric", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int?>("ChangedItems");
|
||||
|
||||
b.Property<DateTime>("ImportDate");
|
||||
|
||||
b.Property<int?>("TotalItems");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ImportMetric");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.Manufacturer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("LineCode");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Manufacturer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.Part", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("Description");
|
||||
|
||||
b.Property<int>("ManufacturerId");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.Property<string>("PartNumber");
|
||||
|
||||
b.Property<long?>("ShopifyId");
|
||||
|
||||
b.Property<int>("Sku");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ManufacturerId");
|
||||
|
||||
b.ToTable("Part");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.PartData", b =>
|
||||
{
|
||||
b.Property<string>("SKU")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("BRAND_NM")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("CATEGORY_NM")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("CORPORATE_STATUS_NM")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<decimal?>("Compare_Price")
|
||||
.HasColumnName("Compare Price")
|
||||
.HasColumnType("money");
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS1")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS10")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS11")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS12")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS13")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS14")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS2")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS3")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS4")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS5")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS6")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS7")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS8")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FAMILY_FEATURES_BENEFITS9")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("FINELINE_NM")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<byte?>("IsFitment");
|
||||
|
||||
b.Property<string>("LOB_NM")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("Line_Code")
|
||||
.HasColumnName("Line Code")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("PRODUCT_ENGLISH_LONG_DESC")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("Part_Number")
|
||||
.HasColumnName("Part Number")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<byte?>("Published");
|
||||
|
||||
b.Property<string>("SUBCATEGORY_NM")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("Tested")
|
||||
.HasMaxLength(255);
|
||||
|
||||
b.Property<string>("Title");
|
||||
|
||||
b.Property<string>("VariantTitle");
|
||||
|
||||
b.Property<decimal?>("Your_Price")
|
||||
.HasColumnName("Your Price")
|
||||
.HasColumnType("money");
|
||||
|
||||
b.HasKey("SKU");
|
||||
|
||||
b.ToTable("PartData");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.PartImage", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("Sku");
|
||||
|
||||
b.Property<string>("Url");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("PartImage");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.PartPrice", b =>
|
||||
{
|
||||
b.Property<string>("SKU")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("Active");
|
||||
|
||||
b.Property<decimal?>("Compare_Price");
|
||||
|
||||
b.Property<decimal?>("Your_Price");
|
||||
|
||||
b.HasKey("SKU");
|
||||
|
||||
b.ToTable("PartPrice");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.PartsAvailability", b =>
|
||||
{
|
||||
b.Property<int>("Store");
|
||||
|
||||
b.Property<int>("SKU");
|
||||
|
||||
b.Property<string>("Line_Code")
|
||||
.HasColumnName("Line Code")
|
||||
.HasMaxLength(50);
|
||||
|
||||
b.Property<string>("Part_Number")
|
||||
.HasColumnName("Part Number")
|
||||
.HasMaxLength(50);
|
||||
|
||||
b.Property<int?>("QTY");
|
||||
|
||||
b.HasKey("Store", "SKU");
|
||||
|
||||
b.ToTable("PartsAvailability");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.Submodel", b =>
|
||||
{
|
||||
b.Property<int>("VehicleToEngineConfigId");
|
||||
|
||||
b.Property<int>("BaseVehicleId");
|
||||
|
||||
b.Property<int>("EngineId");
|
||||
|
||||
b.Property<int>("SubmodelId");
|
||||
|
||||
b.HasKey("VehicleToEngineConfigId");
|
||||
|
||||
b.ToTable("Submodel","Vehicle");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.VehicleEngine", b =>
|
||||
{
|
||||
b.Property<int>("Id");
|
||||
|
||||
b.Property<string>("Description");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("VehicleEngine","Vehicle");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.VehicleMake", b =>
|
||||
{
|
||||
b.Property<int>("Id");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("VehicleMake","Vehicle");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PartSource.Data.Models.VehicleModel", b =>
|
||||
{
|
||||
b.Property<int>("Id");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.Property<int>("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
|
||||
}
|
||||
}
|
||||
}
|
||||
20
PartSource.Data/Models/ApiClient.cs
Normal file
20
PartSource.Data/Models/ApiClient.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
18
PartSource.Data/Models/BaseVehicle.cs
Normal file
18
PartSource.Data/Models/BaseVehicle.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
13
PartSource.Data/Models/DcfMapping.cs
Normal file
13
PartSource.Data/Models/DcfMapping.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
18
PartSource.Data/Models/Engine.cs
Normal file
18
PartSource.Data/Models/Engine.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
19
PartSource.Data/Models/Fitment.cs
Normal file
19
PartSource.Data/Models/Fitment.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
41
PartSource.Data/Models/ImportData.cs
Normal file
41
PartSource.Data/Models/ImportData.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
22
PartSource.Data/Models/ImportMetric.cs
Normal file
22
PartSource.Data/Models/ImportMetric.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 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.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace PartSource.Data.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class ImportMetric
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public Nullable<int> TotalItems { get; set; }
|
||||
public Nullable<int> ChangedItems { get; set; }
|
||||
public System.DateTime ImportDate { get; set; }
|
||||
}
|
||||
}
|
||||
17
PartSource.Data/Models/Manufacturer.cs
Normal file
17
PartSource.Data/Models/Manufacturer.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
27
PartSource.Data/Models/Part.cs
Normal file
27
PartSource.Data/Models/Part.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
108
PartSource.Data/Models/PartData.cs
Normal file
108
PartSource.Data/Models/PartData.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
15
PartSource.Data/Models/PartImage.cs
Normal file
15
PartSource.Data/Models/PartImage.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
17
PartSource.Data/Models/PartPrice.cs
Normal file
17
PartSource.Data/Models/PartPrice.cs
Normal file
@@ -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<decimal> Compare_Price { get; set; }
|
||||
public Nullable<decimal> Your_Price { get; set; }
|
||||
public string Active { get; set; }
|
||||
|
||||
// public virtual PartData PartData { get; set; }
|
||||
}
|
||||
}
|
||||
26
PartSource.Data/Models/PartsAvailability.cs
Normal file
26
PartSource.Data/Models/PartsAvailability.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
33
PartSource.Data/Models/PostalCode.cs
Normal file
33
PartSource.Data/Models/PostalCode.cs
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
15
PartSource.Data/Models/ProductBackup.cs
Normal file
15
PartSource.Data/Models/ProductBackup.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
18
PartSource.Data/Models/Store.cs
Normal file
18
PartSource.Data/Models/Store.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
31
PartSource.Data/Models/StorePart.cs
Normal file
31
PartSource.Data/Models/StorePart.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
26
PartSource.Data/Models/Submodel.cs
Normal file
26
PartSource.Data/Models/Submodel.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
37
PartSource.Data/Models/VehicleData.cs
Normal file
37
PartSource.Data/Models/VehicleData.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
15
PartSource.Data/Models/VehicleMake.cs
Normal file
15
PartSource.Data/Models/VehicleMake.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
19
PartSource.Data/Models/VehicleModel.cs
Normal file
19
PartSource.Data/Models/VehicleModel.cs
Normal file
@@ -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; }
|
||||
|
||||
}
|
||||
}
|
||||
17
PartSource.Data/Nexpart/AddImg.cs
Normal file
17
PartSource.Data/Nexpart/AddImg.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
14
PartSource.Data/Nexpart/AddImgs.cs
Normal file
14
PartSource.Data/Nexpart/AddImgs.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
14
PartSource.Data/Nexpart/Apps.cs
Normal file
14
PartSource.Data/Nexpart/Apps.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
34
PartSource.Data/Nexpart/BaseVehicle.cs
Normal file
34
PartSource.Data/Nexpart/BaseVehicle.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
29
PartSource.Data/Nexpart/BaseVehicleDetail.cs
Normal file
29
PartSource.Data/Nexpart/BaseVehicleDetail.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
31
PartSource.Data/Nexpart/BaseVehicleDetailLookup.cs
Normal file
31
PartSource.Data/Nexpart/BaseVehicleDetailLookup.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
21
PartSource.Data/Nexpart/BaseVehicleDetailLookupResponse.cs
Normal file
21
PartSource.Data/Nexpart/BaseVehicleDetailLookupResponse.cs
Normal file
@@ -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<BaseVehicleDetail>
|
||||
{
|
||||
[XmlElement]
|
||||
public PSResponseHeader PSResponseHeader { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "BaseVehicleDetail")]
|
||||
public BaseVehicleDetail ResponseBody { get; set; }
|
||||
}
|
||||
}
|
||||
32
PartSource.Data/Nexpart/BaseVehicleSearch.cs
Normal file
32
PartSource.Data/Nexpart/BaseVehicleSearch.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
15
PartSource.Data/Nexpart/BaseVehicleSearchResponse.cs
Normal file
15
PartSource.Data/Nexpart/BaseVehicleSearchResponse.cs
Normal file
@@ -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<BaseVehicles>
|
||||
{
|
||||
[XmlElement]
|
||||
public PSResponseHeader PSResponseHeader { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "BaseVehicles")]
|
||||
public BaseVehicles ResponseBody { get; set; }
|
||||
}
|
||||
}
|
||||
16
PartSource.Data/Nexpart/BaseVehicles.cs
Normal file
16
PartSource.Data/Nexpart/BaseVehicles.cs
Normal file
@@ -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; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
44
PartSource.Data/Nexpart/Body.cs
Normal file
44
PartSource.Data/Nexpart/Body.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
14
PartSource.Data/Nexpart/BuyersGuideData.cs
Normal file
14
PartSource.Data/Nexpart/BuyersGuideData.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
20
PartSource.Data/Nexpart/BuyersGuideEngine.cs
Normal file
20
PartSource.Data/Nexpart/BuyersGuideEngine.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
26
PartSource.Data/Nexpart/BuyersGuideMake.cs
Normal file
26
PartSource.Data/Nexpart/BuyersGuideMake.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
26
PartSource.Data/Nexpart/BuyersGuideModel.cs
Normal file
26
PartSource.Data/Nexpart/BuyersGuideModel.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
17
PartSource.Data/Nexpart/BuyersGuidePart.cs
Normal file
17
PartSource.Data/Nexpart/BuyersGuidePart.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
22
PartSource.Data/Nexpart/BuyersGuideSearch.cs
Normal file
22
PartSource.Data/Nexpart/BuyersGuideSearch.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
18
PartSource.Data/Nexpart/BuyersGuideSearchResponse.cs
Normal file
18
PartSource.Data/Nexpart/BuyersGuideSearchResponse.cs
Normal file
@@ -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<BuyersGuideData>
|
||||
{
|
||||
[XmlElement]
|
||||
public PSResponseHeader PSResponseHeader { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "BuyersGuideData")]
|
||||
public BuyersGuideData ResponseBody { get; set; }
|
||||
}
|
||||
}
|
||||
17
PartSource.Data/Nexpart/Criterion.cs
Normal file
17
PartSource.Data/Nexpart/Criterion.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
20
PartSource.Data/Nexpart/Engine.cs
Normal file
20
PartSource.Data/Nexpart/Engine.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
37
PartSource.Data/Nexpart/EngineSearch.cs
Normal file
37
PartSource.Data/Nexpart/EngineSearch.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
21
PartSource.Data/Nexpart/EngineSearchResponse.cs
Normal file
21
PartSource.Data/Nexpart/EngineSearchResponse.cs
Normal file
@@ -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<Engines>
|
||||
{
|
||||
[XmlElement]
|
||||
public PSResponseHeader PSResponseHeader { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "Engines")]
|
||||
public Engines ResponseBody { get; set; }
|
||||
}
|
||||
}
|
||||
17
PartSource.Data/Nexpart/Engines.cs
Normal file
17
PartSource.Data/Nexpart/Engines.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
26
PartSource.Data/Nexpart/Envelope.cs
Normal file
26
PartSource.Data/Nexpart/Envelope.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
20
PartSource.Data/Nexpart/Exceptions.cs
Normal file
20
PartSource.Data/Nexpart/Exceptions.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
15
PartSource.Data/Nexpart/Interfaces/IResponseElement.cs
Normal file
15
PartSource.Data/Nexpart/Interfaces/IResponseElement.cs
Normal file
@@ -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<T>
|
||||
{
|
||||
PSResponseHeader PSResponseHeader { get; set; }
|
||||
|
||||
T ResponseBody { get; set; }
|
||||
}
|
||||
}
|
||||
29
PartSource.Data/Nexpart/Item.cs
Normal file
29
PartSource.Data/Nexpart/Item.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
17
PartSource.Data/Nexpart/Items.cs
Normal file
17
PartSource.Data/Nexpart/Items.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
23
PartSource.Data/Nexpart/Make.cs
Normal file
23
PartSource.Data/Nexpart/Make.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
33
PartSource.Data/Nexpart/MakeSearch.cs
Normal file
33
PartSource.Data/Nexpart/MakeSearch.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
21
PartSource.Data/Nexpart/MakeSearchResponse.cs
Normal file
21
PartSource.Data/Nexpart/MakeSearchResponse.cs
Normal file
@@ -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<Makes>
|
||||
{
|
||||
[XmlElement]
|
||||
public PSResponseHeader PSResponseHeader { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "Makes")]
|
||||
public Makes ResponseBody { get; set; }
|
||||
}
|
||||
}
|
||||
17
PartSource.Data/Nexpart/Makes.cs
Normal file
17
PartSource.Data/Nexpart/Makes.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
29
PartSource.Data/Nexpart/MenuNode.cs
Normal file
29
PartSource.Data/Nexpart/MenuNode.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
17
PartSource.Data/Nexpart/MenuNodes.cs
Normal file
17
PartSource.Data/Nexpart/MenuNodes.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user