public void GetSiteLicenseList() { IEnumerable <SiteLicenseDetailsEntity> licenseDetailsResults = SiteLicensingDataAccess.GetSiteLicenseDetailsResult().Select(X => new SiteLicenseDetailsEntity { StartDate = X.StartDate, ExpireDate = Convert.ToDateTime(SiteLicensingCryptoHelper.Decrypt(X.ExpireDate, "B411y51T")), RuleID = X.RuleID, AlertBeforeDays = X.AlertBeforeDays, KeyStatusID = X.KeyStatusID, LicenseKey = X.LicenseKey, ValidationRequired = X.ValidationRequired, LockSite = X.LockSite, DisableGames = X.DisableGames, WarningOnly = X.WarningOnly, AlertRequired = X.AlertRequired, CreatedDateTime = X.CreatedDateTime, ActivatedDateTime = X.ActivatedDateTime, UpdatedDateTime = X.UpdatedDateTime }); _ActiveLicense = null; _ExpiredLicense = null; _CancelledLicense = null; _NextActiveLicense = null; _SiteLicenseList = licenseDetailsResults.ToList(); }
public SiteLicensingDataResponse GetSiteLicenseData(SiteLicenseDetailsEntity entity) { return(new SiteLicensingDataResponse() { Response = new List <SiteLicensingData>() { } }); }
public SiteLicenseDetailsEntity CurrentLicense() { if (!oSiteLicensingbusiness.IsSiteLincenseEnabled()) { return(null); } GetSiteLicenseList(); SiteLicenseDetailsEntity license = oSiteLicensingbusiness.ActiveLicense; if (license != null) { return(license); } SiteLicenseDetailsEntity cancelledLicense = oSiteLicensingbusiness.CancelledLicense; if (cancelledLicense != null) { return(cancelledLicense); } return(oSiteLicensingbusiness.ExpiredLicense); }
public SiteLicensingDataResponse GetSiteLicenseValidation() { try { oSiteLicensingConfiguration = SiteLicensingConfiguration.SiteLicensingConfigurationInstance; if (!oSiteLicensingConfiguration.IsSiteLincenseEnabled) { LogManager.WriteLog("SiteLicensingExpiryChecker ==> Site Licensing Disabled", LogManager.enumLogLevel.Debug); return(null); } oSiteLicensingConfiguration.GetSiteLicenseList(); SiteLicenseDetailsEntity activeLicense = oSiteLicensingConfiguration.ActiveLicense; if (activeLicense != null) { LogManager.WriteLog("SiteLicensingExpiryChecker ==> Active License Available with Expiry Date " + activeLicense.ExpireDate.ToString(), LogManager.enumLogLevel.Info); DateTime date = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, activeLicense.ExpireDate.Hour, activeLicense.ExpireDate.Minute, activeLicense.ExpireDate.Second); //timer.Interval = (ticks > 0) ? (ticks + 25000) : 60000;//25 seconds added for grace period. It will avoid to lock the site TimeSpan tsDate = activeLicense.ExpireDate.Subtract(DateTime.Now); if (!activeLicense.AlertRequired || tsDate.Days > activeLicense.AlertBeforeDays.GetValueOrDefault()) { LogManager.WriteLog("SiteLicensingExpiryChecker ==> Active License does not require any validation", LogManager.enumLogLevel.Info); LogManager.WriteLog("SiteLicensingExpiryChecker ==> Timer_Elapsed end", LogManager.enumLogLevel.Info); return(null); } return(null); } SiteLicenseDetailsEntity cancelledLicense = oSiteLicensingConfiguration.CancelledLicense; SiteLicenseDetailsEntity expiredLicense = oSiteLicensingConfiguration.ExpiredLicense; if ((cancelledLicense != null && !cancelledLicense.ValidationRequired) || (cancelledLicense == null && expiredLicense != null && !expiredLicense.ValidationRequired)) { LogManager.WriteLog("SiteLicensingExpiryChecker ==> License does not require any validation", LogManager.enumLogLevel.Info); return(null); } if ((cancelledLicense != null && cancelledLicense.DisableGames) || (cancelledLicense == null && expiredLicense != null && expiredLicense.DisableGames)) { if (cancelledLicense != null) { LogManager.WriteLog("SiteLicensingExpiryChecker ==> Active License get cancelled", LogManager.enumLogLevel.Info); } else if (expiredLicense != null) { LogManager.WriteLog("SiteLicensingExpiryChecker ==> Expired License Found", LogManager.enumLogLevel.Info); } oSiteLicensingConfiguration.UpdateSlotStatus(true); } if ((cancelledLicense != null && cancelledLicense.LockSite) || (cancelledLicense == null && expiredLicense != null && expiredLicense.LockSite)) { return(this.GetSiteLicenseData(cancelledLicense == null ? expiredLicense : cancelledLicense)); } if ((cancelledLicense != null && cancelledLicense.WarningOnly) || (cancelledLicense == null && expiredLicense != null && expiredLicense.WarningOnly)) { return(null); } return(this.GetSiteLicenseData(null)); } catch (Exception ex) { ExceptionManager.Publish(ex); } return(null); }
/// <summary> /// Loads the Settings Data. /// </summary> /// <param name="strProfileName"></param> public void LoadData() { try { DataSet dsSiteProfile = new DataSet(); DataTable dtSettingListCopy = new DataTable(); ISettingsDetails objCDO = SettingsBusinessObject.CreateInstance(); dsSiteProfile = objCDO.GetSettingDetails(); DataTable dtSettingList = dsSiteProfile.Tables[1]; DataTable dtSiteProfileName = dsSiteProfile.Tables[0]; dtSettingListCopy = dtSettingList.Copy(); //Get list of settings to be skipped. string strEventTypes = string.Empty; string[] strList; strEventTypes = objCDO.FillSettingsToBeSkipped(); strList = strEventTypes.Split(','); int iColumn = -1; SiteLicensingConfiguration oSiteLicensingConfiguration = SiteLicensingConfiguration.SiteLicensingConfigurationInstance; SiteLicenseDetailsEntity currentLicense = (oSiteLicensingConfiguration != null)?oSiteLicensingConfiguration.CurrentLicense():null; foreach (DataRow row in dtSiteProfileName.Rows) { txtProfileName.Text = row["ProfileName"].ToString(); } foreach (DataRow dr in dtSettingListCopy.Rows) { iColumn++; if (currentLicense != null) { if (dr[1].ToString().Equals("LICENSE DISABLE GAMES")) { dtSettingList.Rows[iColumn][2] = currentLicense.DisableGames; } else if (dr[1].ToString().Equals("LICENSE EXPIRY DATE")) { dtSettingList.Rows[iColumn][2] = currentLicense.ExpireDate; } else if (dr[1].ToString().Equals("LICENSE LOCK SITE")) { dtSettingList.Rows[iColumn][2] = currentLicense.LockSite; } else if (dr[1].ToString().Equals("LICENSE STATUS")) { dtSettingList.Rows[iColumn][2] = ((SiteLicensing.LicenseKeyStatus)(currentLicense.KeyStatusID)).ToString(); } else if (dr[1].ToString().Equals("LICENSE VALIDATION REQUIRED")) { dtSettingList.Rows[iColumn][2] = currentLicense.ValidationRequired; } else if (dr[1].ToString().Equals("LICENSE WARNING ONLY")) { dtSettingList.Rows[iColumn][2] = currentLicense.WarningOnly; } } foreach (String str in strList) { if (dr[1].ToString() == str) { dtSettingList.Rows.RemoveAt(iColumn); iColumn--; } } } lstSettingDetails.DataContext = dtSettingList; } catch (Exception exLoadPropertyGrid) { ExceptionManager.Publish(exLoadPropertyGrid); } }
/// <summary> /// To check whether the site having valid license and allow/restrict the user to login to the site based on the license settings /// </summary> /// <returns></returns> /// public bool ValidateLicense() { try { LogManager.WriteLog(string.Format("Checking for the site [{0}], whether site licensing is mandatory- ", Settings.SiteCode), LogManager.enumLogLevel.Info); if (!_licensingConfig.IsSiteLincenseEnabled) { return(true); } _licensingConfig.GetSiteLicenseList(); LogManager.WriteLog(string.Format("Checking for the active license for the Site- " + Settings.SiteCode), LogManager.enumLogLevel.Info); if (!_licensingConfig.IsLicensenceAvailable) { LogManager.WriteLog(string.Format("Site {0} doesn't have any License. So user not allowed to login.", Settings.SiteCode), LogManager.enumLogLevel.Info); ShowLicenseScreen(Convert.ToString(Application.Current.FindResource("MessageID449")), "MessageID471", ""); return(false); } SiteLicenseDetailsEntity activeLicense = _licensingConfig.ActiveLicense; if (activeLicense != null) { LogManager.WriteLog(string.Format("License check has been completed and Site [{0}] having the valid license.", Settings.SiteCode), LogManager.enumLogLevel.Info); if (!activeLicense.ValidationRequired) { return(true); } TimeSpan tsDate = activeLicense.ExpireDate.Subtract(DateTime.Now); if (Convert.ToInt64(tsDate.TotalDays) > activeLicense.AlertBeforeDays.GetValueOrDefault()) { return(true); } SiteLicenseDetailsEntity NextActiveLicense = _licensingConfig.NextActiveLicense; if (NextActiveLicense != null) { TimeSpan tsDate1 = NextActiveLicense.StartDate.Subtract(activeLicense.ExpireDate); string settingValue = string.Empty; _licensingConfig.GetSetting("GraceTime", "5", ref settingValue); Int32 graceTime = 15; Int32.TryParse(settingValue, out graceTime); LogManager.WriteLog( string.Format("License is going to be expired in {0} days for the Site {1}.\r\nCurrent License Expired date {2}\r\nNext License Available from {3}", tsDate.Days, Settings.SiteCode, activeLicense.ExpireDate.ToString(GetDateFormat()), NextActiveLicense.StartDate.ToString(GetDateFormat())), LogManager.enumLogLevel.Info); if (tsDate1.TotalSeconds > graceTime) { MessageBox.ShowBox("SL_MessageID463", BMC_Icon.Warning, BMC_Button.OK, activeLicense.ExpireDate.ToString(GetDateFormat()), _licensingConfig.NextActiveLicense.StartDate.ToString(GetDateFormat())); //License is going expires on dd/MM/yyyy. Please activate a new license for the Site before the expiry date. } } else { LogManager.WriteLog(string.Format("License is going to be expired in {0} days for the Site {1}.", tsDate.Days, Settings.SiteCode), LogManager.enumLogLevel.Info); MessageBox.ShowBox("MessageID452", BMC_Icon.Warning, BMC_Button.OK, activeLicense.ExpireDate.ToString(GetDateFormat())); //License is going expires on dd/MM/yyyy. Please activate a new license for the Site before the expiry date. } return(true); } SiteLicenseDetailsEntity cancelledLicense = _licensingConfig.CancelledLicense; if ((cancelledLicense != null) && (!cancelledLicense.ValidationRequired)) { return(true); } else if ((cancelledLicense != null) && (cancelledLicense.LockSite)) { LogManager.WriteLog(string.Format("Site [{0}] doesn't have any active license and user not allowed to login to the site.", Settings.SiteCode), LogManager.enumLogLevel.Info); ShowLicenseScreen(Convert.ToString(Application.Current.FindResource("MessageID476")), "MessageID473", ""); return(false); } else if ((cancelledLicense != null) && (cancelledLicense.WarningOnly)) { LogManager.WriteLog(string.Format("Site [{0}] doesn't have any active license but user is allowed to login to the site. cancelledLicense.WarningOnly", Settings.SiteCode), LogManager.enumLogLevel.Info); MessageBox.ShowBox("MessageID474", BMC_Icon.Warning, BMC_Button.OK);//The Active License for the Site was cancelled. Please activate a new License for the Site. return(true); } else if ((cancelledLicense != null) && (cancelledLicense.DisableGames)) { LogManager.WriteLog(string.Format("Site [{0}] doesn't have any active license but user is allowed to login to the site. cancelledLicense.DisableGames", Settings.SiteCode), LogManager.enumLogLevel.Info); MessageBox.ShowBox("MessageID475", BMC_Icon.Warning, BMC_Button.OK);//The Active License for the Site was cancelled. All Slot Machines are disabled based on the license policy. Please activate a new License for the Site. return(true); } SiteLicenseDetailsEntity expireLicense = _licensingConfig.ExpiredLicense; String expiryDate = string.Empty; if (expireLicense != null && expireLicense.ExpireDate != null) { expiryDate = expireLicense.ExpireDate.ToString(GetDateFormat()); } if ((expireLicense != null) && (!expireLicense.ValidationRequired)) { return(true); } else if ((expireLicense != null) && (expireLicense.LockSite)) { LogManager.WriteLog(string.Format("Site [{0}] doesn't have any active license and user not allowed to login to the site.", Settings.SiteCode), LogManager.enumLogLevel.Info); ShowLicenseScreen(string.Format(Application.Current.FindResource("MessageID450").ToString(), expiryDate), "MessageID472", expiryDate); return(false); } else if ((expireLicense != null) && (expireLicense.WarningOnly)) { LogManager.WriteLog(string.Format("Site [{0}] doesn't have any active license but user is allowed to login to the site. expireLicense.WarningOnly", Settings.SiteCode), LogManager.enumLogLevel.Info); MessageBox.ShowBox("MessageID451", BMC_Icon.Warning, BMC_Button.OK, expiryDate); //License has been expired on @@@@@@. Please activate the site with new valid license key. return(true); } else if ((expireLicense != null) && (expireLicense.DisableGames)) { LogManager.WriteLog(string.Format("Site [{0}] doesn't have any active license but user is allowed to login to the site. ExpireLicense.DisableGames", Settings.SiteCode), LogManager.enumLogLevel.Info); MessageBox.ShowBox("MessageID467", BMC_Icon.Warning, BMC_Button.OK, expiryDate); //Site License has expired on @@@@@@. All Slot Machines are disabled based on the license policy. Please activate a new License for the Site. return(true); } else { LogManager.WriteLog(string.Format("Site [{0}] doesn't have any active license and user not allowed to login to the site.", Settings.SiteCode), LogManager.enumLogLevel.Info); ShowLicenseScreen(Convert.ToString(Application.Current.FindResource("MessageID449")), "MessageID471", ""); return(false); } } catch (Exception ex) { LogManager.WriteLog("Exception Occured in ValidateLicense method " + ex.Message + "\r\n\r\n" + ex.StackTrace, LogManager.enumLogLevel.Info); } return(false); }