示例#1
0
        public bool CreateReferral(string business_id, FacebookMessagingEvent referralEvent)
        {
            var    thread_id = ThreadService.FormatId(business_id, referralEvent.sender.id);
            var    threads   = _threadRepository.GetById(business_id, thread_id);
            string data      = referralEvent.postback != null && referralEvent.postback.referral != null && !string.IsNullOrWhiteSpace(referralEvent.postback.referral.Ref) ? referralEvent.postback.referral.Ref : referralEvent.referral != null && !string.IsNullOrWhiteSpace(referralEvent.referral.Ref) ? referralEvent.referral.Ref : "";

            data = data ?? "";
            data = data.Trim();
            if (!string.IsNullOrWhiteSpace(thread_id) && !string.IsNullOrWhiteSpace(business_id) && !string.IsNullOrWhiteSpace(data))
            {
                var referral = _referralService.CreateReferral(business_id, threads, referralEvent.timestamp.ToString(), referralEvent.sender.id, referralEvent.recipient.id, data, thread_id);
            }
            return(true);
        }
示例#2
0
        public bool UpdateReferral(FacebookMessagingEvent referralEvent)
        {
            var puid = referralEvent.sender.id;
            var auid = _customerRepository.GetAppUIDByPageUID("", puid);

            string @ref = referralEvent.postback != null && referralEvent.postback.referral != null && !string.IsNullOrWhiteSpace(referralEvent.postback.referral.Ref) ? referralEvent.postback.referral.Ref : referralEvent.referral != null && !string.IsNullOrWhiteSpace(referralEvent.referral.Ref) ? referralEvent.referral.Ref : _customerRepository.GetPageReferalParam("", puid);

            _customerRepository.UpdateAppPageMapping("", puid, auid, @ref);
            //if (!string.IsNullOrWhiteSpace(puid))
            //{
            //    var buid = _customerRepository.GetBusinessUIDByPageUID(puid);
            //    if (!string.IsNullOrWhiteSpace(buid))
            //    {
            //        _customerRepository.UpdatePageBusinessMapping(buid, puid, @ref);
            //    }
            //}
            return(true);
        }
示例#3
0
 public bool UpdateReferral(FacebookMessagingEvent referralEvent)
 {
     throw new NotImplementedException();
 }