Beispiel #1
0
        public bool CheckLicense(HttpContext context)
        {
            if (!ConfigurationManager.IsLicenseVaild)
            {
                context.Response.ContentType = "text/json";
                context.Response.Charset     = "utf-8";

                String msg = "许可证无效";
                context.Response.Write(new BusinessProcessContext()
                {
                    ClientNotificationType = ClientNotificationType.Notify, Code = SystemInfoHelper.Value(), Message = msg, ClientHandler = ""
                });
                context.Response.End();
                return(false);
            }

            if (ConfigurationManager.LicenseInfo.TrialDays != 0 && ConfigurationManager.LicenseInfo.TrialDateBegin.HasValue)
            {
                TimeSpan sp = DateTime.Now.Subtract(ConfigurationManager.LicenseInfo.TrialDateBegin.Value);
                if (sp.Days > ConfigurationManager.LicenseInfo.TrialDays)
                {
                    context.Response.ContentType = "text/json";
                    context.Response.Charset     = "utf-8";

                    String msg = "许可证过期";
                    context.Response.Write(new BusinessProcessContext()
                    {
                        ClientNotificationType = ClientNotificationType.Notify, Message = msg, Code = SystemInfoHelper.Value(), ClientHandler = ""
                    });
                    context.Response.End();
                    return(false);
                }
            }

            return(true);
        }