private void componentsGrid_DemandLoad(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e) { Business.ApplicationComponent comp = (Business.ApplicationComponent)appComponents[(int)e.Row.Cells.FromKey("Id").Value]; if (comp != null) { e.Row.Expanded = true; UltraGridBand band = componentsGrid.Bands[e.Row.BandIndex + 1]; if (comp.DatabaseComponentId >= 0) { Business.ApplicationComponent dbComp = comp.DatabaseComponent; UltraGridRow newRow = new UltraGridRow(new object[] { comp.DatabaseComponentId, dbComp.Name, dbComp.Type, dbComp.Description }); e.Row.Rows.Add(newRow); newRow.ShowExpand = (dbComp.DatabaseComponentId >= 0 || dbComp.HardwareComponentId >= 0); } if (comp.HardwareComponentId >= 0) { Business.ApplicationComponent hwComp = comp.HardwareComponent; UltraGridRow newRow = new UltraGridRow(new object[] { comp.HardwareComponentId, hwComp.Name, hwComp.Type, hwComp.Description }); e.Row.Rows.Add(newRow); newRow.ShowExpand = (hwComp.DatabaseComponentId >= 0 || hwComp.HardwareComponentId >= 0); } } if (componentsGrid.Bands[e.Row.BandIndex + 1] == null) { AddBand(componentsGrid); } }
public string Check(int appComponentId) { string result = ""; Business.ApplicationComponent component = Business.ApplicationSettings.Components[appComponentId]; if (component != null) { switch (component.Type) { case HyperCatalog.Business.ApplicationComponentTypes.Batch: //if (component.Action == null) // result += "<LI style=\"color:orange;\">Action is not set</LI>"; //else result += "<LI style=\"color:green;\">OK</LI>"; break; case HyperCatalog.Business.ApplicationComponentTypes.Database: if (component.HardwareComponentId <= 0 && component.URI == null) { result += "<LI style=\"color:orange;\">Hardware is not set</LI>"; } else { HyperComponents.Data.dbAccess.Database dbObj = new HyperComponents.Data.dbAccess.Database(component.ConnectionString); DataSet ds = dbObj.RunSQLReturnDataSet("SELECT TOP 1 VersionNumber FROM DBVersion ORDER BY VersionDate DESC"); if (dbObj.LastError != "") { result += "<LI style=\"color:red;\">" + dbObj.LastError + "</LI>"; } else if (ds == null || ds.Tables.Count != 1 || ds.Tables[0].Rows.Count != 1) { result += "<LI style=\"color:orange;\">OK but datatable version was not found</LI>"; } else { result += "<LI style=\"color:green;\">OK (version " + ds.Tables[0].Rows[0].ItemArray[0] + ")</LI>"; } } break; case HyperCatalog.Business.ApplicationComponentTypes.Hardware: if (component.URI == null) { result += "<LI style=\"color:red;\">IP is not set</LI>"; } else { result += "<LI style=\"color:green;\">OK</LI>"; } break; case HyperCatalog.Business.ApplicationComponentTypes.WebService: if (component.URI == null) { result += "<LI style=\"color:red;\">URL is not set</LI>"; } else { try { XmlDocument wsXml = new XmlDocument(); wsXml.Load(System.Net.WebRequest.Create(component.URI + "?WSDL").GetResponse().GetResponseStream()); int methodCount = (int)(HyperComponents.Xml.Xml.SelectNodes(wsXml, "//wsdl:operation", "wsdl").Count / 3); if (methodCount > 0) { result += "<LI style=\"color:green;\">OK: <a target=\"_blank\" href=\"" + component.URI + "\">" + component.Name + "</a> reached (" + methodCount + " method" + (methodCount > 1?"s":"") + " found)</BR>"; } else { result += "<LI style=\"color:orange;\"><a target=\"_blank\" href=\"" + component.URI + "\">" + component.Name + "</a> reached but no method found inside</BR>"; } } catch (Exception exc) { result += "<LI style=\"color:red;\"><a target=\"_blank\" href=\"" + component.URI + "\">" + component.Name + "</a> not reachable</LI>"; } } break; case HyperCatalog.Business.ApplicationComponentTypes.WebUI: if (component.URI == null) { result += "<LI style=\"color:red;\">URL is not set</LI>"; } else { try { XmlDocument wsXml = new XmlDocument(); Stream resStream = System.Net.WebRequest.Create(component.URI).GetResponse().GetResponseStream(); try { wsXml.Load(resStream); result += "<LI style=\"color:green;\">OK: <a target=\"_blank\" href=\"" + component.URI + "\">" + component.Name + "</a> reached</BR>"; } catch { if (resStream.ReadByte() > 0) { result += "<LI style=\"color:green;\">OK: <a target=\"_blank\" href=\"" + component.URI + "\">" + component.Name + "</a> reached</BR>"; } else { result += "<LI style=\"color:red;\"><a target=\"_blank\" href=\"" + component.URI + "\">" + component.Name + "</a> not reachable</BR>"; } } } catch (Exception exc) { result += "<LI style=\"color:red;\"><a target=\"_blank\" href=\"" + component.URI + "\">" + component.Name + "</a> not reachable</LI>"; } } break; } } return(result); }
private void componentsGrid_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e) { Business.ApplicationComponent comp = (Business.ApplicationComponent)e.Data; e.Row.ShowExpand = comp.DatabaseComponentId >= 0 || comp.HardwareComponentId >= 0; }