public async Task <ActionResult> AvailableLanguages(bool enforce = false) { var languages = _languageService.GetAllLanguages(true); var languageDic = languages.ToDictionarySafe(x => x.LanguageCulture, StringComparer.OrdinalIgnoreCase); var downloadState = _asyncState.Get <LanguageDownloadState>(); var lastImportInfos = GetLastResourcesImportInfos(); var checkResult = await CheckAvailableResources(enforce); var model = new AvailableLanguageListModel(); model.Languages = new List <AvailableLanguageModel>(); model.Version = checkResult.Version; model.ResourceCount = checkResult.ResourceCount; foreach (var resources in checkResult.Resources) { if (resources.Language.Culture.HasValue()) { languageDic.TryGetValue(resources.Language.Culture, out Language language); var alModel = new AvailableLanguageModel(); PrepareAvailableLanguageModel(alModel, resources, lastImportInfos, language, downloadState); model.Languages.Add(alModel); } } return(PartialView(model)); }
public ActionResult ProductFileSelect(int id) { var progress = _asyncState.Get <ShopConnectorProcessingInfo>(ShopConnectorPlugin.SystemName); if (progress != null) { return(new EmptyResult()); } var model = new ProductFileSelectModel(); _connectorService.SetupProductFileSelectModel(model, id); if (model.AvailableImportFiles.Count <= 0) { return(new ShopConnectorOperationResult(T("Plugins.SmartStore.ShopConnector.NoImportFilesFound"), false)); } return(PartialView(model)); }
private InstallationResult GetInstallResult() { var result = _asyncState.Get <InstallationResult>(); if (result == null) { result = new InstallationResult(); _asyncState.Set <InstallationResult>(result); } return(result); }
public async Task <ActionResult> AvailableLanguages(bool enforce = false) { if (!_services.Permissions.Authorize(StandardPermissionProvider.ManageLanguages)) { return(Content(T("Admin.AccessDenied.Description"))); } var languages = _languageService.GetAllLanguages(true); var languageDic = languages.ToDictionarySafe(x => x.LanguageCulture, StringComparer.OrdinalIgnoreCase); var downloadState = _asyncState.Get <LanguageDownloadState>(); var translatedPercentageAtLastImport = _genericAttributeService.GetAttributes("TranslatedPercentageAtLastImport", "Language").ToDictionarySafe(x => x.EntityId); var checkResult = await CheckAvailableResources(enforce); var model = new AvailableLanguageListModel(); model.Languages = new List <AvailableLanguageModel>(); model.Version = checkResult.Version; model.ResourceCount = checkResult.ResourceCount; foreach (var resources in checkResult.Resources) { if (resources.Language.Culture.HasValue()) { languageDic.TryGetValue(resources.Language.Culture, out Language language); var alModel = new AvailableLanguageModel(); PrepareAvailableLanguageModel(alModel, resources, translatedPercentageAtLastImport, language, downloadState); model.Languages.Add(alModel); } } return(PartialView(model)); }