Exemple #1
0
        /// <summary>
        /// Update the License Statistics
        /// </summary>
        private void UpdateLicenseStatistics()
        {
            // Recover the total license count from the product key
            Layton.Cab.Interface.LaytonProductKey key = WorkItem.RootWorkItem.Items[Layton.Cab.Interface.MiscStrings.ProductKey] as Layton.Cab.Interface.LaytonProductKey;
            int licenseCount = (key.IsTrial) ? 10 : key.AssetCount;

            UltraExplorerBarGroup licenses = overviewExplorerBar.Groups["licensing"];

            if (licenses == null)
            {
                return;
            }

            // Set this in the explorer bar
            licenses.Items["licensecount"].Text = StatisticTitles.LicensedFor + licenseCount.ToString();

            // Now we need a count of the 'licensable' assets within the database - this is the number of assets
            // which have been audited excluding child assets and any which have been flagged as 'disposed of'
            AssetDAO awDataAccess = new AssetDAO();
            int      licensesUsed = awDataAccess.LicensedAssetCount();

            licenses.Items["licensesused"].Text = StatisticTitles.LicensesUsed + licensesUsed.ToString();
        }
Exemple #2
0
        /// <summary>
        /// This function is called to load (any) AuditWizard license details from the main configuration file
        /// </summary>
        /// <returns></returns>
        public bool LoadProductKey()
        {
            LogFile ourLog = LogFile.Instance;

            // get the product key and installation settings
            string key               = "";
            int    productID         = 0;
            string companyName       = "";
            int    companyID         = 0;
            string installDateString = "";

            // Load the configuration for the Layton Framework
            Configuration config = ConfigurationManager.OpenExeConfiguration(Path.Combine(Application.StartupPath, "AuditWizardv8.exe"));

            // Now try and read the product license key details from it
            try
            {
                key = config.AppSettings.Settings["ProductKey"].Value;
            }
            catch
            {
            }
            try
            {
                productID = Convert.ToInt32(config.AppSettings.Settings["ProductID"].Value);
            }
            catch
            {
            }
            try
            {
                companyName = config.AppSettings.Settings["CompanyName"].Value;
            }
            catch
            {
            }
            try
            {
                companyID = Convert.ToInt32(config.AppSettings.Settings["CompanyID"].Value);
            }
            catch
            {
            }
            try
            {
                installDateString = config.AppSettings.Settings["Code1"].Value;
            }
            catch
            {
            }
            if (installDateString == "")
            {
                installDateString = Layton.Cab.Interface.LaytonProductKey.GenerateCode2();
                config.AppSettings.Settings["Code1"].Value = installDateString;
                config.Save();
            }

            // Create the ProductKey object
            _productKey = new Layton.Cab.Interface.LaytonProductKey(key, productID, companyName, companyID, installDateString);
            //ourLog.Write("Product Key Details: ProductID is " + productID.ToString() + "  Company Name is " + companyName + "  Company ID is " + companyID.ToString() + "  Install date string is " + installDateString, true);

            // Has this license expired (trial or otherwise)
            return(true);
            //!(_productKey.IsTrialExpired);
        }