Beispiel #1
0
        public static CustomerProfilePublicModel ToPublicModel(this Customer customer,
                                                               IWorkContext workContext,
                                                               ICustomerProfileViewService customerProfileViewService,
                                                               ICustomerProfileService customerProfileService,
                                                               IPictureService pictureService,
                                                               MediaSettings mediaSettings,
                                                               UrlHelper url)
        {
            var customerSeName = customer.GetSeName(workContext.WorkingLanguage.Id, true, false);
            var model          = new CustomerProfilePublicModel()
            {
                CustomerId   = customer.Id,
                ViewCount    = customerProfileViewService.GetViewCount(customer.Id),
                FriendCount  = customerProfileService.GetFriendCount(customer.Id),
                CustomerName = customer.GetFullName(),
                SeName       = customerSeName,
                ProfileUrl   = url.RouteUrl("CustomerProfileUrl", new RouteValueDictionary()
                {
                    { "SeName", customerSeName }
                }),
                ProfileImageUrl =
                    pictureService.GetPictureUrl(
                        customer.GetAttribute <int>(SystemCustomerAttributeNames.AvatarPictureId),
                        mediaSettings.AvatarPictureSize, true),
                CoverImageUrl =
                    pictureService.GetPictureUrl(
                        customer.GetAttribute <int>(AdditionalCustomerAttributeNames.CoverImageId))
            };

            return(model);
        }
Beispiel #2
0
        public TeamPageApiController(IWorkContext workContext,
                                     ITeamPageService teamPageService,
                                     ITeamPageGroupService teamPageGroupService,
                                     ITeamPageGroupMemberService teamPageGroupMemberService,
                                     ICustomerService customerService,
                                     ICustomerProfileViewService customerProfileViewService,
                                     IDateTimeHelper dateTimeHelper,
                                     ICustomerProfileService customerProfileService,
                                     IPictureService pictureService,
                                     MediaSettings mediaSettings,
                                     mobSocialSettings mobSocialSettings)
        {
            _workContext                = workContext;
            _teamPageService            = teamPageService;
            _teamPageGroupService       = teamPageGroupService;
            _teamPageGroupMemberService = teamPageGroupMemberService;
            _customerService            = customerService;
            _dateTimeHelper             = dateTimeHelper;
            _customerProfileService     = customerProfileService;
            _pictureService             = pictureService;
            _mediaSettings              = mediaSettings;
            _mobSocialSettings          = mobSocialSettings;
            _customerProfileViewService = customerProfileViewService;

            Mapper.Initialize(cfg => cfg.CreateMap <TeamPageModel, ConfigurationModel>());
            Mapper.Initialize(cfg => cfg.CreateMap <TeamPageModel, TeamPage>());
            Mapper.Initialize(cfg => cfg.CreateMap <TeamPageGroupModel, GroupPage>());
        }
Beispiel #3
0
 public LoginController(ILogger <LoginController> logger, ILoginService loginService, IShopProfileService shopProfileService, IPromotionService promotionService, ICustomerProfileService customerProfileService)
 {
     _logger                 = logger;
     _loginService           = loginService;
     _customerProfileService = customerProfileService;
     _shopProfileService     = shopProfileService;
 }
 public RecommendationViewController(ILogger <RecommendationViewController> logger, IRecommendationService recommendationService, ICustomerProfileService customerProfileService, IPromotionService promotionService)
 {
     _logger = logger;
     _recommendationService  = recommendationService;
     _customerProfileService = customerProfileService;
     _promotionService       = promotionService;
 }
