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

@ -498,6 +498,11 @@ namespace WebsitePanel.EnterpriseServer
return GetServerService(serverId).GetWPIProductsFiltered(keywordId); return GetServerService(serverId).GetWPIProductsFiltered(keywordId);
} }
public static WPIProduct GetWPIProductById(int serverId, string productdId)
{
return GetServerService(serverId).GetWPIProductById(productdId);
}
public static WPIProduct[] GetWPIProductsWithDependencies(int serverId, string[] products) public static WPIProduct[] GetWPIProductsWithDependencies(int serverId, string[] products)

View file

@ -752,6 +752,12 @@ namespace WebsitePanel.EnterpriseServer
return OperatingSystemController.GetWPIProductsFiltered(serverId, keywordId); return OperatingSystemController.GetWPIProductsFiltered(serverId, keywordId);
} }
[WebMethod]
public WPIProduct GetWPIProductById(int serverId, string productdId)
{
InitWPIFeeds(serverId);
return OperatingSystemController.GetWPIProductById(serverId, productdId);
}
[WebMethod] [WebMethod]
public WPIProduct[] GetWPIProductsWithDependencies(int serverId, string[] products) public WPIProduct[] GetWPIProductsWithDependencies(int serverId, string[] products)

View file

@ -26,10 +26,11 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:2.0.50727.42 // Runtime Version:2.0.50727.5466
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
@ -39,8 +40,7 @@
// //
// This source code was auto-generated by wsdl, Version=2.0.50727.42. // This source code was auto-generated by wsdl, Version=2.0.50727.42.
// //
namespace WebsitePanel.Server namespace WebsitePanel.Server {
{
using System.Diagnostics; using System.Diagnostics;
using System.Web.Services; using System.Web.Services;
using System.ComponentModel; using System.ComponentModel;
@ -73,6 +73,8 @@ namespace WebsitePanel.Server
private System.Threading.SendOrPostCallback GetWPIProductsFilteredOperationCompleted; private System.Threading.SendOrPostCallback GetWPIProductsFilteredOperationCompleted;
private System.Threading.SendOrPostCallback GetWPIProductByIdOperationCompleted;
private System.Threading.SendOrPostCallback GetWPITabsOperationCompleted; private System.Threading.SendOrPostCallback GetWPITabsOperationCompleted;
private System.Threading.SendOrPostCallback InitWPIFeedsOperationCompleted; private System.Threading.SendOrPostCallback InitWPIFeedsOperationCompleted;
@ -132,6 +134,9 @@ namespace WebsitePanel.Server
/// <remarks/> /// <remarks/>
public event GetWPIProductsFilteredCompletedEventHandler GetWPIProductsFilteredCompleted; public event GetWPIProductsFilteredCompletedEventHandler GetWPIProductsFilteredCompleted;
/// <remarks/>
public event GetWPIProductByIdCompletedEventHandler GetWPIProductByIdCompleted;
/// <remarks/> /// <remarks/>
public event GetWPITabsCompletedEventHandler GetWPITabsCompleted; public event GetWPITabsCompletedEventHandler GetWPITabsCompleted;
@ -496,6 +501,47 @@ namespace WebsitePanel.Server
} }
} }
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetWPIProductById", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public WPIProduct GetWPIProductById(string productdId) {
object[] results = this.Invoke("GetWPIProductById", new object[] {
productdId});
return ((WPIProduct)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginGetWPIProductById(string productdId, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetWPIProductById", new object[] {
productdId}, callback, asyncState);
}
/// <remarks/>
public WPIProduct EndGetWPIProductById(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((WPIProduct)(results[0]));
}
/// <remarks/>
public void GetWPIProductByIdAsync(string productdId) {
this.GetWPIProductByIdAsync(productdId, null);
}
/// <remarks/>
public void GetWPIProductByIdAsync(string productdId, object userState) {
if ((this.GetWPIProductByIdOperationCompleted == null)) {
this.GetWPIProductByIdOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetWPIProductByIdOperationCompleted);
}
this.InvokeAsync("GetWPIProductById", new object[] {
productdId}, this.GetWPIProductByIdOperationCompleted, userState);
}
private void OnGetWPIProductByIdOperationCompleted(object arg) {
if ((this.GetWPIProductByIdCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetWPIProductByIdCompleted(this, new GetWPIProductByIdCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/> /// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetWPITabs", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetWPITabs", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public WPITab[] GetWPITabs() { public WPITab[] GetWPITabs() {
@ -1237,6 +1283,32 @@ namespace WebsitePanel.Server
} }
} }
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void GetWPIProductByIdCompletedEventHandler(object sender, GetWPIProductByIdCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetWPIProductByIdCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal GetWPIProductByIdCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public WPIProduct Result {
get {
this.RaiseExceptionIfNecessary();
return ((WPIProduct)(this.results[0]));
}
}
}
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void GetWPITabsCompletedEventHandler(object sender, GetWPITabsCompletedEventArgs e); public delegate void GetWPITabsCompletedEventHandler(object sender, GetWPITabsCompletedEventArgs e);

View file

@ -267,6 +267,20 @@ namespace WebsitePanel.Server.Code
return products; 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) public List<Product> GetProductsToInstall(IEnumerable<string> productIdsToInstall)
{ {
List<Product> productsToInstall = new List<Product>(); List<Product> productsToInstall = new List<Product>();
@ -582,7 +596,6 @@ namespace WebsitePanel.Server.Code
private void Initialize() private void Initialize()
{ {
// create cache folder if not exists // create cache folder if not exists
//_webPIinstallersFolder = Environment.ExpandEnvironmentVariables(@"%LocalAppData%\Microsoft\Web Platform Installer\installers");
_webPIinstallersFolder = Path.Combine( _webPIinstallersFolder = Path.Combine(
Environment.ExpandEnvironmentVariables("%SystemRoot%"), Environment.ExpandEnvironmentVariables("%SystemRoot%"),
"Temp\\zoo.wpi\\AppData\\Local\\Microsoft\\Web Platform Installer\\installers"); "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] [WebMethod]
public WPITab[] GetWPITabs() public WPITab[] GetWPITabs()
{ {

View file

@ -394,7 +394,15 @@ public partial class HeliconZoo_Settings : WebsitePanelControlBase, IHostingServ
private static WPIProduct[] RequestHostingPackages() private static WPIProduct[] RequestHostingPackages()
{ {
return ES.Services.Servers.GetWPIProducts(PanelRequest.ServerId, null, "ZooPackage"); List<WPIProduct> result = new List<WPIProduct>();
result.Add(ES.Services.Servers.GetWPIProductById(PanelRequest.ServerId, "HeliconZooModule"));
result.AddRange(ES.Services.Servers.GetWPIProducts(PanelRequest.ServerId, null, "ZooPackage"));
return result.ToArray();
} }
protected string AddUpgradeRemoveText(WPIProduct wpiProduct) protected string AddUpgradeRemoveText(WPIProduct wpiProduct)