/// <summary> /// Primary constructor loads the Email configuration from the database /// </summary> public EmailConfiguration() { // Get the database object SettingsDAO lwDataAccess = new SettingsDAO(); // List of email recipients string recipientList = lwDataAccess.GetSetting(MailSettingsKeys.MailAddress, false); if (recipientList != null) { string[] recipients = recipientList.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); foreach (string recipient in recipients) { this.ListRecipients.Add(recipient); } } // Get the email configuration from the database Sender = lwDataAccess.GetSetting(MailSettingsKeys.MailSender, false); // It's possible that the Port hasn't been set so this conversion could fail try { Port = Convert.ToInt32(lwDataAccess.GetSetting(MailSettingsKeys.MailPort, false)); } catch (Exception) { Port = 23; } Server = lwDataAccess.GetSetting(MailSettingsKeys.MailServer, false); RequiresAuthentication = lwDataAccess.GetSettingAsBoolean(MailSettingsKeys.MailRequiresAuthentication, false); UserName = lwDataAccess.GetSetting(MailSettingsKeys.MailUserName, false); Password = lwDataAccess.GetSetting(MailSettingsKeys.MailPassword, true); SSLEnabled = lwDataAccess.GetSettingAsBoolean(MailSettingsKeys.MailSSLEnabled, false); //Added for ID 66125/66652 }
public void Save() { string filePath = Path.Combine(Application.StartupPath, "Scanners"); filePath = Path.Combine(filePath, AlertMonitorDefinitionsFile); try { XmlSerializer serializer = new XmlSerializer(typeof(AlertMonitorSettings)); TextWriter textWriter = new StreamWriter(filePath); serializer.Serialize(textWriter, this); // We now need to serialize the AlertDefinitions textWriter.Close(); } catch (Exception ex) { MessageBox.Show("Failed to save the Alert Monitor Definitions to '" + filePath + "'. reason: " + ex.Message, "Save Failed"); } // Save enabled/disabled to the database also SettingsDAO lwDataAccess = new SettingsDAO(); lwDataAccess.SetSetting(DatabaseSettings.Setting_AlertMonitorEnable, _enabled.ToString(), false); }
/// <summary> /// Called as the form loads - initialize the default path from the current scanner configuration /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FormUploadAudits_Load(object sender, EventArgs e) { string lLastFolder = new SettingsDAO().GetSetting("LastUploadFolder", false); try { if (lLastFolder != "") { tbAuditFolder.Text = lLastFolder; } else { AuditScannerDefinition auditScannerDefinition = AuditWizardSerialization.DeserializeDefaultScannerObject(); tbAuditFolder.Text = auditScannerDefinition.DeployPathData; } if (tbAuditFolder.Text != String.Empty) { watcher.Path = tbAuditFolder.Text; watcher.NotifyFilter = NotifyFilters.LastWrite; watcher.Filter = "*.adf"; watcher.Changed += new FileSystemEventHandler(watcher_Changed); watcher.Deleted += new FileSystemEventHandler(watcher_Changed); watcher.EnableRaisingEvents = true; RefreshList(); } } catch (ArgumentException ex) { Logger.Error(ex.Message); } }
private void SaveScanSettings() { SettingsDAO settingsDao = new SettingsDAO(); settingsDao.SetSetting("AutoScanIntervalValue", tbScanInterval.Text, false); settingsDao.SetSetting("AutoScanNetwork", Convert.ToString(cbEnableScan.Checked), false); settingsDao.SetSetting("AutoScanDeployAgent", Convert.ToString(cbDeployAgent.Checked), false); settingsDao.SetSetting("AutoScanIntervalUnits", Convert.ToString(cbScanInterval.SelectedItem.ToString()), false); AuditWizardServiceController _serviceController = new Layton.AuditWizard.Common.AuditWizardServiceController(); LaytonServiceController.ServiceStatus serviceStatus = _serviceController.CheckStatus(); if (serviceStatus == LaytonServiceController.ServiceStatus.Running) { _serviceController.RestartService(); } else { if (serviceStatus != LaytonServiceController.ServiceStatus.NotInstalled) { _serviceController.Start(); } } DesktopAlert.ShowDesktopAlert("Settings have been updated."); }
public ReportsWorkItemController(WorkItem workItem) : base(workItem) { // We need to pull the publisher filter list from the database SettingsDAO lwDataAccess = new SettingsDAO(); _publisherFilter = lwDataAccess.GetPublisherFilter(); }
private void OnElapsedTime(object source, ElapsedEventArgs e) { try { //myEventLog.WriteEntry("Timer tick.", EventLogEntryType.Information); timer.Stop(); ConnectionManager connectionManager = new ConnectionManager(); NpgsqlConnection conn = connectionManager.getConnection(); SettingsDAO settingsDAO = new SettingsDAO(); Settings set = settingsDAO.readAll(conn); myEventLog.WriteEntry(set.ToString(), EventLogEntryType.Information); conn.Close(); conn.Dispose(); if (validateSettings(set)) { if (!DayEnabled(set)) { timer.Start(); return; } myEventLog.WriteEntry("Inicia Proceso.", EventLogEntryType.Information); resetWeek(set); string sScheduled = set.todSchedule; string[] scheduled = sScheduled.Split(';'); string current = DateTime.Now.ToString("HH:mm"); bool sent = false; foreach (string sTime in scheduled) { if (current.CompareTo(sTime) >= 0 && !HourExecuted(sTime, set)) { if (!sent && InExecutionRange(sTime)) { sendSMS(set); //localFiles(set); sent = true; } addExecutionToList(sTime, set); } } } else { myEventLog.WriteEntry("Configuracion incorrecta. Corrija la configuracion de SMS y posteriormente reinicie el servicio.", EventLogEntryType.Error); return; } timer.Start(); } catch (Exception ex) { myEventLog.WriteEntry("Ha ocurrido un error: " + ex.Message + " " + ex.StackTrace, EventLogEntryType.Error); } }
public AdministrationWorkItemController(WorkItem workItem) : base(workItem) { this.workItem = workItem as AdministrationWorkItem; // We need to pull the publisher filter list from the database SettingsDAO lwDataAccess = new SettingsDAO(); _publisherFilter = lwDataAccess.GetPublisherFilter(); }
/// <summary> /// Called when we change the state of any fields on this tab to force a change on exit /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void uploadOptions_changed(object sender, EventArgs e) { _uploadConfigurationChanged = true; // Save the settings into the database SettingsDAO lwDataAccess = new SettingsDAO(); lwDataAccess.SetSetting(DatabaseSettingsKeys.Setting_DeleteAfterUpload, rbDeleteAfterUpload.Checked.ToString(), false); lwDataAccess.SetSetting(DatabaseSettingsKeys.Setting_BackupAfterUpload, rbBackupAfterUpload.Checked.ToString(), false); }
/// <summary> /// Initialize this tab /// </summary> private void InitializeTools() { SettingsDAO lwDataAccess = new SettingsDAO(); string remoteDesktop = lwDataAccess.GetSetting("RemoteDesktopCommand", false); if (remoteDesktop == "") { remoteDesktop = Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.System), "mstsc.exe /v:%A"); } tbRemoteDesktop.Text = remoteDesktop; }
private void bnSave_Click(object sender, EventArgs e) { SettingsDAO lSettingsDAO = new SettingsDAO(); lSettingsDAO.SetSetting("NewsFeedDiskSpace", tbDiskSpace.Value.ToString(), false); lSettingsDAO.SetSetting("NewsFeedLicenses", tbLicenses.Value.ToString(), false); lSettingsDAO.SetSetting("NewsFeedPrinters", tbPrinterSupplies.Value.ToString(), false); lSettingsDAO.SetSetting("NewsFeedUpdateAsset", cbAssetUpdated.Checked); Close(); }
private void CheckTasks() { UltraCalendarInfo ultraCalendarInfo = new UltraCalendarInfo(); ultraCalendarInfo.AllowRecurringAppointments = true; TaskSchedulesDAO lTaskSchedulesDAO = new TaskSchedulesDAO(); SettingsDAO lSettingsDAO = new SettingsDAO(); Appointment appointment; object rawAppointmentData; try { foreach (DataRow row in lTaskSchedulesDAO.GetAllAppointments().Rows) { rawAppointmentData = row["_APPOINTMENTDATA"]; if (rawAppointmentData is byte[] == false) { continue; } appointment = Appointment.FromBytes(rawAppointmentData as byte[]); appointment.DataKey = row[0]; ultraCalendarInfo.Appointments.Add(appointment); } string strLastReportRunTime = lSettingsDAO.GetSetting("LastTaskReportRun", false); DateTime lLastReportRunDateTime = (strLastReportRunTime == "") ? DateTime.MinValue : Convert.ToDateTime(strLastReportRunTime); DateTime lReportRunTime = DateTime.Now; AppointmentsSubsetCollection expiredAppointments = ultraCalendarInfo.GetAppointmentsInRange(lLastReportRunDateTime, lReportRunTime); lSettingsDAO.SetSetting("LastTaskReportRun", DateTime.Now.ToString(), false); foreach (Appointment expiredAppointment in expiredAppointments) { // need to re-check that this appointment is between the LastTaskReportRun date and DateTime.Now // there is a hole in the ultraCalendarInfo.GetAppointmentsInRange logic above if ((lLastReportRunDateTime < expiredAppointment.StartDateTime) && (lReportRunTime > expiredAppointment.StartDateTime)) { string lSubject = String.Format("The following task is due at {0}." + Environment.NewLine + Environment.NewLine + expiredAppointment.Subject, expiredAppointment.StartDateTime.ToString()); DesktopAlert.ShowDesktopAlertForTasks(lSubject, (int)expiredAppointment.DataKey); NewsFeed.AddNewsItem(NewsFeed.Priority.Information, "Task due: " + expiredAppointment.Subject); } } } catch (Exception ex) { logger.Error(ex.Message); } }
/// <summary> /// Save any data entered on the Upload tab /// </summary> private void SaveUploadTab() { // If we have made any changes, save them back to the database if (_uploadConfigurationChanged) { // Save the settings into the database SettingsDAO lwDataAccess = new SettingsDAO(); lwDataAccess.SetSetting(DatabaseSettingsKeys.Setting_DeleteAfterUpload, rbDeleteAfterUpload.Checked.ToString(), false); lwDataAccess.SetSetting(DatabaseSettingsKeys.Setting_BackupAfterUpload, rbBackupAfterUpload.Checked.ToString(), false); lwDataAccess.SetSetting(DatabaseSettingsKeys.Setting_OverwriteUserData, cbOverwriteUserData.Checked.ToString(), false); lwDataAccess.SetSetting(DatabaseSettingsKeys.Setting_FindAssetByName, cbFindAssetByName.Checked.ToString(), false); } }
private string CheckNewVersionAvailable() { string alertMsg = ""; try { string lLastAlertedVersion = new SettingsDAO().GetSetting("LatestVersionAlert", false); AuditWizardWebService.CustomerWebService lWebService = new AuditWizardWebService.CustomerWebService(); string lNewVersion = lWebService.GetLatestVersionNumber(); if (lNewVersion.Equals(lLastAlertedVersion)) { return(alertMsg); } string[] lLatestAppVersion = lNewVersion.Split('.'); string[] lCurrentAppVersion = Application.ProductVersion.Split('.'); bool lNewVersionAvailable = Convert.ToInt32(lLatestAppVersion[0]) > Convert.ToInt32(lCurrentAppVersion[0]); if (!lNewVersionAvailable) { lNewVersionAvailable = (Convert.ToInt32(lLatestAppVersion[0]) == Convert.ToInt32(lCurrentAppVersion[0])) && (Convert.ToInt32(lLatestAppVersion[1]) > Convert.ToInt32(lCurrentAppVersion[1])); } if (!lNewVersionAvailable) { lNewVersionAvailable = (Convert.ToInt32(lLatestAppVersion[0]) == Convert.ToInt32(lCurrentAppVersion[0])) && (Convert.ToInt32(lLatestAppVersion[1]) == Convert.ToInt32(lCurrentAppVersion[1]) && (Convert.ToInt32(lLatestAppVersion[2]) > Convert.ToInt32(lCurrentAppVersion[2]))); } if (lNewVersionAvailable) { new SettingsDAO().SetSetting("LatestVersionAlert", lNewVersion, false); NewsFeed.AddNewsItem(NewsFeed.Priority.Information, String.Format("AuditWizard version {0} is now available.", lNewVersion)); return(String.Format("AuditWizard version {0} is now available. Click here to download the latest version.", lNewVersion)); } } catch (Exception) { } return(alertMsg); }
private void FormConfigureNewsFeed_Load(object sender, EventArgs e) { SettingsDAO lSettingsDAO = new SettingsDAO(); cbAssetUpdated.Checked = lSettingsDAO.GetSettingAsBoolean("NewsFeedUpdateAsset", false); tbDiskSpace.Value = lSettingsDAO.GetSettingAsString("NewsFeedDiskSpace", "25") == String.Empty ? 25 : Convert.ToInt32(lSettingsDAO.GetSettingAsString("NewsFeedDiskSpace", "25")); lbDiskSpace.Text = String.Format("Less Than {0}% Disk Space Remaining", tbDiskSpace.Value); tbLicenses.Value = lSettingsDAO.GetSettingAsString("NewsFeedLicenses", "100") == String.Empty ? 100 : Convert.ToInt32(lSettingsDAO.GetSettingAsString("NewsFeedLicenses", "100")); lbLicenses.Text = String.Format("Greater Than {0}% Software Licenses Used", tbLicenses.Value); tbPrinterSupplies.Value = lSettingsDAO.GetSettingAsString("NewsFeedPrinters", "25") == String.Empty ? 25 : Convert.ToInt32(lSettingsDAO.GetSettingAsString("NewsFeedPrinters", "25")); lbPrinterSupplies.Text = String.Format("Less Than {0}% Printer Supplies Remaining", tbPrinterSupplies.Value); }
private string CheckSupportExpiry() { string supportMsg = ""; // only check support expiry if we are in standard application (not PAYG) if (!_standardVersion) { return(supportMsg); } try { AuditWizardWebService.CustomerWebService lWebService = new AuditWizardWebService.CustomerWebService(); DateTime lSupportExpiryDate = lWebService.GetCustomerExpiryDate(ConfigurationManager.AppSettings["CompanyID"].ToString()); bool lNotifySupport = new SettingsDAO().GetSettingAsBoolean("NotifySupport", true); if (lNotifySupport) { if (lSupportExpiryDate != DateTime.MinValue) { if ((lSupportExpiryDate < DateTime.Now.AddMonths(1)) && (lSupportExpiryDate > DateTime.Now)) { return("Your AuditWizard support will expire on " + lSupportExpiryDate.ToLongDateString()); } else if (lSupportExpiryDate < DateTime.Now) { return("Your AuditWizard support expired on " + lSupportExpiryDate.ToLongDateString()); } } } else { // if support is more than a month away, check if NotifySupport is set to False - // if so we can assume that they have renewed support (they have been prompted before) // we should set the flag to true so they are notified the next time support is about to expire if (lSupportExpiryDate > DateTime.Now.AddMonths(1)) { new SettingsDAO().SetSetting("NotifySupport", true); } } } catch (Exception) { } return(supportMsg); }
private void removeFileTypeButton_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Are you sure you want to delete this File Type?", "Remove File Type", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); if (result == DialogResult.OK) { int fileTypeID; DataGridViewRow fileTypeRow; if (fileTypeGridView.Rows.Count > 0) { fileTypeRow = fileTypeGridView.CurrentRow; fileTypeID = Convert.ToInt32(fileTypeRow.Cells["fileTypeID"].Value); try { FileTypeDAO fileTypeDAO = new FileTypeDAO(ConfigurationDatabase); fileTypeDAO.Delete(fileTypeID); SettingsDAO settingsDAO = new SettingsDAO(ConfigurationDatabase); settingsDAO.Delete(fileTypeID); ColumnDAO columnDAO = new ColumnDAO(ConfigurationDatabase); columnDAO.DeleteAll(fileTypeID); HeaderDAO headerDAO = new HeaderDAO(ConfigurationDatabase); headerDAO.DeleteAll(fileTypeID); FooterDAO footerDAO = new FooterDAO(ConfigurationDatabase); footerDAO.DeleteAll(fileTypeID); FileTypes = fileTypeDAO.GetAllFileTypes(); if (FileTypes != null) { fileTypeGridView.Rows.Remove(fileTypeRow); fileTypeGridView.Refresh(); } } catch (Exception exception) { MessageBox.Show("Failed to remove File Source. " + exception.Message, "File Source Configuration", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
public FormAlertLog(DateTime startDate) { Application.UseWaitCursor = false; InitializeComponent(); SettingsDAO lwDataAccess = new SettingsDAO(); cbShowNewAtStartup.Checked = lwDataAccess.GetSettingAsBoolean(DatabaseSettingsKeys.Setting_ShowNewAlertsAtStartup, false); // Populate the alerts dtpStartDateTime.Value = startDate; // ...and populate the control Populate(); }
/// <summary> /// This function is called once and once only during a run of the program. We call this /// from the main 'ActivateWorkItem' function which may be called multiple times. As such /// we guard against performing these actions either too early or multiple times /// </summary> protected void PerformInitializationActions() { // Show that we have performed the initialization actions now _initializationDone = true; // First of all we need to allow the user to login to the system if security has been enabled UsersDAO awDataAccess = new UsersDAO(); bool securityEnabled = awDataAccess.SecurityStatus(); if (securityEnabled) { FormLogin loginform = new FormLogin(); if (loginform.ShowDialog() != DialogResult.OK) { Application.Exit(); return; } // If we are logged in as a USER then we need to disable the Administration Tab User loggedInUser = loginform.LoggedInUser; if (loggedInUser.AccessLevel != 0) { List <WorkItem> workItemList = (List <WorkItem>)workItem.RootWorkItem.WorkItems.FindByType(typeof(AdministrationWorkItem)); AdministrationWorkItem administrationWorkItem = workItemList[0] as AdministrationWorkItem; administrationWorkItem.Terminate(); AdministrationWorkItemController controller = administrationWorkItem.Controller as AdministrationWorkItemController; controller.HideWorkspace(); } } // Display the startup wizard now if required if (!Properties.Settings.Default.DoNotShowWizard) { RunStartupWizard(); } // Ok Logged in - do we need to display any (New) Alerts? SettingsDAO lwDataAccess = new SettingsDAO(); if (lwDataAccess.GetSettingAsBoolean(DatabaseSettingsKeys.Setting_ShowNewAlertsAtStartup, false)) { ShowNewAlerts(); } }
private void Form_Load(object sender, EventArgs e) { SettingsDAO settingDAO = new SettingsDAO(); cbEnableScan.Checked = settingDAO.GetSettingAsBoolean("AutoScanNetwork", false); cbDeployAgent.Checked = settingDAO.GetSettingAsBoolean("AutoScanDeployAgent", false); string intervalUnits = settingDAO.GetSetting("AutoScanIntervalValue", false); tbScanInterval.Text = (intervalUnits == String.Empty) ? "1" : intervalUnits; string intervalPeriod = settingDAO.GetSetting("AutoScanIntervalUnits", false); cbScanInterval.SelectedItem = (intervalPeriod == String.Empty) ? "days" : intervalPeriod; bnApply.Enabled = false; }
/// <summary> /// v8.3.3 /// Called as we change the daily/hourly email selector /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void hourlyRadioButton_CheckedChanged(object sender, EventArgs e) { panelEmailAt.Visible = (dailyRadioButton.Checked); // Save the change SettingsDAO lSettingsDao = new SettingsDAO(); if (dailyRadioButton.Checked) { lSettingsDao.SetSetting(DatabaseSettings.Setting_AlertMonitorEmailFrequency, DatabaseSettings.Setting_AlertMonitorEmailDaily, false); lSettingsDao.SetSetting(DatabaseSettings.Setting_AlertMonitorEmailTime, udteEmailAtTime.DateTime.ToString("HH:mm"), false); } else { lSettingsDao.SetSetting(DatabaseSettings.Setting_AlertMonitorEmailFrequency, DatabaseSettings.Setting_AlertMonitorEmailHourly, false); } }
private void FormFilterPublishers_Load(object sender, EventArgs e) { Application.UseWaitCursor = false; string publisherName = ""; lbFilteredPublishers.EndUpdate(); lbAvailablePublishers.EndUpdate(); lbFilteredPublishers.Items.Clear(); lbAvailablePublishers.Items.Clear(); // Get the list of publishers currently in the filter list SettingsDAO lwDataAccess = new SettingsDAO(); string publisherFilter = lwDataAccess.GetPublisherFilter(); List <String> listFilterPublishers = new List <string>(); listFilterPublishers.AddRange(publisherFilter.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries)); // Recover a complete list of all publsiher names DataTable dtAvailablePublishers = new ApplicationsDAO().GetAllPublisherNames(); // add <unidentified> publisher if not present if (dtAvailablePublishers.Select("_PUBLISHER = '" + DataStrings.UNIDENIFIED_PUBLISHER + "'").Length == 0) { DataRow uidRow = dtAvailablePublishers.NewRow(); uidRow["_PUBLISHER"] = DataStrings.UNIDENIFIED_PUBLISHER; dtAvailablePublishers.Rows.Add(uidRow); } // Add the publisher to the appropriate list foreach (DataRow row in dtAvailablePublishers.Rows) { publisherName = row[0].ToString(); if (!listFilterPublishers.Contains(publisherName)) { lbAvailablePublishers.Items.Add(publisherName); } else { lbFilteredPublishers.Items.Add(publisherName); } } lbFilteredPublishers.EndUpdate(); lbAvailablePublishers.EndUpdate(); }
private void SaveSettings() { SettingsDAO lSettingsDAO = new SettingsDAO(); lSettingsDAO.SetSetting("UseADCustomString", rbCustomLocation.Checked); if (rbCustomLocation.Checked) { StringBuilder sb = new StringBuilder(); foreach (string communityString in lbReadStrings.Items) { sb.Append(communityString + "|"); } lSettingsDAO.SetSetting("ADCustomString", sb.ToString().TrimEnd('|'), false); } }
private void bnSetPublisher_Click(object sender, EventArgs e) { FormSelectPublisher selectPublisher = new FormSelectPublisher(true); if (selectPublisher.ShowDialog() == DialogResult.OK) { tbPublisher.Text = selectPublisher.SelectedPublisher; // Ensure that this publisher is in the publisher filter otherwise this application could disapp[ear SettingsDAO lwDataAccess = new SettingsDAO(); string publisherFilter = lwDataAccess.GetPublisherFilter(); if ((publisherFilter != "") && (!publisherFilter.Contains(tbPublisher.Text))) { publisherFilter = publisherFilter + ";" + tbPublisher.Text; lwDataAccess.SetPublisherFilter(publisherFilter); } } }
private void Form_Load(object sender, EventArgs e) { SettingsDAO lSettingsDAO = new SettingsDAO(); string adLocationStrings = lSettingsDAO.GetSettingAsString("ADCustomString", String.Empty); foreach (string adLocationString in adLocationStrings.Split('|')) { if (adLocationString != String.Empty) { lbReadStrings.Items.Add(adLocationString); } } rbCustomLocation.Checked = lSettingsDAO.GetSettingAsBoolean("UseADCustomString", false); rbRootLocation.Checked = !rbCustomLocation.Checked; ugbCustomLocations.Enabled = rbCustomLocation.Checked; }
private void saveFileTypeButton_Click(object sender, EventArgs e) { try { SettingsDAO settingsDAO = new SettingsDAO(ConfigurationDatabase); settingsDAO.Delete(FileTypeID); settingsDAO.Insert(new Settings(FileTypeID, useFileNameCheckBox.Checked, useFileExtensionCheckBox.Checked, textToIgnoreFileNameTextBox.Text, dateTimeFormatFileNameTextBox.Text, textToIgnoreFileExtensionTextBox.Text, dateTimeFormatFileExtensionTextBox.Text, linkDateTimeCheckBox.Checked, dateTimeColumnTextBox.Text, dateTimeFormatLinkDateTextBox.Text, truncateTableCheckBox.Checked)); ColumnDAO columnDAO = new ColumnDAO(ConfigurationDatabase); columnDAO.DeleteAll(FileTypeID); foreach (DataGridViewRow row in columnDataGridView.Rows) { columnDAO.Insert(new Column(FileTypeID, Convert.ToInt32(row.Cells[0].Value), row.Cells[1].Value.ToString(), row.Cells[2].Value.ToString(), Convert.ToBoolean(row.Cells[3].Value), Convert.ToBoolean(row.Cells[4].Value))); } HeaderDAO headerDAO = new HeaderDAO(ConfigurationDatabase); headerDAO.DeleteAll(FileTypeID); foreach (DataGridViewRow row in headerDataGridView.Rows) { headerDAO.Insert(new Header(FileTypeID, Convert.ToInt32(row.Cells[0].Value), row.Cells[1].Value.ToString())); } FooterDAO footerDAO = new FooterDAO(ConfigurationDatabase); footerDAO.DeleteAll(FileTypeID); foreach (DataGridViewRow row in footerDataGridView.Rows) { footerDAO.Insert(new Footer(FileTypeID, Convert.ToInt32(row.Cells[0].Value), row.Cells[1].Value.ToString())); } MessageBox.Show("Successfully saved File Type Configuration!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); } catch (Exception exception) { MessageBox.Show("Failed to save Column data. " + exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Save any data entered on the Options tab /// </summary> public void SaveEmailSettings() { // Save the settings SettingsDAO lSettingsDao = new SettingsDAO(); if (doSaveAdvancedSettings) { lSettingsDao.SetSetting(MailSettingsKeys.MailRequiresAuthentication, emailForm.UseAuthentication.ToString(), false); lSettingsDao.SetSetting(MailSettingsKeys.MailPort, emailForm.Port.ToString(), false); if (emailForm.UseAuthentication) { lSettingsDao.SetSetting(MailSettingsKeys.MailUserName, emailForm.Username, false); lSettingsDao.SetSetting(MailSettingsKeys.MailPassword, emailForm.Password, true); } lSettingsDao.SetSetting(MailSettingsKeys.MailSSLEnabled, emailForm.EnabledSSL.ToString(), false); // Added for ID 66125/66652 } // Save general email settings lSettingsDao.SetSetting(MailSettingsKeys.MailSender, tbSendingEmailAddress.Text, false); lSettingsDao.SetSetting(MailSettingsKeys.MailServer, smtpTextBox.Text, false); lSettingsDao.SetSetting(MailSettingsKeys.MailAddress, tbRecipientEmailAddress.Text, false); lSettingsDao.SetSetting("EmailAsHtml", rbHtml.Checked); if (dailyRadioButton.Checked) { lSettingsDao.SetSetting(MailSettingsKeys.MailFrequency, MailFrequencyValues.Daily, false); } else if (weeklyRadioButton.Checked) { lSettingsDao.SetSetting(MailSettingsKeys.MailFrequency, MailFrequencyValues.Weekly, false); } else if (monthlyRadioButton.Checked) { lSettingsDao.SetSetting(MailSettingsKeys.MailFrequency, MailFrequencyValues.Monthly, false); } else { lSettingsDao.SetSetting(MailSettingsKeys.MailFrequency, MailFrequencyValues.Never, false); } }
/// <summary> /// Called to start the Audit Uploader Task /// </summary> public void Start() { LogFile ourLog = LogFile.Instance; ourLog.Write("Creating the Audit Upload Controller Thread...", true); // The Controller runs in its own thread to prevent any errors here causing issues // with other parts of the AuditWizard Service if (new SettingsDAO().GetSettingAsBoolean("AutoScanNetwork", false)) { long timerValue = 28800000; string intervalUnits = new SettingsDAO().GetSetting("AutoScanIntervalUnits", false); double intervalValue = Convert.ToDouble(new SettingsDAO().GetSetting("AutoScanIntervalValue", false)); switch (intervalUnits) { case "hours": timerValue = Convert.ToInt64(intervalValue * 3600000); break; case "minutes": timerValue = Convert.ToInt64(intervalValue * 60000); break; case "days": timerValue = Convert.ToInt64(intervalValue * 86400000); break; default: break; } discoveryTimer = new System.Timers.Timer(timerValue); _mainThread = new Thread(new ThreadStart(DiscoveryThreadStart)); _mainThread.Start(); } // Log that the thread has started ourLog.Write("Main Audit Upload Controller Thread Running", true); }
private void Form_Load(object sender, EventArgs e) { string snmpCommunityStrings = new SettingsDAO().GetSettingAsString("SNMPRead", String.Empty); foreach (string communityString in snmpCommunityStrings.Split(',')) { if (communityString != String.Empty) { lbReadStrings.Items.Add(communityString); } } DataTable dt = new LayIpAddressDAO().SelectAllSnmp(); foreach (DataRow row in dt.Rows) { UltraListViewItem item = tcpipListView.Items.Add(row[0].ToString(), row[0].ToString()); item.SubItems[0].Value = row[1].ToString(); item.CheckState = (Convert.ToBoolean(row[2])) ? CheckState.Checked : CheckState.Unchecked; } }
/// <summary> /// Called as we attempt to exit from this form - we need to save any changes made to the /// list of filtered publishers /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bnOK_Click(object sender, EventArgs e) { // Construct the updated filter string foreach (String publisher in lbFilteredPublishers.Items) { // ...add to the filter if (_publisherFilter == "") { _publisherFilter = publisher; } else { _publisherFilter = _publisherFilter + ";" + publisher; } } // ...and save the publisher filter back to the database SettingsDAO lwDataAccess = new SettingsDAO(); lwDataAccess.SetPublisherFilter(_publisherFilter); }
private void SaveChanges() { SettingsDAO settingsDAO = new SettingsDAO(); LayIpAddressDAO ipAddressDao = new LayIpAddressDAO(); StringBuilder sb = new StringBuilder(); // delete all existing before adding new ones ipAddressDao.DeleteAllSnmp(); foreach (UltraListViewItem item in tcpipListView.Items) { IPAddressRange ipAddressRange = new IPAddressRange(item.Text, item.SubItems[0].Text, item.CheckState == CheckState.Checked, IPAddressRange.IPType.Snmp); ipAddressDao.Add(ipAddressRange); } foreach (string communityString in lbReadStrings.Items) { sb.Append(communityString + ","); } settingsDAO.SetSetting("SNMPRead", sb.ToString().TrimEnd(','), false); }