Exemplo n.º 1
0
        /// <summary>
        /// Install the plugin
        /// </summary>
        public override void Install()
        {
            //settings
            _settingService.SaveSetting(new MailChimpSettings());

            //install synchronization task
            if (_scheduleTaskService.GetTaskByType("Nop.Plugin.Misc.MailChimp.Services.MailChimpSynchronizationTask, Nop.Plugin.Misc.MailChimp") == null)
            {
                _scheduleTaskService.InsertTask(new ScheduleTask
                {
                    Name    = "MailChimp synchronization",
                    Seconds = 21600,
                    Type    = "Nop.Plugin.Misc.MailChimp.Services.MailChimpSynchronizationTask, Nop.Plugin.Misc.MailChimp",
                });
            }

            //database objects
            _mailChimpObjectContext.Install();

            //data for the first synchronization
            _mailChimpManager.CreateInitiateData();

            //locales
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.MailChimp.AccountInfo", "Account information");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.MailChimp.AutoSyncRestart", "Task parameters has been changed, please restart the application");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.MailChimp.ManualSync", "Synchronize");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.MailChimp.ManualSync.Hint", "Manual synchronization");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.MailChimp.Fields.ApiKey", "API key");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.MailChimp.Fields.ApiKey.Hint", "Input your MailChimp account API key.");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.MailChimp.Fields.AutoSync", "Auto synchronization");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.MailChimp.Fields.AutoSync.Hint", "Use auto synchronization task.");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.MailChimp.Fields.AutoSyncEachMinutes", "Period (minutes)");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.MailChimp.Fields.AutoSyncEachMinutes.Hint", "Input auto synchronization task period (minutes).");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.MailChimp.Fields.List", "List");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.MailChimp.Fields.List.Hint", "Choose list of contacts for the synchronization.");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.MailChimp.Fields.UseEcommerceApi", "Use MailChimp for E-Commerce");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.MailChimp.Fields.UseEcommerceApi.Hint", "Check for using MailChimp for E-Commerce.");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.MailChimp.SynchronizationError", "Error on synchronization start");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.MailChimp.SynchronizationStart", "Synchronization is in process");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.MailChimp.WebhookError", "Webhook was not created (you'll not be able to get users who unsubscribed from MailChimp)");

            base.Install();
        }