Fix #5054: parse string to number with invariant culture.
This commit is contained in:
@ -73,7 +73,7 @@
|
||||
|
||||
if (PageState.QueryString.ContainsKey("id"))
|
||||
{
|
||||
_folderId = int.Parse(PageState.QueryString["id"]);
|
||||
_folderId = SharedConverter.ParseInteger(PageState.QueryString["id"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@
|
||||
folder.SiteId = PageState.Site.SiteId;
|
||||
folder.Name = _name;
|
||||
folder.Type = _type;
|
||||
folder.Capacity = int.Parse(_capacity);
|
||||
folder.Capacity = SharedConverter.ParseInteger(_capacity);
|
||||
folder.CacheControl = _cachecontrol;
|
||||
folder.ImageSizes = _imagesizes;
|
||||
folder.IsSystem = _isSystem;
|
||||
|
@ -119,7 +119,7 @@ else
|
||||
_imageFiles = (string.IsNullOrEmpty(_imageFiles)) ? Constants.ImageFiles : _imageFiles;
|
||||
_uploadableFiles = SettingService.GetSetting(settings, "UploadableFiles", Constants.UploadableFiles);
|
||||
_uploadableFiles = (string.IsNullOrEmpty(_uploadableFiles)) ? Constants.UploadableFiles : _uploadableFiles;
|
||||
_maxChunkSize = int.Parse(SettingService.GetSetting(settings, "MaxChunkSize", "1"));
|
||||
_maxChunkSize = SharedConverter.ParseInteger(SettingService.GetSetting(settings, "MaxChunkSize", "1"));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -137,7 +137,7 @@ else
|
||||
{
|
||||
try
|
||||
{
|
||||
_folderId = int.Parse((string)e.Value);
|
||||
_folderId = SharedConverter.ParseInteger((string)e.Value);
|
||||
await GetFiles();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
@ -174,11 +174,11 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
job.Interval = int.Parse(_interval);
|
||||
job.Interval = SharedConverter.ParseInteger(_interval);
|
||||
}
|
||||
job.StartDate = Utilities.LocalDateAndTimeAsUtc(_startDate, _startTime);
|
||||
job.EndDate = Utilities.LocalDateAndTimeAsUtc(_endDate, _endTime);
|
||||
job.RetentionHistory = int.Parse(_retentionHistory);
|
||||
job.RetentionHistory = SharedConverter.ParseInteger(_retentionHistory);
|
||||
job.NextExecution = Utilities.LocalDateAndTimeAsUtc(_nextDate, _nextTime);
|
||||
|
||||
try
|
||||
|
@ -127,7 +127,7 @@ else
|
||||
await GetLogs();
|
||||
|
||||
var settings = await SettingService.GetSiteSettingsAsync(PageState.Site.SiteId);
|
||||
_retention = int.Parse( SettingService.GetSetting(settings, "LogRetention", "30"));
|
||||
_retention = SharedConverter.ParseInteger( SettingService.GetSetting(settings, "LogRetention", "30"));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -184,7 +184,7 @@ else
|
||||
|
||||
private async Task GetLogs()
|
||||
{
|
||||
_logs = await LogService.GetLogsAsync(PageState.Site.SiteId, ((_level == "-") ? string.Empty : _level), ((_function == "-") ? string.Empty : _function), int.Parse(_rows));
|
||||
_logs = await LogService.GetLogsAsync(PageState.Site.SiteId, ((_level == "-") ? string.Empty : _level), ((_function == "-") ? string.Empty : _function), SharedConverter.ParseInteger(_rows));
|
||||
}
|
||||
|
||||
private string GetClass(string function)
|
||||
|
@ -256,7 +256,7 @@
|
||||
return;
|
||||
}
|
||||
var pagemodule = await PageModuleService.GetPageModuleAsync(ModuleState.PageModuleId);
|
||||
pagemodule.PageId = int.Parse(_pageId);
|
||||
pagemodule.PageId = SharedConverter.ParseInteger(_pageId);
|
||||
pagemodule.Title = _title;
|
||||
pagemodule.Pane = _pane;
|
||||
pagemodule.EffectiveDate = Utilities.LocalDateAndTimeAsUtc(_effectivedate);
|
||||
|
@ -273,7 +273,7 @@
|
||||
_containers = ThemeService.GetContainerControls(PageState.Site.Themes, _themetype);
|
||||
_containertype = PageState.Site.DefaultContainerType;
|
||||
_children = new List<Page>();
|
||||
foreach (Page p in _pages.Where(item => (_parentid == "-1" && item.ParentId == null) || (item.ParentId == int.Parse(_parentid))))
|
||||
foreach (Page p in _pages.Where(item => (_parentid == "-1" && item.ParentId == null) || (item.ParentId == SharedConverter.ParseInteger(_parentid))))
|
||||
{
|
||||
if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.PermissionList))
|
||||
{
|
||||
@ -303,7 +303,7 @@
|
||||
{
|
||||
_parentid = (string)e.Value;
|
||||
_children = new List<Page>();
|
||||
foreach (Page p in _pages.Where(item => (_parentid == "-1" && item.ParentId == null) || (item.ParentId == int.Parse(_parentid))))
|
||||
foreach (Page p in _pages.Where(item => (_parentid == "-1" && item.ParentId == null) || (item.ParentId == SharedConverter.ParseInteger(_parentid))))
|
||||
{
|
||||
if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.PermissionList))
|
||||
{
|
||||
|
@ -386,7 +386,7 @@
|
||||
_parent = _pages.FirstOrDefault(item => item.PageId == _page.ParentId);
|
||||
}
|
||||
_children = new List<Page>();
|
||||
foreach (Page p in _pages.Where(item => (_parentid == "-1" && item.ParentId == null) || (item.ParentId == int.Parse(_parentid, CultureInfo.InvariantCulture))))
|
||||
foreach (Page p in _pages.Where(item => (_parentid == "-1" && item.ParentId == null) || (item.ParentId == SharedConverter.ParseInteger(_parentid, CultureInfo.InvariantCulture))))
|
||||
{
|
||||
if (p.PageId != _pageId && UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.PermissionList))
|
||||
{
|
||||
@ -471,7 +471,7 @@
|
||||
{
|
||||
_parentid = (string)e.Value;
|
||||
_children = new List<Page>();
|
||||
foreach (Page p in _pages.Where(item => (_parentid == "-1" && item.ParentId == null) || (item.ParentId == int.Parse(_parentid))))
|
||||
foreach (Page p in _pages.Where(item => (_parentid == "-1" && item.ParentId == null) || (item.ParentId == SharedConverter.ParseInteger(_parentid))))
|
||||
{
|
||||
if (p.PageId != _pageId && UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.PermissionList))
|
||||
{
|
||||
@ -661,7 +661,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
await PageService.UpdatePageOrderAsync(_page.SiteId, _page.PageId, int.Parse(_currentparentid));
|
||||
await PageService.UpdatePageOrderAsync(_page.SiteId, _page.PageId, SharedConverter.ParseInteger(_currentparentid));
|
||||
}
|
||||
|
||||
if (_themeSettingsType != null && _themeSettings is ISettingsControl themeSettingsControl)
|
||||
|
@ -189,9 +189,9 @@
|
||||
profile.Title = _title;
|
||||
profile.Description = _description;
|
||||
profile.Category = _category;
|
||||
profile.ViewOrder = int.Parse(_vieworder);
|
||||
profile.MaxLength = int.Parse(_maxlength);
|
||||
profile.Rows = int.Parse(_rows);
|
||||
profile.ViewOrder = SharedConverter.ParseInteger(_vieworder);
|
||||
profile.MaxLength = SharedConverter.ParseInteger(_maxlength);
|
||||
profile.Rows = SharedConverter.ParseInteger(_rows);
|
||||
profile.DefaultValue = _defaultvalue;
|
||||
profile.Options = _options;
|
||||
profile.Validation = _validation;
|
||||
|
@ -122,11 +122,11 @@
|
||||
ExcludeEntities = _excludeEntities,
|
||||
FromDate = (!string.IsNullOrEmpty(_fromDate)) ? DateTime.Parse(_fromDate) : DateTime.MinValue,
|
||||
ToDate = (!string.IsNullOrEmpty(_toDate)) ? DateTime.Parse(_toDate) : DateTime.MaxValue,
|
||||
PageSize = (!string.IsNullOrEmpty(_pageSize)) ? int.Parse(_pageSize) : int.MaxValue,
|
||||
PageSize = (!string.IsNullOrEmpty(_pageSize)) ? SharedConverter.ParseInteger(_pageSize) : int.MaxValue,
|
||||
PageIndex = 0,
|
||||
SortField = (!string.IsNullOrEmpty(_sortField)) ? (SearchSortField)Enum.Parse(typeof(SearchSortField), _sortField) : SearchSortField.Relevance,
|
||||
SortOrder = (!string.IsNullOrEmpty(_sortOrder)) ? (SearchSortOrder)Enum.Parse(typeof(SearchSortOrder), _sortOrder) : SearchSortOrder.Descending,
|
||||
BodyLength = (!string.IsNullOrEmpty(_bodyLength)) ? int.Parse(_bodyLength) : 255
|
||||
BodyLength = (!string.IsNullOrEmpty(_bodyLength)) ? SharedConverter.ParseInteger(_bodyLength) : 255
|
||||
};
|
||||
|
||||
_searchResults = await SearchResultsService.GetSearchResultsAsync(searchQuery);
|
||||
|
@ -530,7 +530,7 @@
|
||||
_smtpsender = SettingService.GetSetting(settings, "SMTPSender", string.Empty);
|
||||
_smtprelay = SettingService.GetSetting(settings, "SMTPRelay", "False");
|
||||
_smtpenabled = SettingService.GetSetting(settings, "SMTPEnabled", "True");
|
||||
_retention = int.Parse(SettingService.GetSetting(settings, "NotificationRetention", "30"));
|
||||
_retention = SharedConverter.ParseInteger(SettingService.GetSetting(settings, "NotificationRetention", "30"));
|
||||
|
||||
// PWA
|
||||
_pwaisenabled = site.PwaIsEnabled.ToString();
|
||||
@ -632,7 +632,7 @@
|
||||
if (site != null)
|
||||
{
|
||||
site.Name = _name;
|
||||
site.HomePageId = (_homepageid != "-" ? int.Parse(_homepageid) : null);
|
||||
site.HomePageId = (_homepageid != "-" ? SharedConverter.ParseInteger(_homepageid) : null);
|
||||
site.IsDeleted = (_isdeleted == null ? true : Boolean.Parse(_isdeleted));
|
||||
|
||||
// appearance
|
||||
|
@ -383,7 +383,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
var tenant = _tenants.FirstOrDefault(item => item.TenantId == int.Parse(_tenantid));
|
||||
var tenant = _tenants.FirstOrDefault(item => item.TenantId == SharedConverter.ParseInteger(_tenantid));
|
||||
if (tenant != null)
|
||||
{
|
||||
config.TenantName = tenant.Name;
|
||||
|
@ -90,7 +90,7 @@ else
|
||||
_capturebrokenurls = PageState.Site.CaptureBrokenUrls.ToString();
|
||||
|
||||
var settings = await SettingService.GetSiteSettingsAsync(PageState.Site.SiteId);
|
||||
_retention = int.Parse(SettingService.GetSetting(settings, "UrlMappingRetention", "30"));
|
||||
_retention = SharedConverter.ParseInteger(SettingService.GetSetting(settings, "UrlMappingRetention", "30"));
|
||||
}
|
||||
|
||||
private async void MappedChanged(ChangeEventArgs e)
|
||||
|
@ -56,7 +56,7 @@
|
||||
{
|
||||
if (!string.IsNullOrEmpty(username.Key) && !string.IsNullOrEmpty(subject))
|
||||
{
|
||||
var user = await UserService.GetUserAsync(int.Parse(username.Key), ModuleState.SiteId);
|
||||
var user = await UserService.GetUserAsync(SharedConverter.ParseInteger(username.Key), ModuleState.SiteId);
|
||||
if (user != null)
|
||||
{
|
||||
var notification = new Notification(PageState.Site.SiteId, PageState.User, user, subject, body);
|
||||
|
@ -135,9 +135,9 @@ else
|
||||
|
||||
_tracking = PageState.Site.VisitorTracking.ToString();
|
||||
var settings = await SettingService.GetSiteSettingsAsync(PageState.Site.SiteId);
|
||||
_duration = int.Parse(SettingService.GetSetting(settings, "VisitorDuration", "5"));
|
||||
_duration = SharedConverter.ParseInteger(SettingService.GetSetting(settings, "VisitorDuration", "5"));
|
||||
_filter = SettingService.GetSetting(settings, "VisitorFilter", Constants.DefaultVisitorFilter);
|
||||
_retention = int.Parse(SettingService.GetSetting(settings, "VisitorRetention", "30"));
|
||||
_retention = SharedConverter.ParseInteger(SettingService.GetSetting(settings, "VisitorRetention", "30"));
|
||||
_correlation = SettingService.GetSetting(settings, "VisitorCorrelation", "true");
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ else
|
||||
{
|
||||
try
|
||||
{
|
||||
_days = int.Parse(e.Value.ToString());
|
||||
_days = SharedConverter.ParseInteger(e.Value.ToString());
|
||||
await GetVisitors();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
Reference in New Issue
Block a user