/// <summary> /// Adds a software data object /// </summary> public void Add() { try { using (var conn = new Model.EoF_Configuration_Database_TEST_REGIONDataSetTableAdapters.SoftwareTableAdapter()) { conn.Insert(Helpers.Globals.DEFAULT_SOFTWARE_NAME, Helpers.Globals.DEAFULT_SOFTWARE_VENDOR, Helpers.Globals.DEFAULT_SOFTWARE_VERSION, Helpers.Globals.DEFAULT_SOFTWARE_DESCRIPTION, Helpers.Globals.DEFAULT_SOFTWARE_PURPOSE); } } catch (Exception ex) { MessageBox.Show(ex.Message); } SoftwareInfoChanged.Invoke(this, new EventArgs()); }
/// <summary> /// Removes the row from the database /// </summary> public void Remove() { try { using (var conn = new Model.EoF_Configuration_Database_TEST_REGIONDataSetTableAdapters.SoftwareTableAdapter()) { conn.DeleteQuery(SelectedSoftware.ID); } } catch (Exception ex) { MessageBox.Show(ex.Message); } SoftwareInfoChanged.Invoke(this, new EventArgs()); }
/// <summary> /// Saves the changes made in data grid etc. /// </summary> public void Save() { try { using (var conn = new Model.EoF_Configuration_Database_TEST_REGIONDataSetTableAdapters.SoftwareTableAdapter()) { foreach (var software in _allSoftware) { conn.Update(software); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } SoftwareInfoChanged.Invoke(this, new EventArgs()); }
/// <summary> /// Generates a pdf report of all the information relevant to that machine /// </summary> public void PrintReport() { var propDic = new Dictionary<String, String>(); propDic.Add("ComputerName", "Computer Name: "); propDic.Add("AssetTag", "Asset Number: "); propDic.Add("UpdateGroup", "Update Policy: "); propDic.Add("EPPositionName", "EP Title: "); propDic.Add("IPStatic", "Static IP Address: "); try { using (var assocConn = new Model.EoF_Configuration_Database_TEST_REGIONDataSetTableAdapters.MachinesSoftwareTableAdapter()) { using (var softConn = new Model.EoF_Configuration_Database_TEST_REGIONDataSetTableAdapters.SoftwareTableAdapter()) { // grab the software relevant to the machine var _software = from _soft in softConn.GetData() join _assoc in assocConn.GetData() on _soft.ID equals _assoc.SoftwareId where SelectedMachine.ID == _assoc.MachineId select _soft; int i = 0; foreach (var software in _software) { propDic.Add("Software Number " + i.ToString() + ": ", software.SoftwareName); i++; } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } Helpers.Reports.PDFIndividualReport.GenerateReport<Model.EoF_Configuration_Database_TEST_REGIONDataSet.MachinesRow>(SelectedMachine, propDic, SelectedMachine.ComputerName); }