Example #1
0
        public DeeplinkDto ConvertWebLinkToDeeplink(WebUrlDto webUrlDto)
        {
            LinkType type = GetPageLinkType(webUrlDto.webUrl);

            DeeplinkDto deeplinkDto = null;

            switch (type)
            {
            case LinkType.HomePage:
                deeplinkDto = _homeLinkConverter.WebUrlToDeeplink(webUrlDto);
                break;

            case LinkType.ProductDetailPage:
                deeplinkDto = _productLinkConverter.WebUrlToDeeplink(webUrlDto);
                break;

            case LinkType.SearchPage:
                deeplinkDto = _searchLinkConverter.WebUrlToDeeplink(webUrlDto);
                break;

            default:
                deeplinkDto = _otherLinkConverter.WebUrlToDeeplink(webUrlDto);
                break;
            }

            return(deeplinkDto);
        }
Example #2
0
 public WebUrlDto DeeplinkToWebUrl(DeeplinkDto deeplinkObj)
 {
     return(new WebUrlDto()
     {
         webUrl = LinkInfoHelper.siteWeb
     });
 }
Example #3
0
        public WebUrlDto ConvertDeeplinkToWebLink(DeeplinkDto deeplinkDto)
        {
            LinkType  type      = GetPageLinkType(deeplinkDto.deeplink, false);
            WebUrlDto webUrlDto = null;

            switch (type)
            {
            case LinkType.HomePage:
                webUrlDto = _homeLinkConverter.DeeplinkToWebUrl(deeplinkDto);
                break;

            case LinkType.ProductDetailPage:
                webUrlDto = _productLinkConverter.DeeplinkToWebUrl(deeplinkDto);
                break;

            case LinkType.SearchPage:
                webUrlDto = _searchLinkConverter.DeeplinkToWebUrl(deeplinkDto);
                break;

            default:
                webUrlDto = _otherLinkConverter.DeeplinkToWebUrl(deeplinkDto);
                break;
            }

            return(webUrlDto);
        }
Example #4
0
        public WebUrlDto DeeplinkToWebUrl(DeeplinkDto deeplinkObj)
        {
            WebUrlDto webUrlDto = new WebUrlDto();

            webUrlDto.webUrl = deeplinkObj.deeplink.Replace(LinkInfoHelper.siteDeeplink, LinkInfoHelper.siteWeb).Replace("?Page=Search", "/tum_urunler").Replace("&Query=", "?q=");
            return(webUrlDto);
        }
Example #5
0
        public WebUrlDto DeeplinkToWebUrl(DeeplinkDto deeplinkObj)
        {
            string contentId  = Regex.Match(deeplinkObj.deeplink, @"(?<=&ContentId=)\d+").Value;
            string boutiqueId = Regex.Match(deeplinkObj.deeplink, @"(?<=&CampaignId=)\d+").Value;
            string merchantId = Regex.Match(deeplinkObj.deeplink, @"(?<=&MerchantId=)\d+").Value;

            string c_link = $"{LinkInfoHelper.siteWeb}/brand/name-p-{contentId}";

            if (!string.IsNullOrEmpty(boutiqueId))
            {
                c_link += $"?boutiqueId={boutiqueId}";
            }

            if (!string.IsNullOrEmpty(merchantId))
            {
                c_link += (c_link.Contains("?") ? "&" : "?") + $"merchantId={merchantId}";
            }

            WebUrlDto webUrlDto = new WebUrlDto()
            {
                webUrl = c_link
            };

            return(webUrlDto);
        }
Example #6
0
        public DeeplinkDto WebUrlToDeeplink(WebUrlDto webUrlObj)
        {
            string sectionName = Regex.Match(webUrlObj.webUrl, @"(?<=\/butik\/liste\/)\w+").Value;
            int    sectionId   = sectionMap.FirstOrDefault(x => ReplaceTurkishChars(x.Value).ToUpper() == sectionName.ToUpper()).Key;

            DeeplinkDto deeplinkDto = new DeeplinkDto();

            deeplinkDto.deeplink = $"{LinkInfoHelper.siteDeeplink}?Page=Home&SectionId={sectionId}";

            return(deeplinkDto);
        }
Example #7
0
        public WebUrlDto DeeplinkToWebUrl(DeeplinkDto deeplinkObj)
        {
            string sectionId = Regex.Match(deeplinkObj.deeplink, @"(?<=SectionId=)\d+").Value;

            string sectionName = sectionMap[Convert.ToInt32(sectionId)];

            WebUrlDto webUrlDto = new WebUrlDto();

            webUrlDto.webUrl = $"{LinkInfoHelper.siteWeb}/butik/liste/{ReplaceTurkishChars(sectionName).ToLower(new CultureInfo("en-US", false))}";

            return(webUrlDto);
        }
Example #8
0
        public DeeplinkDto WebUrlToDeeplink(WebUrlDto webUrlObj)
        {
            Uri unparsedUrl = new Uri(webUrlObj.webUrl);

            string query   = unparsedUrl.Query;
            var    qParams = HttpUtility.ParseQueryString(query);

            DeeplinkDto deeplinkDto = new DeeplinkDto();

            deeplinkDto.deeplink = $"{LinkInfoHelper.siteWeb}?Page=Search&{qParams.ToString().Replace("q=","Query=")}";

            return(deeplinkDto);
        }
Example #9
0
        public ShortLinkDto GetShortLink(WebUrlDto webUrlDto)
        {
            ShortLinkEntity entity = _repository.GetByWebUrl(webUrlDto.webUrl);

            if (entity == null)
            {
                string shortlink = ShortLinkHelper.GenerateShortLink();

                DeeplinkDto deeplinkDto = _helper.ConvertWebLinkToDeeplink(webUrlDto);

                entity = _repository.Insert(deeplinkDto.deeplink, webUrlDto.webUrl, shortlink);
            }

            return(new ShortLinkDto()
            {
                shortlink = entity.ShortLink
            });
        }
Example #10
0
        public DeeplinkDto WebUrlToDeeplink(WebUrlDto webUrlObj)
        {
            string contentId = Regex.Match(webUrlObj.webUrl, @"(?<=-p-)\d+").Value;

            Uri unparsedUrl = new Uri(webUrlObj.webUrl);
            var queryParams = HttpUtility.ParseQueryString(unparsedUrl.Query);

            string boutiqueId = queryParams["boutiqueId"];
            string merchantId = queryParams["merchantId"];

            string c_link = $"{LinkInfoHelper.siteDeeplink}?Page=Product&ContentId={contentId}";

            c_link += (boutiqueId != null ? $"&CampaignId={boutiqueId}" : "") + (merchantId != null ? $"MerchantId={merchantId}":"");

            DeeplinkDto deeplinkDto = new DeeplinkDto()
            {
                deeplink = c_link
            };

            return(deeplinkDto);
        }
Example #11
0
 public ShortLinkDto GetByDeepLink([FromBody] DeeplinkDto deeplinkDto)
 {
     return(_converter.GetShortLink(deeplinkDto));
 }
Example #12
0
 public WebUrlDto GetWebUrl([FromBody] DeeplinkDto rDto)
 {
     return(_helper.ConvertDeeplinkToWebLink(rDto));
 }