public VideoBattleService(ISettingService settingService, IWebHelper webHelper,
                           ILogger logger,
                           IMobRepository <VideoBattle> videoBattleRepository,
                           IMobRepository <VideoBattlePicture> videoBattlePictureRepository,
                           IMobRepository <VideoBattleParticipant> videoBattleParticpantRepository,
                           IMobRepository <VideoBattleGenre> videoBattleGenreRepository,
                           IMobRepository <VideoBattleVideo> videoBattleVideoRepository,
                           IUrlRecordService urlRecordService,
                           IWorkContext workContext,
                           IPictureService pictureService,
                           ICustomerFollowService customerFollowService,
                           IMobSocialMessageService mobSocialMessageService,
                           ICustomerService customerService,
                           IStoreContext stoerContext,
                           ITimelineAutoPublisher timelineAutoPublisher)
     : base(videoBattleRepository, videoBattlePictureRepository, pictureService, workContext, urlRecordService)
 {
     _workContext                      = workContext;
     _customerFollowService            = customerFollowService;
     _mobSocialMessageService          = mobSocialMessageService;
     _customerService                  = customerService;
     _storeContext                     = stoerContext;
     _timelineAutoPublisher            = timelineAutoPublisher;
     _videoBattleRepository            = videoBattleRepository;
     _videoBattleParticipantRepository = videoBattleParticpantRepository;
     _videoBattleGenreRepository       = videoBattleGenreRepository;
     _videoBattleVideoRepository       = videoBattleVideoRepository;
 }
 public FriendsApiController(IFriendService friendService, IPermissionService permissionService, IWorkContext workContext, IPictureService pictureService, ICustomerService customerService, IMobSocialService mobSocialService, ICustomerFollowService customerFollowService)
 {
     _friendService         = friendService;
     _permissionService     = permissionService;
     _workContext           = workContext;
     _pictureService        = pictureService;
     _customerService       = customerService;
     _mobSocialService      = mobSocialService;
     _customerFollowService = customerFollowService;
 }
예제 #3
0
 public ReminderNotificationsTask(IPluginFinder pluginFinder, IMobSocialMessageService mobSocialMessageService, IVideoBattleService videoBattleService, IVideoBattleVideoService videoBattleVideoService, IVideoBattleVoteService videoBattleVoteService, mobSocialSettings mobSocialSettings, IVideoBattleParticipantService videoBattleParticipantService, ICustomerService customerService, IWorkContext workContext, IStoreContext storeContext, ICustomerFollowService customerFollowService, IDateTimeHelper dateTimeHelper)
 {
     _pluginFinder                  = pluginFinder;
     _mobSocialMessageService       = mobSocialMessageService;
     _videoBattleService            = videoBattleService;
     _videoBattleVideoService       = videoBattleVideoService;
     _videoBattleVoteService        = videoBattleVoteService;
     _mobSocialSettings             = mobSocialSettings;
     _videoBattleParticipantService = videoBattleParticipantService;
     _customerService               = customerService;
     _workContext           = workContext;
     _storeContext          = storeContext;
     _customerFollowService = customerFollowService;
     _dateTimeHelper        = dateTimeHelper;
 }
예제 #4
0
 public SkillController(ISkillService skillService, ICustomerService userService, IMediaService mediaService, MediaSettings mediaSettings, IUserSkillService userSkillService, ICustomerFollowService followService, ICustomerLikeService likeService, ICustomerCommentService commentService, IWorkContext workContext, ICustomerProfileService customerProfileService, ICustomerProfileViewService customerProfileViewService, IPictureService pictureService, IUrlRecordService urlRecordService, IStoreContext storeContext, IWebHelper webHelper)
 {
     _skillService               = skillService;
     _userService                = userService;
     _mediaService               = mediaService;
     _mediaSettings              = mediaSettings;
     _userSkillService           = userSkillService;
     _followService              = followService;
     _likeService                = likeService;
     _commentService             = commentService;
     _workContext                = workContext;
     _customerProfileService     = customerProfileService;
     _customerProfileViewService = customerProfileViewService;
     _pictureService             = pictureService;
     _urlRecordService           = urlRecordService;
     _storeContext               = storeContext;
     _webHelper = webHelper;
 }
 public MediaApiController(MediaService mediaService, MediaSettings mediaSettings, IMobSocialVideoProcessor videoProcessor, ICustomerService userService, ICustomerCommentService commentService, ICustomerLikeService likeService, IEntityMediaService entityMediaService, IWorkContext workContext, IStoreContext storeContext, ICustomerProfileService customerProfileService, ICustomerProfileViewService customerProfileViewService, ICustomerLikeService customerLikeService, ICustomerFollowService customerFollowService, ICustomerCommentService customerCommentService, IFriendService friendService, IPictureService pictureService, IWebHelper webHelper)
 {
     _mediaService               = mediaService;
     _mediaSettings              = mediaSettings;
     _videoProcessor             = videoProcessor;
     _userService                = userService;
     _commentService             = commentService;
     _likeService                = likeService;
     _entityMediaService         = entityMediaService;
     _workContext                = workContext;
     _storeContext               = storeContext;
     _customerProfileService     = customerProfileService;
     _customerProfileViewService = customerProfileViewService;
     _customerLikeService        = customerLikeService;
     _customerFollowService      = customerFollowService;
     _customerCommentService     = customerCommentService;
     _friendService              = friendService;
     _pictureService             = pictureService;
     _webHelper = webHelper;
 }
 public CustomerProfileApiController(CustomerProfileService customerProfileService,
     CustomerProfileViewService customerProfileViewService,
     ICustomerService customerService,
     IMobSocialService mobSocialService,
     ICustomerFavoriteSongService customerFavoriteSongService,
     IMusicService musicService,
     IWorkContext workContext, IFriendService friendService, IPictureService pictureService, mobSocialSettings mobSocialSettings, MediaSettings mediaSettings, IGenericAttributeService genericAttributeService, ICustomerFollowService customerFollowService)
 {
     _customerProfileService = customerProfileService;
     _customerProfileViewService = customerProfileViewService;
     _customerService = customerService;
     _customerFavoriteSongService = customerFavoriteSongService;
     _mobSocialService = mobSocialService;
     _musicService = musicService;
     _workContext = workContext;
     _friendService = friendService;
     _pictureService = pictureService;
     _mobSocialSettings = mobSocialSettings;
     _mediaSettings = mediaSettings;
     _genericAttributeService = genericAttributeService;
     _customerFollowService = customerFollowService;
 }
 public CustomerProfileApiController(CustomerProfileService customerProfileService,
                                     CustomerProfileViewService customerProfileViewService,
                                     ICustomerService customerService,
                                     IMobSocialService mobSocialService,
                                     ICustomerFavoriteSongService customerFavoriteSongService,
                                     IMusicService musicService,
                                     IWorkContext workContext, IFriendService friendService, IPictureService pictureService, mobSocialSettings mobSocialSettings, MediaSettings mediaSettings, IGenericAttributeService genericAttributeService, ICustomerFollowService customerFollowService)
 {
     _customerProfileService      = customerProfileService;
     _customerProfileViewService  = customerProfileViewService;
     _customerService             = customerService;
     _customerFavoriteSongService = customerFavoriteSongService;
     _mobSocialService            = mobSocialService;
     _musicService            = musicService;
     _workContext             = workContext;
     _friendService           = friendService;
     _pictureService          = pictureService;
     _mobSocialSettings       = mobSocialSettings;
     _mediaSettings           = mediaSettings;
     _genericAttributeService = genericAttributeService;
     _customerFollowService   = customerFollowService;
 }
예제 #8
0
 public TimelineApiController(ITimelineService timelineService,
                              IWorkContext workContext,
                              ICustomerFollowService customerFollowService,
                              ICustomerService customerService,
                              IPictureService pictureService,
                              MediaSettings mediaSettings,
                              IDateTimeHelper dateTimeHelper,
                              mobSocialSettings mobSocialSettings,
                              IVideoBattleService videoBattleService,
                              ICustomerLikeService customerLikeService,
                              ICustomerCommentService customerCommentService)
 {
     _timelineService        = timelineService;
     _workContext            = workContext;
     _customerFollowService  = customerFollowService;
     _customerService        = customerService;
     _pictureService         = pictureService;
     _mediaSettings          = mediaSettings;
     _dateTimeHelper         = dateTimeHelper;
     _mobSocialSettings      = mobSocialSettings;
     _videoBattleService     = videoBattleService;
     _customerLikeService    = customerLikeService;
     _customerCommentService = customerCommentService;
 }
예제 #9
0
        public static MediaReponseModel ToModel(this Media media,
                                                IMediaService mediaService,
                                                MediaSettings mediaSettings,
                                                IWorkContext workContext,
                                                IStoreContext storeContext,
                                                ICustomerService userService,
                                                ICustomerProfileService customerProfileService,
                                                ICustomerProfileViewService customerProfileViewService,
                                                ICustomerFollowService followService,
                                                IFriendService friendService,
                                                ICustomerCommentService commentService,
                                                ICustomerLikeService likeService,
                                                IPictureService pictureService,
                                                UrlHelper urlHelper,
                                                IWebHelper webHelper,
                                                bool withUserInfo             = true,
                                                bool withSocialInfo           = false,
                                                bool withNextAndPreviousMedia = false)
        {
            var storeUrl = webHelper.GetStoreLocation();
            var model    = new MediaReponseModel()
            {
                Id        = media.Id,
                MediaType = media.MediaType,
                Url       =
                    media.MediaType == MediaType.Image
                        ? mediaService.GetPictureUrl(media)
                        : mediaService.GetVideoUrl(media),
                MimeType       = media.MimeType,
                DateCreatedUtc = media.DateCreated,
                ThumbnailUrl   =
                    media.MediaType == MediaType.Image
                        ? mediaService.GetPictureUrl(media)
                        : media.ThumbnailPath.Replace("~", storeUrl)
            };

            if (withUserInfo && userService != null)
            {
                var user = userService.GetCustomerById(media.UserId);
                if (user != null)
                {
                    var dateTimeHelper = EngineContext.Current.Resolve <IDateTimeHelper>();
                    model.CreatedBy        = user.ToPublicModel(workContext, customerProfileViewService, customerProfileService, pictureService, mediaSettings, urlHelper);
                    model.DateCreatedLocal = dateTimeHelper.ConvertToUserTime(media.DateCreated, DateTimeKind.Utc);
                }
            }
            if (withSocialInfo)
            {
                if (likeService != null)
                {
                    model.TotalLikes = likeService.GetLikeCount <Media>(media.Id);
                    model.LikeStatus =
                        likeService.GetCustomerLike <Media>(workContext.CurrentCustomer.Id, media.Id) != null
                            ? 1
                            : 0;
                }

                if (commentService != null)
                {
                    model.TotalComments = commentService.GetCommentsCount(media.Id, typeof(Media).Name);
                    model.CanComment    = true; //todo: perform check if comments are enabled or user has permission to comment
                }
            }

            if (withNextAndPreviousMedia)
            {
                var allMedia   = mediaService.GetEntityMedia <Customer>(media.UserId, media.MediaType, 1, int.MaxValue).ToList();
                var mediaIndex = allMedia.FindIndex(x => x.Id == media.Id);

                model.PreviousMediaId = mediaIndex <= 0 ? 0 : allMedia[mediaIndex - 1].Id;
                model.NextMediaId     = mediaIndex < 0 || mediaIndex == allMedia.Count - 1 ? 0 : allMedia[mediaIndex + 1].Id;
            }

            model.FullyLoaded = withSocialInfo && withNextAndPreviousMedia;
            return(model);

            ;
        }
 public CustomerFollowApiController(IWorkContext workContext, ICustomerFollowService customerFollowService)
 {
     _workContext           = workContext;
     _customerFollowService = customerFollowService;
 }
예제 #11
0
        public static SkillWithUsersModel ToSkillWithUsersModel(this Skill skill, IWorkContext workContext, IStoreContext storeContext, ICustomerService customerService, IUserSkillService userSkillService, IMediaService mediaService,
                                                                MediaSettings mediaSettings, ICustomerFollowService followService, ICustomerLikeService likeService, ICustomerCommentService commentService, ICustomerProfileService customerProfileService, ICustomerProfileViewService customerProfileViewService, IPictureService pictureService, UrlHelper urlHelper, IWebHelper webHelper)
        {
            var currentUser = workContext.CurrentCustomer;
            var model       = new SkillWithUsersModel()
            {
                Skill = skill.ToModel(workContext),
                FeaturedMediaImageUrl = skill.FeaturedImageId > 0 ? mediaService.GetPictureUrl(skill.FeaturedImageId) : ""
            };

            var perPage = 15;
            //by default we'll send data for 15 users. rest can be queried with paginated request
            //todo: make this thing configurable to set number of users to return with this response
            var userSkills = userSkillService.Get(x => x.SkillId == skill.Id).ToList();

            model.UserSkills =
                userSkills.OrderBy(x => x.Id).Take(perPage).Select(
                    x =>
                    x.ToModel(mediaService, mediaSettings, workContext, storeContext, customerService,
                              customerProfileViewService, customerProfileService, pictureService, urlHelper, webHelper, false, true, true, false)).ToList();

            model.CurrentPage   = 1;
            model.UsersPerPage  = perPage;
            model.TotalUsers    = userSkillService.Count(x => x.SkillId == skill.Id);
            model.FollowerCount = followService.GetFollowerCount <Skill>(skill.Id);

            //does this user follow this skill?
            var userFollow = followService.GetCustomerFollow <Skill>(currentUser.Id, skill.Id);

            model.CanFollow     = true;
            model.FollowStatus  = userFollow == null ? 0 : 1;
            model.HasSkill      = userSkills.Any(x => x.UserId == currentUser.Id);
            model.TotalComments = commentService.GetCommentsCount(skill.Id, "skill");
            model.LikeStatus    = likeService.GetCustomerLike <Skill>(currentUser.Id, skill.Id) == null ? 0 : 1;
            model.TotalLikes    = likeService.GetLikeCount <Skill>(skill.Id);
            return(model);
        }