Пример #1
0
 public MobSocialWebApiPlugin(MobSocialObjectContext context, mobSocialSettings mobSocialSettings,
                              ISettingService settingService, IMessageTemplateService messageTemplateService,
                              IScheduleTaskService scheduleTaskService,
                              IMobSocialService mobSocialService,
                              ILocalizationService localizationService,
                              IStoreContext storeContext,
                              IVideoBattleService videoBattleService, EmailAccountSettings emailAccountSettings)
 {
     _context                = context;
     _mobSocialSettings      = mobSocialSettings;
     _settingService         = settingService;
     _messageTemplateService = messageTemplateService;
     _scheduleTaskService    = scheduleTaskService;
     _mobSocialService       = mobSocialService;
     _localizationService    = localizationService;
     _videoBattleService     = videoBattleService;
     _emailAccountSettings   = emailAccountSettings;
     _storeContext           = storeContext;
     _config = new HttpRuntimeSection(); //TODO Move to dependency registrar and perform injection
 }
Пример #2
0
        /// <summary>
        /// Install plugin
        /// </summary>
        public override void Install()
        {
            //locales
            //this.AddOrUpdatePluginLocaleResource("Plugins.ProductCarousel.Cache", "true");
            //It's required to set initializer to null (for SQL Server Compact).
            //otherwise, you'll get something like "The model backing the 'your context name' context has changed since the database was created. Consider using Code First Migrations to update the database"


            //first check if it's an upgrade to existing plugin, then we won't be doing any insertions
            var mobSocialSettings = _settingService.LoadSetting <mobSocialSettings>();

            if (mobSocialSettings.Version != 0)
            {
                //an installation is already there, so let's skip the step
                if (!MobSocialConstant.SuiteInstallation) //if it's a suite installation, better not call the base method
                {
                    base.Install();
                }
                return;
            }
            //settings
            mobSocialSettings = new mobSocialSettings()
            {
                Version            = MobSocialConstant.ReleaseVersion,
                ProfilePictureSize = 100,
                WidgetZone         = "after_header_links",
                PeopleSearchAutoCompleteEnabled            = true,
                PeopleSearchAutoCompleteNumberOfResults    = 10,
                EventPageSearchAutoCompleteNumberOfResults = 10,
                PeopleSearchTermMinimumLength         = 3,
                EventPageSearchTermMinimumLength      = 1,
                ShowProfileImagesInSearchAutoComplete = true,
                CustomerAlbumPictureThumbnailWidth    = 290,
                MaximumMainAlbumPictures         = 10,
                MaximumMainAlbumVideos           = 10,
                EventPageAttendanceThumbnailSize = 25,
                UninvitedFriendsNumberOfResults  = 20,
                CustomerProfileUpdateViewCountAfterNumberOfSeconds = 180, // 3 minutes,
                FacebookWebsiteAppId    = "1234567890123456",
                BusinessPageSearchUrl   = "BusinessSearch",
                ArtistPageMainImageSize = 300,
                ArtistPageThumbnailSize = 150,
                // Would you like to replace the api key with your own?
                // Find more info here by contacting us at [email protected]
                EchonestAPIKey = "DQFW7ZCMHBBLMLVFE",
                // Would you like to replace the partner id with your own?
                // Find more info here by contacting us at [email protected]
                SevenDigitalPartnerId                    = "9378",
                SongFileMaximumUploadSize                = _config.MaxRequestLength,
                SongFileSampleMaximumUploadSize          = _config.MaxRequestLength,
                PurchasedSongFeePercentage               = 30,
                ShowVideoThumbnailsForBattles            = true,
                DefaultVotingChargeForPaidVoting         = 0.99m,
                EnableFacebookInvite                     = true,
                MacroPaymentsFixedPaymentProcessingFee   = 5,
                MicroPaymentsFixedPaymentProcessingFee   = 0.05m,
                MacroPaymentsPaymentProcessingPercentage = 3.5m,
                MicroPaymentsPaymentProcessingPercentage = 5,
                VideoUploadReminderEmailThresholdDays    = 5,
                BattleVoteReminderEmailThresholdDays     = 5,
                TimelineSmallImageWidth                  = 300
            };

            //save distribution percentages as strings
            _settingService.SetSetting("winner_distribution_1", "100");
            _settingService.SetSetting("winner_distribution_2", "60+40");
            _settingService.SetSetting("winner_distribution_3", "45+35+20");
            _settingService.SetSetting("winner_distribution_4", "45+25+20+10");
            _settingService.SetSetting("winner_distribution_5", "40+25+20+10+5");

            var mediaSettings = new MediaSettings()
            {
                AvatarPictureSize = 200
            };



            AddLocaleResourceStrings();



            _settingService.SaveSetting(mediaSettings);
            _settingService.SaveSetting(mobSocialSettings);


            InsertMessageTemplates();

            AddScheduledTasks();



            _context.Install();
            if (!MobSocialConstant.SuiteInstallation)
            {
                base.Install();//for suite installation, we don't have plugin descriptor, so avoid this call
            }
        }