コード例 #1
0
ファイル: OqtModuleUpdater.cs プロジェクト: valadas/2sxc
        /// <summary>
        /// Saves a temporary templateId to the module's settings
        /// This templateId will be used until a ContentGroup exists
        /// </summary>
        public void SetPreview(int instanceId, Guid previewTemplateGuid)
        {
            var settings = _settingsHelper.Init(EntityNames.Module, instanceId).Settings;

            // Do not allow saving the temporary template id if a ContentGroup exists for this module
            if (settings.TryGetValue(Settings.ModuleSettingContentGroup, out var value) && !string.IsNullOrEmpty(value))
            {
                throw new Exception("Preview template id cannot be set for a module that already has content.");
            }

            UpdateInstanceSetting(instanceId, Settings.ModuleSettingsPreview, previewTemplateGuid.ToString(), Log);
        }
コード例 #2
0
        public new OqtContainer Init(Module module, ILog parentLog)
        {
            var wrapLog = Log.Call($"id:{module.ModuleId}");

            base.Init(module, parentLog);

            InitializeIsPrimary(module);

            _settings = _settingsHelper.Init(EntityNames.Module, module.ModuleId).Settings;

            _id = module.ModuleId;

            wrapLog("ok");

            return(this);
        }