Beispiel #5
0
        public static UserSkillModel ToModel(this UserSkill userSkill, IMediaService mediaService, MediaSettings mediaSettings, IWorkContext workContext, IStoreContext storeContext,
                                             ICustomerService customerService,
                                             ICustomerProfileViewService customerProfileViewService,
                                             ICustomerProfileService customerProfileService,
                                             IPictureService pictureService,
                                             UrlHelper url, IWebHelper webHelper, bool onlySkillData = false, bool firstMediaOnly = false, bool withNextAndPreviousMedia = false, bool withSocialInfo = false)
        {
            var entityMedias = mediaService.GetEntityMedia <UserSkill>(userSkill.Id, null, count: int.MaxValue).ToList();
            var customer     = onlySkillData ? null : customerService.GetCustomerById(userSkill.UserId);
            var model        = new UserSkillModel()
            {
                DisplayOrder = userSkill.Skill.DisplayOrder,
                SkillName    = userSkill.Skill.Name,
                UserSkillId  = userSkill.Id,
                Id           = userSkill.SkillId,
                User         = onlySkillData ? null : customer.ToPublicModel(workContext, customerProfileViewService, customerProfileService, pictureService, mediaSettings, url),
                Media        =
                    entityMedias.Take(firstMediaOnly ? 1 : 15)
                    .ToList()
                    .Select(
                        x =>
                        x.ToModel <UserSkill>(userSkill.Id, mediaService, mediaSettings, workContext, storeContext, customerService, customerProfileService, customerProfileViewService, pictureService, url, webHelper))
                    .ToList(),
                TotalMediaCount   = entityMedias.Count,
                TotalPictureCount = entityMedias.Count(x => x.MediaType == MediaType.Image),
                TotalVideoCount   = entityMedias.Count(x => x.MediaType == MediaType.Video),
                ExternalUrl       = userSkill.ExternalUrl,
                Description       = userSkill.Description,
                SeName            = userSkill.Skill.GetSeName(workContext.WorkingLanguage.Id, true, false)
            };

            return(model);
        }
 public CustomerController(ICustomerProfileService customerService, IJobService jobService, IOfferService offerService, ICommitProvider commitProvider)
 {
     _customerService = customerService;
     _jobService      = jobService;
     _offerService    = offerService;
     _commitProvider  = commitProvider;
 }
Beispiel #7
0
 public mobSocialApiController(IPermissionService permissionService,
                               IWorkContext workContext, AdminAreaSettings adminAreaSettings, ILocalizationService localizationService,
                               IPictureService pictureService, IMobSocialService socialNetworkService, ICustomerService customerService,
                               ICustomerAlbumPictureService customerAlbumPictureService, mobSocialSettings mobSocialSettings, MediaSettings mediaSettings, CustomerSettings customerSettings,
                               ForumSettings forumSettings, RewardPointsSettings rewardPointsSettings, OrderSettings orderSettings,
                               IStoreContext storeContext, IWebHelper webHelper, IUrlRecordService urlRecordService, IRepository <UrlRecord> urlRecordRepository,
                               ICustomerVideoAlbumService customerVideoAlbumService, CustomerProfileViewService customerProfileViewService, IGenericAttributeService genericAttributeService, ICustomerProfileService customerProfileService)
 {
     _permissionService           = permissionService;
     _workContext                 = workContext;
     _adminAreaSettings           = adminAreaSettings;
     _localizationService         = localizationService;
     _pictureService              = pictureService;
     _socialNetworkService        = socialNetworkService;
     _customerService             = customerService;
     _customerAlbumPictureService = customerAlbumPictureService;
     _mobSocialSettings           = mobSocialSettings;
     _mediaSettings               = mediaSettings;
     _customerSettings            = customerSettings;
     _forumSettings               = forumSettings;
     _rewardPointsSettings        = rewardPointsSettings;
     _orderSettings               = orderSettings;
     _storeContext                = storeContext;
     _webHelper                  = webHelper;
     _urlRecordService           = urlRecordService;
     _urlRecordRepository        = urlRecordRepository;
     _customerVideoAlbumService  = customerVideoAlbumService;
     _customerProfileViewService = customerProfileViewService;
     _genericAttributeService    = genericAttributeService;
     _customerProfileService     = customerProfileService;
 }
 public ClaimController(ILogger <ClaimController> logger, IClaimService claimService, ICustomerProfileService customerProfileService, INotificationService notificationService, IConfiguration configuration)
 {
     _logger                 = logger;
     _claimService           = claimService;
     _customerProfileService = customerProfileService;
     _notificationService    = notificationService;
     _configuration          = configuration;
 }
 public VoucherOperationsService(ICustomerProfileService customerProfileService,
                                 ICurrencyConvertorService currencyConvertorService,
                                 ILogFactory logFactory)
 {
     _customerProfileService   = customerProfileService ?? throw new ArgumentNullException(nameof(customerProfileService));
     _currencyConvertorService = currencyConvertorService ?? throw new ArgumentNullException(nameof(currencyConvertorService));
     _log = logFactory.CreateLog(this);
 }
