private void GetAPIData() { SnowAPI snowAPI = new SnowAPI(); var o = snowAPI.GetData().Content; XmlDocument doc = new XmlDocument(); doc.LoadXml(o); foreach (XmlNode node in doc.DocumentElement.ChildNodes) { if (node.InnerText.Contains("Snow License Manager 9")) { foreach (XmlNode n1 in node.ChildNodes) { if (n1.Name == "Version") { Globals.SnowAPILMVersion = n1.InnerText; } } } if (node.InnerText.Contains("Snow Inventory Server 6")) { foreach (XmlNode n1 in node.ChildNodes) { if (n1.Name == "Version") { Globals.SnowAPIISVersion = n1.InnerText; } } } } }
private void debugDataToolStripMenuItem_Click(object sender, EventArgs e) { GetAPIData(); dgvDeviceList.Rows.Clear(); dgvDeviceList.Rows.Add("SVR01EXP01", "Online", "9.7.0", "6.4.0", SnowAPI.VersionCheck("9.7.0", Globals.SnowAPILMVersion), SnowAPI.VersionCheck("6.4.0", Globals.SnowAPIISVersion)); dgvDeviceList.Rows.Add("SVR01EXP02", "Online", "8.3.12", "5.3.1", SnowAPI.VersionCheck("8.3.12", Globals.SnowAPILMVersion), SnowAPI.VersionCheck("5.3.1", Globals.SnowAPIISVersion)); dgvDeviceList.Rows.Add("SVR01EXP03", "Online", Globals.SnowAPILMVersion, Globals.SnowAPIISVersion, SnowAPI.VersionCheck(Globals.SnowAPILMVersion, Globals.SnowAPILMVersion), SnowAPI.VersionCheck(Globals.SnowAPIISVersion, Globals.SnowAPIISVersion)); dgvDeviceList.Rows.Add("SVR01EXP04", "Offline", "", "", false, false); }
private void startScanToolStripMenuItem_Click(object sender, EventArgs e) { try { if (Globals.DeviceList.Count < 1) { MessageBox.Show("Please populate the computers list", "Scan Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { GetAPIData(); dgvDeviceList.Rows.Clear(); //clear all existing data foreach (DeviceModel i in Globals.DeviceList) { string status; if (Globals.PingDevice(i.Name)) { status = "Online"; } else { status = "Offline"; } string LMVersion = Laim.MSSqlServer.ExecuteReadString("Server=" + i.Name + ";Integrated Security=SSPI;Application Name=" + ProductName + ";", "SELECT DBVersion FROM SnowLicenseManager.dbo.tblSystemInfo"); string ISVersion = Laim.MSSqlServer.ExecuteReadString("Server=" + i.Name + ";Integrated Security=SSPI;Application Name=" + ProductName + ";", "SELECT TOP 1 ServerVersion FROM SnowInventory.inv.DbVersionHistory ORDER BY ServerVersion DESC");; bool IsUpdatedRequiredLM = SnowAPI.VersionCheck(LMVersion, Globals.SnowAPILMVersion); bool IsUpdateRequiredIS = SnowAPI.VersionCheck(ISVersion, Globals.SnowAPIISVersion); // add the device to the row then move onto the next one dgvDeviceList.Rows.Add(i.Name, status, LMVersion, ISVersion, IsUpdatedRequiredLM, IsUpdateRequiredIS); } } } catch (SqlException ex) { MessageBox.Show(ex.Message, "SqlException", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } catch (Exception ex) { MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }