protected void HostingPackagesGrid_OnRowCommand(object sender, GridViewCommandEventArgs e) { ArrayList wpiProductsForInstall = GetProductsToInstallList(); int productIndex = int.Parse((string)e.CommandArgument); WPIProduct wpiProduct = GetHostingPackages()[productIndex]; if (null != wpiProduct) { if (e.CommandName == "WpiAdd") { wpiProductsForInstall = GetProductsToInstallList(); wpiProductsForInstall.Add(wpiProduct.ProductId); SetProductsToInstallList(wpiProductsForInstall); ((Button)e.CommandSource).Text = AddUpgradeRemoveText(wpiProduct);; ((Button)e.CommandSource).CommandName = "WpiRemove"; } if (e.CommandName == "WpiRemove") { wpiProductsForInstall = GetProductsToInstallList(); wpiProductsForInstall.Remove(wpiProduct.ProductId); SetProductsToInstallList(wpiProductsForInstall); ((Button)e.CommandSource).Text = AddUpgradeRemoveText(wpiProduct); ((Button)e.CommandSource).CommandName = "WpiAdd"; } btnInstall.Enabled = wpiProductsForInstall.Count > 0; } }
protected string AddUpgradeRemoveText(WPIProduct wpiProduct) { if (GetProductsToInstallList().Contains(wpiProduct.ProductId)) { return("- cancel"); } else { return(wpiProduct.IsUpgrade ? "+ upgrade" : "+ add"); } }
protected void gvWpiInstall_RowDataBound(object sender, GridViewRowEventArgs e) { WPIProduct p = (WPIProduct)e.Row.DataItem; if (p != null) { Label labelFileSize = (Label)e.Row.FindControl("downloadSize"); if (p.FileSize == 0) { if (labelFileSize != null) { labelFileSize.Visible = false; } } else { if (labelFileSize != null) { labelFileSize.Text += " " + p.FileSize + " Kb"; } } if (string.IsNullOrEmpty(p.EulaUrl)) { HyperLink hl = (HyperLink)e.Row.FindControl("eulaLink"); if (hl != null) { hl.Visible = false; } } if (string.IsNullOrEmpty(p.DownloadedLocation)) { Label label = (Label)e.Row.FindControl("labelDownloaded"); if (label != null) { label.Visible = false; } } } }
private void BindEngines() { WPIProduct zooModule = ES.Services.Servers.GetWPIProductById(PanelRequest.ServerId, "HeliconZooModule"); if (!zooModule.IsInstalled || zooModule.IsUpgrade) { HostModule.ShowWarningMessage("Zoo Module is not installed or out-of-date. To proceed press 'Add' or 'Update' next to Helicon Zoo Module below, then press 'Install'."); } // get all engines from IIS HeliconZooEngine[] engineList = ES.Services.HeliconZoo.GetEngines(PanelRequest.ServiceId); if (null != engineList && engineList.Length > 0) { // convert list to dict Dictionary <string, HeliconZooEngine> enginesDict = new Dictionary <string, HeliconZooEngine>(); foreach (HeliconZooEngine engine in engineList) { enginesDict[engine.name] = engine; } // save engines in view state ViewState["HeliconZooEngines"] = enginesDict; // bind to grid EngineGrid.DataSource = engineList; EngineGrid.DataBind(); // bind 'Enable quotas' checkbox bool enabled = ES.Services.HeliconZoo.IsEnginesEnabled(PanelRequest.ServiceId); QuotasEnabled.Checked = !enabled; WebCosoleEnabled.Checked = ES.Services.HeliconZoo.IsWebCosoleEnabled(PanelRequest.ServiceId); } else { EnginesPanel.Visible = false; } }