Beispiel #10
0
 public SeizeBalanceFromCustomerCompletedSubscriber(
     string connectionString,
     ICustomerProfileService customerProfileService,
     ILogFactory logFactory)
     : base(connectionString, ExchangeName, QueueName, logFactory)
 {
     _customerProfileService = customerProfileService;
     _log = logFactory.CreateLog(this);
 }
 public AccountController(IArchiveNoService archiveNoService, IUnitOfWorkAsync unitOfWork,
                          ICustomerProfileService customerProfileService, ICustomerAccounntService customerAccounntService, IHttpService httpService)
 {
     _archiveNoService        = archiveNoService;
     _unitOfWork              = unitOfWork;
     _customerProfileService  = customerProfileService;
     _customerAccounntService = customerAccounntService;
     _httpService             = httpService;
 }
 public CodeVerifiedSubscriber(
     string connectionString,
     ICustomerProfileService customerProfileService,
     ILogFactory logFactory)
     : base(connectionString, ExchangeName, QueueName, logFactory)
 {
     _customerProfileService = customerProfileService;
     _log = logFactory.CreateLog(this);
 }
 public CustomersController(
     ICustomerProfileService customerProfileService,
     IMapper mapper,
     ILogFactory logFactory)
 {
     _customerProfileService = customerProfileService ?? throw new ArgumentNullException(nameof(customerProfileService));
     _mapper = mapper;
     _log    = logFactory.CreateLog(this);
 }
 public HotelCheckoutSubscriber(
     string connectionString,
     string exchangeName,
     ICustomerProfileService customerProfileService,
     ILogFactory logFactory)
     : base(connectionString, exchangeName, logFactory)
 {
     _customerProfileService = customerProfileService;
     GuidsFieldsToValidate.Add(nameof(BonusCustomerTriggerEvent.CustomerId));
 }
 public CustomerProfileController(
     ICustomerProfileService customerProfileService,
     IApiKeyService apiKeyService,
     IMapper mapper,
     ILogFactory logFactory)
 {
     _customerProfileService = customerProfileService;
     _apiKeyService          = apiKeyService;
     _mapper = mapper;
     _log    = logFactory.CreateLog(this);
 }
 public AccountController(ApplicationUserManager userManager,
                          ISecureDataFormat <AuthenticationTicket> accessTokenFormat, IArchiveNoService archiveNoService, IUnitOfWorkAsync unitOfWork, ICustomerProfileService customerProfileService, IService <CustomerAccounnt> service, ICustomerAccounntService customerAccounntService, IHttpService httpService)
 {
     UserManager              = userManager;
     AccessTokenFormat        = accessTokenFormat;
     _archiveNoService        = archiveNoService;
     this._unitOfWork         = unitOfWork;
     _customerProfileService  = customerProfileService;
     _customerAccounntService = customerAccounntService;
     _httpService             = httpService;
 }
        public PropertyLeadApprovedReferralSubscriber(
            string connectionString,
            string exchangeName,
            ILogFactory logFactory,
            ICustomerProfileService customerProfileService)
            : base(connectionString, exchangeName, logFactory)
        {
            _customerProfileService = customerProfileService ??
                                      throw new ArgumentNullException(nameof(customerProfileService));

            GuidsFieldsToValidate.Add(nameof(PropertyLeadApprovedReferralEvent.ReferrerId));
        }
Beispiel #18
0
        public CustomerRegisteredSubscriber(
            string connectionString,
            string exchangeName,
            ILogFactory logFactory,
            ICustomerProfileService customerProfileService)
            : base(connectionString, exchangeName, logFactory)
        {
            _customerProfileService = customerProfileService
                                      ?? throw new ArgumentNullException(nameof(customerProfileService));

            GuidsFieldsToValidate.Add(nameof(CustomerRegistrationEvent.CustomerId));
        }
        public OfferToPurchaseByLeadSubscriber(
            string connectionString,
            string exchangeName,
            ILogFactory logFactory,
            ICustomerProfileService customerProfileService)
            : base(connectionString, exchangeName, logFactory)
        {
            _customerProfileService = customerProfileService ??
                                      throw new ArgumentNullException(nameof(customerProfileService));

            GuidsFieldsToValidate.Add(nameof(OfferToPurchaseByLeadEvent.AgentId));
        }
        public FriendReferralSubscriber(
            string connectionString,
            string exchangeName,
            ILogFactory logFactory,
            ICustomerProfileService customerProfileService)
            : base(connectionString, exchangeName, logFactory)
        {
            _customerProfileService = customerProfileService
                                      ?? throw new ArgumentNullException(nameof(customerProfileService));
            _log = logFactory.CreateLog(this);

            GuidsFieldsToValidate.Add(nameof(FriendReferralEvent.ReferrerId));
        }
Beispiel #21
0
 public PaymentsController(ICardPaymentService cardPaymentService,
                           IMomoPaymentService momoPaymentService, IMapper mapper,
                           IPaymentRequestRepository paymentRequestRepository, IServiceProvider provider,
                           IPaymentTypeConfiguration paymentTypeConfiguration, IUnifiedSalesService unifiedSalesService,
                           IMerchantAccountService merchantAccountService, ICustomerProfileService customerProfileService)
 {
     _mapper = mapper;
     _paymentRequestRepository = paymentRequestRepository;
     _cardPaymentService       = cardPaymentService;
     _momoPaymentService       = momoPaymentService;
     _provider = provider;
     _paymentTypeConfiguration = paymentTypeConfiguration;
     _unifiedSalesService      = unifiedSalesService;
     _merchantAccountService   = merchantAccountService;
     _customerProfileService   = customerProfileService;
 }
        public ParticipatedInCampaignSubscriber(string connectionString,
                                                string exchangeName,
                                                ILogFactory logFactory,
                                                ICampaignService campaignService,
                                                ICustomerProfileService customerProfileService)
            : base(connectionString, exchangeName, logFactory)
        {
            _campaignService = campaignService
                               ?? throw new ArgumentNullException(nameof(campaignService));
            _customerProfileService = customerProfileService
                                      ?? throw new ArgumentNullException(nameof(customerProfileService));
            _log = logFactory.CreateLog(this);

            GuidsFieldsToValidate.Add(nameof(ParticipatedInCampaignEvent.CustomerId));
            GuidsFieldsToValidate.Add(nameof(ParticipatedInCampaignEvent.CampaignId));
        }
Beispiel #23
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;
 }
Beispiel #24
0
        public MAEFController(IMAEFService maefService, IBdoFormHeaderService bdoFormHeaderService, ICustomerProfileService customerProfileService, IMapper mapper, IReturnRemarksService returnRemarksService, IHttpContextAccessor claims)
        {
            this.mapper                 = mapper;
            this.maefService            = maefService;
            this.bdoFormHeaderService   = bdoFormHeaderService;
            this.customerProfileService = customerProfileService;
            this.returnRemarksService   = returnRemarksService;

            /*    var id = new ClaimsIdentity(User.Claims, "Forms", "name", "role");
             *  var claims = id.Claims.ToList();
             *  claimsVm = new ClaimsViewModel {
             *      name = claims.Where(c => c.Type == "name").SingleOrDefault().Value,
             *      rank = claims.Where(c => c.Type == "rank").SingleOrDefault().Value,
             *      role = claims.Where(c => c.Type == "role").Select(s => s.Value),
             *      access = claims.Where(c => c.Type == "access").Select(s => s.Value)
             *  }; */
            name = claims.HttpContext.User.Claims.ToList().SingleOrDefault(c => c.Type == "name").Value;
            // var role = claims.HttpContext.User.Claims.ToList().SingleOrDefault(c => c.Type == "role").Value;
        }
 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 CustomerProfileViewController(ILogger <CustomerProfileViewController> logger, ICustomerProfileService customerProfileService, IRecommendationService recommendationService)
 {
     _logger = logger;
     _customerProfileService = customerProfileService;
     _recommendationService  = recommendationService;
 }
 public CustomerProfileController(ICustomerProfileService customerProfileService, IMapper mapper)
 {
     this.mapper = mapper;
     this.customerProfileService = customerProfileService;
 }
 public CustomerPhonesController(ICustomerProfileService customerProfileService)
 {
     _customerProfileService = customerProfileService;
 }
Beispiel #29
0
        public static MediaReponseModel ToModel <T>(this Media media, int entityId,
                                                    IMediaService mediaService,
                                                    MediaSettings mediaSettings,
                                                    IWorkContext workContext,
                                                    IStoreContext storeContext,
                                                    ICustomerService userService,
                                                    ICustomerProfileService customerProfileService,
                                                    ICustomerProfileViewService customerProfileViewService,
                                                    IPictureService pictureService,
                                                    UrlHelper urlHelper,
                                                    IWebHelper webHelper,
                                                    IFriendService friendService           = null,
                                                    ICustomerCommentService commentService = null,
                                                    ICustomerLikeService likeService       = null,
                                                    bool withUserInfo             = true,
                                                    bool withSocialInfo           = false,
                                                    bool withNextAndPreviousMedia = false,
                                                    bool avoidMediaTypeForNextAndPreviousMedia = false) where T : BaseEntity
        {
            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)
            {
                MediaType?mediaType = null;
                if (!avoidMediaTypeForNextAndPreviousMedia)
                {
                    mediaType = media.MediaType;
                }
                var allMedia   = mediaService.GetEntityMedia <T>(entityId, 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);

            ;
        }
Beispiel #30
0
 public AccountController(IUserService userService, ICustomerProfileService customerService, ICommitProvider commitProvider)
 {
     _userService    = userService;
     _cusomerService = customerService;
     _commitProvider = commitProvider;
 }