WPI: GetWPIProductById

This commit is contained in:
sergey 2013-06-05 12:11:05 +03:00
parent b62b699461
commit 7ceccd4c10
7 changed files with 437 additions and 238 deletions

View file

@ -266,6 +266,20 @@ namespace WebsitePanel.Server.Code
return products;
}
public Product GetWPIProductById(string productId)
{
foreach (Product product in _productManager.Products)
{
if (0 == String.Compare(product.ProductId, productId, StringComparison.OrdinalIgnoreCase))
{
return product;
}
}
return null; //not found
}
public List<Product> GetProductsToInstall(IEnumerable<string> productIdsToInstall)
{
@ -582,7 +596,6 @@ namespace WebsitePanel.Server.Code
private void Initialize()
{
// create cache folder if not exists
//_webPIinstallersFolder = Environment.ExpandEnvironmentVariables(@"%LocalAppData%\Microsoft\Web Platform Installer\installers");
_webPIinstallersFolder = Path.Combine(
Environment.ExpandEnvironmentVariables("%SystemRoot%"),
"Temp\\zoo.wpi\\AppData\\Local\\Microsoft\\Web Platform Installer\\installers");

View file

@ -480,6 +480,27 @@ namespace WebsitePanel.Server
}
}
[WebMethod]
public WPIProduct GetWPIProductById(string productdId)
{
try
{
Log.WriteStart("GetWPIProductById");
WpiHelper wpi = GetWpiFeed();
Product product = wpi.GetWPIProductById(productdId);
WPIProduct wpiProduct = ProductToWPIProduct(product);
Log.WriteEnd("GetWPIProductById");
return wpiProduct;
}
catch (Exception ex)
{
Log.WriteError("GetWPIProductById", ex);
throw;
}
}
[WebMethod]
public WPITab[] GetWPITabs()
{