/// <summary> /// Returns inventoried devices today/yesterday for Inventory and SLM /// </summary> /// <returns></returns> public bool GetReportedToday(bool slm = false, bool sinv = false) { InventoryServer inventoryServer = new InventoryServer(); LicenseManager licenseManager = new LicenseManager(); ExcelPackage.LicenseContext = LicenseContext.NonCommercial; using (ExcelPackage pck = new ExcelPackage(new FileInfo(dc.Export + ExportName))) { if (slm) { pck.Workbook.Worksheets.Add("SLM DeviceReporting (Yday)").Cells["A1"].LoadFromDataTable(licenseManager.ReportedYesterday(), true, tableStyle).AutoFitColumns(); TabColor(pck, "DeviceReporting", Convert.ToInt32(XmlConfigurator.Read(dc.Config + ac.AppConfig, "LicenseManagerDeviceThreshold")), "SLM DeviceReporting (Yday)"); } if (sinv) { pck.Workbook.Worksheets.Add("SINV DeviceReporting (Today)").Cells["A1"].LoadFromDataTable(inventoryServer.ReportedToday(), true, tableStyle).AutoFitColumns(); TabColor(pck, "DeviceReporting", Convert.ToInt32(XmlConfigurator.Read(dc.Config + ac.AppConfig, "InventoryServerDeviceThreshold")), "SINV DeviceReporting (Today)"); } pck.Save(); } if (File.Exists(dc.Export + ExportName)) { return(true); } else { return(false); } }
private void btnStartProgram_Click(object sender, EventArgs e) { try { if (File.Exists(Local.AppConfig)) { FrmMain frm = new FrmMain { SqlConnection = Kryptos.Decrypt(XmlConfigurator.Read("Connections\\" + cbConnectionList.Text + ".config", "SqlConnectionString"), Kryptos.GetHardwareID()) }; frm.Show(); Hide(); } else { FrmSettings frm = new FrmSettings(); using (frm) { frm.FirstStart = true; frm.ShowDialog(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Uncaught Exception", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
// Read the specific node from a configuration file public static string ReadXMLValue(string path, string node, string rootNode = "Configuration") { try { return(XmlConfigurator.Read(path, node, rootNode)); } catch (Exception ex) { return(""); } }
private void FrmSettings_Load(object sender, EventArgs e) { if (FirstStart == false) { try { int etd = 0; foreach (string c in cblReportingTableDesign.Items) { if (c == XmlConfigurator.Read(Local.AppConfig, "ReportingTableDesign")) { cblReportingTableDesign.SelectedIndex = etd; } etd += 1; } List <string> MemorySavingDoubleBuffer = XmlConfigurator.Read(Local.AppConfig, "MemorySavingDoubleBuffer").Split(',').ToList(); foreach (string i in MemorySavingDoubleBuffer) { if (i == "dgvAppList") { cbMemoryAppList.Checked = true; } if (i == "dgvAppListRules") { cbMemoryAppListRules.Checked = true; } if (i == "dgvUnassignedList") { cbMemoryUnassignedAppList.Checked = true; } } txtAppListColumns.Text = XmlConfigurator.Read(Local.AppConfig, "HiddenColumnsAppList"); txtAppListRulesColumns.Text = XmlConfigurator.Read(Local.AppConfig, "HiddenColumnsAppListRules"); txtUnassignedAppListColumns.Text = XmlConfigurator.Read(Local.AppConfig, "HiddenColumnsAppUnassignedList"); txtReportingWorkbookTitle.Text = XmlConfigurator.Read(Local.AppConfig, "ReportingWorkbookTitle"); txtReportingWorkbookCompany.Text = XmlConfigurator.Read(Local.AppConfig, "ReportingWorkbookCompany"); txtReportingWorksheetName.Text = XmlConfigurator.Read(Local.AppConfig, "ReportingWorksheetName"); numDatabaseCommandTimeout.Value = Convert.ToDecimal(XmlConfigurator.Read(Local.AppConfig, "DatabaseCommandTimeout")); } catch (Exception ex) { MessageBox.Show(ex.Message, "Uncaught Exception", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }