コード例 #1
0
        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);
        }
コード例 #2
0
        /// <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);
            }
        }