예제 #1
0
        public IHttpActionResult GetSystemInfo()
        {
            var platformVersion = PlatformVersion.CurrentVersion.ToString();
            var license         = LicenseProvider.LoadLicense(); //need to be refactored into platform v.3

            var installedModules = _moduleCatalog.Modules.OfType <ManifestModuleInfo>().Where(x => x.IsInstalled).OrderBy(x => x.Id)
                                   .Select(x => x.ToWebModel())
                                   .ToArray();

            var result = new SystemInfo()
            {
                PlatformVersion  = platformVersion,
                License          = license,
                InstalledModules = installedModules
            };

            return(Ok(result));
        }
예제 #2
0
        public ActionResult Index()
        {
            var assembly        = Assembly.GetExecutingAssembly();
            var version         = PlatformVersion.CurrentVersion.ToString();
            var demoCredentials = ConfigurationHelper.GetAppSettingsValue("VirtoCommerce:DemoCredentials");
            var resetTimeStr    = ConfigurationHelper.GetAppSettingsValue("VirtoCommerce:DemoResetTime");
            var license         = LicenseProvider.LoadLicense();
            var licenseString   = JsonConvert.SerializeObject(license, new JsonSerializerSettings
            {
                ContractResolver     = new CamelCasePropertyNamesContractResolver(),
                DateTimeZoneHandling = DateTimeZoneHandling.Utc
            });

            if (!string.IsNullOrEmpty(resetTimeStr))
            {
                if (TimeSpan.TryParse(resetTimeStr, out var timeSpan))
                {
                    var now       = DateTime.UtcNow;
                    var resetTime = new DateTime(now.Year, now.Month, now.Day, timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds, DateTimeKind.Utc);

                    if (resetTime < now)
                    {
                        resetTime = resetTime.AddDays(1);
                    }

                    resetTimeStr = JsonConvert.SerializeObject(resetTime).Replace("\"", "'");
                }
            }

            return(View(new PlatformSetting
            {
                PlatformVersion = new MvcHtmlString(version),
                DemoCredentials = new MvcHtmlString(demoCredentials ?? "''"),
                DemoResetTime = new MvcHtmlString(resetTimeStr ?? "''"),
                License = new MvcHtmlString(licenseString),
                FavIcon = new MvcHtmlString(GetFavIcon() ?? "favicon.ico"),
            }));
        }