private async Task From470To480() { #region Install String resources await InstallStringResources("EN_470_480.nopres.xml"); #endregion #region Update customer settings var _settingService = _serviceProvider.GetRequiredService <ISettingService>(); var customerSettings = _serviceProvider.GetRequiredService <CustomerSettings>(); customerSettings.HideSubAccountsTab = true; await _settingService.SaveSetting(customerSettings); #endregion #region Update permissions - Actions IPermissionProvider provider = new StandardPermissionProvider(); //install new permissions await _mediator.Send(new InstallNewPermissionsCommand() { PermissionProvider = provider }); var permissions = provider.GetPermissions(); var permissionService = _serviceProvider.GetRequiredService <IPermissionService>(); foreach (var permission in permissions) { var p = await permissionService.GetPermissionRecordBySystemName(permission.SystemName); if (p != null) { p.Actions = permission.Actions; await permissionService.UpdatePermissionRecord(p); } } #endregion #region Update cancel order Scheduled Task var tasks = _serviceProvider.GetRequiredService <IRepository <ScheduleTask> >(); var cancelOrderTask = new ScheduleTask { ScheduleTaskName = "Cancel unpaid and pending orders", Type = "Grand.Services.Tasks.CancelOrderScheduledTask, Grand.Services", Enabled = false, StopOnError = false, TimeInterval = 1440 }; await tasks.InsertAsync(cancelOrderTask); #endregion }
private async Task From470To480() { #region Install String resources await InstallStringResources("EN_470_480.nopres.xml"); #endregion #region Update customer settings var _settingService = _serviceProvider.GetRequiredService <ISettingService>(); var customerSettings = _serviceProvider.GetRequiredService <CustomerSettings>(); customerSettings.HideSubAccountsTab = true; await _settingService.SaveSetting(customerSettings); #endregion #region Update permissions - Actions IPermissionProvider provider = new StandardPermissionProvider(); var permissions = provider.GetPermissions(); var permissionService = _serviceProvider.GetRequiredService <IPermissionService>(); foreach (var permission in permissions) { var p = await permissionService.GetPermissionRecordBySystemName(permission.SystemName); if (p != null) { p.Actions = permission.Actions; await permissionService.UpdatePermissionRecord(p); } } #endregion }