示例#1
0
        private void ValidateApplicationLicence()
        {
            int               trialDaysLeft     = 0;
            string            licencePath       = GetLicencePath();
            string            currentCulture    = deviceCulture;
            SystemInformation systemInformation = new SystemInformation();
            string            systemSignature   = systemInformation.GetSystemID();

            string licenceID = LicenceValidator.UpdateLastAccessDateTime(licencePath, currentCulture, systemSignature);

            int    errorCode          = 0;
            int    trialLicences      = 0;
            int    registeredLicences = 0;
            int    trialDays          = 0;
            double elapsedDays        = 0;
            bool   isValidLicence     = false;
            string message            = string.Empty;

            isValidLicence = LicenceValidator.IsValidLicence(licencePath, systemSignature, currentCulture, out errorCode, out trialLicences, out registeredLicences, out trialDays, out elapsedDays, out message);
            double remainingDays = double.Parse(trialDays.ToString()) - elapsedDays;

            if (errorCode > 0)
            {
                Session["IsValidLicence"] = "NO";
                redirectPage = string.Format("../Mfp/LicenseErrorpage.aspx?ErrorCode={0}", errorCode);
                return;
            }
            else if (errorCode == 0 && registeredLicences == 0 && remainingDays > 0) // Trial Period
            {
                Session["IsValidLicence"] = "YES";
                string clientIPAddress = Request.ServerVariables["REMOTE_ADDR"];

                if (!DataManagerDevice.ProviderDevice.ApplicationSettings.IsLicencesAvailable(trialLicences, Session.Timeout, Session.SessionID, clientIPAddress))
                {
                    redirectPage = string.Format("../Mfp/LicenseErrorpage.aspx?ErrorCode={0}", "501");
                    return;
                }
            }
            else if (registeredLicences > 0)
            {
                Session["IsValidLicence"] = "YES";
                ValidateDevice();
            }
        }
示例#2
0
    private void ValidateApplicationLicence()
    {
        string            licenceID          = string.Empty;
        int               trialLicences      = 0;
        int               registeredLicences = 0;
        int               trialDays          = 0;
        double            elapsedDays        = 0;
        bool              isValidLicence     = false;
        bool              isServerLicenseed  = false;
        bool              isValidDataBase    = false;
        string            licencePath        = GetLicencePath();
        string            currentCulture     = Session["SelectedCulture"] as string;
        SystemInformation systemInformation  = new SystemInformation();
        string            systemSignature    = systemInformation.GetSystemID();
        string            message            = string.Empty;

        //isServerLicenseed = DataManager.Provider.Registration.isServerValidLicsence(systemSignature);

        //if (!isServerLicenseed)
        //{

        licenceID = LicenceValidator.UpdateLastAccessDateTime(licencePath, currentCulture, systemSignature);

        isValidLicence = LicenceValidator.IsValidLicence(licencePath, systemSignature, currentCulture, out errorCode, out trialLicences, out registeredLicences, out trialDays, out elapsedDays, out message);

        //isValidDataBase = LicenceValidator.isValidDataBase(licencePath,currentCulture);

        double remainingDays = double.Parse(trialDays.ToString()) - elapsedDays;

        Session["TrailDaysForBuild"] = trialDays.ToString();

        Session["DisplayfailoverMessage"] = null;

        //if (!isValidDataBase)
        //{
        //    errorCode = 3001;
        //    redirectPath = string.Format("~/Web/LicenceResponse.aspx?mc={0}", errorCode);
        //}
        if (errorCode > 0 && errorCode != 2001)
        {
            Session["IsValidLicence"] = "NO";
            Session["TrailDaysLeft"]  = null;
            Session["EXMessage"]      = message;
            redirectPath = string.Format("~/Web/LicenceResponse.aspx?mc={0}", errorCode);

            //Response.Redirect(redirectPath, false);
        }
        else if (errorCode == 2001)
        {
            Session["DisplayfailoverMessage"] = "YES";
        }

        else if (errorCode == 0 && registeredLicences == 0 && remainingDays > 0)
        {
            double remainingTrailDays = trialDays - elapsedDays;
            trialDaysLeft            = Convert.ToInt32(remainingTrailDays);
            Session["TrailDaysLeft"] = trialDaysLeft.ToString();

            //DisplayTrialMessage();

            Session["IsValidLicence"] = "YES";
        }
        else if (registeredLicences > 0)
        {
            Session["IsValidLicence"] = "YES";
            Session["TrailDaysLeft"]  = null;
        }
        // }
        else
        {
            Session["IsValidLicence"] = "YES";
            Session["TrailDaysLeft"]  = null;
        }
    }