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 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); }
public void CheckCustomerPaid() { if (_standardVersion) { return; } if (IsTrialVersion()) { return; } bool lCustomerPaid = false; try { AuditWizardWebService.CustomerWebService lWebService = new AuditWizardWebService.CustomerWebService(); lCustomerPaid = lWebService.CheckCustomerPaid(ConfigurationManager.AppSettings["CompanyID"].ToString()); } catch (Exception ex) { logger.Error(ex.Message); lCustomerPaid = false; } finally { if (!lCustomerPaid) { FormAWMessageBox form = new FormAWMessageBox( "It appears that your account has expired or you are not currently connected to the Internet." + Environment.NewLine + Environment.NewLine + "Please contact your local Layton Technology support office."); form.ShowDialog(); System.Diagnostics.Process.Start("http://www.laytontechnology.com/contact-layton-technology.html"); Environment.Exit(0); } } }